api/Events.lua

string table value

:AddCallback("code" , callback [, nsList] [, kwargs] [, extraArg])

Arguments

"code"
string - the tag sequence
callback
function - the function to be called
nsList
string - a semicolon-separated list of namespaces. Base is implied
kwargs
table - a dictionary of default kwargs for all tags in the code to receive
extraArg
value - a value that will be passed into the callback

Notes

Adds a callback that will be called if the code in question is to be updated.

Example

LibStub("LibDogTag-3.0"):AddCallback("[Name]", function(code, kwargs)
	-- do something here
end, "Unit", { unit = 'player' })

:AddEventHandler("namespace" , "event" , func)

Arguments

"namespace"
string - the namespace to mark ownership with
"event"
string - the name of the event
func
function - the function to be called

Notes

Register a function to be called when the event is fired This should only be called by sublibraries

Example

LibStub("LibDogTag-3.0"):AddEventHandler("MyNamespace", "PLAYER_LOGIN", function(event, ...)
	-- do something here.
end)

number

:AddTimerHandler("namespace" , func [, priority])

Arguments

"namespace"
string - the namespace to mark ownership with
func
function - the function to be called
priority
number - a number from 1 to 9 specifying the priority it will be called compared to other timers. 1 being called first and 9 being called last. Is 5 by default.

Notes

Register a function to be called roughly every 0.05 seconds This should only be called by sublibraries

Example

LibStub("LibDogTag-3.0"):AddTimerHandler("MyNamespace", function(num, currentTime)
	-- do something here.
end)

:FireEvent("event" , ...)

Arguments

"event"
string - name of the event
...
tuple - a tuple of arguments

Notes

Fire an event that any tags, handlers, or callbacks will see.

Example

LibStub("LibDogTag-3.0"):FireEvent("MyEvent", "Data", "goes", "here", 52)

string table

:RemoveCallback("code" , callback [, nsList] [, kwargs] [, extraArg])

Arguments

"code"
string - the tag sequence
callback
function - the function to be called
nsList
string - a semicolon-separated list of namespaces. Base is implied
kwargs
table - a dictionary of default kwargs for all tags in the code to receive
extraArg
type - (needs documentation)

Notes

Remove a callback that has been previously added

Example

LibStub("LibDogTag-3.0"):RemoveCallback("[Name]", func, "Unit", { unit = 'player' })

:RemoveEventHandler("namespace" , "event" , func)

Arguments

"namespace"
string - the namespace to mark ownership with
"event"
string - the name of the event
func
function - the function to be called

Notes

Remove an event handler that has been previously added This should only be called by sublibraries

Example

LibStub("LibDogTag-3.0"):RemoveEventHandler("MyNamespace", "PLAYER_LOGIN", func)

:RemoveTimerHandler("namespace" , func)

Arguments

"namespace"
string - the namespace to mark ownership with
func
function - the function to be called

Notes

Remove a timer handler that has previously been added This should only be called by sublibraries

Example

LibStub("LibDogTag-3.0"):RemoveTimerHandler("MyNamespace", func)



Comments

Posts Quoted:
Reply
Clear All Quotes