# frontline-client

> Client for using the Frontline websocket API

Latest version **1.1.3** (published 2025-01-23) · 0 weekly downloads

## Install

```sh
npm install frontline-client
pnpm add frontline-client
yarn add frontline-client
bun add frontline-client
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2025-01-23 |
| First published | 2021-11-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 55.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | frontline-wildfire |

## Links

- npm: https://www.npmjs.com/package/frontline-client
- npm.io page: https://npm.io/package/frontline-client

## Dependencies (1)

- [phoenix](https://npm.io/package/phoenix.md) ^1.6.2

## Recent versions

- 1.1.3 (latest) — 2025-01-23
- 1.1.2 — 2024-06-11
- 1.1.1 — 2022-04-26
- 1.1.0 — 2022-04-25
- 1.0.9 — 2022-04-25
- 1.0.8 — 2022-04-19
- 1.0.7 — 2022-02-11
- 1.0.6 — 2022-02-11
- 1.0.5 — 2021-12-15
- 1.0.4 — 2021-12-03
- 1.0.3 — 2021-12-02
- 1.0.2 — 2021-12-01
- 1.0.1 — 2021-12-01
- 1.0.0 — 2021-11-23

## README

# Frontline Javascript Client

This library is used to interact with the Frontline WebSocket API.

An example usage is below.

```javascript
import {Client} from './index.js';

const url = location.origin;

function save_session(data) {
  localStorage.setItem("session", JSON.stringify(data));
}

function maybe_session() {
  let s = localStorage.getItem("session");
  s = JSON.parse(s);
  return s;
}

function init(session) {
  save_session(session)
  fl.init(session)
}

let session = maybe_session();

function open(event){
  console.info("Open:", event.detail);
}

function initialized(event){
  console.log("channel initialized:", event.detail);
}

function updated(event){
  console.log("channel updated:", event.detail);
}

window.fl = new Client(url);
window.fl.addEventListener("open", open);
window.fl.addEventListener("initialized", initialized);
window.fl.addEventListener("updated", updated);

if(!session){
  let email = prompt("Email Address");
  fl.send_login_email(email);
  let token = prompt("Login Token");
  fl.authenticate(token)
    .then(session => init(session));
}else{
  init(session);
}
```

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