Skip to main content

Bug Tracker

Side navigation

#11011 closed enhancement (fixed)

Opened December 13, 2011 03:42PM UTC

Closed May 16, 2012 06:04PM UTC

Allow traditional options object for $.Callbacks flags

Reported by: jaubourg Owned by:
Priority: low Milestone: 1.8
Component: deferred Version: 1.7.1
Keywords: 1.8-discuss Cc:
Blocked by: Blocking:
Description

This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following:

$.Callbacks( "once memory" );
$.Callbacks({
    once: true,
    memory: true
});
Attachments (0)
Change History (12)

Changed December 13, 2011 03:43PM UTC by jaubourg comment:1

component: unfileddeferred
description: This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following: \ \ {{{!js \ $.Callbacks( "once memory" ); \ $.Callbacks({ \ once: true, \ memory: true \ }); \ }}}This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following: \ \ {{{ \ $.Callbacks( "once memory" ); \ $.Callbacks({ \ once: true, \ memory: true \ }); \ }}}
keywords: → 1.8-discuss
priority: undecidedlow

Changed December 13, 2011 03:43PM UTC by jaubourg comment:2

milestone: None1.8

Changed December 13, 2011 04:29PM UTC by jaubourg comment:3

description: This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following: \ \ {{{ \ $.Callbacks( "once memory" ); \ $.Callbacks({ \ once: true, \ memory: true \ }); \ }}}This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following:\ \ {{{\ $.Callbacks( "once memory" );\ $.Callbacks({\ once: true,\ memory: true\ });\ }}}

+1

Changed December 13, 2011 05:56PM UTC by dmethvin comment:4

description: This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following:\ \ {{{\ $.Callbacks( "once memory" );\ $.Callbacks({\ once: true,\ memory: true\ });\ }}}This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following: \ \ {{{ \ $.Callbacks( "once memory" ); \ $.Callbacks({ \ once: true, \ memory: true \ }); \ }}}

-1, I am not sure how this improves the interface (especially if we have to keep the old one) and I am pretty sure it will increase the size.

Changed December 13, 2011 06:10PM UTC by jaubourg comment:5

Replying to [comment:4 dmethvin]:

-1, I am not sure how this improves the interface (especially if we have to keep the old one) and I am pretty sure it will increase the size.

We're basically talking about replacing:

flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};

with

flags = typeof flags === "string" ? ( flagsCache[ flags ] || createFlags( flags ) ) : ( flags || {} );

Are you being serious about the size Dave?

Regarding the gain, it's quite obviously easier and more natural to build an flags map compared to a string... not mention the possibility to add other (non-boolean) options in the future easily.

Changed December 14, 2011 03:36AM UTC by dmethvin comment:6

status: newopen

Changed December 14, 2011 04:17PM UTC by timmywil comment:7

_comment0: -11324316950481799
description: This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following: \ \ {{{ \ $.Callbacks( "once memory" ); \ $.Callbacks({ \ once: true, \ memory: true \ }); \ }}}This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following:\ \ {{{\ $.Callbacks( "once memory" );\ $.Callbacks({\ once: true,\ memory: true\ });\ }}}

+1

Changed December 15, 2011 07:31AM UTC by mikesherov comment:8

description: This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following:\ \ {{{\ $.Callbacks( "once memory" );\ $.Callbacks({\ once: true,\ memory: true\ });\ }}}This enhancement is quite simple. There is some concern about $.Callbacks flags being in a string format. I propose to accept objects as an alternative so that you could do both of the following: \ \ {{{ \ $.Callbacks( "once memory" ); \ $.Callbacks({ \ once: true, \ memory: true \ }); \ }}}

-1, YAGNI. If we ever have a need for an object version, we can add it then.

Changed December 19, 2011 05:38PM UTC by rwaldron comment:9

+1

Changed January 02, 2012 04:30PM UTC by dmethvin comment:10

+1, Changing my vote if it's that small, although the Callbacks api footprint is still an issue

Changed April 01, 2012 11:06PM UTC by jaubourg comment:11

Changed May 16, 2012 06:04PM UTC by jaubourg comment:12

resolution: → fixed
status: openclosed

Allows traditional options object for $.Callbacks flags. Fixes #11011. Unit tests added.

Changeset: 7fa0da08b88534e486ddb7eb3752ef76467fb7dd