WoW LibPubSub-1.0 addon Dragonflight/Wrath of the Lich King Classic 2024
wow addon LibPubSub-1.0


Game Version: 9.1.0
Total Downloads: 2,278
Updated: Jul 4, 2021
Created: Apr 17, 2013
download LibPubSub-1.0Download Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
1.0.10 release 2.86 KB Jul 4, 2021 9.1.0 0 download LibPubSub-1.0 1.0.10 releaseDownload
1.0.9 release 2.98 KB Oct 1, 2019 8.2.5 +1 237 download LibPubSub-1.0 1.0.9 releaseDownload
1.0.8 release 2.87 KB Nov 18, 2016 7.1.0 442 download LibPubSub-1.0 1.0.8 releaseDownload
1.0.7 release 2.92 KB Feb 25, 2015 6.1.0 483 download LibPubSub-1.0 1.0.7 releaseDownload
1.0.6 release 2.93 KB Nov 3, 2014 6.0.3 328 download LibPubSub-1.0 1.0.6 releaseDownload
1.0.5 release 2.90 KB Oct 15, 2014 6.0.2 113 download LibPubSub-1.0 1.0.5 releaseDownload
1.0.4 release 2.92 KB Jan 6, 2014 5.4.2 290 download LibPubSub-1.0 1.0.4 releaseDownload
1.0.3 release 2.90 KB Sep 13, 2013 5.4.0 135 download LibPubSub-1.0 1.0.3 releaseDownload
1.0.2 release 2.90 KB May 22, 2013 5.3.0 134 download LibPubSub-1.0 1.0.2 releaseDownload
1.0.1 release 2.88 KB Apr 20, 2013 5.2.0 114 download LibPubSub-1.0 1.0.1 releaseDownload


Share this:


Simple embeddable publish-subscribe implementation.

Including LibPubSub functionality

The easiest method for utilising LibPubSub is a mixin, like so:

MyAddon = LibStub('AceAddon-3.0'):NewAddon('MyAddon', 'LibPubSub-1.0')

If you’re not using AceAddon, you can still embed LibPubSub in an
object/table via LibPubSub’s Embed() function:


If you don’t want to embed LibPubSub’s methods in your objects, you can
get a separate LibPubSub object:

local Observer = LibStub('LibPubSub-3.0'):New()

In the following examples, please replace Observer with the right


Observer:Publish(message, …)

This calls all listeners subscribed to this message, and passes the
arguments given after the message. Multiple objects or functions can be
subscribed to the same message.


  • message (string)

    • The message to publish
  • (mixed)

    • Any arguments to pass to the listeners

Observer:Subscribe(message[, object][, function])

There are multiple ways to subscribe to messages, and multiple listeners
can be attached for the same message:

Observer:Subscribe('NAME_OF_MESSAGE') -- calls Observer:NAME_OF_MESSAGE()
Observer:Subscribe('NAME_OF_MESSAGE', funcref) -- calls funcref()
Observer:Subscribe('NAME_OF_MESSAGE', 'FunctionName') -- calls Observer:FunctionName()
Observer:Subscribe('NAME_OF_MESSAGE', Object) -- calls Object:NAME_OF_MESSAGE()
Observer:Subscribe('NAME_OF_MESSAGE', Object, 'FunctionName') -- calls Object:FunctionName()

The second, third and fourth versions of attaching listeners can also be
passed as a table, as shorthand for attaching listeners for multiple

Observer:Subscribe({NAME_OF_MESSAGE = funcref, OTHER_MESSAGE = 'FunctionName'})

The arguments passed to the listener are the arguments passed to the
Publish function after the message name.


  • message (string)

    • The message to subscribe to
  • object (table)

    • The object the function should be called on
  • function (string/funcref)

    • The function to call

Observer:Unsubscribe(message[, object][, function])

This works exactly the same as subscribing to a message. Note that you
need to pass the same arguments to Unsubscribe as you passed to
Subscribe to remove a listener for a message. That means that, if you
subscribed using Observer:Subscribe('NAME_OF_MESSAGE', funcref) you
need to unsubscribe using Observer:Unsubscribe('NAME_OF_MESSAGE',

The possible ways to call this function:

Observer:Unsubscribe('NAME_OF_MESSAGE', funcref)
Observer:Unsubscribe('NAME_OF_MESSAGE', 'FunctionName')
Observer:Unsubscribe('NAME_OF_MESSAGE', Object)
Observer:Unsubscribe('NAME_OF_MESSAGE', Object, 'FunctionName')
Observer:Unsubscribe({NAME_OF_MESSAGE = funcref, OTHER_MESSAGE = 'FunctionName'})


  • message (string)

    • The message to unsubscribe from
  • object (table)

    • The object the function would be called on
  • function (string/funcref)

    • The subscribed function


Removes all currently subscribed listeners immediately.




Add a comment