import QJKanKan from '@/sdk/QJKanKan'
let _app
let _num
let deferred = QJKanKan.Deferred()
import { debuggerHelper } from './utils/debuggerHelper'

debuggerHelper(true);

export function createApp(opitons = {}) {
    if (_app) {
        return
    }
    _app = new QJKanKan(opitons)
    deferred.resolve(_app)
    window.__sdk = _app
    return _app
}

export function useApp() {
    if (_app) {
        return Promise.resolve(_app)
    }
    return deferred
}

export function getApp() {
    return _app
}

export function getNum() {
    return _num
}
