-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
70 lines (58 loc) · 3.03 KB
/
index.d.ts
File metadata and controls
70 lines (58 loc) · 3.03 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* auto-generated by NAPI-RS */
/* eslint-disable */
/**
* Demonstrates weak references that don't keep the process alive
* Creates a background logger that won't prevent process termination
*/
export declare function backgroundLogger(callback: (arg: string) => void): void
/**
* Demonstrates passing multiple arguments to a callback using FnArgs
* Calculates salary components and passes them to the callback
*/
export declare function calculateSalary(baseAmount: number, callback: (arg0: number, arg1: number, arg2: string) => number): number
/**
* Demonstrates custom error handling in ThreadsafeFunction
* Simulates a file download with progress updates and potential failure
*/
export declare function downloadFileWithProgress(url: string, callback: ((err: Error | null, arg: number) => void)): void
/**
* Demonstrates async/await with ThreadsafeFunction returning a Promise
* Fetches user profile data asynchronously
*/
export declare function fetchUserProfile(userId: number, callback: ((err: Error | null, arg: string) => Promise<string>)): Promise<string>
/**
* Demonstrates calling JavaScript from a background thread
* Simulates monitoring system resources with periodic callbacks
*/
export declare function monitorSystemResources(callback: ((err: Error | null, arg: number) => any)): void
/** Test function with optional callback */
export declare function optionalCallbackTest(value: string, callback?: (arg: string) => void | undefined | null): string
/**
* Demonstrates the difference between Blocking and NonBlocking call modes
* Processes events with different priorities
*/
export declare function processEvents(highPriority: ((err: Error | null, arg: string) => any), lowPriority: ((err: Error | null, arg: string) => any)): void
/**
* Demonstrates basic synchronous callback usage
* Takes a username and a callback that processes the uppercase version
*/
export declare function processUserData(username: string, callback: (arg: string) => string): string
/** Demonstrates processing return values from threadsafe function callbacks */
export declare function processWithFeedback(items: Array<string>, processor: ((err: Error | null, arg: string) => string)): void
/**
* Demonstrates using function references to call JS functions later
* Schedules a notification callback after a delay
*/
export declare function scheduleNotification(delayMs: number, callback: (arg: string) => void): Promise<void>
/** Simple sync function for testing */
export declare function simpleCallbackTest(value: number, callback: (arg: number) => number): number
/**
* Demonstrates converting a Function to ThreadsafeFunction
* Simulates a file watcher that reports file changes
*/
export declare function startFileWatcher(callback: (arg0: string, arg1: number) => void): void
/**
* A more complex example simulating a real-time data stream
* with multiple callback types and error handling
*/
export declare function streamSensorData(dataCallback: ((err: Error | null, arg0: string, arg1: number, arg2: number) => any), errorCallback: (arg: string) => void): void