From d307b21d3dd54bf39d83c8839a6e6c8b4a5be45f Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Fri, 16 Oct 2015 10:59:55 -0400 Subject: [PATCH] Add cookie setter to jar --- src/lib/jar.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/jar.js b/src/lib/jar.js index d4f509780..250a04608 100644 --- a/src/lib/jar.js +++ b/src/lib/jar.js @@ -30,3 +30,10 @@ module.use = function (name, uri, callback) { }); }); }; + +module.set = function (name, value) { + var obj = cookie.serialize(name, value); + var expires = '; expires=' + new Date(new Date().setYear(new Date().getFullYear() + 1)).toUTCString(); + var path = '; path=/'; + document.cookie = obj + expires + path; +};