File tree 5 files changed +13
-7
lines changed
5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,18 @@ Page({
10
10
11
11
data : {
12
12
res : '' ,
13
- input : 33 ,
13
+ input : 35 ,
14
+ } ,
15
+
16
+ onLoad ( ) {
17
+ this . _worker = wx . createWorker ( 'workers/fib/index.js' )
14
18
} ,
15
19
16
20
onUnload ( ) {
17
21
clearInterval ( this . interval )
18
22
if ( this . _worker ) this . _worker . terminate ( )
19
23
} ,
20
-
24
+
21
25
bindInput ( e ) {
22
26
const val = Number ( e . detail . value )
23
27
if ( val > 40 ) return { value : 40 }
34
38
35
39
compute ( ) {
36
40
this . reset ( )
37
- wx . showLoading ( )
41
+ wx . showLoading ( {
42
+ title : '计算中...'
43
+ } )
38
44
const t0 = + Date . now ( )
39
45
const res = fib ( this . data . input )
40
46
const t1 = + Date . now ( )
47
53
48
54
multiThreadCompute ( ) {
49
55
this . reset ( )
50
- wx . showLoading ( )
51
- this . _worker = wx . createWorker ( 'workers/fib/index.js' )
56
+ wx . showLoading ( {
57
+ title : '计算中...'
58
+ } )
52
59
53
60
const t0 = + Date . now ( )
54
61
this . _worker . postMessage ( {
59
66
if ( res . type === 'execFunc_fib' ) {
60
67
wx . hideLoading ( )
61
68
const t1 = + Date . now ( )
62
- this . _worker . terminate ( )
63
69
this . setData ( {
64
70
res : res . result ,
65
71
time : t1 - t0
Original file line number Diff line number Diff line change 42
42
name : '画布' ,
43
43
pages : [ 'canvas' ]
44
44
} , {
45
- id : 'ad ' ,
45
+ id : 'open ' ,
46
46
name : '开放能力' ,
47
47
pages : [ 'ad' , 'open-data' , 'web-view' ]
48
48
}
You can’t perform that action at this time.
0 commit comments