mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
added Common.deprecated
This commit is contained in:
parent
6957dbff63
commit
ffa31937f0
1 changed files with 15 additions and 0 deletions
|
@ -373,6 +373,21 @@ module.exports = Common;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a deprecated console warning when the function on the given object is called.
|
||||||
|
* The target function will be replaced with a new function that first shows the warning
|
||||||
|
* and then calls the original function.
|
||||||
|
* @method deprecated
|
||||||
|
* @param {object} obj The object or module
|
||||||
|
* @param {string} name The property name of the function on obj
|
||||||
|
* @param {string} warning The one-time message to show if the function is called
|
||||||
|
*/
|
||||||
|
Common.deprecated = function(obj, prop, warning) {
|
||||||
|
obj[prop] = Common.chain(function() {
|
||||||
|
Common.warnOnce('🔅 deprecated 🔅', warning);
|
||||||
|
}, obj[prop]);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next unique sequential ID.
|
* Returns the next unique sequential ID.
|
||||||
* @method nextId
|
* @method nextId
|
||||||
|
|
Loading…
Reference in a new issue