readReplicant
readReplicant(name, *bundle, cb)
Reads the value of a replicant once, and doesn't create a subscription to it. Also available as a static method.
Parameters
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name | string | The name of the replicant. | ||
bundle | string | <optional> | Current bundle | The bundle namespace to in which to look for this replicant. |
cb | function | Browser only The callback that handles the server's response which contains the value. |
Example
From an extension:
// Extensions have immediate access to the database of Replicants.
// For this reason, they can use readReplicant synchronously, without a callback.
module.exports = function(nodecg) {
const myVal = nodecg.readReplicant('myVar', 'some-bundle');
};