Opened 13 years ago

Closed 11 years ago

#2229 closed enhancement (wontfix)

Make using Dojo Event with Dojo Storage more elegant

Reported by: bradneuberg Owned by: bradneuberg
Priority: high Milestone: 1.4
Component: Storage/Flash Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Brad Neuberg)

Right now, if you use Dojo Event with Dojo Storage to know when the storage subsystem is loaded, you have to do an ugly block like this:

if(dojo.storage.manager.isInitialized() == false){

dojo.event.connect(dojo.storage.manager,

"loaded", Moxie, Moxie.initialize);

}else{

dojo.event.connect(dojo, "loaded",

Moxie, Moxie.initialize);

}

Thats just ugly boilerplate; I'd like to make it just be:

dojo.event.connect(dojo.storage.manager,

"loaded", Moxie, Moxie.initialize);

However, here's the problem; if we reach that dojo.event.connect and the storage system is already initialized, then Moxie.initialize never gets called! We need to find a way to have that "loaded" event fired even after we have been loaded if someone is adding a listener afterwards. Not sure how to do this in dojo.event.

Making this cleaner will eliminate a common source of bugs for people using Dojo Storage and make their code cleaner.

Change History (5)

comment:1 Changed 13 years ago by liucougar

have a look at deferred

that may be what you need

comment:2 Changed 12 years ago by dylan

Milestone: 0.91.0

comment:3 Changed 12 years ago by bradneuberg

Milestone: 1.01.1

comment:4 Changed 11 years ago by bradneuberg

Milestone: 1.11.4

comment:5 Changed 11 years ago by Brad Neuberg

Description: modified (diff)
Resolution: wontfix
Status: newclosed

I'm going to close this since its been open forever as a note to myself, like a todo list item. Marking as WONTFIX for now.

Note: See TracTickets for help on using tickets.