Skip to content

Instantly share code, notes, and snippets.

@lizmat
Created October 27, 2022 10:26
Show Gist options
  • Save lizmat/737f60089a92e0b560bb12bbfed4f17d to your computer and use it in GitHub Desktop.
Save lizmat/737f60089a92e0b560bb12bbfed4f17d to your computer and use it in GitHub Desktop.
Pseudocode of a function key supply
use Term::ReadKey;
sub function-keys(:$echo) {
supply {
my @seen;
whenever key-pressed($!echo) -> \value {
@seen.push: value;
if @seen eqv [1,2,3,4] {
emit associated function key value;
@seen = ();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment