0.0.6 • Published 8 months ago
@kevisual/load v0.0.6
load fn
主要作用为加载模块,并时刻监测,当检测到已经加载,执行某一个功能。主要的检测是通过hasLoaded
import { BaseLoad } from '@kevisual/load';
const load = new BaseLoad();
load
.load(
async () => {
return {
a: 1,
b: 2,
};
},
{ key: 'test' },
)
.then((res) => {
console.log('test-load:', res);
});
console.log('test-loading:', load.loading);
load.hasLoaded('test', { isExist: true }).then((res) => {
console.log('test-load:has load', res);
});