npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

streamboard-sdk

v1.7.0

Published

StreamBoard SDK is an SDK to create plugin for the Stream Board

Downloads

14

Readme

GitHub Workflow Status (branch) npm Code Style: Google Code: TypeScript Made By: StudiMax

This project is the official SDK for the Stream Board project.

The SDK is helpful to develop some plugins as easy as possible and as fast as possible.

Installation

$ npm install streamboard-sdk
OR
$ yarn add streamboard-sdk

Example

Then you can use the sdk like this example

import StreamBoardSDK from "stremboard-sdk";

const sdk = new StreamBoardSDK();

sdk.setActionConfig('myaction', [
  { type: 'input_text', key: 'world', default: () => 'World' },
]);

sdk.onContext('myaction', context => {
  context.setText("Hello");
  context.setColor("#1452bc");

  context.onPressDown(async () => {
    const config = await context.getConfig();

    context.setText(`Hello ${config.world}`);
    context.setColor("#14bc30");
  });
});

sdk.ready();

Package.json

The plugin need a valid package.json with this minimum configuration:

{
  "name": "simple-plugin",
  "version": "1.0.0",
  "main": "src/index.ts",
  "icon": "assets/img/icon.png",
  "identifier": "ch.studimax.simple-plugin",
  "actions": {
    "myaction": {
      "name": "Test",
      "icon": "assets/img/actions/test.png"
    }
  },
  "engines": {
    "node": ">=14.16.0"
  }
}

Context

The plugin is executed one time on the StreamBoard, so there is only one instance of the plugin. That's why we need to use context. Context is an instance of a plugin's action declared in package.json.

setText(value:string)

context.setText("text");

setImage(src:string)

src is an absolute URL.

context.setImage("https://media.giphy.com/media/xT4uQl1oBYev1vaRos/giphy.gif");

setColor(color:string)

color is a valid CSS color.

context.setColor("#ff0000");

Context Events

onPressDown

Got this event when icon is pressed down.

context.onPressDown(() => {
  console.log('press down');
})

onPressUp

Got this event when icon is pressed up. You can get the press duration with pressDuration

context.onPressUp(({ pressDuration }) => {
  console.log('press up');
})

onStop

Got this event when the context is stopped.

context.onStop(() => {
  console.log('stop');
})

onSettings

Got this event when the context's config changed.

context.onSettings(config => {
  console.log(config);
})

Get all contexts

//get all contexts
const contexts = sdk.getAllContexts();

//get all contexts with action named "action"
const contexts = sdk.getAllContexts("action");

onContext

onContext is executed when a new context is added on StreamBoard, the context instance and the config are returned.

sdk.onContext((context, config) => {
  console.log(context);
})

Done

Et voilà - we created a simple plugin. Don't forget that this project is in development.