当前位置: 首页 > 软件库 > 程序开发 > >

ember-cookies

授权协议 MIT License
开发语言 JavaScript
所属分类 程序开发
软件类型 开源软件
地区 不详
投 递 者 韩靖琪
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

CI

ember-cookies

ember-cookies implements an abstract cookie API that works both in thebrowser (via document.cookie) as well as with Fastboot in the servercontext (using the request and response accessible via the fastBootservice).

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

Installation

Install ember-cookies with

ember install ember-cookies

Example Usage

// app/controllers/application.js
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
const { keys } = Object;

export default class ApplicationController extends Controller {
  @service cookies;

  @computed
  get allCookies () {
    let cookieService = this.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:

  • read(name, options = {}): reads the cookie with the given name, returns itsvalue as a String; options can be used to set raw (boolean, disablesURL-decoding the value).
  • write(name, value, options = {}): writes a cookie with the given name andvalue; options can be used to set domain, expires (Date), maxAge (timein seconds), path, secure, raw (boolean, disables URL-encoding thevalue) and sameSite.
  • clear(name, options = {}): clears the cookie so that future reads do notreturn a value; options can be used to specify domain, path or secure.
  • exists(name): checks whether a cookie exists at all (even with a falsyvalue) and returns true if that is the case or false otherwise.

License

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

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

  • 引子 SPA(单页面应用)的核心是什么? 自该类型应用诞生以来我最多思考的问题就是这个。现在前端 SPA 框架满天飞,许多不是框架的也被称作框架,究竟有什么代表性的层(layer)能让一个系统称得上是框架? 我的答案是路由,而路由的本质就是一个状态管理器。没有路由机制的系统不能称之为框架,而路由机制做得不好的框架也算不上好框架(但可以算是好的工具集合,比如 Angular——详见我在 Ruby C

 相关资料
  • Ember检查器是一个浏览器插件,用于调试Ember应用程序。 灰烬检查员包括以下主题 - S.No. 灰烬检查员方式和描述 1 安装Inspector 您可以安装Ember检查器来调试您的应用程序。 2 Object Inspector Ember检查器允许与Ember对象进行交互。 3 The View Tree 视图树提供应用程序的当前状态。 4 检查路由,数据选项卡和库信息 您可以看到检查

  • 英文原文: http://emberjs.com/guides/getting-ember/index/ Ember构建 Ember的发布管理团队针对Ember和Ember Data维护了不同的发布方法。 频道 最新的Ember和Ember Data的 Release,Beta 和 Canary 构建可以在这里找到。每一个频道都提供了一个开发版、最小化版和生产版。更多关于不同频道的信息可以查看博客

  • ember-emojione ember-emojione is your emoji solution for Ember, based on the EmojiOne project. EmojiOne version 2 is used, which is free to use for everyone (CC BY-SA 4.0), you're only required to giv

  • Ember 3D Ember 3D is an Ember addon for using Three.js - an easy to use, lightweight, javascript 3D library. It is designed to: Prescribe a solid file structure to Three.js code using ES6 modules. Ena

  • Ember Table An addon to support large data set and a number of features around table. Ember Table canhandle over 100,000 rows without any rendering or performance issues. Ember Table 3.x supports: Emb

  • vscode-ember This is the VSCode extension to use the Ember Language Server. Features All features currently only work in Ember-CLI apps that use classic structure and are a rough first draft with a lo