欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

callbacks.lock()方法怎么用

這篇文章將為大家詳細講解有關(guān)callbacks.lock()方法怎么用,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比安達網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式安達網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋安達地區(qū)。費用合理售后完善,十多年實體公司更值得信賴。

callbacks.lock()

描述: 鎖定回調(diào)列表的當前狀態(tài)。

添加的版本: 1.7callbacks.lock()

這個方法不接受任何參數(shù)

此方法返回綁定它的那個回調(diào)對象(this).

如果回調(diào)對象被創(chuàng)建,用"memory"標志作為它的參數(shù),綁定函數(shù)可能會在回調(diào)列表中被鎖定后增加并且觸發(fā)。

例子:

Example: 用 callbacks.lock() 鎖定一個回調(diào)列表,以避免進一步的修改列表狀態(tài) :

// a sample logging function to be added to a callbacks list

var foo = function( value ) {

console.log( "foo:" + value );

};

var callbacks = $.Callbacks();

// add the logging function to the callback list

callbacks.add( foo );

// fire the items on the list, passing an argument

callbacks.fire( "hello" );

// outputs "foo: hello"

// lock the callbacks list

callbacks.lock();

// try firing the items again

callbacks.fire( "world" );

// as the list was locked, no items

// were called, so "world" isn"t logged

Example: Use callbacks.lock() to lock a callback list with "memory," and then resume using the list:

<!DOCTYPE html>

<html>

<head>

<script src="https://code.jquery.com/jquery-latest.js"></script>

</head>

<body>

<div id="log"></div>

<script>// simple function for logging results

var log = function( value) {

$( "#log" ).append( "<p>" + value + "</p>" );

};

// two sample functions to be added to a callbacks list

var foo = function( value ) {

log( "foo: " + value );

};

var bar = function( value ) {

log( "bar: " + value );

};

// create the callbacks object with the "memory" flag

var callbacks = $.Callbacks( "memory" );

// add the foo logging function to the callback list

callbacks.add( foo );

// fire the items on the list, passing an argument

callbacks.fire( "hello" );

// outputs "foo: hello"

// lock the callbacks list

callbacks.lock();

// try firing the items again

callbacks.fire( "world" );

// as the list was locked, no items were called,

// so "foo: world" isn't logged

// add the foo function to the callback list again

callbacks.add( foo );

// try firing the items again

callbacks.fire( "silentArgument" );

// outputs "foo: hello" because the argument value was stored in memory

// add the bar function to the callback list

callbacks.add( bar );

callbacks.fire( "youHadMeAtHello" );

// outputs "bar: hello" because the list is still locked,

// and the argument value is still stored in memory

</script>

</body>

</html>

關(guān)于“callbacks.lock()方法怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

網(wǎng)站欄目:callbacks.lock()方法怎么用
路徑分享:http://chinadenli.net/article22/gjcijc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動網(wǎng)站建設(shè)關(guān)鍵詞優(yōu)化、全網(wǎng)營銷推廣、搜索引擎優(yōu)化、品牌網(wǎng)站制作網(wǎng)站維護

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化