mqtt5-wasm 0.1.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/README.md +49 -0
- package/mqtt5_wasm.d.ts +292 -0
- package/mqtt5_wasm.js +1714 -0
- package/mqtt5_wasm_bg.wasm +0 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# mqtt5-wasm
|
|
2
|
+
|
|
3
|
+
MQTT v5.0 WebAssembly client and broker for browser environments.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **WebSocket transport** - Connect to remote MQTT brokers
|
|
8
|
+
- **In-tab broker** - Run a complete MQTT broker in the browser
|
|
9
|
+
- **MessagePort/BroadcastChannel** - Inter-tab communication
|
|
10
|
+
- **Full QoS support** - QoS 0, 1, and 2
|
|
11
|
+
- **Automatic keepalive** - Connection health monitoring
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```toml
|
|
16
|
+
[dependencies]
|
|
17
|
+
mqtt5-wasm = "0.10"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Build with wasm-pack:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
wasm-pack build --target web --features client,broker
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import init, { WasmMqttClient } from "./pkg/mqtt5_wasm.js";
|
|
30
|
+
|
|
31
|
+
await init();
|
|
32
|
+
const client = new WasmMqttClient("browser-client");
|
|
33
|
+
|
|
34
|
+
await client.connect("ws://broker.example.com:8080/mqtt");
|
|
35
|
+
|
|
36
|
+
await client.subscribe_with_callback("sensors/#", (topic, payload) => {
|
|
37
|
+
console.log(`${topic}: ${new TextDecoder().decode(payload)}`);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
await client.publish("sensors/temp", new TextEncoder().encode("25.5"));
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Documentation
|
|
44
|
+
|
|
45
|
+
See the [main repository](https://github.com/LabOverWire/mqtt-lib) for complete documentation and examples.
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
|
package/mqtt5_wasm.d.ts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export class WasmBroker {
|
|
4
|
+
free(): void;
|
|
5
|
+
[Symbol.dispose](): void;
|
|
6
|
+
constructor();
|
|
7
|
+
static with_config(wasm_config: WasmBrokerConfig): WasmBroker;
|
|
8
|
+
add_user(username: string, password: string): Promise<void>;
|
|
9
|
+
add_user_with_hash(username: string, password_hash: string): Promise<void>;
|
|
10
|
+
remove_user(username: string): Promise<boolean>;
|
|
11
|
+
has_user(username: string): Promise<boolean>;
|
|
12
|
+
user_count(): Promise<number>;
|
|
13
|
+
set_allow_anonymous(allow: boolean): void;
|
|
14
|
+
static hash_password(password: string): string;
|
|
15
|
+
create_client_port(): MessagePort;
|
|
16
|
+
}
|
|
17
|
+
export class WasmBrokerConfig {
|
|
18
|
+
free(): void;
|
|
19
|
+
[Symbol.dispose](): void;
|
|
20
|
+
constructor();
|
|
21
|
+
set max_clients(value: number);
|
|
22
|
+
set session_expiry_interval_secs(value: number);
|
|
23
|
+
set max_packet_size(value: number);
|
|
24
|
+
set topic_alias_maximum(value: number);
|
|
25
|
+
set retain_available(value: boolean);
|
|
26
|
+
set maximum_qos(value: number);
|
|
27
|
+
set wildcard_subscription_available(value: boolean);
|
|
28
|
+
set subscription_identifier_available(value: boolean);
|
|
29
|
+
set shared_subscription_available(value: boolean);
|
|
30
|
+
set server_keep_alive_secs(value: number | null | undefined);
|
|
31
|
+
}
|
|
32
|
+
export class WasmConnectOptions {
|
|
33
|
+
free(): void;
|
|
34
|
+
[Symbol.dispose](): void;
|
|
35
|
+
constructor();
|
|
36
|
+
set_will(will: WasmWillMessage): void;
|
|
37
|
+
clear_will(): void;
|
|
38
|
+
addUserProperty(key: string, value: string): void;
|
|
39
|
+
clearUserProperties(): void;
|
|
40
|
+
keepAlive: number;
|
|
41
|
+
cleanStart: boolean;
|
|
42
|
+
get username(): string | undefined;
|
|
43
|
+
set username(value: string | null | undefined);
|
|
44
|
+
set password(value: Uint8Array);
|
|
45
|
+
get sessionExpiryInterval(): number | undefined;
|
|
46
|
+
set sessionExpiryInterval(value: number | null | undefined);
|
|
47
|
+
get receiveMaximum(): number | undefined;
|
|
48
|
+
set receiveMaximum(value: number | null | undefined);
|
|
49
|
+
get maximumPacketSize(): number | undefined;
|
|
50
|
+
set maximumPacketSize(value: number | null | undefined);
|
|
51
|
+
get topicAliasMaximum(): number | undefined;
|
|
52
|
+
set topicAliasMaximum(value: number | null | undefined);
|
|
53
|
+
get requestResponseInformation(): boolean | undefined;
|
|
54
|
+
set requestResponseInformation(value: boolean | null | undefined);
|
|
55
|
+
get requestProblemInformation(): boolean | undefined;
|
|
56
|
+
set requestProblemInformation(value: boolean | null | undefined);
|
|
57
|
+
get authenticationMethod(): string | undefined;
|
|
58
|
+
set authenticationMethod(value: string | null | undefined);
|
|
59
|
+
set authenticationData(value: Uint8Array);
|
|
60
|
+
}
|
|
61
|
+
export class WasmMqttClient {
|
|
62
|
+
free(): void;
|
|
63
|
+
[Symbol.dispose](): void;
|
|
64
|
+
constructor(client_id: string);
|
|
65
|
+
connect(url: string): Promise<void>;
|
|
66
|
+
connect_with_options(url: string, config: WasmConnectOptions): Promise<void>;
|
|
67
|
+
connect_message_port(port: MessagePort): Promise<void>;
|
|
68
|
+
connect_broadcast_channel(channel_name: string): Promise<void>;
|
|
69
|
+
publish(topic: string, payload: Uint8Array): Promise<void>;
|
|
70
|
+
publish_with_options(topic: string, payload: Uint8Array, options: WasmPublishOptions): Promise<void>;
|
|
71
|
+
publish_qos1(topic: string, payload: Uint8Array, callback: Function): Promise<number>;
|
|
72
|
+
publish_qos2(topic: string, payload: Uint8Array, callback: Function): Promise<number>;
|
|
73
|
+
subscribe(topic: string): Promise<number>;
|
|
74
|
+
subscribe_with_options(topic: string, callback: Function, options: WasmSubscribeOptions): Promise<number>;
|
|
75
|
+
subscribe_with_callback(topic: string, callback: Function): Promise<number>;
|
|
76
|
+
unsubscribe(topic: string): Promise<number>;
|
|
77
|
+
disconnect(): Promise<void>;
|
|
78
|
+
is_connected(): boolean;
|
|
79
|
+
on_connect(callback: Function): void;
|
|
80
|
+
on_disconnect(callback: Function): void;
|
|
81
|
+
on_error(callback: Function): void;
|
|
82
|
+
on_auth_challenge(callback: Function): void;
|
|
83
|
+
respond_auth(auth_data: Uint8Array): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
export class WasmPublishOptions {
|
|
86
|
+
free(): void;
|
|
87
|
+
[Symbol.dispose](): void;
|
|
88
|
+
constructor();
|
|
89
|
+
addUserProperty(key: string, value: string): void;
|
|
90
|
+
clearUserProperties(): void;
|
|
91
|
+
qos: number;
|
|
92
|
+
retain: boolean;
|
|
93
|
+
get payloadFormatIndicator(): boolean | undefined;
|
|
94
|
+
set payloadFormatIndicator(value: boolean | null | undefined);
|
|
95
|
+
get messageExpiryInterval(): number | undefined;
|
|
96
|
+
set messageExpiryInterval(value: number | null | undefined);
|
|
97
|
+
get topicAlias(): number | undefined;
|
|
98
|
+
set topicAlias(value: number | null | undefined);
|
|
99
|
+
get responseTopic(): string | undefined;
|
|
100
|
+
set responseTopic(value: string | null | undefined);
|
|
101
|
+
set correlationData(value: Uint8Array);
|
|
102
|
+
get contentType(): string | undefined;
|
|
103
|
+
set contentType(value: string | null | undefined);
|
|
104
|
+
}
|
|
105
|
+
export class WasmSubscribeOptions {
|
|
106
|
+
free(): void;
|
|
107
|
+
[Symbol.dispose](): void;
|
|
108
|
+
constructor();
|
|
109
|
+
qos: number;
|
|
110
|
+
noLocal: boolean;
|
|
111
|
+
retainAsPublished: boolean;
|
|
112
|
+
retainHandling: number;
|
|
113
|
+
get subscriptionIdentifier(): number | undefined;
|
|
114
|
+
set subscriptionIdentifier(value: number | null | undefined);
|
|
115
|
+
}
|
|
116
|
+
export class WasmWillMessage {
|
|
117
|
+
free(): void;
|
|
118
|
+
[Symbol.dispose](): void;
|
|
119
|
+
constructor(topic: string, payload: Uint8Array);
|
|
120
|
+
topic: string;
|
|
121
|
+
qos: number;
|
|
122
|
+
retain: boolean;
|
|
123
|
+
get willDelayInterval(): number | undefined;
|
|
124
|
+
set willDelayInterval(value: number | null | undefined);
|
|
125
|
+
get messageExpiryInterval(): number | undefined;
|
|
126
|
+
set messageExpiryInterval(value: number | null | undefined);
|
|
127
|
+
get contentType(): string | undefined;
|
|
128
|
+
set contentType(value: string | null | undefined);
|
|
129
|
+
get responseTopic(): string | undefined;
|
|
130
|
+
set responseTopic(value: string | null | undefined);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
134
|
+
|
|
135
|
+
export interface InitOutput {
|
|
136
|
+
readonly memory: WebAssembly.Memory;
|
|
137
|
+
readonly __wbg_wasmbrokerconfig_free: (a: number, b: number) => void;
|
|
138
|
+
readonly wasmbrokerconfig_new: () => number;
|
|
139
|
+
readonly wasmbrokerconfig_set_max_clients: (a: number, b: number) => void;
|
|
140
|
+
readonly wasmbrokerconfig_set_session_expiry_interval_secs: (a: number, b: number) => void;
|
|
141
|
+
readonly wasmbrokerconfig_set_max_packet_size: (a: number, b: number) => void;
|
|
142
|
+
readonly wasmbrokerconfig_set_topic_alias_maximum: (a: number, b: number) => void;
|
|
143
|
+
readonly wasmbrokerconfig_set_retain_available: (a: number, b: number) => void;
|
|
144
|
+
readonly wasmbrokerconfig_set_maximum_qos: (a: number, b: number) => void;
|
|
145
|
+
readonly wasmbrokerconfig_set_wildcard_subscription_available: (a: number, b: number) => void;
|
|
146
|
+
readonly wasmbrokerconfig_set_subscription_identifier_available: (a: number, b: number) => void;
|
|
147
|
+
readonly wasmbrokerconfig_set_shared_subscription_available: (a: number, b: number) => void;
|
|
148
|
+
readonly wasmbrokerconfig_set_server_keep_alive_secs: (a: number, b: number) => void;
|
|
149
|
+
readonly __wbg_wasmbroker_free: (a: number, b: number) => void;
|
|
150
|
+
readonly wasmbroker_new: () => [number, number, number];
|
|
151
|
+
readonly wasmbroker_with_config: (a: number) => [number, number, number];
|
|
152
|
+
readonly wasmbroker_add_user: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
153
|
+
readonly wasmbroker_add_user_with_hash: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
154
|
+
readonly wasmbroker_remove_user: (a: number, b: number, c: number) => any;
|
|
155
|
+
readonly wasmbroker_has_user: (a: number, b: number, c: number) => any;
|
|
156
|
+
readonly wasmbroker_user_count: (a: number) => any;
|
|
157
|
+
readonly wasmbroker_set_allow_anonymous: (a: number, b: number) => void;
|
|
158
|
+
readonly wasmbroker_hash_password: (a: number, b: number) => [number, number, number, number];
|
|
159
|
+
readonly wasmbroker_create_client_port: (a: number) => [number, number, number];
|
|
160
|
+
readonly __wbg_wasmmqttclient_free: (a: number, b: number) => void;
|
|
161
|
+
readonly wasmmqttclient_new: (a: number, b: number) => number;
|
|
162
|
+
readonly wasmmqttclient_connect: (a: number, b: number, c: number) => any;
|
|
163
|
+
readonly wasmmqttclient_connect_with_options: (a: number, b: number, c: number, d: number) => any;
|
|
164
|
+
readonly wasmmqttclient_connect_message_port: (a: number, b: any) => any;
|
|
165
|
+
readonly wasmmqttclient_connect_broadcast_channel: (a: number, b: number, c: number) => any;
|
|
166
|
+
readonly wasmmqttclient_publish: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
167
|
+
readonly wasmmqttclient_publish_with_options: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
168
|
+
readonly wasmmqttclient_publish_qos1: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
169
|
+
readonly wasmmqttclient_publish_qos2: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
170
|
+
readonly wasmmqttclient_subscribe: (a: number, b: number, c: number) => any;
|
|
171
|
+
readonly wasmmqttclient_subscribe_with_options: (a: number, b: number, c: number, d: any, e: number) => any;
|
|
172
|
+
readonly wasmmqttclient_subscribe_with_callback: (a: number, b: number, c: number, d: any) => any;
|
|
173
|
+
readonly wasmmqttclient_unsubscribe: (a: number, b: number, c: number) => any;
|
|
174
|
+
readonly wasmmqttclient_disconnect: (a: number) => any;
|
|
175
|
+
readonly wasmmqttclient_is_connected: (a: number) => number;
|
|
176
|
+
readonly wasmmqttclient_on_connect: (a: number, b: any) => void;
|
|
177
|
+
readonly wasmmqttclient_on_disconnect: (a: number, b: any) => void;
|
|
178
|
+
readonly wasmmqttclient_on_error: (a: number, b: any) => void;
|
|
179
|
+
readonly wasmmqttclient_on_auth_challenge: (a: number, b: any) => void;
|
|
180
|
+
readonly wasmmqttclient_respond_auth: (a: number, b: number, c: number) => any;
|
|
181
|
+
readonly __wbg_wasmconnectoptions_free: (a: number, b: number) => void;
|
|
182
|
+
readonly wasmconnectoptions_new: () => number;
|
|
183
|
+
readonly wasmconnectoptions_keepAlive: (a: number) => number;
|
|
184
|
+
readonly wasmconnectoptions_set_keepAlive: (a: number, b: number) => void;
|
|
185
|
+
readonly wasmconnectoptions_cleanStart: (a: number) => number;
|
|
186
|
+
readonly wasmconnectoptions_set_cleanStart: (a: number, b: number) => void;
|
|
187
|
+
readonly wasmconnectoptions_username: (a: number) => [number, number];
|
|
188
|
+
readonly wasmconnectoptions_set_username: (a: number, b: number, c: number) => void;
|
|
189
|
+
readonly wasmconnectoptions_set_password: (a: number, b: number, c: number) => void;
|
|
190
|
+
readonly wasmconnectoptions_set_will: (a: number, b: number) => void;
|
|
191
|
+
readonly wasmconnectoptions_clear_will: (a: number) => void;
|
|
192
|
+
readonly wasmconnectoptions_sessionExpiryInterval: (a: number) => number;
|
|
193
|
+
readonly wasmconnectoptions_receiveMaximum: (a: number) => number;
|
|
194
|
+
readonly wasmconnectoptions_set_receiveMaximum: (a: number, b: number) => void;
|
|
195
|
+
readonly wasmconnectoptions_maximumPacketSize: (a: number) => number;
|
|
196
|
+
readonly wasmconnectoptions_set_maximumPacketSize: (a: number, b: number) => void;
|
|
197
|
+
readonly wasmconnectoptions_topicAliasMaximum: (a: number) => number;
|
|
198
|
+
readonly wasmconnectoptions_set_topicAliasMaximum: (a: number, b: number) => void;
|
|
199
|
+
readonly wasmconnectoptions_requestResponseInformation: (a: number) => number;
|
|
200
|
+
readonly wasmconnectoptions_set_requestResponseInformation: (a: number, b: number) => void;
|
|
201
|
+
readonly wasmconnectoptions_requestProblemInformation: (a: number) => number;
|
|
202
|
+
readonly wasmconnectoptions_set_requestProblemInformation: (a: number, b: number) => void;
|
|
203
|
+
readonly wasmconnectoptions_authenticationMethod: (a: number) => [number, number];
|
|
204
|
+
readonly wasmconnectoptions_set_authenticationMethod: (a: number, b: number, c: number) => void;
|
|
205
|
+
readonly wasmconnectoptions_set_authenticationData: (a: number, b: number, c: number) => void;
|
|
206
|
+
readonly wasmconnectoptions_addUserProperty: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
207
|
+
readonly wasmconnectoptions_clearUserProperties: (a: number) => void;
|
|
208
|
+
readonly __wbg_wasmpublishoptions_free: (a: number, b: number) => void;
|
|
209
|
+
readonly wasmpublishoptions_new: () => number;
|
|
210
|
+
readonly wasmpublishoptions_qos: (a: number) => number;
|
|
211
|
+
readonly wasmpublishoptions_set_qos: (a: number, b: number) => void;
|
|
212
|
+
readonly wasmpublishoptions_retain: (a: number) => number;
|
|
213
|
+
readonly wasmpublishoptions_set_retain: (a: number, b: number) => void;
|
|
214
|
+
readonly wasmpublishoptions_payloadFormatIndicator: (a: number) => number;
|
|
215
|
+
readonly wasmpublishoptions_set_payloadFormatIndicator: (a: number, b: number) => void;
|
|
216
|
+
readonly wasmpublishoptions_topicAlias: (a: number) => number;
|
|
217
|
+
readonly wasmpublishoptions_set_topicAlias: (a: number, b: number) => void;
|
|
218
|
+
readonly wasmpublishoptions_responseTopic: (a: number) => [number, number];
|
|
219
|
+
readonly wasmpublishoptions_set_responseTopic: (a: number, b: number, c: number) => void;
|
|
220
|
+
readonly wasmpublishoptions_set_correlationData: (a: number, b: number, c: number) => void;
|
|
221
|
+
readonly wasmpublishoptions_contentType: (a: number) => [number, number];
|
|
222
|
+
readonly wasmpublishoptions_set_contentType: (a: number, b: number, c: number) => void;
|
|
223
|
+
readonly wasmpublishoptions_addUserProperty: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
224
|
+
readonly wasmpublishoptions_clearUserProperties: (a: number) => void;
|
|
225
|
+
readonly __wbg_wasmsubscribeoptions_free: (a: number, b: number) => void;
|
|
226
|
+
readonly wasmsubscribeoptions_new: () => number;
|
|
227
|
+
readonly wasmsubscribeoptions_qos: (a: number) => number;
|
|
228
|
+
readonly wasmsubscribeoptions_set_qos: (a: number, b: number) => void;
|
|
229
|
+
readonly wasmsubscribeoptions_noLocal: (a: number) => number;
|
|
230
|
+
readonly wasmsubscribeoptions_set_noLocal: (a: number, b: number) => void;
|
|
231
|
+
readonly wasmsubscribeoptions_retainAsPublished: (a: number) => number;
|
|
232
|
+
readonly wasmsubscribeoptions_set_retainAsPublished: (a: number, b: number) => void;
|
|
233
|
+
readonly wasmsubscribeoptions_retainHandling: (a: number) => number;
|
|
234
|
+
readonly wasmsubscribeoptions_set_retainHandling: (a: number, b: number) => void;
|
|
235
|
+
readonly __wbg_wasmwillmessage_free: (a: number, b: number) => void;
|
|
236
|
+
readonly wasmwillmessage_new: (a: number, b: number, c: number, d: number) => number;
|
|
237
|
+
readonly wasmwillmessage_topic: (a: number) => [number, number];
|
|
238
|
+
readonly wasmwillmessage_set_topic: (a: number, b: number, c: number) => void;
|
|
239
|
+
readonly wasmwillmessage_qos: (a: number) => number;
|
|
240
|
+
readonly wasmwillmessage_set_qos: (a: number, b: number) => void;
|
|
241
|
+
readonly wasmwillmessage_retain: (a: number) => number;
|
|
242
|
+
readonly wasmwillmessage_set_retain: (a: number, b: number) => void;
|
|
243
|
+
readonly wasmwillmessage_contentType: (a: number) => [number, number];
|
|
244
|
+
readonly wasmwillmessage_set_contentType: (a: number, b: number, c: number) => void;
|
|
245
|
+
readonly wasmwillmessage_responseTopic: (a: number) => [number, number];
|
|
246
|
+
readonly wasmwillmessage_set_responseTopic: (a: number, b: number, c: number) => void;
|
|
247
|
+
readonly wasmconnectoptions_set_sessionExpiryInterval: (a: number, b: number) => void;
|
|
248
|
+
readonly wasmpublishoptions_set_messageExpiryInterval: (a: number, b: number) => void;
|
|
249
|
+
readonly wasmsubscribeoptions_set_subscriptionIdentifier: (a: number, b: number) => void;
|
|
250
|
+
readonly wasmwillmessage_set_willDelayInterval: (a: number, b: number) => void;
|
|
251
|
+
readonly wasmpublishoptions_messageExpiryInterval: (a: number) => number;
|
|
252
|
+
readonly wasmsubscribeoptions_subscriptionIdentifier: (a: number) => number;
|
|
253
|
+
readonly wasmwillmessage_willDelayInterval: (a: number) => number;
|
|
254
|
+
readonly wasmwillmessage_messageExpiryInterval: (a: number) => number;
|
|
255
|
+
readonly wasmwillmessage_set_messageExpiryInterval: (a: number, b: number) => void;
|
|
256
|
+
readonly wasm_bindgen__convert__closures_____invoke__hacd56641ea4358f0: (a: number, b: number, c: any) => void;
|
|
257
|
+
readonly wasm_bindgen__closure__destroy__h2a5cb8478cd1adb0: (a: number, b: number) => void;
|
|
258
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2d3fbbff27fe5544: (a: number, b: number, c: any) => void;
|
|
259
|
+
readonly wasm_bindgen__closure__destroy__h07c691622f9242a9: (a: number, b: number) => void;
|
|
260
|
+
readonly wasm_bindgen__convert__closures_____invoke__h4c33ce4d986075ed: (a: number, b: number) => void;
|
|
261
|
+
readonly wasm_bindgen__closure__destroy__he3a6d52737a61d69: (a: number, b: number) => void;
|
|
262
|
+
readonly wasm_bindgen__convert__closures_____invoke__hbbb6f9316512cb4e: (a: number, b: number, c: any, d: any) => void;
|
|
263
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
264
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
265
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
266
|
+
readonly __externref_table_alloc: () => number;
|
|
267
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
268
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
269
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
270
|
+
readonly __wbindgen_start: () => void;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
274
|
+
/**
|
|
275
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
276
|
+
* a precompiled `WebAssembly.Module`.
|
|
277
|
+
*
|
|
278
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
279
|
+
*
|
|
280
|
+
* @returns {InitOutput}
|
|
281
|
+
*/
|
|
282
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
286
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
287
|
+
*
|
|
288
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
289
|
+
*
|
|
290
|
+
* @returns {Promise<InitOutput>}
|
|
291
|
+
*/
|
|
292
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|