From f3e2facd9afd034f83c2148ae6217bb13ef72e64 Mon Sep 17 00:00:00 2001 From: AJ Keller Date: Tue, 31 Jan 2017 17:44:36 -0500 Subject: [PATCH] Update README.md --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f1f14e..ac7b6c5 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,34 @@ const ourBoard = new Ganglion({ }); ``` +For initializing with callback, such as to catch errors on `noble` startup: + +```js +const Ganglion = require('openbci-ganglion').Ganglion; +const ourBoard = new Ganglion((error) => { + if (error) { + console.log("error", error); + } else { + console.log("no error"); + } +}); +``` +For initializing with options and callback, such as verbose and to catch errors on `noble` startup: + +```js +const Ganglion = require('openbci-ganglion').Ganglion; +const ourBoard = new Ganglion({ + verbose: true +},(error) => { + if (error) { + console.log("error", error); + } else { + console.log("no error"); + } +}); +``` + + 'ready' event ------------ @@ -176,7 +204,7 @@ See Reference Guide for a complete list of impedance tests. --------------- ### Constructor: -#### Ganglion (options) +#### Ganglion (options, callback) Create new instance of a Ganglion board. @@ -201,6 +229,10 @@ Board optional configurations. **Note, we have added support for either all lowercase OR camel case for the options, use whichever style you prefer.** +**_callback (optional)_** + +Callback function to catch errors. Returns only error if an error was encountered. + ### Methods: #### .accelStart()