sknk-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.25 • Public • Published

sknk-client

Description

SKNK-Client is a little library that reduces biolerplate to connect to a SKNK server

You can find more informations about SKNK here

Usage

Modern JS

import sknk from 'skunk-client';

sknk.register({
  name: "strateApp",
  layoutOptions: {
    id: "strates"
  },
  render: (domId, bp, token) => {
    sknk.ack(token);
    /* Code that launches your app (reactdom render, vue mount, etc...)
  }
});

Typescript

import sknk from 'skunk-client';

interface IMyBaseProps {
    // ...
}

sknk.register({
  name: "strateApp",
  layoutOptions: {
    id: "strates"
  },
  render: (domId: string, bp: IMyBaseProps, token: string) => {
    sknk.ack(token);
    /* Code that launches your app (reactdom render, vue mount, etc...)
  }
});

Functions

Register

Register is the function that connects to the sknk server and identifies your app.

Properties

register only takes the registerObject with the following fields:

Name Type Description
name string Name of the application used by the Mother application
layoutOptions LayoutOptions Used to give your rendering requirements ex : { id: "search" }
render function(string, any, string): void You need to give a function that will launch your app and you will recieve three parameters from the server : \ domId is the id you can use to render yourself in \ baseProps is the data that is passed to you from the mother app

ACK

getProps

Readme

Keywords

none

Package Sidebar

Install

npm i sknk-client

Weekly Downloads

1

Version

0.0.25

License

MIT

Unpacked Size

13.1 kB

Total Files

9

Last publish

Collaborators

  • dkfn