mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
event handlers framework
This commit is contained in:
parent
740c2ca189
commit
bcabe494e3
15 changed files with 1091 additions and 5 deletions
30
core/event/new.go
Normal file
30
core/event/new.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package event
|
||||
|
||||
// eventBus contains pub/sub
|
||||
var eventBus Bus
|
||||
|
||||
func init() {
|
||||
eventBus = New()
|
||||
}
|
||||
|
||||
// Handler returns the global instance of the event bus
|
||||
func Handler() Bus {
|
||||
return eventBus
|
||||
}
|
||||
|
||||
// Type defines the format of event descriptors
|
||||
type Type string
|
||||
|
||||
// Valid event types for publication and subscription
|
||||
const (
|
||||
// TypeAddAccount for when account for user is created
|
||||
TypeAddAccount Type = "ACCOUNT_ADD"
|
||||
// TypeAddUser for when user is created
|
||||
TypeAddUser Type = "USER_ADD"
|
||||
// TypeRemoveUser for when user is deleted
|
||||
TypeRemoveUser Type = "USER_DELETE"
|
||||
// TypeAddDocument for when document created
|
||||
TypeAddDocument Type = "DOCUMENT_ADD"
|
||||
// TypeSystemLicenseChange for when adin updates license
|
||||
TypeSystemLicenseChange Type = "LICENSE_CHANGE"
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue