Use async store

This commit is contained in:
yflory
2017-11-30 15:01:17 +01:00
parent 0840570fbf
commit b3688db202
15 changed files with 251 additions and 297 deletions

View File

@@ -36,12 +36,12 @@ define([
};
window.addEventListener('message', onMsg);
}).nThen(function (/*waitFor*/) {
var getSecrets = function (Cryptpad, Utils) {
var proxy = Cryptpad.getProxy();
var hash = proxy.todo || Utils.Hash.createRandomHash();
if (!proxy.todo) { proxy.todo = hash; }
return Utils.Hash.getSecrets('todo', hash);
var getSecrets = function (Cryptpad, Utils, cb) {
Cryptpad.getTodoHash(function (hash) {
var nHash = hash || Utils.Hash.createRandomHash();
if (!hash) { Cryptpad.setTodoHash(nHash); }
cb(null, Utils.Hash.getSecrets('todo', hash));
});
};
SFCommonO.start({
getSecrets: getSecrets,