0.0.3 • Published 4 years ago

@watched-com/sdk v0.0.3

Weekly downloads
-
License
-
Repository
github
Last release
4 years ago

@watched-com/sdk

WATCHED javascript addon SDK.

Create an addon

There are two ways to create addons.

1. With a class

import * as watched from '@watched-com/sdk';

watched.setup({
  id: 'com.example.testserver',
  name: 'WATCHED test server',
});

class MyAddon extends watched.Addon {
  getProps() {
    return {
      type: 'worker',
      id: 'com.example.sample.addon',
      name: 'Sample Addon',
    };
  }

  async directory(ctx, args) {
    console.warn(ctx, args);
    return { items: [] };
  }
}

// Create addon instance, this also registers the addon
new MyAddon();

watched.start();

2. With functions

import * as watched from '@watched-com/sdk';

watched.setup({
  id: 'com.example.testserver',
  name: 'WATCHED test server',
});

watched
  .createAddon({
    type: 'worker',
    id: 'com.example.sample.addon',
    name: 'Sample Addon',
  })
  .on('directory', async (ctx, args) => {
    console.warn(ctx, args);
    return { items: [] };
  });

watched.start();
0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago