This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/js-framework/demo.ts

35 lines
825 B
TypeScript
Raw Normal View History

2019-07-22 13:52:30 +08:00
import { NativeCall, Text, Alignment, Color, VLayout, Panel, log, logw, loge } from "./index"
2019-07-22 14:36:32 +08:00
import { Group } from "./src/ui/view";
2019-07-18 16:29:24 +08:00
2019-07-18 20:11:01 +08:00
2019-07-22 13:41:38 +08:00
@Entry
2019-07-18 16:29:24 +08:00
export class MyPage extends Panel {
2019-07-22 14:36:32 +08:00
build(rootView: Group): void {
log('build view')
const text = new Text
text.text = "hello"
rootView.children.push(text)
2019-07-18 16:29:24 +08:00
}
2019-07-22 14:36:32 +08:00
2019-07-22 13:41:38 +08:00
@NativeCall
2019-07-18 16:29:24 +08:00
log() {
2019-07-22 13:41:38 +08:00
log("Hello.HEGO")
logw("Hello.HEGO")
loge("Hello.HEGO")
2019-07-22 15:02:38 +08:00
context.demo.testPromise(true).then((r) => {
2019-07-22 11:22:19 +08:00
log('resolve', r)
}, (e) => {
log('reject', e)
})
2019-07-22 15:02:38 +08:00
context.demo.testPromise(false).then((r) => {
2019-07-22 11:22:19 +08:00
log('resolve', r)
}, (e) => {
log('reject', e)
})
2019-07-22 13:41:38 +08:00
setTimeout(function () {
log('settimeout')
}, 1000)
2019-07-18 16:29:24 +08:00
}
}