Opened 11 years ago

Closed 3 years ago

#6411 closed defect (patchwelcome)

Consider better options for preventing addOnUnload functions from being called

Reported by: James Burke Owned by: James Burke
Priority: low Milestone: 1.13
Component: Core Version: 1.1.0
Keywords: needsreview Cc:
Blocked By: Blocking:

Description

Right now if you want to prompt the user on the beforeunload event if they want to close the page or do some save action, then it is hard to do so without the addOnUnload listeners being called, since they are triggered onbeforeunload.

One way might be to just pass the unload event to dojo.unloaded so if you wanted the above behavior you can override dojo.unloaded and stop the event based on a condition.

That would be the easiest change, but still requires lots of work on the developer. Consider other options too.

Change History (7)

comment:1 Changed 11 years ago by James Burke

Owner: changed from anonymous to James Burke

comment:2 Changed 11 years ago by liucougar

what about add another event, say dojo.beforeOnUnload, and in dojo.unloaded, check whether dojo.beforeOnUnLoad is defined, if so check the return value of dojo.beforeOnUnLoad, if it is true, stop processing onUnload handler and dismiss the unload event

alternatively, we can have a dojo.addBeforeOnUnload function, and users can register a function to be called upon beforeonunload to determine whether the event should be stoped

comment:3 Changed 11 years ago by James Burke

Milestone: 1.2future

Not going to get to this in time for 1.2 beta build.

comment:4 Changed 11 years ago by James Burke

See also duplicate #7771 for more conversation on this issue.

comment:5 Changed 11 years ago by James Burke

See duplicate (really the first report) ticket #4478 for other info too.

comment:6 Changed 7 years ago by ben hockey

Keywords: needsreview added
Priority: highlow

comment:7 Changed 3 years ago by dylan

Milestone: future1.12
Resolution: patchwelcome
Status: newclosed

Given the lack of interest over the past 5+ years, I'm closing as patchwelcome. Please re-open if you want to create a pull request.

Note: See TracTickets for help on using tickets.