1.2.1 • Published 3 years ago

parookiejs v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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);
1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago