それを壊すには:items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source;
したがって、オブジェクトには source と呼ばれるプロパティがあり、配列または関数のthis.source
ように見えます。this.source
それらの述語関数$.isFunction(this.source)
はオブジェクトを取り、それが関数の場合は true を返します。関数の場合はthis.source(this.query, $.proxy(this.process, this))
実行されます。
ここで、this.source(this.query, $.proxy(this.process, this))
通話を中断します。
$.isFunction(this.source)
関数である呼び出しの結果から、 this.source
2 つの引数を取ることがわかります。最初this.query
は文字列だと思います。2 つ目$.proxy(this.process, this))
は、コールバック関数です。関数とオブジェクト/コンテキストの 2 つの$.proxy
引数を取り、新しい関数を返します。返された関数コンテキスト ( this
) は、確実にオブジェクト/コンテキストで渡されます。
$.proxy
このように見えます
var proxy = function( func, context ) {
return ( function() {
func.apply( context, arguments );
});
};
//build a new function and set this to window
var newFunction = proxy( someOrtherFunction, window );
//use the new function
newFunction();
ここで詳細を準備でき$.proxy
ます:http://api.jquery.com/jQuery.proxy/
から生成された新しく作成された関数は、コールバックとして関数$.proxy(this.process, this)
で使用されます。this.source