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

53 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-07-21 05:50:54 +08:00
import { Text, Alignment, Color, VLayout, Link, Panel, log, logw, loge } from "./index"
2019-07-18 16:29:24 +08:00
const v = new Text
v.width = 20
v.height = 30
v.left = 5
v.top = 5
v.bgColor = Color.parse('#00ff00')
v.config = {
alignment: Alignment.start
}
2019-07-22 11:22:19 +08:00
// console.log(v.toModel())
2019-07-18 16:29:24 +08:00
const layout = new VLayout
layout.space = 10
console.log(layout.viewId)
console.log(layout.toModel())
2019-07-22 11:22:19 +08:00
// log('console', Object.getOwnPropertyNames(console))
2019-07-18 20:11:01 +08:00
2019-07-22 11:22:19 +08:00
// setTimeout(() => {
// log('exec setTimeout')
// // context.callNative("modal", "toast", "Hello,Doric!")
// }, 1000)
// const timerId = setInterval(() => {
// log('exec setInterval')
// }, 1000)
2019-07-18 20:11:01 +08:00
2019-07-22 11:22:19 +08:00
// setTimeout(() => {
// log('exec cancelTimer')
// clearInterval(timerId)
// }, 5000)
2019-07-18 16:29:24 +08:00
2019-07-21 05:50:54 +08:00
@Link(context)
2019-07-18 16:29:24 +08:00
export class MyPage extends Panel {
build() {
return layout
}
log() {
2019-07-22 11:22:19 +08:00
// log("Hello.HEGO")
// logw("Hello.HEGO")
// loge("Hello.HEGO")
context.bridge.demo_testPromise(true).then((r) => {
log('resolve', r)
}, (e) => {
log('reject', e)
})
context.bridge.demo_testPromise(false).then((r) => {
log('resolve', r)
}, (e) => {
log('reject', e)
})
2019-07-18 16:29:24 +08:00
}
}