botbuilder-azure
Version:
Azure extensions for Microsoft BotBuilder.
33 lines • 750 B
JavaScript
/**
* @module botbuilder-azure
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DoOnce = void 0;
/**
* Task to perform only one time.
*/
class DoOnce {
constructor() {
this.task = {};
}
/**
* Wait for the task to be executed.
*
* @param key Key of the task.
* @param fn Function to perform.
* @returns A promise representing the asynchronous operation.
*/
waitFor(key, fn) {
if (!this.task[key]) {
this.task[key] = fn();
}
return this.task[key];
}
}
exports.DoOnce = DoOnce;
//# sourceMappingURL=doOnce.js.map
;