UNPKG

@dutchfurniturefulfilment/skik-client

Version:

Javascript package for integrating a SKIK configurator inside web projects.

42 lines (25 loc) 1.53 kB
# SKIK Client - Quick-start guide ## Installation Install the SKIK client package from NPM: ```bash $ npm install @dutchfurniturefulfilment/skik-client --save ``` ## Basic usage **Module environments (ESM, CommonJS)** Import the default export of the package into your project: ```javascript import SKIKClient from `@dutchfurniturefulfilment/skik-client; ``` **Global scope** The package is built as a **UMD bundle**, meaning it is also possible to simply include the file `./dist/skik-client.js` in a `<script>` tag, and a global variable `SKIKClient` should become available, as an alternative to importing within an ES Module- or CommonJS-environments. ## Instantiating `SKIKClient.Client` instances The SKIKClient module provides a single [static method `create`](api/static#creating-a-skikclient-instance), which accepts a single argument of type object used to provide the [configuration options](api/static#constructor-options) for the instance: ```javascript // Create a new SKIKClient instance: const skikClient = SKIKClient.create({ containerId: 'my-frame-container' }); ``` ## Listening for events A client instance provides the method [`Client.on()`](api/client#listening-for-events) to listen for a [selection of events](interfaces/event-channels) that are possibly of interest to your application. For example, we might want to log a message each time the lanuage of the configurator changed: ```javascript skikClient.on("locale-changed", (locale) => console.log(`Locale changed to "${locale}".`)); ```