add callbacks

This commit is contained in:
c9s 2021-05-22 16:47:34 +08:00
parent 8acada76a9
commit 6df72d54a8
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,25 @@
// Code generated by "callbackgen -type RBTOrderBook"; DO NOT EDIT.
package types
import ()
func (b *RBTOrderBook) OnLoad(cb func(book *RBTOrderBook)) {
b.loadCallbacks = append(b.loadCallbacks, cb)
}
func (b *RBTOrderBook) EmitLoad(book *RBTOrderBook) {
for _, cb := range b.loadCallbacks {
cb(book)
}
}
func (b *RBTOrderBook) OnUpdate(cb func(book *RBTOrderBook)) {
b.updateCallbacks = append(b.updateCallbacks, cb)
}
func (b *RBTOrderBook) EmitUpdate(book *RBTOrderBook) {
for _, cb := range b.updateCallbacks {
cb(book)
}
}

View File

@ -0,0 +1,25 @@
// Code generated by "callbackgen -type SliceOrderBook"; DO NOT EDIT.
package types
import ()
func (b *SliceOrderBook) OnLoad(cb func(book *SliceOrderBook)) {
b.loadCallbacks = append(b.loadCallbacks, cb)
}
func (b *SliceOrderBook) EmitLoad(book *SliceOrderBook) {
for _, cb := range b.loadCallbacks {
cb(book)
}
}
func (b *SliceOrderBook) OnUpdate(cb func(book *SliceOrderBook)) {
b.updateCallbacks = append(b.updateCallbacks, cb)
}
func (b *SliceOrderBook) EmitUpdate(book *SliceOrderBook) {
for _, cb := range b.updateCallbacks {
cb(book)
}
}