Skip to content

Commit

Permalink
Properly deprecate BaseTexture v4 members and methods (#5556)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtimebuddy committed Apr 2, 2019
1 parent 849b7cb commit 15c4ec3
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions bundles/pixi.js/src/useDeprecated.js
Expand Up @@ -603,6 +603,56 @@ export default function useDeprecated()

const { BaseTexture } = PIXI;

/**
* @method loadSource
* @memberof PIXI.BaseTexture#
* @deprecated since 5.0.0
*/
BaseTexture.prototype.loadSource = function loadSource(image)
{
deprecation(v5, 'PIXI.BaseTexture#loadSource has been deprecated');

const resource = PIXI.resources.autoDetectResource(image);

resource.internal = true;

this.setResource(resource);
this.update();
};

Object.defineProperties(BaseTexture.prototype, {
/**
* @name PIXI.BaseTexture#hasLoaded
* @type {boolean}
* @deprecated since 5.0.0
* @readonly
* @see PIXI.BaseTexture#valid
*/
hasLoaded: {
get()
{
deprecation(v5, 'PIXI.BaseTexture#hasLoaded has been removed, used valid.');

return this.valid;
},
},
/**
* @name PIXI.BaseTexture#imageUrl
* @type {string}
* @deprecated since 5.0.0
* @readonly
* @see PIXI.resource.ImageResource#url
*/
imageUrl: {
get()
{
deprecation(v5, 'PIXI.BaseTexture#imageUrl has been removed, used resource.url.');

return this.resource && this.resource.url;
},
},
});

/**
* @method fromImage
* @static
Expand Down

0 comments on commit 15c4ec3

Please sign in to comment.