UNPKG

ng-refs

Version:

Practice better dependency injection of browser APIs within your Angular components and services.

117 lines (104 loc) 2.36 kB
import { Injectable, NgModule } from '@angular/core'; class AnimationFrameRef { nativeCancel(handle) { return cancelAnimationFrame(handle); } nativeRequest(callback) { return requestAnimationFrame(callback); } } AnimationFrameRef.decorators = [ { type: Injectable } ]; class ConsoleRef { get native() { return console; } } ConsoleRef.decorators = [ { type: Injectable } ]; class GetComputedStyleRef { native(elt, pseudoElt) { return getComputedStyle(elt, pseudoElt); } } GetComputedStyleRef.decorators = [ { type: Injectable } ]; class IntervalRef { nativeClear(handle) { return clearInterval(handle); } nativeSet(handler, timeout, ...args) { return setInterval(handler, timeout, ...args); } } IntervalRef.decorators = [ { type: Injectable } ]; class LocalstorageRef { get native() { return localStorage; } } LocalstorageRef.decorators = [ { type: Injectable } ]; class LocationRef { get native() { return location; } } LocationRef.decorators = [ { type: Injectable } ]; class SessionstorageRef { get native() { return sessionStorage; } } SessionstorageRef.decorators = [ { type: Injectable } ]; class TimeoutRef { nativeClear(handle) { return clearTimeout(handle); } nativeSet(handler, timeout, ...args) { return setTimeout(handler, timeout, ...args); } } TimeoutRef.decorators = [ { type: Injectable } ]; class WindowRef { get native() { return window; } } WindowRef.decorators = [ { type: Injectable } ]; class NgRefsModule { } NgRefsModule.decorators = [ { type: NgModule, args: [{ providers: [ AnimationFrameRef, ConsoleRef, GetComputedStyleRef, IntervalRef, LocalstorageRef, LocationRef, SessionstorageRef, TimeoutRef, WindowRef ] },] } ]; /** * Generated bundle index. Do not edit. */ export { AnimationFrameRef, ConsoleRef, GetComputedStyleRef, IntervalRef, LocalstorageRef, LocationRef, NgRefsModule, SessionstorageRef, TimeoutRef, WindowRef }; //# sourceMappingURL=ng-refs.js.map