simplabs/ember-cookies

Name: ember-cookies

Owner: simplabs

Description: Cookies abstraction for Ember.js that works both in the browser as well as with Fastboot on the server

Created: 2016-03-12 08:34:56.0

Updated: 2018-04-24 08:59:11.0

Pushed: 2018-05-17 09:59:45.0

Homepage: null

Size: 246

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

ember-cookies

ember-cookies implements an abstract cookie API that works both in the browser (via document.cookie) as well as with Fastboot in the server context (using the request and response accessible via the fastBoot service).

Having access to cookies both in the browser as well as in FastBoot is key to being able to share a common session.

Installation

Install ember-cookies with

ember install ember-cookies

Example Usage
pp/controllers/application.js
rt Controller from '@ember/controller';
rt { inject as service } from '@ember/service';
rt { computed } from '@ember/object';
t { keys } = Object;

rt default Controller.extend({
okies: service(),

lCookies: computed(function() {
let cookieService = this.get('cookies');
cookieService.write('now', new Date().getTime());

let cookies = cookieService.read();
return keys(cookies).reduce((acc, key) => {
  let value = cookies[key];
  acc.push({ name: key, value });

  return acc;
}, []);


API

The cookies service has methods for reading and writing cookies:

License

ember-cookies is developed by and © simplabs GmbH and contributors. It is released under the MIT License.

ember-cookies is not an official part of Ember.js and is not maintained by the Ember.js Core Team.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.