Forgot to add base.js to last commit

This commit is contained in:
Skyler Lehmkuhl 2012-02-09 14:11:32 -05:00
parent 3ec41e43ee
commit 08e27633f4
1 changed files with 47 additions and 0 deletions

47
base.js
View File

@ -881,6 +881,7 @@ function SharedObject () {
this.data = {} this.data = {}
this.flush = function () { this.flush = function () {
localStorage.setItem(this._name, this.data) localStorage.setItem(this._name, this.data)
//TODO: onStatus
} }
this.clear = function () { this.clear = function () {
localStorage.removeItem(this._name) localStorage.removeItem(this._name)
@ -921,6 +922,52 @@ SharedObject.getLocal = function (name, localPath, secure) {
//TODO: localPath should allow changing domain access; secure should force HTTPS. //TODO: localPath should allow changing domain access; secure should force HTTPS.
} }
function LoadVars () {
this.onData = function () {}
this.onHTTPStatus = function () {}
this.onLoad = function () {}
this.send = function (url, target, method) {
if (!method){
method="POST"
}
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if (target=="_self"){
//TODO
}
else if (target=="_blank"){
consoleRef=window.open('','Response','scrollbars=1,resizable=1')
consoleRef.document.writeln(xmlhttp.responseText)
}
}
}
xmlhttp.open(method,url,true);
xmlhttp.send();
}
this.sendAndLoad = function (url, target, method) {
if (!method){
method="POST"
}
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
//TODO: parse response, load into current object
}
}
xmlhttp.open(method,url,true);
xmlhttp.send();
}
Object.defineProperty(this, 'onData', {enumerable:false})
Object.defineProperty(this, 'onHTTPStatus', {enumerable:false})
Object.defineProperty(this, 'onLoad', {enumerable:false})
Object.defineProperty(this, 'send', {enumerable:false})
Object.defineProperty(this, 'sendAndLoad', {enumerable:false})
}
//TODO: ContextMenu //TODO: ContextMenu