Skip to content

Commit 138df34

Browse files
committed
feat(weex): remove timer API from instance context
1 parent 9cb3a47 commit 138df34

File tree

1 file changed

+1
-46
lines changed

1 file changed

+1
-46
lines changed

src/platforms/weex/entry-framework.js

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ export function createInstanceContext (
2525
// Each instance has a independent `Vue` module instance
2626
const Vue = instance.Vue = createVueModuleInstance(instanceId, weex)
2727

28-
// DEPRECATED
29-
const timerAPIs = getInstanceTimer(instanceId, weex.requireModule)
30-
31-
const instanceContext = Object.assign({ Vue }, timerAPIs)
32-
Object.freeze(instanceContext)
33-
return instanceContext
28+
return { Vue }
3429
}
3530

3631
/**
@@ -145,43 +140,3 @@ function createVueModuleInstance (
145140

146141
return Vue
147142
}
148-
149-
/**
150-
* DEPRECATED
151-
* Generate HTML5 Timer APIs. An important point is that the callback
152-
* will be converted into callback id when sent to native. So the
153-
* framework can make sure no side effect of the callback happened after
154-
* an instance destroyed.
155-
*/
156-
function getInstanceTimer (
157-
instanceId: string,
158-
moduleGetter: Function
159-
): Object {
160-
const instance = instanceOptions[instanceId]
161-
const timer = moduleGetter('timer')
162-
const timerAPIs = {
163-
setTimeout: (...args) => {
164-
const handler = function () {
165-
args[0](...args.slice(2))
166-
}
167-
168-
timer.setTimeout(handler, args[1])
169-
return instance.document.taskCenter.callbackManager.lastCallbackId.toString()
170-
},
171-
setInterval: (...args) => {
172-
const handler = function () {
173-
args[0](...args.slice(2))
174-
}
175-
176-
timer.setInterval(handler, args[1])
177-
return instance.document.taskCenter.callbackManager.lastCallbackId.toString()
178-
},
179-
clearTimeout: (n) => {
180-
timer.clearTimeout(n)
181-
},
182-
clearInterval: (n) => {
183-
timer.clearInterval(n)
184-
}
185-
}
186-
return timerAPIs
187-
}

0 commit comments

Comments
 (0)