GithubHelp home page GithubHelp logo

seebiscuit / aurelia-cookie Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vheissu/aurelia-cookie

0.0 1.0 0.0 82 KB

A simplistic ES2015 class for working with cookies in Aurelia (or any modern Javascript application).

License: MIT License

JavaScript 49.10% TypeScript 50.90%

aurelia-cookie's Introduction

aurelia-cookie

A simplistic ES2015 class for working with cookies in Aurelia (or any modern Javascript application).

Installation

Jspm

jspm install npm:aurelia-cookie

Aurelia CLI/Webpack

npm install aurelia-cookie

CLI User?

The Aurelia CLI requires some additional configuration to use this plugin. Open up your aurelia.json file located in the aurelia_project directory and at the bottom of the dependencies section add in the following:

{
    "name": "aurelia-cookie",
    "path": "../node_modules/aurelia-cookie/dist/amd",
    "main": "index"
}

Setup

Just like you would any other plugin, simply instantiate it with the framework inside of your main bootstrapping file.

aurelia.use
.plugin('aurelia-cookie');

Use

import {AureliaCookie} from 'aurelia-cookie';

// Set a cookie
AureliaCookie.set('name', 'value', {
    expiry: 1, // Expiry in hours, -1 for never expires or minimum 1 for one hour, 2 for two hours and so
    path: '', // Specify cookie path
    domain: '', // Domain restricted cookie
    secure: false // Either true or false
});

AureliaCookie.get('name'); // Get a cookie value

AureliaCookie.delete('name'); // Delete a cookie by name

AureliaCookie.all(); // Returns an array of all set cookies

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.