Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WAKThreads

Hierarchy

Index

Properties

Mutex

Mutex: Mutex

References the mutex constructor.

NodeWorker

NodeWorker: NodeWorker

References the node worker constructor.

SharedWorker

SharedWorker: SharedWorker

References the shared worker constructor.

SystemWorker

SystemWorker: SystemWorker

References the system worker constructor.

Methods

close

  • close(): void

exitWait

  • exitWait(): void
  • Exit pending wait() in the current thread. Does not impact pending wait() in other threads.

    exitWait();

    Returns void

require

  • require(moduleId: String): Module
  • Requires an SSJS module (CommonJS compliant). This module must be defined in PROJECT/modules/.

    // Get the module defined in PROJECT/modules/mail
    var mail = require('mail');
    // Get the module defined in PROJECT/modules/customers/platinium
    var platiniumCustomers = require('/customers/platinium');

    Parameters

    • moduleId: String

      Describes the module id and path

    Returns Module

    Returns the exported API of the given module

requireNode

  • requireNode(moduleId: String): Module
  • Requires a NodeJS module. This module must be defined in PROJECT/node_modules.

    // Get the Node module defined in PROJECT/node_modules/http
    var http = requireNode('http');
    warning

    This API is only available inside a Node worker (See NodeWorker for more details)

    Parameters

    • moduleId: String

      Describes the module id and path

    Returns Module

    Returns the exported API of the given module

wait

  • wait(timeout?: Number): void
  • Allows a thread to handle events and to continue to exist after the complete code executes.

    // Wait for 100ms
    wait(100);
    // Wait for the end of time
    wait();

    Parameters

    • Optional timeout: Number

      Milliseconds to wait for. If none, it's an infinite wait. Can be squeeze with an exitWait().

    Returns void