run-outside-angular

RunOutsideAngular is Angular class decorator that wrap all class methods on ngZone.runOutsideAngular()

Usage no npm install needed!

<script type="module">
  import runOutsideAngular from 'https://cdn.skypack.dev/run-outside-angular';
</script>

README

@RunOutsideAngular

An Angular class decorator that wrap all class methods excluding constructor and Angular lifecycle methods on ngZone.runOutsideAngular(). Add method names which should be excluded in config.

npm i run-outside-angular
import { RunOutsideAngular } from 'run-outside-angular';

@RunOutsideAngular({
    exclude: ['yo']
})
@Component({...})
export class ExampleComponent {
    // _ngZone must be in constructor class
    constructor(private _ngZOne: NgZone)

    yo() {
        // will be runned in Angular Zone
    }

    hoho() {
        // will be runned out Angular Zone
    }
}