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

46 lines
974 B
TypeScript
Raw Normal View History

2019-07-18 16:29:24 +08:00
import { Text, Alignment, Color, VLayout, Registor, Panel, log, logw, loge } from "./index"
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
}
console.log(v.toModel())
const layout = new VLayout
layout.space = 10
console.log(layout.viewId)
console.log(layout.toModel())
2019-07-18 20:11:01 +08:00
log('console', Object.getOwnPropertyNames(console))
setTimeout(() => {
log('exec setTimeout')
2019-07-20 13:40:06 +08:00
// context.callNative("modal", "toast", "Hello,Doric!")
2019-07-18 20:11:01 +08:00
}, 1000)
const timerId = setInterval(() => {
log('exec setInterval')
}, 1000)
setTimeout(() => {
log('exec cancelTimer')
clearInterval(timerId)
}, 5000)
2019-07-18 16:29:24 +08:00
2019-07-18 18:44:16 +08:00
@Registor(context)
2019-07-18 16:29:24 +08:00
export class MyPage extends Panel {
build() {
return layout
}
log() {
log("Hello.HEGO")
logw("Hello.HEGO")
loge("Hello.HEGO")
2019-07-20 13:40:06 +08:00
setTimeout(() => {
context.bridge.demo_test()
}, 1000)
2019-07-18 16:29:24 +08:00
}
}