Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
daslyfe committed Dec 31, 2024
1 parent 974376d commit 08f6c1a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/signal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ export const always = register('always', function (func, pat) {
* @memberof Pattern
* @returns Pattern
* @example
* * s("bd(5,8)").onKey("Control:j", x => x.segment(16).color("red")).onKey("Control:i", x => x.fast(2).color("blue"))
* s("bd(5,8)").onKey("Control:j", x => x.segment(16).color("red")).onKey("Control:i", x => x.fast(2).color("blue"))
*/

export const onKey = register('onKey', function (input, func, pat) {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/util.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ let keyState;

export function getCurrentKeyboardState() {
if (keyState == null) {
if (typeof window === 'undefined') {
return;
}
keyState = {};
// Listen for the keydown event to mark the key as pressed
window.addEventListener('keydown', (event) => {
Expand Down
24 changes: 23 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/__snapshots__/examples.test.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4902,6 +4902,8 @@ exports[`runs examples > example "often" example index 0 1`] = `
]
`;

exports[`runs examples > example "onKey" example index 0 1`] = `[]`;

exports[`runs examples > example "orbit" example index 0 1`] = `
[
"[ 0/1 → 1/6 | s:hh delay:0.5 delaytime:0.25 orbit:1 ]",
Expand Down

0 comments on commit 08f6c1a

Please sign in to comment.