Typescript 把带参数的函数当做参数的写法

    loadAsset(path:string, type:typeof cc.Asset, callback:(asset:typeof cc.Asset)=>void){
        cc.loader.loadRes(path, type, (e, res)=>{
            if(e){
                console.log(e);
                return;
            }
            callback(res);
        })
    }

其中callback就是个带有参数的形参

猜你喜欢

转载自blog.csdn.net/Continue__/article/details/88327293