How to use jQuery .subscribe()?
-
25-06-2021 - |
Question
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.
Solution
You will need Publish/subscribe plugin.
I stand corrected: you will need Struts2 jQuery Plugin.
OTHER TIPS
I know I'm a bit late to the party but why not just write your own simple pubsub? Check out this article: https://lowbrowcoder.wordpress.com/2015/02/16/pubsub-pattern-in-javascript/