Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@doars/doars-cookies
Advanced tools
Doars plugin that adds a cookies context to add and remove browser cookies.
Plugin that adds a cookies context to add and remove browser cookies
Install the package from NPM, then import and enable the library in your build.
npm i @doars/doars @doars/doars-cookies
// Import library.
import Doars from '@doars/doars'
import DoarsCookies from '@doars/doars-cookies'
// Setup a library instance.
const doars = new Doars()
// Setup the plugin.
const doarsCookies = new DoarsCookies(doars /*, options */)
// Enable library.
doars.enable()
Add the IIFE build to the page from for example the jsDelivr CDN and enable the library.
<!-- Import library. -->
<script src="https://cdn.jsdelivr.net/npm/@doars/doars@2/dst/doars.iife.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@doars/doars-cookies@2/dst/doars-cookies.iife.js"></script>
<script type="application/javascript">
document.addEventListener('DOMContentLoaded', () => {
// Setup a library instance.
const doars = new window.Doars()
// Setup the plugin.
const doarsCookies = window.DoarsCookies(doars /*, options */)
// Enable library.
doars.enable()
})
</script>
ESM and IIFE builds are also available via the jsDelivr CDN.
The following contexts are added by the plugin.
Access the cookies object.
<!-- Sets a 'hello' cookie to 'world' -->
<div d-initialize="$cookies.hello = 'world'"></div>
<!-- Logs the 'hello' cookie the console -->
<div d-initialize="console.log($cookies.hello)"></div>
<!-- Deletes the 'hello' cookie -->
<div d-initialize="$cookies.hello = null"></div>
constructor
Create plugin instance.
@param {Doars} library
A doars library instance.@returns {DoarsCookies}
@doars/doars-cookies version | @doars/doars version |
---|---|
2.x | 2.x |
FAQs
Doars plugin that adds a cookies context to add and remove browser cookies.
We found that @doars/doars-cookies 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.