Skip to main content

Migrating from v5 to v6

The new version 6 of the SDK is mostly backwards compatible with v5.

There are 3 changes.

1. Import name change

The most important change is the new renamed npm package and the name of the main SDK class.

Before:

import { Notion } from "@neurosity/notion";

const notion = new Notion();

After:

import { Neurosity } from "@neurosity/sdk";

const neurosity = new Neurosity();

2. Single metric/label pair

Previously, the following function could accept multiple labels:

Before:

neurosity.brainwaves("raw", "psd", "powerByBand");
neurosity.kinesis("push", "pull");
neurosity.predictions("push", "pull");

In v6, these functions only accept 1 label.

After:

neurosity.brainwaves("raw");
neurosity.kinesis("pull");
neurosity.predictions("push");

To get the same behavior as before, you can merge the streams:

import { merge } from "rxjs";

merge(
neurosity.brainwaves("raw"),
neurosity.brainwaves("psd"),
neurosity.brainwaves("powerByBand")
).subscribe((brainwaves) => {
//
});

3. Removed Local Mode

We've removed the following local mode functions in favor of the new Bluetooth support:

neurosity.enableLocalMode();
neurosity.isLocalMode();

If you are interested in supporting Bluetooth for your app, you can check out the Bluetooth tutorial.