Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use jQuery .subscribe()?

I've been trying to use $.subscribe but it doesn't seem to work. I downloaded a WAR project where it does work but when I use this function in my project it doesn't work. Do I have to download an extra plugin?

Because I couldn't find info about these functions in the jQuery website either, I just found the new $.Callbacks() function. The reason I need to use $.subscribe is so I can use something like onBeforeTopic.

Thanks in advance.

like image 923
Diego Ramos Avatar asked Aug 12 '12 01:08

Diego Ramos


People also ask

What is subscribe in jQuery?

The Publish Subscribe or pub/sub pattern is used to logically decouple object(s) that generate an event, and object(s) that act on it. It is a useful pattern for object oriented development in general and especially useful when developing asynchronous Javascript applications.

How use JavaScript subscribe?

The subscriber function defines how to obtain or generate values or messages to be published. To execute the observable you have created and begin receiving notifications, you call its subscribe() method, passing an observer. This is a JavaScript object that defines the handlers for the notifications you receive.

What does $( function ()) shorthand do?

So what is $(function() { });? Now that you know that $ is the name of the function, if you are using the jQuery library, then you are calling the function named $ and passing the argument function() {} into it. The jQuery library will call the function at the appropriate time.

What is the use of each () function in jQuery?

each(), which is used to iterate, exclusively, over a jQuery object. The $. each() function can be used to iterate over any collection, whether it is an object or an array. In the case of an array, the callback is passed an array index and a corresponding array value each time.


1 Answers

You will need Publish/subscribe plugin.

I stand corrected: you will need Struts2 jQuery Plugin.

like image 121
Bart Platak Avatar answered Sep 19 '22 11:09

Bart Platak