# @dcefram/xjs

> XSplit JS Framework

Latest version **0.2.4** (published 2020-07-06) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install @dcefram/xjs
pnpm add @dcefram/xjs
yarn add @dcefram/xjs
bun add @dcefram/xjs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2020-07-06 |
| First published | 2020-02-04 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 89 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | SplitmediaLabs, Ltd. |
| Maintainers | dcefram |
| Keywords | xsplit, plugin, framework |

## Links

- npm: https://www.npmjs.com/package/@dcefram/xjs
- Repository: https://github.com/dcefram/xjs
- Homepage: https://github.com/dcefram/xjs#readme
- Issues: https://github.com/dcefram/xjs/issues
- npm.io page: https://npm.io/package/@dcefram/xjs

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [fast-xml-parser](https://npm.io/package/fast-xml-parser.md) ^3.17.4

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads
- [@modern-js/plugin-swc](https://npm.io/package/@modern-js/plugin-swc.md) — 3.4K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2020-07-06
- 0.2.3 — 2020-05-22
- 0.2.2 — 2020-05-22
- 0.2.1 — 2020-05-22
- 0.2.0 — 2020-05-22
- 0.1.20 — 2020-04-16
- 0.1.19 — 2020-04-14
- 0.1.18 — 2020-03-24
- 0.1.12 — 2020-03-23
- 0.1.11 — 2020-03-17
- 0.1.10 — 2020-03-12
- 0.1.8 — 2020-03-12
- 0.1.7 — 2020-03-12
- 0.1.6 — 2020-03-12
- 0.1.5 — 2020-02-20
- … 5 more at https://npm.io/package/@dcefram/xjs/versions

## README

> WARNING: This is still very much a work-in-progress!

# XJS Framework

The XSplit JS Framework allows developers to create plugins for XSplit Broadcaster.

This branch is the proposed next version of XJS Framework. Further documentation will be done down the line.

- [API Reference](https://xjs.dcefram.now.sh/)

## Remote

```
import XJS from 'xjs';
import { XjsTypes } from 'xjs/core/xjs/types';

// Establish connection
const Connection = () => {
  return new Promise(resolve => {
    if (RTCPeerConnection !== undefined) {
      const rtc = new RTCPeerConnection();

      rtc.ondatachannel = channel => {
        resolve(channel);
      };

      return;
    }

    const ws = new WebSocket('ws://localhost:9999');

    return resolve(ws);
  });
};

(async () => {
  // PROXY using RTC
  const conn = (await Connection()) as RTCDataChannel;

  conn.addEventListener('open', d => {
    const xjs = new XJS({
      type: XjsTypes.Proxy,
      sendMessage: conn.send.bind(conn),
    });

    conn.addEventListener('message', ({ data: message }) => {
      xjs.remote.receiveMessage(message);
    });
  });
})();

(async () => {
  // PROXY using WebSocket
  const conn = (await Connection()) as WebSocket;

  conn.addEventListener('open', d => {
    const xjs = new XJS({
      type: XjsTypes.Proxy,
      sendMessage: conn.send.bind(conn),
    });

    conn.addEventListener('message', ({ data: message }) => {
      xjs.remote.receiveMessage(message);
    });
  });
})();

(async () => {
  // REMOTE using WebSocket
  const conn = (await Connection()) as RTCDataChannel;

  conn.addEventListener('open', d => {
    const xjs = new XJS({
      type: XjsTypes.Remote,
      sendMessage: conn.send.bind(conn),
    });

    conn.addEventListener('message', ({ data: message }) => {
      xjs.remote.receiveMessage(message);
    });
  });
})();

(async () => {
  // REMOTE using WebSocket
  const conn = (await Connection()) as WebSocket;

  conn.addEventListener('open', d => {
    const xjs = new XJS({
      type: XjsTypes.Remote,
      sendMessage: conn.send.bind(conn),
    });

    conn.addEventListener('message', ({ data: message }) => {
      xjs.remote.receiveMessage(message);
    });
  });
})();

```

---
_Source: https://npm.io/package/@dcefram/xjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
