ripple 0.2.61 → 0.2.63
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/package.json
CHANGED
|
@@ -1089,6 +1089,13 @@ const visitors = {
|
|
|
1089
1089
|
context.state.init.push(b.block(statements));
|
|
1090
1090
|
},
|
|
1091
1091
|
|
|
1092
|
+
TSAsExpression(node, context) {
|
|
1093
|
+
if (!context.state.to_ts) {
|
|
1094
|
+
return context.visit(node.expression);
|
|
1095
|
+
}
|
|
1096
|
+
return context.next();
|
|
1097
|
+
},
|
|
1098
|
+
|
|
1092
1099
|
TryStatement(node, context) {
|
|
1093
1100
|
if (!is_inside_component(context)) {
|
|
1094
1101
|
context.next();
|
package/src/runtime/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
set_active_reaction,
|
|
7
7
|
set_tracking,
|
|
8
8
|
tracking,
|
|
9
|
-
} from './runtime';
|
|
9
|
+
} from './runtime.js';
|
|
10
10
|
import { array_from, define_property, is_array } from './utils.js';
|
|
11
11
|
|
|
12
12
|
/** @type {Set<string>} */
|
|
@@ -15,6 +15,20 @@ var all_registered_events = new Set();
|
|
|
15
15
|
/** @type {Set<(events: Array<string>) => void>} */
|
|
16
16
|
var root_event_handles = new Set();
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @param {EventTarget} element
|
|
20
|
+
* @param {string} type
|
|
21
|
+
* @param {EventListener} handler
|
|
22
|
+
* @param {AddEventListenerOptions} [options]
|
|
23
|
+
*/
|
|
24
|
+
export function on(element, type, handler, options = {}) {
|
|
25
|
+
var target_handler = create_event(type.toLowerCase(), element, handler, options);
|
|
26
|
+
|
|
27
|
+
return () => {
|
|
28
|
+
element.removeEventListener(type, target_handler, options);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
/**
|
|
19
33
|
* @this {EventTarget}
|
|
20
34
|
* @param {Event} event
|
|
@@ -160,8 +174,6 @@ export function handle_event_propagation(event) {
|
|
|
160
174
|
* @param {AddEventListenerOptions} [options]
|
|
161
175
|
*/
|
|
162
176
|
function create_event(event_name, dom, handler, options = {}) {
|
|
163
|
-
var block = active_block;
|
|
164
|
-
|
|
165
177
|
function target_handler(/** @type {Event} */ event) {
|
|
166
178
|
var previous_block = active_block;
|
|
167
179
|
var previous_reaction = active_reaction;
|
package/types/index.d.ts
CHANGED
|
@@ -72,3 +72,38 @@ export declare function createRefKey(): symbol;
|
|
|
72
72
|
type Tracked<V> = { '#v': V };
|
|
73
73
|
|
|
74
74
|
export declare function track<V>(value?: V | (() => V)): Tracked<V>;
|
|
75
|
+
|
|
76
|
+
export function on<Type extends keyof WindowEventMap>(
|
|
77
|
+
window: Window,
|
|
78
|
+
type: Type,
|
|
79
|
+
handler: (this: Window, event: WindowEventMap[Type]) => any,
|
|
80
|
+
options?: AddEventListenerOptions | undefined
|
|
81
|
+
): () => void;
|
|
82
|
+
|
|
83
|
+
export function on<Type extends keyof DocumentEventMap>(
|
|
84
|
+
document: Document,
|
|
85
|
+
type: Type,
|
|
86
|
+
handler: (this: Document, event: DocumentEventMap[Type]) => any,
|
|
87
|
+
options?: AddEventListenerOptions | undefined
|
|
88
|
+
): () => void;
|
|
89
|
+
|
|
90
|
+
export function on<Element extends HTMLElement, Type extends keyof HTMLElementEventMap>(
|
|
91
|
+
element: Element,
|
|
92
|
+
type: Type,
|
|
93
|
+
handler: (this: Element, event: HTMLElementEventMap[Type]) => any,
|
|
94
|
+
options?: AddEventListenerOptions | undefined
|
|
95
|
+
): () => void;
|
|
96
|
+
|
|
97
|
+
export function on<Element extends MediaQueryList, Type extends keyof MediaQueryListEventMap>(
|
|
98
|
+
element: Element,
|
|
99
|
+
type: Type,
|
|
100
|
+
handler: (this: Element, event: MediaQueryListEventMap[Type]) => any,
|
|
101
|
+
options?: AddEventListenerOptions | undefined
|
|
102
|
+
): () => void;
|
|
103
|
+
|
|
104
|
+
export function on(
|
|
105
|
+
element: EventTarget,
|
|
106
|
+
type: string,
|
|
107
|
+
handler: EventListener,
|
|
108
|
+
options?: AddEventListenerOptions | undefined
|
|
109
|
+
): () => void;
|