renoise.Document.ObservableBang

Observable without a value which sends out notifications when "banging" it.


Functions

add_notifier(self, notifier : NotifierFunction)

Register a function or method as a notifier, which will be called as soon as the observable's value changed. The passed notifier can either be a function or a table with a function and some context (an "object") -> method.

example:

renoise.song().transport.bpm_observable:add_notifier(function()
  print("BPM changed")
end)

local my_context = { bpm_changes = 0, something_else = "bla" }
renoise.song().transport.bpm_observable:add_notifier({
  my_context,
  function(context)
    context.bpm_changes = context.bpm_changes + 1;
    print(("#BPM changes: %s"):format(context.bpm_changes));
  end
})

bang(self)

fire a notification, calling all registered notifiers.

has_notifier(self, notifier : NotifierFunction)

->boolean

Checks if the given function, method was already registered as notifier.

remove_notifier(self, notifier : NotifierFunction | NotifierMemberContext)

Unregister a previously registered notifier. When only passing an object, all notifier functions that match the given object will be removed. This will not fire errors when no methods for the given object are attached. Trying to unregister a function or method which wasn't registered, will resolve into an error.


Local Aliases

NotifierFunction

fun()

NotifierMemberContext

table | userdata