Sha256: f10611063fee33e39ec83623e5b74d97e98a44c077746b3252189f794003eda1
Contents?: true
Size: 587 Bytes
Versions: 5
Compression:
Stored size: 587 Bytes
Contents
# Super simple event pub/sub ## to add events ```ruby Lux::EventBus.on('test') { |arg| puts 'foo: %s' % arg } Lux.event.on('test', :foo) { |arg| puts 'bar: %s' % arg } Lux.event.on('test', :foo) { |arg| puts 'baz: %s' % arg } Lux.event.on('test') { |arg| raise 'abc' } ### # foo: xxx # baz: xxx # error logged ``` ## to call ```ruby Lux.event.call 'test', 'xxx' ``` ## Error handler Default event bus error handle. ```ruby Lux.config.on_event_bus_error = proc do |error, name| Lux.logger(:event_bus).error '[%s] %s' % [name, error.message] end ```
Version data entries
5 entries across 5 versions & 1 rubygems