Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@abtasty/widget-utils
Advanced tools
Collection of useful functions for AB Tasty Widgets.
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
With Webpack or Rollup.js:
// Import what you need
import { domReady, log } from '@abtasty/widget-utils'
domReady(() => {
log('The dom is ready here..')
})
domReady(callback)
Trigger callback function once the page Document Object Model (DOM) is ready.
The is useful when you want to manipulate the DOM of the page (someting that you will probably do with a Widget). This function ensures that the DOM is ready and you can safely manipulate it, even if your Widget is injected before the document is ready.
domReady(() => {
// The dom is ready here..
})
waitForElement(selector, successCallback, errorCallback)
Trigger a callback function once a specific element on the page is ready.
Similar to domReady
, but this function will not wait for the DOM to be ready but for a more specific element on the page. For example, the DOM can be ready but the webpage adds an element after the page is fully loaded. If the element is not found after 10 secondes, errorCallback
is called.
waitForElement('.footer', (footer) => {
// Footer is found and ready to be manipulated.
}, (error) => {
// Footer not found :(
})
Note: It is strongly recommended to use this function if you let the user select an element with an Element selector input, see https://abtasty.gitbooks.io/widget/create-widget/configuration-form.html#element-selector.
log(...messages)
Log messages prefixed with "AB Tasty Widget" and the name of your widget.
log(`Can't find element.`)
// Will output:
// [AB Tasty Widget] tooltip: Can't find element.
FAQs
Collection of useful functions for AB Tasty Widgets.
The npm package @abtasty/widget-utils receives a total of 250 weekly downloads. As such, @abtasty/widget-utils popularity was classified as not popular.
We found that @abtasty/widget-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 30 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.