taking care of connection during creation
This commit is contained in:
parent
46da72ab64
commit
e93e50c43c
@ -124,6 +124,8 @@ const main = async function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await dispatcher.ready.waitFor(value => value);
|
||||||
|
|
||||||
const sleep = promisify(setTimeout);
|
const sleep = promisify(setTimeout);
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
|
|
||||||
|
@ -26,12 +26,19 @@ export function getLinkedDispatcher(options: INopeRpcDispatcherOptions) {
|
|||||||
|
|
||||||
const dispatcher = getDispatcher(options);
|
const dispatcher = getDispatcher(options);
|
||||||
|
|
||||||
// Iterate over the Functions
|
// If the Dispatcher has been connected, register all functions.
|
||||||
for (const [uri, settings] of container.instance.entries()) {
|
dispatcher.ready.waitFor(value => value).then(() => {
|
||||||
dispatcher.registerFunction(settings.callback, {
|
if (dispatcher.ready.getContent()){
|
||||||
id: uri
|
// Iterate over the Functions
|
||||||
});
|
for (const [uri, settings] of container.instance.entries()) {
|
||||||
}
|
dispatcher.registerFunction(settings.callback, {
|
||||||
|
id: uri
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Failed')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return dispatcher;
|
return dispatcher;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ export type IValidPromise<T> = Promise<T> | INopePromise<T>;
|
|||||||
* @interface INopeDispatcher
|
* @interface INopeDispatcher
|
||||||
*/
|
*/
|
||||||
export interface INopeDispatcher {
|
export interface INopeDispatcher {
|
||||||
|
|
||||||
|
readonly ready: INopeObservable<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the Dispatcher
|
* ID of the Dispatcher
|
||||||
|
Loading…
Reference in New Issue
Block a user