Add events

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-07-12 21:46:57 -03:00
parent d18b11ebd4
commit 6eaece99c5
3 changed files with 81 additions and 0 deletions

16
event/event.go Normal file
View File

@@ -0,0 +1,16 @@
package event
type EventType string
const INSTANCE_VIEWPORT_RESIZE EventType = "instance viewport resize"
const INSTANCE_DELETE EventType = "instance delete"
const INSTANCE_NEW EventType = "instance new"
const SESSION_END EventType = "session end"
const SESSION_READY EventType = "session ready"
type Handler func(args ...interface{})
type EventApi interface {
Emit(name EventType, args ...interface{})
On(name EventType, handler Handler)
}