dist/ember-testing.js in ember-source-2.1.0.beta.3 vs dist/ember-testing.js in ember-source-2.1.0
- old
+ new
@@ -3,11 +3,11 @@
* @copyright Copyright 2011-2015 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 2.1.0-beta.3
+ * @version 2.1.0
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
var mainContext = this;
@@ -320,14 +320,70 @@
_emberMetalCore.default.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
}
}, false);
}
}
-
+ /**
+ @public
+ @class Ember.Debug
+ */
_emberMetalCore.default.Debug = {};
+ /**
+ Allows for runtime registration of handler functions that override the default deprecation behavior.
+ Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate).
+ The following example demonstrates its usage by registering a handler that throws an error if the
+ message contains the word "should", otherwise defers to the default handler.
+ ```javascript
+ Ember.Debug.registerDeprecationHandler((message, options, next) => {
+ if (message.indexOf('should') !== -1) {
+ throw new Error(`Deprecation message with should: ${message}`);
+ } else {
+ // defer to whatever handler was registered before this one
+ next(message, options);
+ }
+ }
+ ```
+ The handler function takes the following arguments:
+ <ul>
+ <li> <code>message</code> - The message received from the deprecation call. </li>
+ <li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li>
+ <ul>
+ <li> <code>id</code> - an id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li>
+ <li> <code>until</code> - is the version number Ember the feature and deprecation will be removed in.</li>
+ </ul>
+ <li> <code>next</code> - a function that calls into the previously registered handler.</li>
+ </ul>
+ @public
+ @static
+ @method registerDeprecationHandler
+ @param handler {Function} a function to handle deprecation calls
+ */
_emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
+ /**
+ Allows for runtime registration of handler functions that override the default warning behavior.
+ Warnings are invoked by calls made to [Ember.warn](http://emberjs.com/api/classes/Ember.html#method_warn).
+ The following example demonstrates its usage by registering a handler that does nothing overriding Ember's
+ default warning behavior.
+ ```javascript
+ // next is not called, so no warnings get the default behavior
+ Ember.Debug.registerWarnHandler(() => {});
+ ```
+ The handler function takes the following arguments:
+ <ul>
+ <li> <code>message</code> - The message received from the warn call. </li>
+ <li> <code>options</code> - An object passed in with the warn call containing additional information including:</li>
+ <ul>
+ <li> <code>id</code> - an id of the warning in the form of <code>package-name.specific-warning</code>.</li>
+ </ul>
+ <li> <code>next</code> - a function that calls into the previously registered handler.</li>
+ </ul>
+ @public
+ @static
+ @method registerWarnHandler
+ @param handler {Function} a function to handle warnings
+ */
_emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
/*
We are transitioning away from `ember.js` to `ember.debug.js` to make
it much clearer that it is only for local development purposes.
@@ -444,19 +500,31 @@
@public
*/
function deprecate(message, test, options) {
if (!options || !options.id && !options.until) {
- deprecate(missingOptionsDeprecation, false, { id: 'ember-debug.deprecate-options-missing', until: '3.0.0' });
+ deprecate(missingOptionsDeprecation, false, {
+ id: 'ember-debug.deprecate-options-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
if (options && !options.id) {
- deprecate(missingOptionsIdDeprecation, false, { id: 'ember-debug.deprecate-id-missing', until: '3.0.0' });
+ deprecate(missingOptionsIdDeprecation, false, {
+ id: 'ember-debug.deprecate-id-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
if (options && !options.until) {
- deprecate(missingOptionsUntilDeprecation, options && options.until, { id: 'ember-debug.deprecate-until-missing', until: '3.0.0' });
+ deprecate(missingOptionsUntilDeprecation, options && options.until, {
+ id: 'ember-debug.deprecate-until-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
_emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(_slice.call(arguments)));
}
});
@@ -539,14 +607,22 @@
@public
*/
function warn(message, test, options) {
if (!options) {
- _emberMetalCore.default.deprecate(missingOptionsDeprecation, false, { id: 'ember-debug.warn-options-missing', until: '3.0.0' });
+ _emberMetalCore.default.deprecate(missingOptionsDeprecation, false, {
+ id: 'ember-debug.warn-options-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
if (options && !options.id) {
- _emberMetalCore.default.deprecate(missingOptionsIdDeprecation, false, { id: 'ember-debug.warn-id-missing', until: '3.0.0' });
+ _emberMetalCore.default.deprecate(missingOptionsIdDeprecation, false, {
+ id: 'ember-debug.warn-id-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
_emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(_slice.call(arguments)));
}
});
\ No newline at end of file