web-background 1.0.0 → 1.0.1
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
CHANGED
|
@@ -13,6 +13,11 @@ Most WebAPIs including DOM APIs are cannot be used.
|
|
|
13
13
|
DOM API를 포함한 대부분의 WebAPI를 사용하지 못합니다.
|
|
14
14
|
[Read More](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)
|
|
15
15
|
|
|
16
|
+
To send arguments, you must use data from structured clone algorithm types.
|
|
17
|
+
인자로 전송 가능한 데이터 유형은 복사 가능한 타입의 데이터만 가능합니다.
|
|
18
|
+
[Read More](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)
|
|
19
|
+
|
|
20
|
+
|
|
16
21
|
## Example
|
|
17
22
|
|
|
18
23
|
**background**
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
type _ClonableType = Exclude<PrimityType, symbol> | Record<string | number, Exclude<any, Function>> | Array<any> | ArrayBuffer | Map<any, any> | Set<any> | Date | Blob | File | FileList | RegExp;
|
|
3
|
-
export type ClonableType = Exclude<_ClonableType, Function>;
|
|
4
|
-
export interface TypedMessageEvent<Data> extends MessageEvent {
|
|
1
|
+
export interface TypedMessageEvent<Data = any> extends MessageEvent {
|
|
5
2
|
data: Data;
|
|
6
3
|
}
|
|
7
|
-
export declare class TypedWorker<Payload
|
|
4
|
+
export declare class TypedWorker<Payload, Response> extends Worker {
|
|
8
5
|
postMessage<T = Payload>(payload: T): void;
|
|
9
6
|
addEventListener<R = Response>(type: 'message' | 'error' | 'messageerror', observer: (this: Worker, event: TypedMessageEvent<R>) => void): void;
|
|
10
7
|
}
|
|
11
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class UtilWorker<Payload
|
|
1
|
+
import { TypedWorker } from "./TypedWorker";
|
|
2
|
+
export declare class UtilWorker<Payload = never, Result = void> extends TypedWorker<Payload, Result> {
|
|
3
3
|
constructor(scriptURL: string | URL, options?: WorkerOptions);
|
|
4
4
|
request(payload: Payload): Promise<Result>;
|
|
5
5
|
}
|