MCPcopy
hub / github.com/angular/angular / onDestroy

Method onDestroy

packages/core/src/application/application_ref.ts:786–790  ·  view source on GitHub ↗

* Registers a listener to be called when an instance is destroyed. * * @param callback A callback function to add as a listener. * @returns A function which unregisters a listener.

(callback: () => void)

Source from the content-addressed store, hash-verified

784 * @returns A function which unregisters a listener.
785 */
786 onDestroy(callback: () => void): VoidFunction {
787 (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
788 this._destroyListeners.push(callback);
789 return () => remove(this._destroyListeners, callback);
790 }
791
792 /**
793 * Destroys an Angular application represented by this `ApplicationRef`. Calling this function

Callers

nothing calls this directly

Calls 3

warnIfDestroyedFunction · 0.85
removeFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected