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 CURR_BNDL 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) { var myVal = nodecg.readReplicant('myVar', 'some-bundle'); }; From a graphic or dashboard panel: // Graphics and dashboard panels must query the server to retrieve the value, // and therefore must provide a callback. nodecg.readReplicant('myRep', 'some-bundle', value => { // I can use 'value' now! console.log('myRep has the value ' + value + '!'); });
1
readReplicant
sZLukas1607 edited this page 2020-05-29 08:46:29 +02:00