1 | <html> |
2 | <head> |
3 | <title>LargeLocalStorage Test</title> |
4 | </head> |
5 | |
6 | <body> |
7 | |
8 | <script src="http://tantaman.github.io/LargeLocalStorage/bower_components/jquery/jquery.js"></script> |
9 | <script src="http://tantaman.github.io/LargeLocalStorage/bower_components/q/q.js"></script> |
10 | <script src="http://tantaman.github.io/LargeLocalStorage/dist/LargeLocalStorage.js"></script> |
11 | <script src="http://tantaman.github.io/LargeLocalStorage/dist/contrib/URLCache.js"></script> |
12 | |
13 | <script> |
14 | |
15 | Q.longStackSupport = true; |
16 | Q.onerror = function(err) { |
17 | console.log(err); |
18 | throw err; |
19 | }; |
20 | |
21 | // Specify desired capacity in bytes |
22 | var desiredCapacity = 10 * 1024 * 1024; |
23 | |
24 | console.log("Making LargeLocalStorage"); |
25 | |
26 | var storage = new LargeLocalStorage({size: desiredCapacity, name: 'lls-test'}); |
27 | |
28 | storage.initialized.then(function(capacity) { |
29 | console.log('initialized with capacity: ' + capacity); |
30 | |
31 | var test1a1txt = '123asd'; |
32 | var blob = new Blob([test1a1txt], {type: 'text/plain'}); |
33 | |
34 | console.log("Saving blob"); |
35 | |
36 | storage.setAttachment('myDoc', 'titleImage2', blob).then(function() { |
37 | console.log('finished setting the titleImage2 attachment'); |
38 | |
39 | storage.getAttachment('myDoc', 'titleImage').then(function(blob) { |
40 | console.log('Got blob back: ' + blob); |
41 | var reader = new FileReader(); |
42 | reader.onload = function() { |
43 | console.log('blob text: ' + reader.result); |
44 | }; |
45 | reader.readAsText(blob); |
46 | }); |
47 | }); |
48 | }); |
49 | |
50 | </script> |
51 | </body> |
52 | </html> |
Began life as a copy of #1018986
download render html show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018991 |
Snippet name: | Test LargeLocalStorage v2 |
Eternal ID of this version: | #1018991/14 |
Text MD5: | 7ffc11e27a8f9e948098607babdb9dd4 |
Author: | stefan |
Category: | javax / web |
Type: | HTML |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-19 17:29:42 |
Source code size: | 1496 bytes / 52 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 313 / 265 |
Version history: | 13 change(s) |
Referenced in: | [show references] |