-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgofmt_web.d.ts
More file actions
49 lines (44 loc) · 1.26 KB
/
gofmt_web.d.ts
File metadata and controls
49 lines (44 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* A wasm based golang formatter
*
* @example
* ```ts
* ```javascript
* import init, { format } from "@wasm-fmt/gofmt";
*
* await init();
*
* const source = `
* package main
* import "fmt"
* func main(){fmt.Println("Hello, 世界")
* }
* `;
*
* const formatted = format(source);
* ```
*
* @module
*/
/**
* Input types for asynchronous WASM initialization.
* Can be a URL/path to fetch, a Response object, raw bytes, or a pre-compiled WebAssembly.Module.
*/
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
/**
* Input types for synchronous WASM initialization.
* Must be raw bytes (BufferSource) or a pre-compiled WebAssembly.Module.
*/
export type SyncInitInput = BufferSource | WebAssembly.Module;
import type * as InitOutput from "./gofmt.wasm";
/**
* Initializes the WASM module asynchronously.
* @param init_input - Optional URL/path to the WASM file, or any valid InitInput
*/
export default function initAsync(init_input?: InitInput): Promise<InitOutput>;
/**
* Initializes the WASM module synchronously.
* @param buffer_or_module - The WASM module or buffer source
*/
export declare function initSync(buffer_or_module: BufferSource | WebAssembly.Module): InitOutput;
export * from "./gofmt.d.ts";