All files / engine/Source/Core deprecationWarning.js

100% Statements 3/3
100% Branches 4/4
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54                                                                                          13x 2x       11x      
import defined from "./defined.js";
import DeveloperError from "./DeveloperError.js";
import oneTimeWarning from "./oneTimeWarning.js";
 
/**
 * Logs a deprecation message to the console.  Use this function instead of
 * <code>console.log</code> directly since this does not log duplicate messages
 * unless it is called from multiple workers.
 *
 * @function deprecationWarning
 *
 * @param {string} identifier The unique identifier for this deprecated API.
 * @param {string} message The message to log to the console.
 *
 * @example
 * // Deprecated function or class
 * function Foo() {
 *    deprecationWarning('Foo', 'Foo was deprecated in Cesium 1.01.  It will be removed in 1.03.  Use newFoo instead.');
 *    // ...
 * }
 *
 * // Deprecated function
 * Bar.prototype.func = function() {
 *    deprecationWarning('Bar.func', 'Bar.func() was deprecated in Cesium 1.01.  It will be removed in 1.03.  Use Bar.newFunc() instead.');
 *    // ...
 * };
 *
 * // Deprecated property
 * Object.defineProperties(Bar.prototype, {
 *     prop : {
 *         get : function() {
 *             deprecationWarning('Bar.prop', 'Bar.prop was deprecated in Cesium 1.01.  It will be removed in 1.03.  Use Bar.newProp instead.');
 *             // ...
 *         },
 *         set : function(value) {
 *             deprecationWarning('Bar.prop', 'Bar.prop was deprecated in Cesium 1.01.  It will be removed in 1.03.  Use Bar.newProp instead.');
 *             // ...
 *         }
 *     }
 * });
 *
 * @private
 */
function deprecationWarning(identifier, message) {
  //>>includeStart('debug', pragmas.debug);
  if (!defined(identifier) || !defined(message)) {
    throw new DeveloperError("identifier and message are required.");
  }
  //>>includeEnd('debug');
 
  oneTimeWarning(identifier, message);
}
export default deprecationWarning;