44
NodeCG.md
Normal file
44
NodeCG.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
new NodeCG(bundle, socket)
|
||||||
|
Creates a new NodeCG API instance. It should never be necessary to use this constructor in a bundle, as NodeCG automatically injects a pre-made API instance.
|
||||||
|
Name Type Description
|
||||||
|
bundle object The bundle object to build an API instance from.
|
||||||
|
socket object The Socket.IO socket instance to communicate with.
|
||||||
|
#Members
|
||||||
|
#(static) declaredReplicants
|
||||||
|
An object containing references to all Replicants that have been declared in this window, sorted by bundle. E.g., NodeCG.declaredReplicants.myBundle.myRep
|
||||||
|
#bundleConfig
|
||||||
|
An object containing the parsed content of cfg/<bundle-name>.json, the contents of which are read once when NodeCG starts up. Used to quickly access per-bundle configuration properties.
|
||||||
|
#(readonly) bundleGit
|
||||||
|
Provides information about the current git status of this bundle, if found.
|
||||||
|
#Properties
|
||||||
|
Name Type Attribues Description
|
||||||
|
branch String What branch this bundle is on.
|
||||||
|
hash String The full hash of the commit this bundle is on.
|
||||||
|
shortHash String The short hash of the commit this bundle is on.
|
||||||
|
date Date <optional> The date of the commit this bundle is on.
|
||||||
|
message String <optional> The message of the commit this bundle is on.
|
||||||
|
#bundleName
|
||||||
|
The name of the bundle which this NodeCG API instance is for.
|
||||||
|
|
||||||
|
#bundleVersion
|
||||||
|
The version (from package.json) of the bundle which this NodeCG API instance is for.
|
||||||
|
#extensions
|
||||||
|
EXTENSION ONLY
|
||||||
|
This can only be used in code which runs on the server.
|
||||||
|
Object containing references to all other loaded extensions. To access another bundle's extension, it must be declared as a bundleDependency in your bundle's manifest.
|
||||||
|
// bundles/my-bundle/package.json
|
||||||
|
{
|
||||||
|
"name": "my-bundle"
|
||||||
|
...
|
||||||
|
"bundleDependencies": {
|
||||||
|
"other-bundle": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// bundles/my-bundle/extension.js
|
||||||
|
module.exports = function (nodecg) {
|
||||||
|
const otherBundle = nodecg.extensions['other-bundle'];
|
||||||
|
// Now I can use `otherBundle`!
|
||||||
|
}
|
||||||
|
#Logger :Object
|
||||||
|
Provides easy access to the Logger class. Useful in cases where you want to create your own custom logger.
|
||||||
Reference in New Issue
Block a user