Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@68publishers/cookie-consent-resolver
Advanced tools
Changelog
1.0.1 - 2023-05-17
Readme
Utility for 68publishers/cookie-consent that allows you to inject scripts without waiting for the cookies widget to load!
In some cases, it is desirable to run some scripts as soon as possible, and initializing the cookie widget may slow down the execution of these scripts. This package allows scripts to be injected into the page immediately if the user has already given consent.
The first option is to download the package as a module.
$ npm i --save @68publishers/cookie-consent-resolver
# or
$ yarn add @68publishers/cookie-consent-resolver
And import it in your project.
import CookieConsentResolver from '@68publishers/cookie-consent-resolver';
// or
const CookieConsentResolver = require('@68publishers/cookie-consent-resolver');
Or you can import the CookieConsentResolver
into the browser from the CDN
<script src="https://unpkg.com/@68publishers/cookie-consent-resolver/dist/cookie-consent-resolver.min.js"></script>
var cookieConsentResolver = CookieConsentResolver.createFromCookie('cc-settings');
cookieConsentResolver.bindCookieConsentWrapper(CookieConsentWrapper);
// the following script will be injected if the `ad_storage` is enabled
cookieConsentResolver.injectScript('ad_storage', 'https://www.example.com/my-script.js');
// the following script will be injected if the `ad_storage` and `analytics_storage` are enabled
cookieConsentResolver.injectScript(['ad_storage', 'analytics_storage'], 'https://www.example.com/my-script2.js');
Additional <script>
tag attributes can be provided in the third argument.
cookieConsentResolver.injectScript('ad_storage', 'https://www.example.com/my-script.js', {
id: 'my-script',
async: true,
});
If you want to do anything other than inject the script in case of consent, you can use the resolve()
method.
cookieConsentResolver.resolve('ad_storage', () => {
console.log('Ad storage is enabled!');
});
The package is distributed under the MIT License. See LICENSE for more information.
FAQs
Inject scripts without waiting for the cookies widget to load!
The npm package @68publishers/cookie-consent-resolver receives a total of 4 weekly downloads. As such, @68publishers/cookie-consent-resolver popularity was classified as not popular.
We found that @68publishers/cookie-consent-resolver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.