parookiejs

1.2.1 • Public • Published

parookiejs

npm build status

Parookie.js is an MIT-licensed JavaScript package/script that creates a cookie from every url parameter (?name=value) using URLSearchParams(window.location.search)

Installation

browser:

<script src="function.js"></script>
<script>
  cookify(expirationTime, useSessionStorage, whitelist, debug)
</script>

npm:

npm i parookiejs

node.js:

var parookie = require('parookie');

bower:

bower install EthanMcBloxxer/parookiejs

yarn:

yarn add parookiejs

requirejs:

require({'paths': {'parookie': 'path/to/parookiejs'}}, ['parookiejs'], function(x) {console.log(x);});

API

cookify()

This is the main function for parookie, which converts the url parameters into cookies.

int expirationTime

In miliseconds, the expiration time of the cookie. Set to 0 to disable and make the cookie permanent. 1-1000 is a good option for keeping the cookie on just page load.

bool useSessionStorage

true: Use sessionStorage instead of cookies
false: Don't impact the script

array whitelist[]

Add values to this for them to be the only creatable cookies, like ["1", "2"]. Leave as [] to disable.

bool debug

Log to the console when an event completes

Example

require("function.js");
cookify(0, false, [], false);

Readme

Keywords

Package Sidebar

Install

npm i parookiejs

Weekly Downloads

2

Version

1.2.1

License

MIT

Unpacked Size

10 kB

Total Files

9

Last publish

Collaborators

  • ethanmcbloxxer