UNPKG

@genexus/web-standard-functions

Version:

GeneXus JavaScript standard functions library for web generators

39 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.subscribe = subscribe; exports.unSubscribe = unSubscribe; exports.unSubscribeAll = unSubscribeAll; exports.publish = publish; const pubSub_1 = require("../pubSub/pubSub"); /** * Subscribe to topic name. Automatically gets notified when someone publish to the topic name. * @param topicName The topic name to be subscribed. * @param handler The function to be called when someone publish to the topic name. * @return Returns Subscription object */ function subscribe(name, handler) { return (0, pubSub_1.subscribe)(name, handler); } /** * Cancel a specific subscription. * @param suscription The suscription object */ function unSubscribe(suscription) { (0, pubSub_1.cancelSubscription)(suscription); } /** * Cancel all subscriptions */ function unSubscribeAll() { (0, pubSub_1.cancelAllSubscriptions)(); } /** * Asynchronously publishes the message, passing the data to it's subscribers * @param topicName The topic name to publish the data * @param data The data to pass to subscribers * @return Returns true if there are subscribers to the topic */ function publish(topicName, ...data) { return pubSub_1.publish.apply(this, [topicName].concat(data)); } //# sourceMappingURL=globalEvents.js.map