Nobody Prefers Margarine

    @soundworks/service-checkin

    0.0.1-alpha.0 • Public • Published

    @soundworks/service-checkin

    The checkin service simply assigns a ticket (unique index) to the client among the available ones. The ticket can optionally be associated with coordinates or label according to the server setup configuration.

    Install

    npm install --save @soundworks/service-checkin

    Usage

    client

    registering the service

    // index.js
    import { Client } from '@soundworks/core/client';
    import serviceCheckinFactory from '@soundworks/service-checkin/client';
    
    const client = new Client();
    client.registerService('checkin', serviceCheckinFactory, {}, []);

    requiring the service

    // MyExperience.js
    import { Experience } from '@soundworks/core/client';
    
    class MyExperience extends Experience {
      constructor() {
        super();
        this.checkin = this.require('checkin');
      }
    
      start() {
        const index = this.checkin.state.get('index');
        const label = this.checkin.state.get('label');
      }
    }

    options

    server

    registering the service

    // index.js
    import { Server } from '@soundworks/core/server';
    import serviceCheckinFactory from '@soundworks/service-checkin/server';
    
    const server = new Server();
    server.registerService('platform', serviceCheckinFactory, {
      order: 'ascending',
      capacity: 4,
      labels: ['a', 'b', 'c', 'd'],
    }, []);

    requiring the service

    // MyExperience.js
    import { Experience } from '@soundworks/core/server';
    
    class MyExperience extends Experience {
      constructor() {
        super();
        this.checkin = this.require('checkin');
      }
    }

    options

    • order: order in which the indexes are attributed to clients, random or ascending (default)
    • capacity: number of places that can be attributed
    • labels: optionnal labels associated with the index

    License

    BSD-3-Clause

    Keywords

    none

    Install

    npm i @soundworks/service-checkin

    DownloadsWeekly Downloads

    2

    Version

    0.0.1-alpha.0

    License

    BSD-3-Clause

    Unpacked Size

    10.6 kB

    Total Files

    7

    Last publish

    Collaborators

    • b-ma