diff --git a/.DS_Store b/.DS_Store index 0b2aa60..d2a7294 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index c4735fd..0d8c1e4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,9 @@ demo/app/*.js !demo/karma.conf.js !demo/app/tests/*.js -demo/*.d.ts !demo/references.d.ts demo/lib demo/platforms demo/node_modules +demo/hooks node_modules \ No newline at end of file diff --git a/demo/app/app.ts b/demo/app/app.ts new file mode 100644 index 0000000..98f8260 --- /dev/null +++ b/demo/app/app.ts @@ -0,0 +1,2 @@ +import * as application from 'application'; +application.start({ moduleName: "main-page" }); diff --git a/demo/app/main-page.ts b/demo/app/main-page.ts new file mode 100644 index 0000000..9f76b86 --- /dev/null +++ b/demo/app/main-page.ts @@ -0,0 +1,16 @@ +import * as observable from 'data/observable'; +import * as pages from 'ui/page'; +import {HelloWorldModel} from './main-view-model'; +import { EventData } from 'data/observable'; +import { Page } from 'ui/page'; +import { isAndroid, device } from "platform"; +import { Color } from "color"; +import { android } from "application"; +// Event handler for Page 'loaded' event attached in main-page.xml +export function pageLoaded(args: observable.EventData) { + // Get the event sender + let page = args.object; + page.bindingContext = new HelloWorldModel(page); + +} + \ No newline at end of file diff --git a/demo/app/main-view-model.ts b/demo/app/main-view-model.ts new file mode 100644 index 0000000..8fa23ca --- /dev/null +++ b/demo/app/main-view-model.ts @@ -0,0 +1,21 @@ +import {Observable} from 'data/observable'; +import {AndroidIosSwitch} from 'nativescript-android-iosswitch'; +import { Page } from 'ui/page'; +export class HelloWorldModel extends Observable { + + public message: string; + private npb: AndroidIosSwitch; + constructor(mainPage: Page) { + super(); + // this.npb = new NumberProgressBar(); + this.npb = mainPage.getViewById('sb'); + + } + public onTrue() { + this.npb.toggleSwitch(true); + } + public onFalse() { + this.npb.setChecked(false); + } +} +