@tarojs/runtime 4.0.0-canary.8 → 4.0.0
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/LICENSE +17 -3
- package/dist/bom/URL.d.ts +54 -0
- package/dist/bom/URL.js +221 -0
- package/dist/bom/URL.js.map +1 -0
- package/dist/bom/URLSearchParams.d.ts +2 -0
- package/dist/bom/URLSearchParams.js +131 -0
- package/dist/bom/URLSearchParams.js.map +1 -0
- package/dist/bom/document.d.ts +3 -0
- package/dist/bom/document.js +39 -0
- package/dist/bom/document.js.map +1 -0
- package/dist/bom/getComputedStyle.d.ts +5 -0
- package/dist/bom/getComputedStyle.js +8 -0
- package/dist/bom/getComputedStyle.js.map +1 -0
- package/dist/bom/history.d.ts +32 -0
- package/dist/bom/history.js +121 -0
- package/dist/bom/history.js.map +1 -0
- package/dist/bom/location.d.ts +39 -0
- package/dist/bom/location.js +240 -0
- package/dist/bom/location.js.map +1 -0
- package/dist/bom/navigator.d.ts +2 -0
- package/dist/bom/navigator.js +24 -0
- package/dist/bom/navigator.js.map +1 -0
- package/dist/bom/raf.d.ts +5 -0
- package/dist/bom/raf.js +33 -0
- package/dist/bom/raf.js.map +1 -0
- package/dist/bom/window.d.ts +26 -0
- package/dist/bom/window.js +92 -0
- package/dist/bom/window.js.map +1 -0
- package/dist/constants/index.d.ts +60 -0
- package/dist/constants/index.js +63 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/current.d.ts +19 -0
- package/dist/current.js +9 -0
- package/dist/current.js.map +1 -0
- package/dist/dom/anchor-element.d.ts +14 -0
- package/dist/dom/anchor-element.js +54 -0
- package/dist/dom/anchor-element.js.map +1 -0
- package/dist/dom/class-list.d.ts +17 -0
- package/dist/dom/class-list.js +92 -0
- package/dist/dom/class-list.js.map +1 -0
- package/dist/dom/document.d.ts +25 -0
- package/dist/dom/document.js +80 -0
- package/dist/dom/document.js.map +1 -0
- package/dist/dom/element.d.ts +40 -0
- package/dist/dom/element.js +315 -0
- package/dist/dom/element.js.map +1 -0
- package/dist/dom/event-source.d.ts +7 -0
- package/dist/dom/event-source.js +17 -0
- package/dist/dom/event-source.js.map +1 -0
- package/dist/dom/event-target.d.ts +8 -0
- package/dist/dom/event-target.js +78 -0
- package/dist/dom/event-target.js.map +1 -0
- package/dist/dom/event.d.ts +24 -0
- package/dist/dom/event.js +152 -0
- package/dist/dom/event.js.map +1 -0
- package/dist/dom/form.d.ts +10 -0
- package/dist/dom/form.js +38 -0
- package/dist/dom/form.js.map +1 -0
- package/dist/dom/node.d.ts +107 -0
- package/dist/dom/node.js +292 -0
- package/dist/dom/node.js.map +1 -0
- package/dist/dom/root.d.ts +16 -0
- package/dist/dom/root.js +169 -0
- package/dist/dom/root.js.map +1 -0
- package/dist/dom/style.d.ts +15 -0
- package/dist/dom/style.js +168 -0
- package/dist/dom/style.js.map +1 -0
- package/dist/dom/style_properties.d.ts +3 -0
- package/dist/dom/style_properties.js +186 -0
- package/dist/dom/style_properties.js.map +1 -0
- package/dist/dom/svg.d.ts +4 -0
- package/dist/dom/svg.js +8 -0
- package/dist/dom/svg.js.map +1 -0
- package/dist/dom/text.d.ts +15 -0
- package/dist/dom/text.js +41 -0
- package/dist/dom/text.js.map +1 -0
- package/dist/dom/transfer.d.ts +8 -0
- package/dist/dom/transfer.js +15 -0
- package/dist/dom/transfer.js.map +1 -0
- package/dist/dom/tree.d.ts +4 -0
- package/dist/dom/tree.js +38 -0
- package/dist/dom/tree.js.map +1 -0
- package/dist/dom-external/element.d.ts +4 -0
- package/dist/dom-external/element.js +29 -0
- package/dist/dom-external/element.js.map +1 -0
- package/dist/dom-external/index.d.ts +1 -0
- package/dist/dom-external/index.js +38 -0
- package/dist/dom-external/index.js.map +1 -0
- package/dist/dom-external/inner-html/html.d.ts +3 -0
- package/dist/dom-external/inner-html/html.js +28 -0
- package/dist/dom-external/inner-html/html.js.map +1 -0
- package/dist/dom-external/inner-html/parser.d.ts +25 -0
- package/dist/dom-external/inner-html/parser.js +216 -0
- package/dist/dom-external/inner-html/parser.js.map +1 -0
- package/dist/dom-external/inner-html/scaner.d.ts +30 -0
- package/dist/dom-external/inner-html/scaner.js +304 -0
- package/dist/dom-external/inner-html/scaner.js.map +1 -0
- package/dist/dom-external/inner-html/style.d.ts +27 -0
- package/dist/dom-external/inner-html/style.js +235 -0
- package/dist/dom-external/inner-html/style.js.map +1 -0
- package/dist/dom-external/inner-html/tags.d.ts +9 -0
- package/dist/dom-external/inner-html/tags.js +26 -0
- package/dist/dom-external/inner-html/tags.js.map +1 -0
- package/dist/dom-external/inner-html/utils.d.ts +2 -0
- package/dist/dom-external/inner-html/utils.js +12 -0
- package/dist/dom-external/inner-html/utils.js.map +1 -0
- package/dist/dom-external/mutation-observer/implements.d.ts +71 -0
- package/dist/dom-external/mutation-observer/implements.js +108 -0
- package/dist/dom-external/mutation-observer/implements.js.map +1 -0
- package/dist/dom-external/mutation-observer/index.d.ts +12 -0
- package/dist/dom-external/mutation-observer/index.js +35 -0
- package/dist/dom-external/mutation-observer/index.js.map +1 -0
- package/dist/dom-external/node.d.ts +12 -0
- package/dist/dom-external/node.js +75 -0
- package/dist/dom-external/node.js.map +1 -0
- package/dist/dsl/common.d.ts +16 -0
- package/dist/dsl/common.js +337 -0
- package/dist/dsl/common.js.map +1 -0
- package/dist/emitter/emitter.d.ts +4 -0
- package/dist/emitter/emitter.js +7 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/env.d.ts +7 -0
- package/dist/env.js +9 -0
- package/dist/env.js.map +1 -0
- package/dist/hydrate.d.ts +11 -0
- package/dist/hydrate.js +91 -0
- package/dist/hydrate.js.map +1 -0
- package/dist/index-26658829.d.ts +23 -0
- package/dist/{runtime.cjs.d.ts → index.cjs.d.ts} +108 -102
- package/dist/{runtime.h5.js → index.cjs.js} +4301 -2495
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/instance-4c64b022.d.ts +85 -0
- package/dist/next-tick.d.ts +3 -0
- package/dist/next-tick.js +47 -0
- package/dist/next-tick.js.map +1 -0
- package/dist/node_types-9ac5b4dd.d.ts +11 -0
- package/dist/options-4c64b022.d.ts +17 -0
- package/dist/options.d.ts +3 -0
- package/dist/options.js +7 -0
- package/dist/options.js.map +1 -0
- package/dist/perf.d.ts +9 -0
- package/dist/perf.js +49 -0
- package/dist/perf.js.map +1 -0
- package/dist/polyfill/array.d.ts +3 -0
- package/dist/polyfill/array.js +56 -0
- package/dist/polyfill/array.js.map +1 -0
- package/dist/polyfill/index.d.ts +2 -0
- package/dist/polyfill/index.js +34 -0
- package/dist/polyfill/index.js.map +1 -0
- package/dist/polyfill/intersection-observer.d.ts +2 -0
- package/dist/polyfill/intersection-observer.js +600 -0
- package/dist/polyfill/intersection-observer.js.map +1 -0
- package/dist/polyfill/object.d.ts +4 -0
- package/dist/polyfill/object.js +102 -0
- package/dist/polyfill/object.js.map +1 -0
- package/dist/record-32b054d8.d.ts +25 -0
- package/dist/runtime.esm.d.ts +108 -102
- package/dist/runtime.esm.js +4126 -3320
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.d.ts +13 -0
- package/dist/utils/cache.js +27 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.js +99 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/lodash.d.ts +3 -0
- package/dist/utils/lodash.js +32 -0
- package/dist/utils/lodash.js.map +1 -0
- package/dist/utils/router.d.ts +8 -0
- package/dist/utils/router.js +24 -0
- package/dist/utils/router.js.map +1 -0
- package/package.json +23 -26
- package/dist/runtime.cjs.js +0 -4628
- package/dist/runtime.h5.d.ts +0 -800
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="react" />
|
|
1
3
|
import { Shortcuts, Events } from "@tarojs/shared";
|
|
2
|
-
import { PageConfig } from "@tarojs/taro";
|
|
3
|
-
import VueCtor from "vue";
|
|
4
|
-
import { ComponentOptions, VNode } from "vue";
|
|
5
4
|
import { Component as Vue3Component } from "@vue/runtime-core";
|
|
6
5
|
import { Component, ComponentClass } from "react";
|
|
7
|
-
import { CombinedVueInstance } from "vue/types/vue";
|
|
8
6
|
declare class ClassList {
|
|
9
7
|
private el;
|
|
10
8
|
private tokenList;
|
|
@@ -49,6 +47,9 @@ interface EventHandler<T = any, R = void> {
|
|
|
49
47
|
(...args: T[]): R;
|
|
50
48
|
_stop?: boolean;
|
|
51
49
|
}
|
|
50
|
+
// Note: @tarojs/runtime 不依赖 @tarojs/taro, 所以不能改为从 @tarojs/taro 引入 (可能导致循环依赖)
|
|
51
|
+
type TFunc = (...args: any[]) => any;
|
|
52
|
+
type PageConfig = Record<string, any>;
|
|
52
53
|
interface MpInstance {
|
|
53
54
|
config: PageConfig;
|
|
54
55
|
setData: (data: unknown, cb: () => void) => void;
|
|
@@ -135,8 +136,6 @@ interface Options {
|
|
|
135
136
|
};
|
|
136
137
|
miniGlobal?: any;
|
|
137
138
|
}
|
|
138
|
-
type Func = (...args: any[]) => any;
|
|
139
|
-
type Ctx = Record<string, any>;
|
|
140
139
|
declare class TaroEventTarget {
|
|
141
140
|
__handlers: Record<string, EventHandler[]>;
|
|
142
141
|
addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -152,8 +151,8 @@ declare class TaroRootElement extends TaroElement {
|
|
|
152
151
|
get _path(): string;
|
|
153
152
|
get _root(): TaroRootElement;
|
|
154
153
|
enqueueUpdate(payload: UpdatePayload): void;
|
|
155
|
-
performUpdate(initRender?: boolean, prerender?:
|
|
156
|
-
enqueueUpdateCallback(cb:
|
|
154
|
+
performUpdate(initRender?: boolean, prerender?: TFunc): void;
|
|
155
|
+
enqueueUpdateCallback(cb: TFunc, ctx?: Record<string, any>): void;
|
|
157
156
|
flushUpdateCallback(): void;
|
|
158
157
|
}
|
|
159
158
|
interface RemoveChildOptions {
|
|
@@ -224,7 +223,7 @@ declare class TaroNode extends TaroEventTarget {
|
|
|
224
223
|
hasChildNodes(): boolean;
|
|
225
224
|
enqueueUpdate(payload: UpdatePayload): void;
|
|
226
225
|
get ownerDocument(): TaroDocument;
|
|
227
|
-
static extend(methodName: string, options:
|
|
226
|
+
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
228
227
|
}
|
|
229
228
|
declare class Style {
|
|
230
229
|
_pending: boolean;
|
|
@@ -298,7 +297,7 @@ declare class TaroElement extends TaroNode {
|
|
|
298
297
|
dispatchEvent(event: TaroEvent): boolean;
|
|
299
298
|
addEventListener(type: any, handler: any, options: any): void;
|
|
300
299
|
removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
|
|
301
|
-
static extend(methodName: string, options:
|
|
300
|
+
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
302
301
|
}
|
|
303
302
|
declare class FormElement extends TaroElement {
|
|
304
303
|
get type(): string;
|
|
@@ -312,6 +311,7 @@ declare class TaroDocument extends TaroElement {
|
|
|
312
311
|
head: TaroElement;
|
|
313
312
|
body: TaroElement;
|
|
314
313
|
createEvent: typeof createEvent;
|
|
314
|
+
cookie?: string;
|
|
315
315
|
constructor();
|
|
316
316
|
createElement(type: string): TaroElement | TaroRootElement | FormElement;
|
|
317
317
|
// an ugly fake createElementNS to deal with @vue/runtime-dom's
|
|
@@ -330,8 +330,9 @@ interface Env {
|
|
|
330
330
|
document: TaroDocument;
|
|
331
331
|
}
|
|
332
332
|
declare const env: Env;
|
|
333
|
-
declare
|
|
334
|
-
|
|
333
|
+
declare const document: TaroDocument;
|
|
334
|
+
type TGetComputedStyle = typeof window.getComputedStyle | ((el: TaroElement) => Style);
|
|
335
|
+
declare const getComputedStyle: TGetComputedStyle;
|
|
335
336
|
declare const eventCenter: Events;
|
|
336
337
|
type EventsType = typeof Events;
|
|
337
338
|
/**
|
|
@@ -346,75 +347,60 @@ declare class RuntimeCache<T> {
|
|
|
346
347
|
get(identifier: string): T | undefined;
|
|
347
348
|
delete(identifier: string): void;
|
|
348
349
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
set search(val: string);
|
|
386
|
-
get hash(): string;
|
|
387
|
-
// 小程序的navigateTo存在截断hash字符串的问题
|
|
388
|
-
set hash(val: string);
|
|
389
|
-
get href(): string;
|
|
390
|
-
set href(val: string);
|
|
391
|
-
get origin(): string;
|
|
392
|
-
set origin(val: string);
|
|
393
|
-
/* public method */
|
|
394
|
-
assign(): void;
|
|
395
|
-
reload(): void;
|
|
396
|
-
replace(url: string): void;
|
|
397
|
-
toString(): string;
|
|
398
|
-
// For debug
|
|
399
|
-
get cache(): RuntimeCache<LocationContext>;
|
|
400
|
-
}
|
|
350
|
+
type Options$0 = {
|
|
351
|
+
window: any;
|
|
352
|
+
};
|
|
353
|
+
type LocationContext = {
|
|
354
|
+
lastHref: string;
|
|
355
|
+
};
|
|
356
|
+
declare class TaroLocation extends Events {
|
|
357
|
+
#private;
|
|
358
|
+
constructor(options: Options$0);
|
|
359
|
+
/* public property */
|
|
360
|
+
get protocol(): string;
|
|
361
|
+
set protocol(val: string);
|
|
362
|
+
get host(): string;
|
|
363
|
+
set host(val: string);
|
|
364
|
+
get hostname(): string;
|
|
365
|
+
set hostname(val: string);
|
|
366
|
+
get port(): string;
|
|
367
|
+
set port(val: string);
|
|
368
|
+
get pathname(): string;
|
|
369
|
+
set pathname(val: string);
|
|
370
|
+
get search(): string;
|
|
371
|
+
set search(val: string);
|
|
372
|
+
get hash(): string;
|
|
373
|
+
// 小程序的navigateTo存在截断hash字符串的问题
|
|
374
|
+
set hash(val: string);
|
|
375
|
+
get href(): string;
|
|
376
|
+
set href(val: string);
|
|
377
|
+
get origin(): string;
|
|
378
|
+
set origin(val: string);
|
|
379
|
+
/* public method */
|
|
380
|
+
assign(): void;
|
|
381
|
+
reload(): void;
|
|
382
|
+
replace(url: string): void;
|
|
383
|
+
toString(): string;
|
|
384
|
+
// For debug
|
|
385
|
+
get cache(): RuntimeCache<LocationContext>;
|
|
401
386
|
}
|
|
387
|
+
declare const Location: typeof TaroLocation;
|
|
402
388
|
interface HistoryState {
|
|
403
389
|
state: Record<string, any> | null;
|
|
404
390
|
title: string;
|
|
405
391
|
url: string;
|
|
406
392
|
}
|
|
407
|
-
type Options$
|
|
393
|
+
type Options$1 = {
|
|
408
394
|
window: any;
|
|
409
395
|
};
|
|
410
396
|
type HistoryContext = {
|
|
411
|
-
location:
|
|
397
|
+
location: TaroLocation;
|
|
412
398
|
stack: HistoryState[];
|
|
413
399
|
cur: number;
|
|
414
400
|
};
|
|
415
|
-
declare class
|
|
401
|
+
declare class TaroHistory extends Events {
|
|
416
402
|
#private;
|
|
417
|
-
constructor(location:
|
|
403
|
+
constructor(location: TaroLocation, options: Options$1);
|
|
418
404
|
/* public property */
|
|
419
405
|
get length(): number;
|
|
420
406
|
get state(): Record<string, any> | null;
|
|
@@ -427,28 +413,15 @@ declare class History extends Events {
|
|
|
427
413
|
// For debug
|
|
428
414
|
get cache(): RuntimeCache<HistoryContext>;
|
|
429
415
|
}
|
|
430
|
-
declare const
|
|
416
|
+
declare const History: typeof TaroHistory;
|
|
417
|
+
declare const nav: typeof window.navigator;
|
|
431
418
|
// https://github.com/myrne/performance-now
|
|
432
419
|
declare let now: () => number;
|
|
433
420
|
// https://gist.github.com/paulirish/1579671
|
|
434
421
|
// https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
|
|
435
422
|
declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
436
423
|
declare const _caf: typeof cancelAnimationFrame;
|
|
437
|
-
declare class
|
|
438
|
-
#private;
|
|
439
|
-
constructor(query: any);
|
|
440
|
-
append(name: string, value: string): void;
|
|
441
|
-
delete(name: string): void;
|
|
442
|
-
get(name: string): any;
|
|
443
|
-
getAll(name: string): any;
|
|
444
|
-
has(name: string): boolean;
|
|
445
|
-
keys(): string[];
|
|
446
|
-
set(name: string, value: string): void;
|
|
447
|
-
forEach(callback: any, thisArg: any): void;
|
|
448
|
-
toJSON(): {};
|
|
449
|
-
toString(): string;
|
|
450
|
-
}
|
|
451
|
-
declare class URL {
|
|
424
|
+
declare class TaroURL {
|
|
452
425
|
#private;
|
|
453
426
|
static createObjectURL(): void;
|
|
454
427
|
static revokeObjectURL(): void;
|
|
@@ -489,6 +462,7 @@ declare class URL {
|
|
|
489
462
|
href: string;
|
|
490
463
|
};
|
|
491
464
|
}
|
|
465
|
+
declare const URL: typeof TaroURL;
|
|
492
466
|
declare function parseUrl(url?: string): {
|
|
493
467
|
href: string;
|
|
494
468
|
origin: string;
|
|
@@ -500,9 +474,27 @@ declare function parseUrl(url?: string): {
|
|
|
500
474
|
search: string;
|
|
501
475
|
hash: string;
|
|
502
476
|
};
|
|
503
|
-
declare
|
|
504
|
-
declare
|
|
505
|
-
|
|
477
|
+
declare const URLSearchParams: any;
|
|
478
|
+
declare class TaroWindow extends Events {
|
|
479
|
+
navigator: Navigator;
|
|
480
|
+
requestAnimationFrame: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
481
|
+
cancelAnimationFrame: typeof cancelAnimationFrame;
|
|
482
|
+
getComputedStyle: TGetComputedStyle;
|
|
483
|
+
Date: DateConstructor;
|
|
484
|
+
location: TaroLocation;
|
|
485
|
+
history: TaroHistory;
|
|
486
|
+
XMLHttpRequest?: Partial<XMLHttpRequest>;
|
|
487
|
+
constructor();
|
|
488
|
+
initEvent(): void;
|
|
489
|
+
get document(): TaroDocument;
|
|
490
|
+
addEventListener(event: string, callback: (arg: any) => void): void;
|
|
491
|
+
removeEventListener(event: string, callback: (arg: any) => void): void;
|
|
492
|
+
setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
|
|
493
|
+
clearTimeout(...args: Parameters<typeof clearTimeout>): void;
|
|
494
|
+
}
|
|
495
|
+
declare const window: TaroWindow;
|
|
496
|
+
declare const location: TaroLocation;
|
|
497
|
+
declare const history: TaroHistory;
|
|
506
498
|
// for Vue3
|
|
507
499
|
declare class SVGElement extends TaroElement {
|
|
508
500
|
}
|
|
@@ -656,14 +648,6 @@ interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInst
|
|
|
656
648
|
$nextTick?(cb: () => void): void;
|
|
657
649
|
$options: Instance;
|
|
658
650
|
}
|
|
659
|
-
interface VueAppInstance extends ComponentOptions<VueCtor> {
|
|
660
|
-
$options: AppInstance;
|
|
661
|
-
}
|
|
662
|
-
type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
|
|
663
|
-
interface VueInternal {
|
|
664
|
-
_render(): VNode;
|
|
665
|
-
_update(vnode: VNode, hyrate: boolean): void;
|
|
666
|
-
}
|
|
667
651
|
interface PageProps {
|
|
668
652
|
tid?: string;
|
|
669
653
|
}
|
|
@@ -678,7 +662,7 @@ interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
|
|
|
678
662
|
interface PageLifeCycle extends Show {
|
|
679
663
|
eh?(event: MpEvent): void;
|
|
680
664
|
onAddToFavorites?(): void;
|
|
681
|
-
onLoad?(options: Record<string, unknown>, cb?:
|
|
665
|
+
onLoad?(options: Record<string, unknown>, cb?: TFunc): void;
|
|
682
666
|
onOptionMenuClick?(): void;
|
|
683
667
|
onPageScroll?(obj: {
|
|
684
668
|
scrollTop: number;
|
|
@@ -713,6 +697,8 @@ interface PageInstance extends PageLifeCycle {
|
|
|
713
697
|
options?: Record<string, unknown>;
|
|
714
698
|
/** 页面渲染引擎类型 */
|
|
715
699
|
renderer?: "webview" | "skyline";
|
|
700
|
+
/** 获得一个 EventChannel 对象,用于页面间通讯 */
|
|
701
|
+
getOpenerEventChannel?(): Record<string, any>;
|
|
716
702
|
}
|
|
717
703
|
interface Show {
|
|
718
704
|
componentDidShow?(): void;
|
|
@@ -722,13 +708,14 @@ interface Show {
|
|
|
722
708
|
}
|
|
723
709
|
interface AppInstance extends Show {
|
|
724
710
|
componentDidShow?(options?: Record<string, unknown>): void;
|
|
725
|
-
mount?(component: React.ComponentClass |
|
|
726
|
-
mount?(component: React.ComponentClass |
|
|
711
|
+
mount?(component: React.ComponentClass | Vue3Component, id: string, cb: (...args: any[]) => void): void;
|
|
712
|
+
mount?(component: React.ComponentClass | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
|
|
727
713
|
onError?(error: string): void;
|
|
728
714
|
onLaunch?(options?: Record<string, unknown>): void;
|
|
729
715
|
onPageNotFound?(res: any): void;
|
|
730
716
|
onUnhandledRejection?(error: any): void;
|
|
731
717
|
onShow?(options?: Record<string, unknown>): void;
|
|
718
|
+
onHide?(options?: Record<string, unknown>): void;
|
|
732
719
|
unmount?(id: string, cb?: () => void): void;
|
|
733
720
|
taroGlobalData?: Record<any, any>;
|
|
734
721
|
config?: Record<any, any>;
|
|
@@ -758,7 +745,6 @@ declare const eventSource: IEventSource;
|
|
|
758
745
|
declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
|
|
759
746
|
declare function getPageInstance(id: string): Instance | undefined;
|
|
760
747
|
declare function removePageInstance(id: string): void;
|
|
761
|
-
declare function addLeadingSlash(path?: string): string;
|
|
762
748
|
declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
|
|
763
749
|
declare function stringify(obj?: Record<string, unknown>): string;
|
|
764
750
|
declare function getPath(id: string, options?: Record<string, unknown>): string;
|
|
@@ -775,8 +761,16 @@ declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
|
775
761
|
* it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
|
|
776
762
|
*/
|
|
777
763
|
declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
778
|
-
declare const nextTick: (cb:
|
|
764
|
+
declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
|
|
779
765
|
declare const options: Options;
|
|
766
|
+
declare class Performance {
|
|
767
|
+
#private;
|
|
768
|
+
private recorder;
|
|
769
|
+
start(id: string): void;
|
|
770
|
+
stop(id: string, now?: number): void;
|
|
771
|
+
delayStop(id: string, delay?: number): ((...args: any[]) => void) | undefined;
|
|
772
|
+
}
|
|
773
|
+
declare const perf: Performance;
|
|
780
774
|
declare const incrementId: () => () => string;
|
|
781
775
|
declare function isElement(node: TaroNode): node is TaroElement;
|
|
782
776
|
declare function isText(node: TaroNode): node is TaroText;
|
|
@@ -793,8 +787,20 @@ declare const customWrapperCache: Map<string, Record<string, any>>;
|
|
|
793
787
|
interface Ctor {
|
|
794
788
|
new (...args: any[]): any;
|
|
795
789
|
}
|
|
796
|
-
declare function extend(ctor: Ctor, methodName: string, options:
|
|
790
|
+
declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<string, any>): void;
|
|
797
791
|
declare function getComponentsAlias(): any;
|
|
798
792
|
declare function convertNumber2PX(value: number): string;
|
|
793
|
+
declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
|
|
794
|
+
declare function debounce(fn: any, ms?: number, scope?: any): (...args: any[]) => void;
|
|
795
|
+
// export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
|
|
796
|
+
// export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
|
|
797
|
+
declare const addLeadingSlash: (url?: string) => string;
|
|
798
|
+
declare const hasBasename: (path?: string, prefix?: string) => boolean;
|
|
799
|
+
declare const stripBasename: (path?: string, prefix?: string) => string;
|
|
800
|
+
declare const stripTrailing: (str?: string) => string;
|
|
801
|
+
declare const stripSuffix: (path?: string, suffix?: string) => string;
|
|
802
|
+
declare const getHomePage: (path?: string, basename?: string, customRoutes?: Record<string, string | string[]>, entryPagePath?: string) => string;
|
|
803
|
+
declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
|
|
804
|
+
declare function handlePolyfill(): void;
|
|
799
805
|
export { hooks } from '@tarojs/shared';
|
|
800
|
-
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource,
|
|
806
|
+
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, perf, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, debounce, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
|