UNPKG

agora-edu-core

Version:

Core APIs for building an online classroom

89 lines (87 loc) 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EduClassroomStore = void 0; var _api = require("../../../services/api"); var _cloudDrive = require("./cloud-drive"); var _connection = require("./connection"); var _room = require("./room"); var _statistics = require("./statistics"); var _stream = require("./stream"); var _user = require("./user"); var _message = require("./message"); var _media = require("./media"); var _handUp = require("./hand-up"); var _recording = require("./recording"); var _group = require("./group"); var _base = require("./base"); var _report = require("./report"); var _logReporter = require("../../../log-reporter"); var _eventCenter = require("../../../event-center"); var _widget = require("./widget"); class EduClassroomStore { constructor() { this._api = new _api.EduApiService(); this.connectionStore = new _connection.ConnectionStore(this); this.widgetStore = new _widget.WidgetStore(this); this.cloudDriveStore = new _cloudDrive.CloudDriveStore(this); this.userStore = new _user.UserStore(this); this.messageStore = new _message.MessagesStore(this); this.mediaStore = new _media.MediaStore(this); this.roomStore = new _room.RoomStore(this); this.statisticsStore = new _statistics.StatisticsStore(this); this.streamStore = new _stream.StreamStore(this); this.handUpStore = new _handUp.HandUpStore(this); this.recordingStore = new _recording.RecordingStore(this); this.groupStore = new _group.GroupStore(this); this.logReporter = new _logReporter.LogReporter(this); this.reportStore = new _report.ReportStore(this); } get api() { return this._api; } /** * 初始化所有Store * **/ /** @en * Initializes all the stores */ initialize() { this.logReporter.enableLogReport(); Object.getOwnPropertyNames(this).forEach(propertyName => { if (propertyName.endsWith('Store')) { const store = this[propertyName]; if (store instanceof _base.EduStoreBase) { store.onInstall(); } } }); this.connectionStore.initialize(); } /** * 销毁所有Store * @param connectionType * @returns * **/ /** @en * Destroys all the stores * @param connectionType * @returns */ destroy() { this.logReporter.disableLogReport(); Object.getOwnPropertyNames(this).forEach(propertyName => { if (propertyName.endsWith('Store')) { const store = this[propertyName]; if (store instanceof _base.EduStoreBase) { store.onDestroy(); } } }); _eventCenter.EduEventCenter.shared.cleanup(); } } exports.EduClassroomStore = EduClassroomStore;