Experimenting with storing drafts. Fixed an old scary tfrpc bug which resulted in localStorageGet returning wrong values on subsequent calls.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4138 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-01-21 00:16:18 +00:00
parent 77df158178
commit dab7050899
8 changed files with 84 additions and 50 deletions

View File

@ -387,7 +387,7 @@ function api_localStorageSet(key, value) {
window.localStorage.setItem('app:' + key, value);
}
function api_localStorageGet(key, value) {
function api_localStorageGet(key) {
return window.localStorage.getItem('app:' + key);
}
@ -620,17 +620,19 @@ function _receive_websocket_message(message) {
message.message === 'tfrpc' &&
message.method) {
let api = k_api[message.method];
let id = message.id;
let params = message.params;
if (api) {
Promise.resolve(api.func(...message.params)).then(function(result) {
Promise.resolve(api.func(...params)).then(function(result) {
send({
message: 'tfrpc',
id: message.id,
id: id,
result: result,
});
}).catch(function(error) {
send({
message: 'tfrpc',
id: message.id,
id: id,
error: error,
});
});