JSPM

fusion-tokens

0.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1143
  • Score
    100M100P100Q99059F
  • License MIT

Dependency injection tokens for FusionJS

Package Exports

  • fusion-tokens
  • fusion-tokens/dist/browser.es5.cjs.js
  • fusion-tokens/dist/browser.es5.es.js
  • fusion-tokens/dist/node.cjs.js
  • fusion-tokens/dist/node.es.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fusion-tokens) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build status

fusion-tokens

Dependency injection tokens for FusionJS.

FusionJS dependency injection is based on tokens rather than strings. This avoids naming collision issues. This package provides utilities to create named tokens, as well as common tokens that are used by packages maintained by the FusionJS team.

Installation

yarn add fusion-tokens

API

createToken

import {createToken} from 'fusion-tokens';

const token = createToken(name);

Creates a DI token

  • name: string - A human-readable name for the token. Used in error messsages.
  • token: Token - A token

createOptionalToken

import {createOptionalToken} from 'fusion-tokens';

const token = createOptionalToken(name, defaultValue);

Creates a special DI token with a default value associated with it

  • name: string - A human-readable name for the token. Used in error messsages.
  • defaultValue: any - The token's default value
  • token: Token - A token

Tokens

import {FetchToken} from 'fusion-tokens'; import {LoggerToken} from 'fusion-tokens'; import {SessionToken} from 'fusion-tokens';