BCI.js methods are contained within the src directory. To keep the project organized, methods are separated into five folders:
compat
Deprecated methods which remain for compatibility purposesdata
Methods which pertain to data management (CSV files, partition data, etc.)math
Methods used to process data (CSP, LDA, ICA, etc.)metrics
Methods for result metrics (confusion matrices, precision, recall, f1 scores, etc.)network
Networking methods (OSC)
If a method is Node.js exclusive and won't run in the browser, placing
<p>This method is exclusive to Node.js</p>
below the method description in the documentation comment will exclude the method from the browser-only build.
To create a new method, create a file in the appropriate folder, and make sure the file name matches the method name. When bci.js builds, it searches for new files within the src folders and adds them automatically.
Looking at src/modules.js
(must be generated), you'll see each method of bci.js points to the appropriate file in src. As such, making a change to an already existing method will not require rebuilding the index.js. However, adding a new method or renaming a method will require a rebuild.
To build/rebuild src/modules.js
, run
npm run build
This will also rebuild src/modules_browser.js
, which is index.js, but with the node-only methods removed. That way it can be used with webpack or browserify.
To rebuild the dist files for use in the browser, run
npm run dist
To rebuild the docs, run
npm run docs