0.0.25 • Published 5 years ago

sknk-client v0.0.25

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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:

NameTypeDescription
namestringName of the application used by the Mother application
layoutOptionsLayoutOptionsUsed to give your rendering requirements ex : { id: "search" }
renderfunction(string, any, string): voidYou 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