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);