Created
February 23, 2013 22:50
-
-
Save mattapperson/5021707 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
// Here we have 2 examples of perposed TiKit syntax | |
// Example 1 (a basic window): | |
var TiKit = require('com.tikit'); | |
var win = new TiKit.Window({ | |
backgroundColor: 'red' | |
}); | |
win.open(); | |
//--------------------------- | |
// Example 2 (a custom window): | |
var TiKit = require('com.tikit'); | |
var CustomWin = TiKit.Window.extend(function(parentPrototype) { //parentPrototype var would be the TiKit.Window default prototype | |
return { | |
init: function(_args) { | |
// _args are what get passed into the constructure | |
this.backgroundColor = 'red'; | |
// maybe add some views or something... | |
var testView = new TiKit.View(); | |
this.add(testView); | |
parentPrototype.init.call(this, _args); // do whatever the parent init would have done | |
}, | |
open: function() { | |
alert('fire an alert any time the custom window opens'); | |
parentPrototype.open.call(this, _args); // do whatever the parent open would have done | |
} | |
} | |
}); | |
var win = new CustomWin(); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment