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
| // model | |
| function Model () { | |
| this._state = {} | |
| return this | |
| } | |
| Model.prototype.get = function (key) { | |
| return this._state[key] | |
| } |
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
| // Set up a simple object to use as "context" | |
| var context = { foo: "bar" }; | |
| // A function that uses a reference to a variable called "foo" | |
| // on the "this" context. | |
| function returnFoo () { | |
| return this.foo; | |
| } | |
| // This variable does not exist on scope, so is undefined. |
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
| // open all external links in a new tab/window | |
| $("a[href^='http']:not([href*='" + "<w:account key='domain' />" + "'])").addClass("external").attr({ target: "_blank" }); |
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
| function getTodos(callback) { | |
| var request = new XMLHttpRequest(); | |
| request.open("Get", "/api/Todo", true); | |
| request.onload = function() { | |
| console.log("Returned"); | |
| if (request.error) { | |
| console.log(request.error); | |
| } else { | |
| var response = JSON.parse(request.responseText); | |
| console.log(response); |
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 Model = {}; | |
| var View = {}; | |
| var Controller = {}; |