BrObject parent class for all Bright classes

This class is the parent for all Bright classes.

Bright object implement following:

  • key/value storage
  • singleton pattern
  • events queue

Object members

Method/property Description
If you are using global config, please prepend below methods with br()->config()->
setAttr(name, value) Set value of object attribute.
getAttr(name, defaultValue, saveDefault) Get value of object attribute. If value is missing - get default value. If saveDefault = true and value is missing, default value will be stored as object attribute value.
clearAttr(name) Clear value of object attribute
isAttrExists(name) Check is value for some object sttribute exists
getAttributes() Get all object attributes
setAttributes() Set all object attributes at once
enable() Increase internal enable/disable counter. Set enabled flag to true if counter become 0
disable() Set enabled flag to false and decrease internal enable/disable counter
isEnabled() Check if enabled flag is true
getInstance() Return singleton object for current class
before(event, callback) Register callback which must be called before event triggered
after(event, callback) Register callback which must be called after event triggered
on(event, callback) Register callback which must be called when event triggered
trigger(event, ...) Trigger event