From ffd4f0b77ecf8def4ed4a9a2ccb85c972088d376 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Thu, 17 Nov 2016 13:46:35 +0800 Subject: [PATCH] add type for loader.getRes and loader.releaseRes --- cocos2d/core/load-pipeline/CCLoader.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cocos2d/core/load-pipeline/CCLoader.js b/cocos2d/core/load-pipeline/CCLoader.js index 6606914ea3..e4f716541b 100644 --- a/cocos2d/core/load-pipeline/CCLoader.js +++ b/cocos2d/core/load-pipeline/CCLoader.js @@ -427,15 +427,16 @@ JS.mixin(CCLoader.prototype, { * * @method getRes * @param {String} url + * @param {Function} [type] - Only asset of type will be returned if this argument is supplied. * @returns {*} */ - getRes: function (url) { + getRes: function (url, type) { var item = this._cache[url]; if (item && item.alias) { item = this._cache[item.alias]; } if (!item) { - var uuid = this._getResUuid(url); + var uuid = this._getResUuid(url, type); item = this._cache[uuid]; } return item ? item.content : null; @@ -581,9 +582,10 @@ JS.mixin(CCLoader.prototype, { * * @method releaseRes * @param {String} url + * @param {Function} [type] - Only asset of type will be released if this argument is supplied. */ - releaseRes: function (url) { - var uuid = this._getResUuid(url); + releaseRes: function (url, type) { + var uuid = this._getResUuid(url, type); if (uuid) { this.release(uuid); }