mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-28 04:28:04 +00:00
38 lines
855 B
JavaScript
38 lines
855 B
JavaScript
cc.loader.downloader.loadSubpackage = function (name, completeCallback) {
|
|
wx.loadSubpackage({
|
|
name: name,
|
|
success: function () {
|
|
if (completeCallback) completeCallback();
|
|
},
|
|
fail: function () {
|
|
if (completeCallback) completeCallback(new Error(`Failed to load subpackage ${name}`));
|
|
}
|
|
})
|
|
};
|
|
|
|
function downloadScript (item, callback, isAsync) {
|
|
var url = '../../' + item.url;
|
|
require(url);
|
|
callback(null, item.url);
|
|
}
|
|
|
|
function loadFont (item) {
|
|
var url = item.url;
|
|
var fontFamily = wx.loadFont(url);
|
|
return fontFamily || 'Arial';
|
|
}
|
|
|
|
cc.loader.downloader.addHandlers({
|
|
js : downloadScript
|
|
});
|
|
|
|
cc.loader.loader.addHandlers({
|
|
// Font
|
|
font: loadFont,
|
|
eot: loadFont,
|
|
ttf: loadFont,
|
|
woff: loadFont,
|
|
svg: loadFont,
|
|
ttc: loadFont,
|
|
});
|