Some plumbing for local storage for apps.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3864 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
a1d244567a
commit
42fcfee042
@ -418,6 +418,10 @@ function receive(message) {
|
||||
}
|
||||
}
|
||||
console.log('error', message);
|
||||
} else if (message && message.action == "localStorageSet") {
|
||||
window.localStorage.setItem('app:' + message.key, message.value);
|
||||
} else if (message && message.action == "localStorageGet") {
|
||||
send({message: 'localStorage', key: message.key, value: window.localStorage.getItem('app:' + message.key)});
|
||||
} else if (message && message.action == "print") {
|
||||
console.log('app>', ...message.args);
|
||||
} else if (message && message.action == "stats") {
|
||||
@ -673,6 +677,8 @@ function connectSocket(path) {
|
||||
['setDocument', 'content'],
|
||||
['postMessage', 'message'],
|
||||
['error', 'error'],
|
||||
['localStorageSet', 'key', 'value'],
|
||||
['localStorageGet', 'key'],
|
||||
],
|
||||
}));
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ async function getProcessBlob(blobId, key, options) {
|
||||
}
|
||||
process.eventHandlers[eventName].push(handler);
|
||||
},
|
||||
'unregister': function(eventHandle, handler) {
|
||||
'unregister': function(eventName, handler) {
|
||||
if (process.eventHandlers[eventName]) {
|
||||
let index = process.eventHandlers[eventName].indexOf(handler);
|
||||
if (index != -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user