Version 0.2.2, Localstorage support using WrapperApi, User manage bugfix
This commit is contained in:
parent
655607466c
commit
9f9433a61e
5 changed files with 49 additions and 7 deletions
|
@ -807,6 +807,10 @@ jQuery.extend( jQuery.easing,
|
|||
return this.actionWrapperPrompt(message);
|
||||
} else if (cmd === "wrapperSetViewport") {
|
||||
return this.actionSetViewport(message);
|
||||
} else if (cmd === "wrapperGetLocalStorage") {
|
||||
return this.actionGetLocalStorage(message);
|
||||
} else if (cmd === "wrapperSetLocalStorage") {
|
||||
return this.actionSetLocalStorage(message);
|
||||
} else {
|
||||
if (message.id < 1000000) {
|
||||
return this.ws.send(message);
|
||||
|
@ -891,6 +895,24 @@ jQuery.extend( jQuery.easing,
|
|||
}
|
||||
};
|
||||
|
||||
Wrapper.prototype.actionGetLocalStorage = function(message) {
|
||||
var data;
|
||||
data = localStorage.getItem("site." + window.address);
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
return this.sendInner({
|
||||
"cmd": "response",
|
||||
"to": message.id,
|
||||
"result": data
|
||||
});
|
||||
};
|
||||
|
||||
Wrapper.prototype.actionSetLocalStorage = function(message) {
|
||||
var back;
|
||||
return back = localStorage.setItem("site." + window.address, JSON.stringify(message.params));
|
||||
};
|
||||
|
||||
Wrapper.prototype.onOpenWebsocket = function(e) {
|
||||
this.ws.cmd("channelJoin", {
|
||||
"channel": "siteChanged"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue