@tarojs/runtime 3.6.7 → 3.6.9-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime.esm.js +23 -12
- package/dist/runtime.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/runtime.esm.js
CHANGED
|
@@ -2661,7 +2661,7 @@ class TaroRootElement extends TaroElement {
|
|
|
2661
2661
|
}
|
|
2662
2662
|
performUpdate(initRender = false, prerender) {
|
|
2663
2663
|
this.pendingUpdate = true;
|
|
2664
|
-
const ctx = this.ctx;
|
|
2664
|
+
const ctx = hooks.call('proxyToRaw', this.ctx);
|
|
2665
2665
|
setTimeout(() => {
|
|
2666
2666
|
const setDataMark = `${SET_DATA} 开始时间戳 ${Date.now()}`;
|
|
2667
2667
|
perf.start(setDataMark);
|
|
@@ -3896,7 +3896,7 @@ function getOnHideEventKey(path) {
|
|
|
3896
3896
|
function createPageConfig(component, pageName, data, pageConfig) {
|
|
3897
3897
|
// 小程序 Page 构造器是一个傲娇小公主,不能把复杂的对象挂载到参数上
|
|
3898
3898
|
const id = pageName !== null && pageName !== void 0 ? pageName : `taro_page_${pageId()}`;
|
|
3899
|
-
const [ONLOAD, ONUNLOAD, ONREADY, ONSHOW, ONHIDE, LIFECYCLES, SIDE_EFFECT_LIFECYCLES] = hooks.call('getMiniLifecycleImpl').page;
|
|
3899
|
+
const [ONLOAD, ONUNLOAD, ONREADY, ONSHOW, ONHIDE, LIFECYCLES, SIDE_EFFECT_LIFECYCLES,] = hooks.call('getMiniLifecycleImpl').page;
|
|
3900
3900
|
let pageElement = null;
|
|
3901
3901
|
let unmounting = false;
|
|
3902
3902
|
let prepareMountList = [];
|
|
@@ -4031,7 +4031,8 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
4031
4031
|
var _a;
|
|
4032
4032
|
if (component[lifecycle] ||
|
|
4033
4033
|
((_a = component.prototype) === null || _a === void 0 ? void 0 : _a[lifecycle]) ||
|
|
4034
|
-
component[lifecycle.replace(/^on/, 'enable')]
|
|
4034
|
+
component[lifecycle.replace(/^on/, 'enable')] ||
|
|
4035
|
+
(pageConfig === null || pageConfig === void 0 ? void 0 : pageConfig[lifecycle.replace(/^on/, 'enable')])) {
|
|
4035
4036
|
config[lifecycle] = function (...args) {
|
|
4036
4037
|
var _a;
|
|
4037
4038
|
const target = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.target;
|
|
@@ -4143,18 +4144,27 @@ function createRecursiveComponentConfig(componentName) {
|
|
|
4143
4144
|
} }, lifeCycles);
|
|
4144
4145
|
}
|
|
4145
4146
|
|
|
4147
|
+
const TIMEOUT = 100;
|
|
4146
4148
|
const nextTick = (cb, ctx) => {
|
|
4147
|
-
|
|
4149
|
+
const beginTime = Date.now();
|
|
4148
4150
|
const router = Current.router;
|
|
4149
4151
|
const timerFunc = () => {
|
|
4150
4152
|
setTimeout(function () {
|
|
4151
4153
|
ctx ? cb.call(ctx) : cb();
|
|
4152
4154
|
}, 1);
|
|
4153
4155
|
};
|
|
4154
|
-
if (router
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4156
|
+
if (router === null)
|
|
4157
|
+
return timerFunc();
|
|
4158
|
+
const path = router.$taroPath;
|
|
4159
|
+
/**
|
|
4160
|
+
* 三种情况
|
|
4161
|
+
* 1. 调用 nextTick 时,pendingUpdate 已经从 true 变为 false(即已更新完成),那么需要光等 100ms
|
|
4162
|
+
* 2. 调用 nextTick 时,pendingUpdate 为 true,那么刚好可以搭上便车
|
|
4163
|
+
* 3. 调用 nextTick 时,pendingUpdate 还是 false,框架仍未启动更新逻辑,这时最多轮询 100ms,等待 pendingUpdate 变为 true。
|
|
4164
|
+
*/
|
|
4165
|
+
function next() {
|
|
4166
|
+
var _a, _b, _c;
|
|
4167
|
+
const pageElement = env.document.getElementById(path);
|
|
4158
4168
|
if (pageElement === null || pageElement === void 0 ? void 0 : pageElement.pendingUpdate) {
|
|
4159
4169
|
if (isWebPlatform()) {
|
|
4160
4170
|
// eslint-disable-next-line dot-notation
|
|
@@ -4166,13 +4176,14 @@ const nextTick = (cb, ctx) => {
|
|
|
4166
4176
|
pageElement.enqueueUpdateCallback(cb, ctx);
|
|
4167
4177
|
}
|
|
4168
4178
|
}
|
|
4169
|
-
else {
|
|
4179
|
+
else if (Date.now() - beginTime > TIMEOUT) {
|
|
4170
4180
|
timerFunc();
|
|
4171
4181
|
}
|
|
4182
|
+
else {
|
|
4183
|
+
setTimeout(() => next(), 20);
|
|
4184
|
+
}
|
|
4172
4185
|
}
|
|
4173
|
-
|
|
4174
|
-
timerFunc();
|
|
4175
|
-
}
|
|
4186
|
+
next();
|
|
4176
4187
|
};
|
|
4177
4188
|
|
|
4178
4189
|
export { Current, FormElement, History, Location, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, URL, URLSearchParams, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
|