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

feat(v3): preload

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