12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /*
- * @Author: Rindy
- * @Date: 2020-03-06 15:49:01
- * @LastEditors: Rindy
- * @LastEditTime: 2020-04-03 12:02:39
- * @Description: 启动器
- */
- class Detector {
- constructor() {
- this._resolve = null
- }
- register(callback) {
- this._promise = callback(this)
- }
- listener() {
- if (!this._promise) {
- return Promise.resolve()
- }
- return this._promise
- }
- valid() {
- this._resolve && this._resolve()
- }
- resolve(resolve) {
- this._resolve = resolve
- }
- }
- /**
- * 是否上线检测器
- */
- export const OnlineDetector = new Detector()
- /**
- * 登录检测器
- */
- export const LoginDetector = new Detector()
- /**
- * 场景是否生成检测器
- */
- export const ListDetector = new Detector()
|