28 lines
No EOL
1,011 B
JavaScript
28 lines
No EOL
1,011 B
JavaScript
"use strict";
|
|
/**
|
|
* @module botbuilder
|
|
*/
|
|
/**
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License.
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.useBotState = void 0;
|
|
const registerClassMiddleware_1 = require("./registerClassMiddleware");
|
|
/**
|
|
* Adds middleware to the adapter to register one or more BotState objects on the turn context.
|
|
* The middleware registers the state objects on the turn context at the start of each turn.
|
|
*
|
|
* @param botAdapter The adapter on which to register the state objects.
|
|
* @param botStates The state objects to register.
|
|
* @returns The updated adapter.
|
|
*/
|
|
function useBotState(botAdapter, ...botStates) {
|
|
for (const botState of botStates) {
|
|
const key = botState.constructor.name;
|
|
botAdapter.use(new registerClassMiddleware_1.RegisterClassMiddleware(botState, key));
|
|
}
|
|
return botAdapter;
|
|
}
|
|
exports.useBotState = useBotState;
|
|
//# sourceMappingURL=adapterExtensions.js.map
|