Skip to main content

Bug Tracker

Side navigation

#15158 closed feature (migrated)

Opened June 20, 2014 09:38AM UTC

Closed October 21, 2014 12:43AM UTC

Allow to fire callbacks in reversed order using $.Callbacks object

Reported by: logo Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.1
Keywords: Cc:
Blocked by: Blocking:

A new flag (e.g. "reversed") could be added to $.Callbacks object, which would make method to fire callbacks in reversed order.

Stack-based execution patterns are very popular and this flag would add another possible usage to this simple yet powerful tool.


function fn1( value ) {
  console.log( value );
function fn2( value ) {
  console.log( "fn2 says: " + value );
  return false;

var callbacks = $.Callbacks( "reversed" );
callbacks.add( fn1 );
// Outputs: foo! "foo!" );
callbacks.add( fn2 );
// Outputs: fn2 says: bar!, foo! "bar!" );
Attachments (0)
Change History (2)

Changed June 23, 2014 03:33AM UTC by dmethvin comment:1

If this had a low (near zero) byte cost it could be possible to add, but someone would need to do an implementation to see the cost. The number of people using $.Callbacks directly seems to be very low so this would probably not benefit many people.

Changed October 21, 2014 12:43AM UTC by m_gol comment:2

resolution: → migrated
status: newclosed