Namespace Railgun.Storage
A wrapper object defining Railgun's storage namespace, which is responsible for handling communications with the Railgun server.
- Defined in: RailgunClient.js
Field Attributes | Field Name and Description |
---|---|
<static> <constant> | Railgun.Storage.domain The domain where the Railgun server is located. |
<static> | Railgun.Storage.iframe A reference to the iframe HTML element which is appended to the body of the main page when initialized in Railgun.Storage.init() . |
<static> | Railgun.Storage.serverState A copy of all the properties of the RailgunServer object. |
<static> | Railgun.Storage.storageState A copy of all the contents of localStorage provided by the server upon pageload. |
Method Summary
Method Attributes | Method Name and Description |
---|---|
<static> | Railgun.Storage.init() The initialization method for the Storage object. |
<static> | Railgun.Storage.sendRequest(request) The main line of communication from client to server. |
Field Detail
<static> <constant> {String}Railgun.Storage.domain
The domain where the Railgun server is located.
- Default Value:
- "http://railgunscript.wikia.com"
<static> {Object}Railgun.Storage.iframe
A reference to the iframe HTML element which is appended to the body of the main page when initialized in
Railgun.Storage.init()
. The client communicates with the server by issuing postMessage requests to the iframe's contentWindow property.- See:
- Railgun.Storage.init()
<static> {Object}Railgun.Storage.serverState
A copy of all the properties of the RailgunServer object. This property is initialized in
Railgun.initProcessServerResponse()
.<static> {Object}Railgun.Storage.storageState
A copy of all the contents of localStorage provided by the server upon pageload. This property is initialized in
Railgun.initProcessServerResponse()
.Method Detail
- <static> Railgun.Storage.init()The initialization method for the Storage object. This method loads the server into an iframe and appends it to the body of the document.
- <static> Railgun.Storage.sendRequest(request)The main line of communication from client to server. This method accepts a request object as a parameter, converts it to JSON and sends it to the server via iframe.contentWindow.postMessage(). Sample usage:
Railgun.Storage.sendRequest({
id : "showSiderail()",
instruction : "setItem",
key : "siderailHidden",
value : false });- Parameters:
- {Object} request
- a request object to be sent to the server