@tarojs/runtime 3.5.7-alpha.7 → 3.5.7-alpha.8

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.
@@ -0,0 +1,14 @@
1
+ export declare class URLSearchParams {
2
+ #private;
3
+ constructor(query: any);
4
+ append(name: string, value: string): void;
5
+ delete(name: string): void;
6
+ get(name: string): any;
7
+ getAll(name: string): any;
8
+ has(name: string): boolean;
9
+ keys(): string[];
10
+ set(name: string, value: string): void;
11
+ forEach(callback: any, thisArg: any): void;
12
+ toJSON(): {};
13
+ toString(): string;
14
+ }
@@ -0,0 +1,29 @@
1
+ import { Events } from '../emitter/emitter';
2
+ import { RuntimeCache } from '../utils/cache';
3
+ import type * as LocationType from './location';
4
+ export interface HistoryState {
5
+ state: Record<string, any> | null;
6
+ title: string;
7
+ url: string;
8
+ }
9
+ declare type Options = {
10
+ window: any;
11
+ };
12
+ declare type HistoryContext = {
13
+ location: LocationType.Location;
14
+ stack: HistoryState[];
15
+ cur: number;
16
+ };
17
+ export declare class History extends Events {
18
+ #private;
19
+ constructor(location: LocationType.Location, options: Options);
20
+ get length(): number;
21
+ get state(): HistoryState;
22
+ go(delta: number): void;
23
+ back(): void;
24
+ forward(): void;
25
+ pushState(state: any, title: string, url: string): void;
26
+ replaceState(state: any, title: string, url: string): void;
27
+ get cache(): RuntimeCache<HistoryContext>;
28
+ }
29
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Events } from '../emitter/emitter';
2
+ import { RuntimeCache } from '../utils/cache';
3
+ declare type Options = {
4
+ window: any;
5
+ };
6
+ declare type LocationContext = {
7
+ lastHref: string;
8
+ };
9
+ export declare class Location extends Events {
10
+ #private;
11
+ constructor(options: Options);
12
+ get protocol(): string;
13
+ set protocol(val: string);
14
+ get host(): string;
15
+ set host(val: string);
16
+ get hostname(): string;
17
+ set hostname(val: string);
18
+ get port(): string;
19
+ set port(val: string);
20
+ get pathname(): string;
21
+ set pathname(val: string);
22
+ get search(): string;
23
+ set search(val: string);
24
+ get hash(): string;
25
+ set hash(val: string);
26
+ get href(): string;
27
+ set href(val: string);
28
+ get origin(): string;
29
+ set origin(val: string);
30
+ assign(): void;
31
+ reload(): void;
32
+ replace(val: string): void;
33
+ toString(): string;
34
+ get cache(): RuntimeCache<LocationContext>;
35
+ }
36
+ export {};
@@ -1,2 +1,4 @@
1
1
  declare let window: any;
2
+ export declare const location: any;
3
+ export declare const history: any;
2
4
  export { window };
@@ -45,3 +45,12 @@ export declare const ON_HIDE = "onHide";
45
45
  export declare const OPTIONS = "options";
46
46
  export declare const EXTERNAL_CLASSES = "externalClasses";
47
47
  export declare const BEHAVIORS = "behaviors";
48
+ /**
49
+ * 页面上下文切换时的行为
50
+ */
51
+ export declare enum CONTEXT_ACTIONS {
52
+ INIT = "0",
53
+ RECOVER = "1",
54
+ RESTORE = "2",
55
+ DESTORY = "3"
56
+ }
@@ -81,5 +81,6 @@ export interface AppInstance extends Show {
81
81
  onShow?(options?: Record<string, unknown>): void;
82
82
  unmount?(id: string, cb?: () => void): void;
83
83
  taroGlobalData?: Record<any, any>;
84
+ config?: Record<any, any>;
84
85
  }
85
86
  export {};
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ export { document } from './bom/document';
4
4
  export { getComputedStyle } from './bom/getComputedStyle';
5
5
  export { nav as navigator } from './bom/navigator';
6
6
  export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf';
7
- export { window } from './bom/window';
7
+ export { URLSearchParams } from './bom/URLSearchParams';
8
+ export { history, location, window } from './bom/window';
8
9
  export { TaroElement } from './dom/element';
9
10
  export { createEvent, eventHandler, TaroEvent } from './dom/event';
10
11
  export { FormElement } from './dom/form';
@@ -325,7 +325,23 @@ declare let now: () => number;
325
325
  // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
326
326
  declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
327
327
  declare const _caf: typeof cancelAnimationFrame;
328
+ declare class URLSearchParams {
329
+ #private;
330
+ constructor(query: any);
331
+ append(name: string, value: string): void;
332
+ delete(name: string): void;
333
+ get(name: string): any;
334
+ getAll(name: string): any;
335
+ has(name: string): boolean;
336
+ keys(): string[];
337
+ set(name: string, value: string): void;
338
+ forEach(callback: any, thisArg: any): void;
339
+ toJSON(): {};
340
+ toString(): string;
341
+ }
328
342
  declare let window: any;
343
+ declare const location: any;
344
+ declare const history: any;
329
345
  // for Vue3
330
346
  declare class SVGElement extends TaroElement {
331
347
  }
@@ -490,6 +506,7 @@ interface AppInstance extends Show {
490
506
  onShow?(options?: Record<string, unknown>): void;
491
507
  unmount?(id: string, cb?: () => void): void;
492
508
  taroGlobalData?: Record<any, any>;
509
+ config?: Record<any, any>;
493
510
  }
494
511
  interface Router {
495
512
  params: Record<string, unknown>;
@@ -535,4 +552,4 @@ declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
535
552
  declare const options: Options;
536
553
  declare const incrementId: () => () => string;
537
554
  export { hooks } from '@tarojs/shared';
538
- export { document, getComputedStyle, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options, Func, Ctx };
555
+ export { document, getComputedStyle, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options, Func, Ctx };