Skip to main content

Search and Top Navigation

#8826 closed feature (wontfix)

Opened November 17, 2012 10:17PM UTC

Closed November 21, 2012 02:08PM UTC

Widget: ._on() equivalent of .one()

Reported by: nix Owned by: nix
Priority: minor Milestone: 1.10.0
Component: ui.widget Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

It would be nice to have this so that, when hooking up a one-shot event, if the widget is destroyed before the event fires, the handler is removed.

Currently we'd have to call ._off() from the handler attached with ._on() to accomplish this.

Attachments (0)
Change History (5)

Changed November 18, 2012 03:35AM UTC by scottgonzalez comment:1

owner: → nix
status: newpending
summary: Need a one-shot version of ._on()Widget: ._on() equivalent of .one()
version: git1.9.1

Can you provide some examples of when you need this?

Changed November 18, 2012 12:04PM UTC by nix comment:2

status: pendingnew

In mobile's fixedToolbar, we implement toolbars that are persistent across pages by hooking a one-shot handler to the next page's "pageshow" event and attach the header/footer there. (or look for '.one( "pageshow"' ).

Now, mind you, "pagebeforehide" is called shortly before "pageshow" for the next page, so chances are the .one() handler will indeed run, but there's still a possibility that the page will be destroyed before the next one shows.

Changed November 19, 2012 04:19PM UTC by scottgonzalez comment:3

status: newpending

Is that the only place you would use it in jQuery Mobile? If so, I'm going to close as wontfix. While this case would be easy to handle, the case of using a named function reference via a string would not.

Changed November 21, 2012 10:07AM UTC by nix comment:4

status: pendingnew

I guess that's fine ...

Changed November 21, 2012 02:08PM UTC by scottgonzalez comment:5

resolution: → wontfix
status: newclosed