"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var async_event_emitter_1 = __importDefault(require("@xmader/async-event-emitter"));
var fs_1 = __importDefault(require("./fs"));
var os_browserify_1 = __importDefault(require("os-browserify"));
var path_browserify_1 = __importDefault(require("path-browserify"));
var PluginsCore = /** @class */ (function (_super) {
    __extends(PluginsCore, _super);
    function PluginsCore() {
        var _this = _super.call(this) || this;
        _this.fs = fs_1.default;
        _this.path = path_browserify_1.default;
        _this.os = os_browserify_1.default;
        _this.extra = {};
        return _this;
    }
    PluginsCore.prototype.registerPlugin = function (plugin) {
        var _this = this;
        window.addEventListener("beforeunload", function () {
            if (plugin.deactivate && typeof plugin.deactivate == "function") {
                plugin.deactivate(_this);
            }
        });
        plugin.activate(this);
    };
    return PluginsCore;
}(async_event_emitter_1.default));
exports.PluginsCore = PluginsCore;
exports.PluginsHelper = new PluginsCore();
exports.default = exports.PluginsHelper;
