botbuilder-dialogs
Version:
A dialog stack based conversation manager for Microsoft BotBuilder.
69 lines • 2.51 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryScope = void 0;
/**
* Abstract base class for all memory scopes.
*/
class MemoryScope {
/**
* Initializes a new instance of the [MemoryScope](xref:botbuilder-dialogs.MemoryScope) class.
*
* @param name Name of the scope.
* @param includeInSnapshot Boolean value indicating whether this memory
* should be included in snapshot. Default value is true.
*/
constructor(name, includeInSnapshot = true) {
this.includeInSnapshot = includeInSnapshot;
this.name = name;
}
/**
* Changes the backing object for the memory scope.
*
* @param _dc Current dialog context
* @param _memory memory to assign
*/
setMemory(_dc, _memory) {
throw new Error(`MemoryScope.setMemory: The '${this.name}' memory scope is read-only.`);
}
/**
* Loads a scopes backing memory at the start of a turn.
*
* @param _dc Current dialog context.
*/
load(_dc) {
return __awaiter(this, void 0, void 0, function* () {
// No initialization by default.
});
}
/**
* Saves a scopes backing memory at the end of a turn.
*
* @param _dc Current dialog context.
*/
saveChanges(_dc) {
return __awaiter(this, void 0, void 0, function* () {
// No initialization by default.
});
}
/**
* Deletes the backing memory for a scope.
*
* @param _dc Current dialog context.
*/
delete(_dc) {
return __awaiter(this, void 0, void 0, function* () {
throw new Error(`MemoryScope.delete: The '${this.name}' memory scope can't be deleted.`);
});
}
}
exports.MemoryScope = MemoryScope;
//# sourceMappingURL=memoryScope.js.map
;