Options
All
  • Public
  • Public/Protected
  • All
Menu

Module src/core/symbol

core/symbol

This module provides a function to create unique symbols in a more flexible way.

import symbolGenerator from 'core/symbol';

// All symbols that produce from this constant will be automatically generated by the first touch.
// This mechanism is based on the JS Proxy API.
const
$$ = symbolGenerator();

// This code is similar to
// const hi = Symbol('hi');
// console.log(hi);
console.log($$.hi);

Index

Functions

Functions

  • Returns a factory for flexible creation of unique symbols by the first touch

    Parameters

    • Optional fields: string[]

      list of predefined fields (it can be useful to shim the Proxy API)

    Returns StrictDictionary<symbol>