Function scru64

  • Generates a new SCRU64 ID object using the 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.

    This function usually returns a value immediately, but if not possible, it sleeps and waits for the next timestamp tick.

    Returns Promise<Scru64Id>

    Throws

    Error if the global generator is not properly configured.