@lynx-js/types 3.3.0 → 3.3.2

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.
@@ -13,6 +13,58 @@ export interface TextMetrics {
13
13
  width: number;
14
14
  content?: Array<string>;
15
15
  }
16
+
17
+ export type DispatchEventResult =
18
+ // 'NotCanceled'
19
+ // Event was not canceled by event handler or default event handler.
20
+ | 0
21
+ // 'CanceledByEventHandler'
22
+ // Event was canceled by event handler; i.e. a script handler calling
23
+ // preventDefault.
24
+ | 1
25
+ // 'CanceledByDefaultEventHandler'
26
+ // Event was canceled by the default event handler; i.e. executing the default
27
+ // action. This result should be used sparingly as it deviates from the DOM
28
+ // Event Dispatch model. Default event handlers really shouldn't be invoked
29
+ // inside of dispatch.
30
+ | 2
31
+ // 'CanceledBeforeDispatch'
32
+ // Event was canceled but suppressed before dispatched to event handler. This
33
+ // result should be used sparingly; and its usage likely indicates there is
34
+ // potential for a bug. Trusted events may return this code; but untrusted
35
+ // events likely should always execute the event handler the developer intends
36
+ // to execute.
37
+ | 3;
38
+
39
+ export interface MessageEvent {
40
+ type: string;
41
+ data: any;
42
+ origin?: string;
43
+ }
44
+
45
+ export interface ContextProxy {
46
+ onTriggerEvent?: (event: MessageEvent) => void;
47
+
48
+ postMessage(message: any): void;
49
+ dispatchEvent(event: MessageEvent): DispatchEventResult;
50
+ addEventListener(type: string, listener: (event: MessageEvent) => void): void;
51
+ removeEventListener(
52
+ type: string,
53
+ listener: (event: MessageEvent) => void
54
+ ): void;
55
+ }
56
+
57
+ export interface BundleInfo {
58
+ url: string;
59
+ code: number;
60
+ error_msg: string;
61
+ }
62
+
63
+ export interface ResponseHandler {
64
+ wait: (timeout: number) => BundleInfo;
65
+ then: (info: BundleInfo) => {}
66
+ }
67
+
16
68
  /*
17
69
  *@description Common Lynx type
18
70
  */
@@ -32,4 +84,12 @@ export interface CommonLynx {
32
84
  * @since main-thread:3.0, background-thread: 2.6
33
85
  */
34
86
  targetSdkVersion?: string;
87
+
88
+ getDevtool(): ContextProxy;
89
+ getCoreContext(): ContextProxy;
90
+ getJSContext(): ContextProxy;
91
+ getUIContext(): ContextProxy;
92
+ getNative(): ContextProxy;
93
+ getEngine(): ContextProxy;
94
+ fetchBundle(url: string, options?: {}): ResponseHandler;
35
95
  }
@@ -7,9 +7,18 @@
7
7
  */
8
8
  export interface TraceOption {
9
9
  /**
10
- * An optional unique identifier for tracing the event flow.
10
+ * An optional unique identifier for tracing a single event flow.
11
+ *
12
+ * Note: If `flowIds` is set, this parameter will be ignored.
11
13
  */
12
14
  flowId?: number;
15
+
16
+ /**
17
+ * An optional unique identifier for tracing multiple event flows.
18
+ * Support from Lynx 3.5
19
+ */
20
+ flowIds?: number[];
21
+
13
22
  /**
14
23
  * An optional collection of key-value pairs providing additional context for the tracing event.
15
24
  */
@@ -5,26 +5,6 @@
5
5
  import { CSSProperties } from '../common';
6
6
 
7
7
  export interface Element {
8
- styles: CSSProperties;
9
- attributes: Record<string, any>;
10
- scrollBy: (
11
- width: number,
12
- height: number
13
- ) => {
14
- consumedX: number;
15
- consumedY: number;
16
- unconsumedX: number;
17
- unconsumedY: number;
18
- };
19
- getBoundingClientRect: () => {
20
- width: number;
21
- height: number;
22
- top: number;
23
- bottom: number;
24
- left: number;
25
- right: number;
26
- };
27
-
28
8
  /**
29
9
  * Set an attribute.
30
10
  * @param attributeName The name of the attribute.