Class GlobalGenerator

The gateway object that forwards supported method calls to the process-wide global generator.

By default, the global generator reads the node configuration from the SCRU64_NODE_SPEC global variable when a generator method is first called, and it throws an error if it fails to do so. The node configuration is encoded in a node spec string consisting of nodeId and nodeIdSize integers separated by a slash (e.g., "42/8", "0xb00/12"; see NodeSpec for details). You can configure the global generator differently by calling GlobalGenerator.initialize before the default initializer is triggered.

Constructors

Methods

  • Initializes the global generator, if not initialized, with the node spec passed.

    This method tries to configure the global generator with the argument only when the global generator is not yet initialized. Otherwise, it preserves the existing configuration.

    Parameters

    Returns boolean

    true if this method configures the global generator or false if it preserves the existing configuration.

    Throws

    SyntaxError or RangeError according to the semantics of new Scru64Generator(nodeSpec) if the argument represents an invalid node spec.