Skip to content

Question: Detect Window Close #358

@MichaelMay81

Description

@MichaelMay81

A part of my app should update continuously.

let delayedDownload (delayInMin:int) = async {
    do! delayInMin * 60 |> Task.Delay |> Async.AwaitTask
    return! remote.getDownloadLinks ()
}

I put this in a Cmd and when I get the 'msg I schedule it again.
But on closing the page this continuous to run.

I need a way to detect, that the window has been closed, to stop that scheduling.

Adding a component and dispatching a 'msg on Dispose seems to work. Although it takes 3 minutes from closing the window until the Dispose and I haven´t figured out how to give the component the dispatch function.

Is there a recommended way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions