Created
July 17, 2019 23:30
-
-
Save dallinbeutler/4c47b0e78e1f98c48011959c5abe88c5 to your computer and use it in GitHub Desktop.
An Idea for dispatching Elmish events via a scrubbable timeline
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
//It all depends on where i call what the return shoud be... | |
// unit would be easiest with preapplied dispatcher | |
type Disp= unit->unit | |
//type Disp= unit->msg | |
type Event(dispatch:Disp, elapsedTime: int64 )= | |
member this.Msg = dispatch | |
member this.Time = elapsedTime | |
member this.Equals (obj) = false | |
interface System.IComparable with | |
member this.CompareTo(obj): int = | |
int (this.Time - elapsedTime) | |
static member ExecIfPast elapsed (event:Event) = if event.Time < elapsed then event.Msg(); true else false | |
let advanceTime (timelayer: Event list ) (newElapsed:int64) = | |
timelayer |> List.skipWhile (Event.ExecIfPast newElapsed) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment