@onsetio/widget
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published
Onset

Official Onset SDK for Widget Embed

npm version Documentation

We recommend that you should always be loaded the Widget.js script directly from https://widget.onset.io/widget.js, rather than including it in a bundle or host yourself. If must bundle the Widget code into your application, you can use this package.

Installation and Usage

Simply install the package:

npm install --save @onsetio/widget
yarn add @onsetio/widget

Setup and usage of these SDKs always follows the same principle.

import Widget from '@onsetio/widget';

const widgetInstance = new Widget({
  page: '__PAGE_HOST__',
  // ...
});

Embed via CDN

<script>
  window.onsetWidgetSettings = {
    triggerText: "🔔 What's New",
    page: '__PAGE_HOST__',
    // ...
  };

  (function (e, t) {
    e.onsetWidget = {};
    e.onsetWidget.on = function () {
      (e.onsetWidget.$ = e.onsetWidget.$ || []).push(arguments);
    };
    var c = t.getElementsByTagName('script')[0],
      i = t.createElement('script');
    i.async = true;
    i.src = 'https://widget.onset.io/widget.js';
    c.parentNode.insertBefore(i, c);
  })(window, document);
</script>

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.2
    0
    • latest

Version History

Package Sidebar

Install

npm i @onsetio/widget

Weekly Downloads

0

Version

0.2.2

License

none

Unpacked Size

27.7 kB

Total Files

11

Last publish

Collaborators

  • sonnyt