?
本文檔使用 PHP中文網(wǎng)手冊(cè) 發(fā)布
訪問(wèn)給定的上下文和參數(shù)列表中的所有回調(diào)
context: 該列表中的回調(diào)被觸發(fā)的上下文引用
args: 一個(gè)參數(shù)或參數(shù)列表傳回給回調(diào)列表。
使用 callbacks.fireWith() 訪問(wèn)給定的上下文和參數(shù)列表中的所有回調(diào)。
// a sample logging function to be added to a callbacks list var log = function( value1, value2 ){ console.log( 'Received:' + value1 + ',' + value2 ); } var callbacks = $.Callbacks(); // add the log method to the callbacks list callbacks.add( log ); // fire the callbacks on the list using the context 'window' // and an arguments array callbacks.fireWith( window, ['foo','bar']); // outputs: Received: foo, bar