-
Notifications
You must be signed in to change notification settings - Fork 1
/
Index.ets
43 lines (41 loc) · 1.13 KB
/
Index.ets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import hilog from '@ohos.hilog';
import simpleservo from 'libsimpleservo.so';
@Entry
@Component
struct Index {
xComponentContext: object | undefined = undefined;
xComponentAttrs: XComponentAttrs = {
id: 'ServoDemo',
type: XComponentType.SURFACE,
libraryname: 'simpleservo'
}
urlToLoad: string = 'https://servo.org'
build() {
Column() {
TextInput({placeholder:'URL',text: this.urlToLoad})
.type(InputType.Normal)
.onChange((value) => {
this.urlToLoad = value
})
.onSubmit((EnterKeyType)=>{
simpleservo.loadURL(this.urlToLoad)
console.info('Load URL: ', this.urlToLoad)
})
XComponent(this.xComponentAttrs)
.focusable(true)
.onLoad((xComponentContext) => {
this.xComponentContext = xComponentContext;
console.info('ServoDemo XCOMPONENT onLoad enter');
})
.onDestroy(() => {
console.info('ServoDemo XCOMPONENT onDestroy');
})
}
.width('100%')
}
}
interface XComponentAttrs {
id: string;
type: number;
libraryname: string;
}