From 6a3732f19c824f97a2738d2886706d92a3948048 Mon Sep 17 00:00:00 2001 From: sZLukas1607 Date: Fri, 29 May 2020 08:45:09 +0200 Subject: [PATCH] --- NodeCG.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 NodeCG.md diff --git a/NodeCG.md b/NodeCG.md new file mode 100644 index 0000000..f4237ee --- /dev/null +++ b/NodeCG.md @@ -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/.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 The date of the commit this bundle is on. +message String 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.