/*
 * @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 LoginDetector = new Detector()
