Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use callbacks.fire ()

Shulou Source: shulou.com Published: 2022-06-01 07:34:37 11月16日 Update

This article mainly introduces how to use callbacks.fire (), has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Callbacks.fire (arguments)

Description: all callbacks are called by passing in the specified parameters

Added version: 1.7callbacks.fire (arguments)

Arguments

Type: Anything

This parameter or parameter list is returned to the callback list.

This method returns the callback object (this) that binds it.

Example

Use callbacks.fire () to invoke the callback in the list with any passed arguments:

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

Var foo = function (value) {

Console.log ("foo:" + value)

}

Var callbacks = $.Callrooms ()

/ / add the function "foo" to the list

Callbacks.add (foo)

/ / fire the items on the list

Callbacks.fire ("hello"); / / outputs: "foo: hello"

Callbacks.fire ("world"); / / outputs: "foo: world"

/ / add another function to the list

Var bar = function (value) {

Console.log ("bar:" + value)

}

/ / add this function to the list

Callbacks.add (bar)

/ / fire the items on the list again

Callbacks.fire ("hello again")

/ / outputs:

/ / "foo: hello again"

/ / "bar: hello again"

Thank you for reading this article carefully. I hope the article "how to use callbacks.fire ()" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Parameters articles value interest at the same time objects more friends this method version knowledge type editing industry information information channels channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Redmi MySQL Shulou Technology NVidia