js:add notification plugin
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
export * from 'reflect-metadata'
|
||||
|
||||
export type BridgeContext = { [index: string]: { [index: string]: (args?: any) => Promise<any> } }
|
||||
export type BridgeContext = {
|
||||
[index: string]: { [index: string]: (args?: any) => Promise<any> }
|
||||
}
|
||||
|
||||
declare global {
|
||||
const context: BridgeContext
|
||||
|
@@ -173,6 +173,18 @@ export class Context {
|
||||
register(instance: Object) {
|
||||
this.entity = instance
|
||||
}
|
||||
|
||||
function2Id(func: Function) {
|
||||
const functionId = uniqueId('function')
|
||||
this.callbacks.set(functionId, {
|
||||
resolve: func,
|
||||
reject: () => { loge("This should not be called") }
|
||||
})
|
||||
return functionId
|
||||
}
|
||||
removeFuncById(funcId: string) {
|
||||
this.callbacks.delete(funcId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user