Skip to content

Enigma mixins

This package contains set ot enigma.js mixins. Enigma.js documentation describes mixins as:

The mixin concept allows you to add or override QIX Engine API functionality. A mixin is basically a JavaScript object describing which types it modifies, and a list of functions for extending and overriding the API for those types.

enigma-mixin adds few mixin on global, doc and object enigma.js objects.

For the specific mixin have a look at the dedicated pages:

Installation

The installation is very simple:

1
npm install enigma-mixin

Usage

1
2
3
4
5
6
7
8
import { globalMixin, docMixin, objectMixin } from "enigma-mixin";

const session = enigma.create({
  schema,
  mixins: [...docMixin, ...globalMixin, ...objectMixin],
  url: `wss://sense-engine-url`,
  createSocket: (url) => new WebSocket(url),
});

As we can see mixins are loaded/defined as a session property. There is no need to attach all types of mixin. Attach whatever type is required.