-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathColdstorage.js
32 lines (27 loc) · 957 Bytes
/
Coldstorage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* StromDAO Business Object: StringStorage
* =========================================
* @author Thorsten Zoerner thorsten.zoerner@stromdao.de
* */
this.coldstorage = function(obj_or_address) {
if(typeof obj_or_address == "undefined") obj_or_address=parent.options.contracts["StromDAO-BO.sol:StringStorage"];
var p1 = new Promise(function(resolve, reject) {
var instance={};
instance.setObj=function(bucket,str) {
var p2 = new Promise(function(resolve2, reject2) {
parent.storage.setItemSync("cold_"+bucket,str);
resolve2();
});
return p2;
};
instance.getObj=function(bucket) {
var p2 = new Promise(function(resolve2, reject2) {
var str=parent.storage.getItemSync("cold_"+bucket);
resolve2(str);
});
return p2;
};
resolve(instance);
});
return p1;
};