Created
October 2, 2012 16:34
-
-
Save ryugoo/3820772 to your computer and use it in GitHub Desktop.
TypeScript for Titanium Mobile test application
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 MyTabGroup = (function () { | |
| function MyTabGroup() { | |
| this.tabGroup = Ti.UI.createTabGroup(); | |
| } | |
| MyTabGroup.prototype.appendTab = function (params) { | |
| for(var i = 0, l = params.length; i < l; i++) { | |
| this.tabGroup.addTab(Ti.UI.createTab(params[i])); | |
| } | |
| }; | |
| MyTabGroup.prototype.open = function () { | |
| this.tabGroup.setActiveTab(0); | |
| this.tabGroup.open(); | |
| }; | |
| return MyTabGroup; | |
| })(); | |
| var tabGroup = new MyTabGroup(); | |
| var win = Ti.UI.createWindow({ | |
| title: "First TypeScript", | |
| backgroundColor: "#FFFFFF", | |
| tabBarHidden: true | |
| }); | |
| win.add(Ti.UI.createLabel({ | |
| text: "First TypeScript Apps for Ti!", | |
| color: "#666666" | |
| })); | |
| tabGroup.appendTab([ | |
| { | |
| title: "First TypeScript", | |
| window: win | |
| } | |
| ]); | |
| tabGroup.open(); |
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
| class MyTabGroup { | |
| constructor() { | |
| this.tabGroup = Ti.UI.createTabGroup(); | |
| } | |
| appendTab(params) { | |
| for (var i = 0, l = params.length; i < l; i++) { | |
| this.tabGroup.addTab(Ti.UI.createTab(params[i])); | |
| } | |
| } | |
| open() { | |
| this.tabGroup.setActiveTab(0); | |
| this.tabGroup.open(); | |
| } | |
| } | |
| var tabGroup = new MyTabGroup(); | |
| var win = Ti.UI.createWindow({ | |
| title: "First TypeScript", | |
| backgroundColor: "#FFFFFF", | |
| tabBarHidden: true | |
| }); | |
| win.add(Ti.UI.createLabel({ | |
| text: "First TypeScript Apps for Ti!", | |
| color: "#666666" | |
| })) | |
| tabGroup.appendTab([{ | |
| title: "First TypeScript", | |
| window: win | |
| }]); | |
| tabGroup.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment