@abtasty/widget-utils

Collection of useful functions for AB Tasty Widgets.

Usage no npm install needed!

<script type="module">
  import abtastyWidgetUtils from 'https://cdn.skypack.dev/@abtasty/widget-utils';
</script>

README

Widgets Utils

Collection of useful functions for AB Tasty Widgets.

Installation

Inside your Widget folder, install the widget-utils library:

npm install @abtasty/widget-utils

Note: you can also use yarn instead of npm: yarn add @abtasty/widget-utils

Usage

With Webpack or Rollup.js:

import { waitForElement, isAffected } from '@abtasty/widget-utils'

const waitForBody = waitForElement('#section', section => {
    section.insertAdjacentHTML('beforeend', '<p>New paragraph at the end of that section.</p>');
});

setTimeout(() => {
    if (!isAffected()) {
        waitForBody.clear();
    }
}, 10000);