-
-
Save MaxMorais/18c34444541fb8d97c9208cdef1c30d1 to your computer and use it in GitHub Desktop.
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
type ModelEvent struct { | |
Dao *daos.Dao | |
Model models.Model | |
} | |
func modelEventCallbackConstructor(event string) { | |
return func(cb func(e *core.ModelEvent)){ | |
fmt.Println("Listening in GO for %s", event) | |
unsub := event.On(event, func(e *event.UnknownPayload){ | |
core((*core.ModelEvent)(unsafe.Pointer(e))) | |
}) | |
cleanup(event, unsub); | |
} | |
} | |
func eventCallbackConstructor(event string, *eventType any){ | |
return func(cb func(e *eventType)){ | |
fmt.Println("Listening in GO for %s", event) | |
unsub := event.On(event, func(e *event.UnknownPayload){ | |
core((*eventType)(unsafe.Pointer(e))) | |
}); | |
cleanup(event, unsub); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment