Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#4969 closed enhancement (fixed)

[patch][cla] Carry over functionality from 0.4.x for cookies

Reported by: jgarfield Owned by: dante
Priority: high Milestone: 1.1
Component: Core Version: 0.9
Keywords: cookie, dojo.cookie, dojo.io.cookie Cc:
Blocked By: Blocking:

Description

In Dojo 0.4.x, there were a few functions that didn't make it into 0.9...

dojo.io.cookie.setObjectCookie

dojo.io.cookie.getObjectCookie

dojo.io.cookie.isSupported

These can be very helpful for users of the toolkit, especially even the cookie-check (isSupported) itself.

I've created a patch to add the following two functions to cookie.js (dojo.cookie)

dojo.cookie.object - Allows the getting/setting of objects into/from a cookie

dojo.cookie.isSupported - Allows a single call to tell if the browser supports cookies

Attachments (1)

Ticket_4969.patch (1.1 KB) - added by jgarfield 12 years ago.
.patch file for Ticket #4969

Download all attachments as: .zip

Change History (12)

Changed 12 years ago by jgarfield

Attachment: Ticket_4969.patch added

.patch file for Ticket #4969

comment:1 Changed 12 years ago by Adam Peller

should dojo.cookie.object be folded into dojo.cookie? in fact, I'd wonder if we could just use to/from Json all of the time, except it does weird things with primitives.

comment:2 Changed 12 years ago by Adam Peller

Summary: Carry over functionality from 0.4.x for cookies[patch]Carry over functionality from 0.4.x for cookies

see #4970

comment:3 Changed 12 years ago by dylan

patch looks ok to me... it would be nice if we can add unit tests for this as well to http://trac.dojotoolkit.org/browser/dojo/trunk/tests/cookie.html

comment:4 Changed 12 years ago by dylan

Owner: changed from anonymous to alex

on second though, I'm not sure we should use the word object given its reserved nature... thoughts?

comment:5 Changed 12 years ago by dylan

Summary: [patch]Carry over functionality from 0.4.x for cookies[patch][cla] Carry over functionality from 0.4.x for cookies

comment:6 Changed 12 years ago by Adam Peller

Milestone: 1.01.1

comment:7 Changed 12 years ago by jgarfield

I agree with folding this into dojo.cookie if it won't cause too many problems for the users of the toolkit.

If we do fold it into the main function, then we would only have to worry about the wording of it in the comments, since we'd be handling the serializing/de-serializing of the JSON for the user.

Just my 2-cents :)

comment:8 Changed 11 years ago by dylan

Owner: changed from alex to dante

Reassigning to dante... should be pretty trivial, but need to decide where to put this to not add to the size of Base.

comment:9 Changed 11 years ago by Adam Peller

Component: GeneralCore

cookie.js is core, not base, so no problem.

love the patch. perhaps we could call the 'object' method 'fromObject'? Wonder if it's worth keeping the string/object magic API or just picking one?

comment:10 Changed 11 years ago by dante

Resolution: fixed
Status: newclosed

(In [11834]) fixes #4969 - went with dojo.cookie.useObject (get/setObject combination? - contemplated asObject, and others. change if inappropriate) ... adds test to and enabled the cookie doh test. couldn't figure out a simple simple way to drop useObject functionality into dojo.cookie without mini refactor.

comment:11 Changed 11 years ago by Adam Peller

(In [12445]) remove useObject, since it's really a one-liner for the developer. Fixes #5810. reduce some code. use expires to remove test cookie. Refs #4969 !strict

Note: See TracTickets for help on using tickets.