Neanderthal Pudding Mix

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

    0.0.17 • 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>

    Keywords

    none

    Install

    npm i @onsetio/widget

    DownloadsWeekly Downloads

    55

    Version

    0.0.17

    License

    none

    Unpacked Size

    22.1 kB

    Total Files

    11

    Last publish

    Collaborators

    • sonnyt