let loaded = false;
let funs = [];
function init(){
loaded = true;
funs.map(({fun,params})=>{
fun(params)
});
}
function makePoints(list){
if(loaded === false) return funs.push({fun:makePoints,params:list});
}
function makeLines(list){
if(loaded === false) return funs.push({fun:makeLines,params:list});
}
function makeCircles(list){
if(loaded === false) return funs.push({fun:makeCircles,params:list});
}
执行 makePoints,makeLines,makeCircles 函数,给funs添加队列,
调用 init函数,执行队列funs。