提交 f7647139 编写于 作者: fxy060608's avatar fxy060608

feat(v3): preload

上级 e006a832
......@@ -12139,32 +12139,32 @@ var serviceContext = (function () {
this.id = uploadTaskId;
this._callbackId = callbackId;
this._callbacks = [];
}
}
abort () {
invokeMethod('operateRequestTask', {
invokeMethod('operateUploadTask', {
uploadTaskId: this.id,
operationType: 'abort'
});
}
}
onProgressUpdate (callback) {
if (typeof callback !== 'function') {
return
}
this._callbacks.push(callback);
}
}
onHeadersReceived () {
}
}
offProgressUpdate (callback) {
const index = this._callbacks.indexOf(callback);
if (index >= 0) {
this._callbacks.splice(index, 1);
}
}
}
offHeadersReceived () {
......@@ -12206,7 +12206,7 @@ var serviceContext = (function () {
errMsg: 'request:fail ' + errMsg
});
// eslint-disable-next-line no-fallthrough
default:
default:
// progressUpdate 可能晚于 success
setTimeout(() => {
delete uploadTasks$1[uploadTaskId];
......@@ -14208,6 +14208,20 @@ var serviceContext = (function () {
Vue.prototype.$mount = function mount (el, hydrating) {
if (this.mpType === 'app') {
this.$options.render = function () {};
if (weex.config.preload) { // preload
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] preload app-service.js');
}
const globalEvent = weex.requireModule('globalEvent');
globalEvent.addEventListener('launchApp', () => {
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] launchApp');
}
registerApp(this);
oldMount.call(this, el, hydrating);
});
return
}
registerApp(this);
}
return oldMount.call(this, el, hydrating)
......
......@@ -47,6 +47,20 @@ export default {
Vue.prototype.$mount = function mount (el, hydrating) {
if (this.mpType === 'app') {
this.$options.render = function () {}
if (weex.config.preload) { // preload
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] preload app-service.js')
}
const globalEvent = weex.requireModule('globalEvent')
globalEvent.addEventListener('launchApp', () => {
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] launchApp')
}
registerApp(this)
oldMount.call(this, el, hydrating)
})
return
}
registerApp(this)
}
return oldMount.call(this, el, hydrating)
......@@ -70,4 +84,4 @@ export default {
return callback ? undefined : result
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册