open-index/open-npm huggingface dataset:
npm package: @raydiant/sdk
Description: Raydiant SDK
Latest version: 0.9.2

# Raydiant SDK

A JavaScript library for interacting with the Raydiant runtime.

## Installation

### NPM

```bash
npm install @raydiant/sdk
# or yarn
yarn install @raydiant/sdk
```

```js
import { runtime, devTools } from '@raydiant/sdk';
```

### CDN

```html
<script src="https://cdn.raydiant.com/lib/raydiant-sdk@0.9.0.min.js"></script>
```

```js
const { runtime, devTools } = window.Raydiant;
```

## Usage

```js
// Send 'ready' event.
runtime.ready();

// Send 'complete' event.
runtime.complete();

// Send 'complete' event with error.
runtime.complete(new Error());

// Subscribe to the runtime's 'play' event.
const unsubscribe = runtime.subscribe('play', () => {
  // ...
});
```

### Developer Tools

Use the built-in developer tools to simulate sending and receiving events in local development. When you open your app directly in the browser the dev tools are automatically enabled.

```js
// Check if dev tools are enabled.
devTools.isEnabled();

// Simulate receiving 'play' from the playlist runtime.
devTools.play();

// Immediately call play again after complete, simulating a single presentation in the playlist.
devTools.play(true);

// Stop looping.
devTools.disableLoop();
```

## Contributing

See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for instructions on how to contribute to the Raydiant SDK.