0.0.3 • Published 4 years ago

@angeeks/globals v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Globals

Build Status npm version

A small useful piece for globals seperation.

Installation

  npm i -P @angeeks/globals

:construction: Usage

import { GlobalsModule } from '@angkees/globals';

@NgModule({
  imports: [
    ...,
    GlobalsModule
  ]
})

That's it, now you can use globals in as injectables.

import { Globals } from '@angkees/globals';
class AppComponent {
  constructor(g: Globals) {
    g.window.open('http://google.com', 'blank');
    g.console.log(g.document.body);
    g.localStorage.set('key', 'value');
  }
}

Advanced Usage

:construction: Inject customed symbols

import { GlobalsModule, windowToken } from '@angkees/g';

@NgModule({
  imports: [
    ...,
    GlobalsModule
  ],
  providers: [
    { provide: windowToken, useValue: { window: 'for test' } }
  ]
})
0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago