@zlepper/rpc
Advanced tools
Comparing version 0.0.9 to 0.0.10
import { WorkerClientConnection } from './worker-client-connection.js'; | ||
import { IEventDispatcher, InferEvent, NormalizedEventTarget } from "../shared/normalized-event-target"; | ||
import { IEventDispatcher, InferEvent, NormalizedEventTarget } from '../shared/normalized-event-target'; | ||
export type AsyncProperty<T> = T extends (...args: infer TArgs) => infer TResult ? (...args: TArgs) => TResult extends Promise<any> ? TResult : Promise<TResult> : Promise<T>; | ||
@@ -4,0 +4,0 @@ export type WrappedObject<T> = T extends IEventDispatcher<infer TEvent> ? { |
@@ -6,6 +6,14 @@ export interface AddEventListenerOptions { | ||
removeEventListener<K extends keyof TEvent>(type: K, listener?: (data: TEvent[K]) => void): void; | ||
/** | ||
* @private | ||
*/ | ||
___typescriptInferenceHack: TEvent; | ||
} | ||
export interface IEventDispatcher<TEvent extends object> { | ||
dispatchEvent<K extends keyof TEvent>(type: K, data: TEvent[K]): void; | ||
/** | ||
* @private | ||
*/ | ||
___typescriptInferenceHack: TEvent; | ||
} | ||
export type InferEvent<T> = T extends IEventDispatcher<infer TEvent> ? TEvent : never; |
@@ -10,4 +10,8 @@ import { WorkerServerConnection } from "./worker-server-connection.js"; | ||
export declare abstract class EventDispatcher<TEvent extends object> implements IEventDispatcher<TEvent> { | ||
/** | ||
* @private | ||
*/ | ||
___typescriptInferenceHack: TEvent; | ||
dispatchEvent<K extends keyof TEvent>(type: K, data: TEvent[K]): void; | ||
} | ||
export {}; |
@@ -81,2 +81,6 @@ // @ts-ignore | ||
/** | ||
* @private | ||
*/ | ||
___typescriptInferenceHack = null; | ||
/** | ||
* @internal | ||
@@ -83,0 +87,0 @@ */ |
{ | ||
"name": "@zlepper/rpc", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Allows RPC from the main thread to a background worker thread (Of any kind), using ES6 classes.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24927
423