-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kirill <paltsev.kir@gmail.com>
- Loading branch information
1 parent
8a96b78
commit b89e078
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
package l1 | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/NethermindEth/juno/core" | ||
) | ||
|
||
type EventListener interface { | ||
OnNewL1Head(head *core.L1Head) | ||
OnL1Call(method string, took time.Duration) | ||
} | ||
|
||
type SelectiveListener struct { | ||
OnNewL1HeadCb func(head *core.L1Head) | ||
OnL1CallCb func(method string, took time.Duration) | ||
} | ||
|
||
func (l SelectiveListener) OnNewL1Head(head *core.L1Head) { | ||
if l.OnNewL1HeadCb != nil { | ||
l.OnNewL1HeadCb(head) | ||
} | ||
} | ||
|
||
func (l SelectiveListener) OnL1Call(method string, took time.Duration) { | ||
if l.OnL1CallCb != nil { | ||
l.OnL1CallCb(method, took) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters