
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
third-partay.js
Advanced tools
A tiny library that loads and manages external third-party JavaScript snippets.
A tiny library that loads and manages external third-party JavaScript snippets.
Sometimes you need to include a vendor's third party "cut and paste" JavaScript snippet in your project. ThirdPartay is a tiny, dependency-free library that gives you basic loading, management, and callback capabilities (via ES6 promises) over those unruly snippets. With ThirdPartay, you can bridge the gap between your own code and external vendor-provided scripts.
To use ThirdPartay, you'll need a modern JavaScript workflow and build system with ES6 module bundling and transpiling capabilities. Here's a great example. ThirdPartay makes use of ES6 promises, which are supported in modern browsers. To support older browsers, you might need to polyfill.
Install ThirdPartay via NPM and add to your dependencies:
$ npm install third-partay.js --save
Import the ThirdPartay module, then instantiate it. The constructor takes an optional selector argument, this is the selector to which your third party scripts will be appended. The default document.body should be fine in most cases.
// import ThirdPartay
import ThirdPartay from 'third-partay.js'
// create an instance
const Party = new ThirdPartay()
Each instance represents a group of external scripts. You can add as many scripts to an instance as you'd like.
Party.add('//cdn.urltoyourvendorsscript.com/script.js')
Party.add('//static.urltoanothervendorsscript.com/script.js')
Each instance returns a promise when all member scripts are loaded, allowing you to create intelligent groups of third party snippets with asynchronous promise-driven callbacks. Add a callback function to your instance to execute it once all of the instances scripts have been loaded.
Party.loaded((returned) => {
console.log(returned);
});
MIT. © 2016 Donny West
FAQs
A tiny library that loads and manages external third-party JavaScript snippets.
We found that third-partay.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.