Last active
August 29, 2015 14:26
-
-
Save mikicho/56502c44b330a5c9b68c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadPage(url) { | |
URLReq = new Http(url/*btn.attributes.getNamedItem("href").value*/); | |
URLReq.onError("Can't load "+URLReq.url); | |
URLReq.onData = function (content) | |
{ | |
pages.get(url).content = content; | |
setContent(pages.get(url)); | |
} | |
URLReq.request(false); | |
} | |
function setContent(page:Page) { | |
var c = doc.getElementsByClassName("content"); | |
if( c == null ) | |
trace("Unknown element: content"); | |
c.item(0).innerHTML = page.content; | |
switch(page.url) { | |
case "index": | |
case "register":registerFormValid = new FormValidator("registerForm"); trace(this); | |
case "ask": | |
} | |
history.pushState(page.url, pages.get(page.url).title, page.url); | |
} | |
function initRegisterPage():Bool | |
{ | |
trace(this); | |
trace(registerFormValid); | |
registerFormValid.checkValid(); | |
//untyped __js__("debugger"); | |
return false; | |
//return registerFormValid.isValid; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Client.prototype = { | |
loadPage: function(url) { | |
var _g = this; | |
this.URLReq = new haxe_Http(url); | |
this.URLReq.onError("Can't load " + this.URLReq.url); | |
this.URLReq.onData = function(content) { | |
_g.pages.get(url).content = content; | |
_g.setContent(_g.pages.get(url)); | |
}; | |
this.URLReq.request(false); | |
} | |
,setContent: function(page) { | |
var c = this.doc.getElementsByClassName("content"); | |
if(c == null) console.log("Unknown element: content"); | |
c.item(0).innerHTML = page.content; | |
var _g = page.url; | |
switch(_g) { | |
case "index": | |
break; | |
case "register": | |
this.registerFormValid = new client_FormValidator("registerForm"); | |
console.log(this); //Return Client object - OK! | |
console.log(this.registerFormValid);// Return the right Object | |
break; | |
case "ask": | |
break; | |
} | |
this.history.pushState(page.url,this.pages.get(page.url).title,page.url); | |
} | |
,initRegisterPage: function() { | |
console.log(this); //Return Client.prototype object - not OK! | |
console.log(this.registerFormValid); //Return undefined | |
this.registerFormValid.checkValid(); | |
return false; | |
} | |
,__class__: Client | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment