Files
NapCatQQ/.pnpm-store/v3/files/73/2decd1da69ba9b26951b7b5bebb44729105fcbd37c7fa9e19c6e9aee6ad3c237aa7c977c6306ba0bdbe85a26311fc8cf35095ef7176ec3b62ff1b93fa59adb
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

35 lines
826 B
Plaintext

'use strict';
function ready(flagOrFunction) {
this._ready = !!this._ready;
this._readyCallbacks = this._readyCallbacks || [];
if (arguments.length === 0) {
// return a promise
// support `this.ready().then(onready);` and `yield this.ready()`;
return new Promise(function (resolve) {
if (this._ready) {
return resolve();
}
this._readyCallbacks.push(resolve);
}.bind(this));
} else if (typeof flagOrFunction === 'function') {
this._readyCallbacks.push(flagOrFunction);
} else {
this._ready = !!flagOrFunction;
}
if (this._ready) {
this._readyCallbacks.splice(0, Infinity).forEach(function(callback) {
process.nextTick(callback);
});
}
}
function mixin(object) {
object.ready = ready;
}
module.exports = mixin;
module.exports.mixin = mixin;