UNPKG

@genexus/web-standard-functions

Version:

GeneXus JavaScript standard functions library for web generators

20 lines 805 B
import { publish, subscribe, cancelSubscription } from "../pubSub/pubSub"; import { stdToGeneratorPublishedMessage as prefix } from "./helpers"; import { GxGuid } from "../types/gxguid"; export async function publishCall(fnName, options, resolver, ...params) { return new Promise(resolve => { let guid = GxGuid.newGuid().toString(); let suscriptions = options.map(opt => { let s = subscribe(`${prefix}_${fnName}_${guid}_${opt}`, (result) => { unsubscribe(); resolver(opt, result, resolve); }); return s; }); let unsubscribe = () => { suscriptions.map(cancelSubscription); }; publish(`${prefix}_${fnName}`, guid, ...params); }); } //# sourceMappingURL=publishCall.js.map