Created
September 13, 2015 02:25
-
-
Save geetfun/a407a59c28643dcd6938 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var count = 1; | |
var showHelloWorld = function(count) { | |
var resource = Template.call(this, count); | |
var parser = new DOMParser(); | |
var doc = parser.parseFromString(resource, "application/xml"); | |
doc.addEventListener("select", function() { | |
count += 1; | |
var oldDoc = doc; | |
var newDoc = showHelloWorld(count) | |
navigationDocument.replaceDocument(newDoc, oldDoc); | |
}); | |
return doc; | |
}; | |
App.onLaunch = function(options) { | |
evaluateScripts([`http://localhost:9001/templates/hello_world.xml.js`], | |
function(success) { | |
var doc = showHelloWorld(count) | |
navigationDocument.pushDocument(doc); | |
} | |
); | |
}; |
This file contains hidden or 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
var Template = function(count) { return `<?xml version="1.0" encoding="UTF-8" ?> | |
<document> | |
<alertTemplate> | |
<title>Hello World Example</title> | |
<description>This is the Hello World ${count} description</description> | |
<button> | |
<text>Hit Me!</text> | |
</button> | |
<text>Hint: Try pressing the button</text> | |
</alertTemplate> | |
</document>` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment