Function
registerWarnHandler (handler) public
Module:
@ember/debug
Defined in packages/@ember/debug/lib/warn.ts:24
Available since v2.1.0
import { registerWarnHandler } from '@ember/debug'; |
- handler
- Function
- A function to handle warnings.
Allows for runtime registration of handler functions that override the default warning behavior. Warnings are invoked by calls made to @ember/debug/warn. The following example demonstrates its usage by registering a handler that does nothing overriding Ember's default warning behavior.
1 2 3 4 |
import { registerWarnHandler } from '@ember/debug'; // next is not called, so no warnings get the default behavior registerWarnHandler(() => {}); |
The handler function takes the following arguments:
-
message
- The message received from the warn call. -
options
- An object passed in with the warn call containing additional information including: -
id
- An id of the warning in the form ofpackage-name.specific-warning
. -
next
- A function that calls into the previously registered handler.