Files
NapCatQQ/.pnpm-store/v3/files/37/8b093f8dc6f934b6b54dc45e210be4b29f7791e07aa5796e69a29de79081edd246880753741b181bbc36325f018b3134df08134aca40588bbd91c4c06290bb
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

29 lines
1.3 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SnapshotManager = void 0;
const InversifyContainerError_1 = require("../../error/models/InversifyContainerError");
const InversifyContainerErrorKind_1 = require("../../error/models/InversifyContainerErrorKind");
class SnapshotManager {
#serviceReferenceManager;
#snapshots;
constructor(serviceReferenceManager) {
this.#serviceReferenceManager = serviceReferenceManager;
this.#snapshots = [];
}
restore() {
const snapshot = this.#snapshots.pop();
if (snapshot === undefined) {
throw new InversifyContainerError_1.InversifyContainerError(InversifyContainerErrorKind_1.InversifyContainerErrorKind.invalidOperation, 'No snapshot available to restore');
}
this.#serviceReferenceManager.reset(snapshot.activationService, snapshot.bindingService, snapshot.deactivationService);
}
snapshot() {
this.#snapshots.push({
activationService: this.#serviceReferenceManager.activationService.clone(),
bindingService: this.#serviceReferenceManager.bindingService.clone(),
deactivationService: this.#serviceReferenceManager.deactivationService.clone(),
});
}
}
exports.SnapshotManager = SnapshotManager;
//# sourceMappingURL=SnapshotManager.js.map