UNPKG

@antv/g2

Version:

the Grammar of Graphics in Javascript

15 lines (12 loc) 484 B
import { G2ComponentNamespaces, G2Component } from '../runtime'; import { registerSymbol, type SymbolFactor } from '../utils/marker'; export const library = {}; // @todo Warn if override existing key. export function register( key: `${G2ComponentNamespaces | 'symbol'}.${any}`, component: G2Component | SymbolFactor, ) { if (key.startsWith('symbol.')) registerSymbol(key.split('.').pop(), component as SymbolFactor); else Object.assign(library, { [key]: component }); }