@microsoft/botbuilder-m365
Version:
M365 extensions for Microsoft BotBuilder, Alpha release.
43 lines • 1.11 kB
JavaScript
"use strict";
/**
* @module botbuilder-m365
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TurnStateEntry = void 0;
class TurnStateEntry {
constructor(value, storageKey) {
this._deleted = false;
this._value = value || {};
this._storageKey = storageKey;
this._hash = JSON.stringify(this._value);
}
get hasChanged() {
return JSON.stringify(this._value) != this._hash;
}
get isDeleted() {
return this._deleted;
}
get value() {
if (this.isDeleted) {
// Switch to a replace scenario
this._value = {};
this._deleted = false;
}
return this._value;
}
get storageKey() {
return this._storageKey;
}
delete() {
this._deleted = true;
}
replace(state) {
this._value = state || {};
}
}
exports.TurnStateEntry = TurnStateEntry;
//# sourceMappingURL=TurnState.js.map