Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FixtureLibrary

The Fixture Library

The main class for managing DMX-Fixtures.

Example - commonJs

const { FixtureLibrary } = require('fixturelibrary');
const fl = new FixtureLibrary();

async function foo(){
// Fetching a Fixture from the Library
const fixture = await fl.getFixture('cameo/auro-spot-300');
console.log(`${fixture.name} has ${fixture.modes.length} Modes.`);

// This will return true since we're validating a fixture from Ofl.
console.log(fl.validate(fixture));
}

Example - ESM/TS

import { FixtureLibrary } from 'fixturelibrary';

const fl = new FixtureLibrary();
const fixture = await fl.getFixture('arri/broadcaster-2-plus');

Hierarchy

  • FixtureLibrary

Index

Constructors

constructor

Methods

downloadOfl

  • downloadOfl(): Promise<void | string[]>
  • This call has a long executiontime and is therefore Not Recommended to be used in scripts! Please use npx syncOfl instead!

    ONLY available when allowing web access usage. Downloading the whole Open Fixture Library to the fixture index. The Fixtureindex should, after a successfull download, have an additional ~30KB in size.

    Returns Promise<void | string[]>

    List of all the fixtures which got updated.

fetchOfl

  • fetchOfl(): Promise<void | string[]>
  • This call has a long executiontime and is therefore Not Recommended to be used in scripts! Please use npx syncOfl shallow instead!

    Insteadof downloadOfl, this only downloads the references to the OFL fixtures and none of the files.

    Returns Promise<void | string[]>

    List of all the fixtures which got updated.

getFixture

  • getFixture(key: string): Promise<undefined | Fixture>
  • Get a Fixture from the Library or OFL if allowed. This relies on reading definitions from file/web and caching. Execution time depends on the size of the definition (.6 - 4ms) and if it was cached (.01ms). In Case it needs to be downloaded, it will take alot longer. (depending on your connection)

    Parameters

    • key: string

      Key of the fixture

    Returns Promise<undefined | Fixture>

    Fixture Definition or undefined if not found

Private saveIndex

  • saveIndex(): Promise<void>
  • Saving the Index to a file to be available after execution.

    Returns Promise<void>

setFixture

  • setFixture(key: string, fixture: Fixture, sha?: string, validate?: boolean, override?: boolean): Promise<undefined | Fixture>
  • Adding a new fixture to the Library.

    Parameters

    • key: string

      new and unique fixture key

    • fixture: Fixture

      Fixture Definition

    • sha: string = ''

      The version SHA of the fixture (Can be usefull for Versioning)

    • validate: boolean = true

      If the fixture should be validated against the OFL Schema

    • override: boolean = false

      If existing entries should be overwritten

    Returns Promise<undefined | Fixture>

    The passed Fixture Definition to enable method chaining

validate

  • validate(fixture: any): boolean
  • Validate a fixture definition against the Open Fixture Library Schema

    Parameters

    • fixture: any

      the fixture definition

    Returns boolean

    wether the fixture is applicable to the schema or not

Generated using TypeDoc