arowM/elm-thread/3.0.0

NOTE: the latest version is 3.0.1

Thread.LocalMemory

Helper module that enable to manage the local memory state of each thread. For a sample, see sample/src/Advanced.elm and its live demo.

Core

Core type to store local memory states.

Construct an initial instance of LocalMemory.

toList : LocalMemory a -> List ( ThreadId, a )

Convert into list. The elements in this list are ordered by the time the thread was created, from newest to oldest.

Procedures

Lifter memory (LocalMemory a)
-> a
-> Block a event
-> Procedure memory event

Run a child Block in a new thread by Thread.Procedure.async, assign a local memory for the thread, and free the local memory when the thread is end.

The second argument is initial value of the local memory.

Lifter memory (LocalMemory a)
-> a
-> Block a event
-> Procedure memory event

Run a child Block by Thread.Procedure.block, assign a local memory for the thread, and free the local memory when the thread is end.

The second argument is initial value of the local memory.

Lifter memory (LocalMemory a)
-> a
-> ((Block a event -> Block memory event) -> Block memory event)
-> Procedure memory event

Similar to asyncChild, but async can also handle parent Procedures in the new thread.

Lifter memory (LocalMemory a)
-> a
-> ((Block a event -> Block memory event) -> Block memory event)
-> Procedure memory event

Similar to blockChild, but block can also handle parent Procedures in the new thread.