Giter Site home page Giter Site logo

jquery.cookie's Introduction

jquery.cookie spm version

AUTHOR WEBSITE: http://ydr.me/

Simple to operate cookie.

IT IS A spm package.

#USAGE

var $ = require('jquery');
require('jquery.cookie')($);

// 1. 配置参数
$.cookie.defaults = {...};
$.cookie(settings);


// 2. 设置cookie
$.cookie(settings).set('key', 'value');
$.cookie(settings).set({
   'key1': 'val1',
   'key2': 'val2'
});


// 3. 获取cookie
$.cookie(settings).get();
$.cookie(settings).get('key');
$.cookie(settings).get(['key1', 'key2']);


// 4. 清除cookie
$.cookie(settings).remove();
$.cookie(settings).remove('key');
$.cookie(settings).remove(['key1', 'key2']);

#OPTIONS

defaults = {
    // 是否以严格模式读取和设置cookie,默认true
    // 严格模式下,将在读之后、写之前都会进行 encodeURIComponent、decodeURIComponent操作
    isStrict: !0,
    // 在无域名的时候,必须设置为空才能在本地写入
    domain: location.hostname || '',
    // 默认cookie有效期1个小时(单位秒)
    expires: 3600,
    // 默认cookie存储路径
    path: '/',
    // 是否加密cookie
    secure: !1
}

#SET OPTIONS

$.cookie.defaults;

jquery.cookie's People

Contributors

cloudcome avatar

Watchers

James Cloos avatar

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.