Instead of "injecting" characters into the input stream, the input stream is now forwarded to the `musicplayer`. It has will have to decide what to do with the stream, e.g. by setting the "mode" to something that captures the input stream and acts upon it
16 lines
369 B
Gleam
16 lines
369 B
Gleam
import gleam/erlang/process.{type Name}
|
|
|
|
import musicplayer/input/key.{type Key}
|
|
|
|
/// `new` accepts a subject that all input will be sent to
|
|
pub fn new(input_keys_name: Name(Key)) -> Nil {
|
|
let _ =
|
|
process.spawn(fn() {
|
|
let input_keys = process.named_subject(input_keys_name)
|
|
key.read_input_until_key(input_keys)
|
|
})
|
|
|
|
key.start_raw_shell()
|
|
Nil
|
|
}
|