@tarojs/runtime 4.1.7-beta.4 → 4.1.7-beta.5
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/bom/raf.d.ts +1 -1
- package/dist/bom/window.d.ts +2 -2
- package/dist/dsl/common.js +24 -9
- package/dist/dsl/common.js.map +1 -1
- package/dist/dsl/instance.d.ts +5 -0
- package/dist/index.cjs.d.ts +8 -3
- package/dist/index.cjs.js +24 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/runtime.esm.d.ts +8 -3
- package/dist/runtime.esm.js +24 -9
- package/dist/runtime.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/runtime.esm.d.ts
CHANGED
|
@@ -511,7 +511,7 @@ declare const History: typeof TaroHistory;
|
|
|
511
511
|
declare const nav: typeof window.navigator;
|
|
512
512
|
|
|
513
513
|
declare let now: () => number;
|
|
514
|
-
declare const _raf: typeof requestAnimationFrame;
|
|
514
|
+
declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
515
515
|
declare const _caf: typeof cancelAnimationFrame;
|
|
516
516
|
|
|
517
517
|
declare class TaroURL {
|
|
@@ -570,7 +570,7 @@ declare const URLSearchParams$1: any;
|
|
|
570
570
|
|
|
571
571
|
declare class TaroWindow extends Events {
|
|
572
572
|
navigator: Navigator;
|
|
573
|
-
requestAnimationFrame: typeof requestAnimationFrame;
|
|
573
|
+
requestAnimationFrame: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
574
574
|
cancelAnimationFrame: typeof cancelAnimationFrame;
|
|
575
575
|
getComputedStyle: TGetComputedStyle;
|
|
576
576
|
Date: DateConstructor;
|
|
@@ -582,7 +582,7 @@ declare class TaroWindow extends Events {
|
|
|
582
582
|
get document(): TaroDocument;
|
|
583
583
|
addEventListener(event: string, callback: (arg: any) => void): void;
|
|
584
584
|
removeEventListener(event: string, callback: (arg: any) => void): void;
|
|
585
|
-
setTimeout(...args: Parameters<typeof setTimeout>):
|
|
585
|
+
setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
|
|
586
586
|
clearTimeout(...args: Parameters<typeof clearTimeout>): void;
|
|
587
587
|
}
|
|
588
588
|
|
|
@@ -760,6 +760,9 @@ interface PageLifeCycle extends Show {
|
|
|
760
760
|
onAddToFavorites?(): void;
|
|
761
761
|
onLoad?(options: Record<string, unknown>, cb?: TFunc): void;
|
|
762
762
|
onOptionMenuClick?(): void;
|
|
763
|
+
onKeyboardHeight?(obj: {
|
|
764
|
+
height: number;
|
|
765
|
+
}): void;
|
|
763
766
|
onPageScroll?(obj: {
|
|
764
767
|
scrollTop: number;
|
|
765
768
|
}): void;
|
|
@@ -793,6 +796,8 @@ interface PageInstance extends PageLifeCycle {
|
|
|
793
796
|
options?: Record<string, unknown>;
|
|
794
797
|
/** 页面渲染引擎类型 */
|
|
795
798
|
renderer?: 'webview' | 'skyline';
|
|
799
|
+
/** 页面事件对象,支付宝小程序特有,详见[events](https://opendocs.alipay.com/mini/framework/page-detail#events) */
|
|
800
|
+
events?: Record<string, (...args: any[]) => any>;
|
|
796
801
|
/** 获得一个 EventChannel 对象,用于页面间通讯 */
|
|
797
802
|
getOpenerEventChannel?(): Record<string, any>;
|
|
798
803
|
/** 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
package/dist/runtime.esm.js
CHANGED
|
@@ -4145,19 +4145,34 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
4145
4145
|
}
|
|
4146
4146
|
LIFECYCLES.forEach((lifecycle) => {
|
|
4147
4147
|
let isDefer = false;
|
|
4148
|
+
let isEvent = false;
|
|
4148
4149
|
lifecycle = lifecycle.replace(/^defer:/, () => {
|
|
4149
4150
|
isDefer = true;
|
|
4150
4151
|
return '';
|
|
4151
4152
|
});
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4153
|
+
lifecycle = lifecycle.replace(/^events:/, () => {
|
|
4154
|
+
isEvent = true;
|
|
4155
|
+
return '';
|
|
4156
|
+
});
|
|
4157
|
+
if (isEvent && process.env.TARO_ENV === 'alipay') {
|
|
4158
|
+
// 初始化 config.events 对象
|
|
4159
|
+
if (!config.events)
|
|
4160
|
+
config.events = {};
|
|
4161
|
+
config.events[lifecycle] = function () {
|
|
4162
|
+
return safeExecute(this.$taroPath, lifecycle, ...arguments);
|
|
4163
|
+
};
|
|
4164
|
+
}
|
|
4165
|
+
else {
|
|
4166
|
+
config[lifecycle] = function () {
|
|
4167
|
+
const exec = () => safeExecute(this.$taroPath, lifecycle, ...arguments);
|
|
4168
|
+
if (isDefer) {
|
|
4169
|
+
hasLoaded.then(exec);
|
|
4170
|
+
}
|
|
4171
|
+
else {
|
|
4172
|
+
return exec();
|
|
4173
|
+
}
|
|
4174
|
+
};
|
|
4175
|
+
}
|
|
4161
4176
|
});
|
|
4162
4177
|
// onShareAppMessage 和 onShareTimeline 一样,会影响小程序右上方按钮的选项,因此不能默认注册。
|
|
4163
4178
|
SIDE_EFFECT_LIFECYCLES.forEach(lifecycle => {
|