starling-framework
Version:
A fast, productive library for 2D cross-platform development.
116 lines (98 loc) • 3.02 kB
JavaScript
// Class: starling.assets.AssetFactoryHelper
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../hxClasses_stub").default;
var $hxEnums = require("./../../hxEnums_stub").default;
var $import = require("./../../import_stub").default;
function starling_utils_SystemUtil() {return require("./../../starling/utils/SystemUtil");}
function starling_utils_Execute() {return require("./../../starling/utils/Execute");}
// Constructor
var AssetFactoryHelper = function() {
}
// Meta
AssetFactoryHelper.__name__ = "starling.assets.AssetFactoryHelper";
AssetFactoryHelper.__isInterface__ = false;
AssetFactoryHelper.prototype = {
getNameFromUrl: function(url) {
if(this._getNameFromUrlFunc != null) {
return this._getNameFromUrlFunc(url);
} else {
return "";
}
},
getExtensionFromUrl: function(url) {
if(this._getExtensionFromUrlFunc != null) {
return this._getExtensionFromUrlFunc(url);
} else {
return "";
}
},
loadDataFromUrl: function(url,onComplete,onError) {
if(this._dataLoader != null) {
this._dataLoader.load(url,onComplete,onError);
}
},
addPostProcessor: function(processor,priority) {
if(priority == null) {
priority = 0;
}
if(this._addPostProcessorFunc != null) {
this._addPostProcessorFunc(processor,priority);
}
},
onBeginRestore: function() {
if(this._onRestoreFunc != null) {
this._onRestoreFunc(false);
}
},
onEndRestore: function() {
if(this._onRestoreFunc != null) {
this._onRestoreFunc(true);
}
},
log: function(message) {
if(this._logFunc != null) {
this._logFunc(message);
}
},
addComplementaryAsset: function(name,asset,type) {
if(this._addAssetFunc != null) {
this._addAssetFunc(name,asset,type);
}
},
executeWhenContextReady: function(call,args) {
if((starling_utils_SystemUtil().default).get_isDesktop()) {
(starling_utils_Execute().default).execute(call,args);
} else {
(starling_utils_SystemUtil().default).executeWhenApplicationIsActive(call,args);
}
},
set_getNameFromUrlFunc: function(value) {
return this._getNameFromUrlFunc = value;
},
set_getExtensionFromUrlFunc: function(value) {
return this._getExtensionFromUrlFunc = value;
},
set_dataLoader: function(value) {
return this._dataLoader = value;
},
set_logFunc: function(value) {
return this._logFunc = value;
},
set_addAssetFunc: function(value) {
return this._addAssetFunc = value;
},
set_onRestoreFunc: function(value) {
return this._onRestoreFunc = value;
},
set_addPostProcessorFunc: function(value) {
return this._addPostProcessorFunc = value;
}
};
AssetFactoryHelper.prototype.__class__ = AssetFactoryHelper.prototype.constructor = $hxClasses["starling.assets.AssetFactoryHelper"] = AssetFactoryHelper;
// Init
// Statics
// Export
exports.default = AssetFactoryHelper;