refactor: declare KeyWeakMap<K, V> returned by createIDWeakMap() / createDoubleIDWeakMap() (#21171)

This commit is contained in:
Milan Burda 2019-11-21 13:32:31 +01:00 committed by Alexey Kuzmin
parent 92ff39c168
commit 3f2cb91a35
4 changed files with 15 additions and 7 deletions

View file

@ -29,7 +29,8 @@ declare namespace NodeJS {
setHiddenValue<T>(obj: any, key: string, value: T): void;
deleteHiddenValue(obj: any, key: string): void;
requestGarbageCollectionForTesting(): void;
createDoubleIDWeakMap(): any;
createIDWeakMap<V>(): ElectronInternal.KeyWeakMap<number, V>;
createDoubleIDWeakMap<V>(): ElectronInternal.KeyWeakMap<[string, number], V>;
setRemoteCallbackFreer(fn: Function, frameId: number, contextId: String, id: number, sender: any): void
}

View file

@ -112,6 +112,13 @@ declare namespace ElectronInternal {
appIcon: string | null;
}
interface KeyWeakMap<K, V> {
set(key: K, value: V): void;
get(key: K): V | undefined;
has(key: K): boolean;
remove(key: K): void;
}
// Internal IPC has _replyInternal and NO reply method
interface IpcMainInternalEvent extends Omit<Electron.IpcMainEvent, 'reply'> {
_replyInternal(...args: any[]): void;