success to call promise
This commit is contained in:
@@ -9,26 +9,26 @@ v.bgColor = Color.parse('#00ff00')
|
||||
v.config = {
|
||||
alignment: Alignment.start
|
||||
}
|
||||
console.log(v.toModel())
|
||||
// console.log(v.toModel())
|
||||
|
||||
const layout = new VLayout
|
||||
layout.space = 10
|
||||
console.log(layout.viewId)
|
||||
console.log(layout.toModel())
|
||||
log('console', Object.getOwnPropertyNames(console))
|
||||
// log('console', Object.getOwnPropertyNames(console))
|
||||
|
||||
setTimeout(() => {
|
||||
log('exec setTimeout')
|
||||
// context.callNative("modal", "toast", "Hello,Doric!")
|
||||
}, 1000)
|
||||
const timerId = setInterval(() => {
|
||||
log('exec setInterval')
|
||||
}, 1000)
|
||||
// setTimeout(() => {
|
||||
// log('exec setTimeout')
|
||||
// // context.callNative("modal", "toast", "Hello,Doric!")
|
||||
// }, 1000)
|
||||
// const timerId = setInterval(() => {
|
||||
// log('exec setInterval')
|
||||
// }, 1000)
|
||||
|
||||
setTimeout(() => {
|
||||
log('exec cancelTimer')
|
||||
clearInterval(timerId)
|
||||
}, 5000)
|
||||
// setTimeout(() => {
|
||||
// log('exec cancelTimer')
|
||||
// clearInterval(timerId)
|
||||
// }, 5000)
|
||||
|
||||
@Link(context)
|
||||
export class MyPage extends Panel {
|
||||
@@ -36,11 +36,18 @@ export class MyPage extends Panel {
|
||||
return layout
|
||||
}
|
||||
log() {
|
||||
log("Hello.HEGO")
|
||||
logw("Hello.HEGO")
|
||||
loge("Hello.HEGO")
|
||||
setTimeout(() => {
|
||||
context.bridge.demo_test()
|
||||
}, 1000)
|
||||
// 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)
|
||||
})
|
||||
}
|
||||
}
|
@@ -46,7 +46,7 @@ export function jsCallResolve(contextId: string, callbackId: string, args?: any)
|
||||
for (let i = 2; i < arguments.length; i++) {
|
||||
argumentsList.push(arguments[i])
|
||||
}
|
||||
Reflect.apply(callback.resolve, context, args)
|
||||
Reflect.apply(callback.resolve, context, argumentsList)
|
||||
}
|
||||
|
||||
export function jsCallReject(contextId: string, callbackId: string, args?: any) {
|
||||
@@ -64,7 +64,7 @@ export function jsCallReject(contextId: string, callbackId: string, args?: any)
|
||||
for (let i = 2; i < arguments.length; i++) {
|
||||
argumentsList.push(arguments[i])
|
||||
}
|
||||
Reflect.apply(callback.reject, context, args)
|
||||
Reflect.apply(callback.reject, context, argumentsList)
|
||||
}
|
||||
|
||||
export class Context {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { } from './../runtime/global';
|
||||
import { View, Stack, Group } from "./view";
|
||||
import { log } from 'util';
|
||||
import { loge } from '../util/log';
|
||||
import { loge, log } from '../util/log';
|
||||
|
||||
export function Link(context: any) {
|
||||
return <T extends { new(...args: any[]): {} }>(constructor: T) => {
|
||||
|
Reference in New Issue
Block a user