sknk-client

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

Usage no npm install needed!

<script type="module">
  import sknkClient from 'https://cdn.skypack.dev/sknk-client';
</script>

README

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