Update documentation
This commit is contained in:
@@ -8,14 +8,8 @@ import musicplayer/ui/ui
|
|||||||
|
|
||||||
pub fn main() -> Nil {
|
pub fn main() -> Nil {
|
||||||
let input_keys_name: Name(Key) = process.new_name("input_keys")
|
let input_keys_name: Name(Key) = process.new_name("input_keys")
|
||||||
|
|
||||||
// `input_inject` is created by name to allow the `input` process that
|
|
||||||
// owns `read_input` to be able to register and receive from it,
|
|
||||||
// while the any other processes can use the name reference to
|
|
||||||
// inject input
|
|
||||||
let input_inject_name: Name(Key) = process.new_name("input_inject_keys")
|
let input_inject_name: Name(Key) = process.new_name("input_inject_keys")
|
||||||
|
|
||||||
// TODO should input.new just return the inject_subject?
|
|
||||||
input.new(input_keys_name, input_inject_name)
|
input.new(input_keys_name, input_inject_name)
|
||||||
|
|
||||||
let assert Ok(ui) = ui.new()
|
let assert Ok(ui) = ui.new()
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ import gleam/erlang/process.{type Name}
|
|||||||
|
|
||||||
import musicplayer/input/key.{type Key}
|
import musicplayer/input/key.{type Key}
|
||||||
|
|
||||||
// TODO REWRITE below
|
/// `new` accepts two named subjects:
|
||||||
|
/// - one to send the input to, and
|
||||||
/// `new` accepts a list of listeners that are composed of two subjects;
|
/// - one to receive injected input from
|
||||||
/// - one to get the final `Key` and
|
///
|
||||||
/// - one to tap the input as it is read from i/o
|
/// The subject for input injection is used to allow the `input` process that
|
||||||
/// and
|
/// owns `read_input` to be able to register and receive from it, while
|
||||||
/// - a subject name that is used to create a `Subject` that other processes
|
/// the any other processes can use the name reference to inject input
|
||||||
/// know they can inject a `Key` into the input with
|
|
||||||
pub fn new(input_keys_name: Name(Key), input_inject_name: Name(Key)) -> Nil {
|
pub fn new(input_keys_name: Name(Key), input_inject_name: Name(Key)) -> Nil {
|
||||||
let _ =
|
let _ =
|
||||||
process.spawn(fn() {
|
process.spawn(fn() {
|
||||||
|
|||||||
@@ -134,7 +134,9 @@ fn update_search(ui: Subject(ui_control.Control), content: String) -> Nil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// `handle_key` listens to a subject onto which `input` will send messages with
|
/// `handle_key` listens to a subject onto which `input` will send messages with
|
||||||
/// parsed `Key`s which will be mapped to `Control`s (if possible)
|
/// `Key`s. The keys can be either be
|
||||||
|
/// - instances of `Continue` which are "streamed"input, or
|
||||||
|
/// - instances of "final" keys that are the result of "end of input"
|
||||||
fn handle_key(musicplayer: Subject(Control), input_keys: Subject(Key)) -> Nil {
|
fn handle_key(musicplayer: Subject(Control), input_keys: Subject(Key)) -> Nil {
|
||||||
let _ = case
|
let _ = case
|
||||||
process.new_selector()
|
process.new_selector()
|
||||||
|
|||||||
Reference in New Issue
Block a user