@angeeks/globals
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Globals

Build Status npm version

A small useful piece for globals seperation.

Installation

  npm i -P @angeeks/globals

🚧 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

🚧 Inject customed symbols

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

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

Package Sidebar

Install

npm i @angeeks/globals

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

38.7 kB

Total Files

26

Last publish

Collaborators

  • speed.of.light