Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/ccrma/webchuck into HID
Browse files Browse the repository at this point in the history
  • Loading branch information
terryzfeng committed Dec 5, 2023
2 parents be90a1c + cbfc47e commit dd35c3e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
17 changes: 10 additions & 7 deletions dist/Hid.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import Chuck from "./Chuck";
/**
* Introducing HID (Human Interface Device) support for WebChucK. WebChucK HID
* brings mouse and keyboard support to work with the native {@link https://chuck.stanford.edu/doc/reference/io.html#Hid | Hid}
* class in ChucK. WebChucK HID wraps JavaScript mouse and keyboard event
* listeners. To get started with HID:
* Introducing HID (Human Interface Device) support for WebChucK. HID wraps
* JavaScript mouse/keyboard event listeners enabling mouse and keyboard
* communication with the native {@link https://chuck.stanford.edu/doc/reference/io.html#Hid | HID}
* class in ChucK.
*
* To get started with HID:
* @example
* ```ts
* import { Chuck, HID } from "webchuck";
*
* const theChuck = await Chuck.init([]);
* const hid = await HID.init(theChuck);
* const hid = await HID.init(theChuck); // Initialize HID with mouse and keyboard
* ```
*/
export default class HID {
Expand Down Expand Up @@ -65,8 +67,9 @@ export default class HID {
y: number;
};
/**
* Enable Mouse HID Javascript event listeners for Chuck HID
* Enable Mouse HID Javascript event listeners for HID.
* Adds a mousemove, mousedown, mouseup, and wheel listener to the document.
* This will also disable the context menu on right click.
* @example
* ```ts
* // If mouse HID is not yet enabled
Expand All @@ -84,7 +87,7 @@ export default class HID {
*/
disableMouse(): void;
/**
* Enable keyboard HID Javascript event listeners for Chuck HID
* Enable keyboard HID Javascript event listeners for HID.
* Adds a keydown and keyup listener to the document.
* @example
* ```ts
Expand Down
18 changes: 11 additions & 7 deletions dist/Hid.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ var HidMsgType;
HidMsgType[HidMsgType["MOUSE_MOTION"] = 5] = "MOUSE_MOTION";
HidMsgType[HidMsgType["WHEEL_MOTION"] = 6] = "WHEEL_MOTION";
})(HidMsgType || (HidMsgType = {}));
//TODO: Update the latest mouse.ck and kb.ck files
/**
* Introducing HID (Human Interface Device) support for WebChucK. WebChucK HID
* brings mouse and keyboard support to work with the native {@link https://chuck.stanford.edu/doc/reference/io.html#Hid | Hid}
* class in ChucK. WebChucK HID wraps JavaScript mouse and keyboard event
* listeners. To get started with HID:
* Introducing HID (Human Interface Device) support for WebChucK. HID wraps
* JavaScript mouse/keyboard event listeners enabling mouse and keyboard
* communication with the native {@link https://chuck.stanford.edu/doc/reference/io.html#Hid | HID}
* class in ChucK.
*
* To get started with HID:
* @example
* ```ts
* import { Chuck, HID } from "webchuck";
*
* const theChuck = await Chuck.init([]);
* const hid = await HID.init(theChuck);
* const hid = await HID.init(theChuck); // Initialize HID with mouse and keyboard
* ```
*/
export default class HID {
Expand Down Expand Up @@ -96,8 +99,9 @@ export default class HID {
};
}
/**
* Enable Mouse HID Javascript event listeners for Chuck HID
* Enable Mouse HID Javascript event listeners for HID.
* Adds a mousemove, mousedown, mouseup, and wheel listener to the document.
* This will also disable the context menu on right click.
* @example
* ```ts
* // If mouse HID is not yet enabled
Expand Down Expand Up @@ -127,7 +131,7 @@ export default class HID {
document.removeEventListener("contextmenu", HID.handleContextMenu);
}
/**
* Enable keyboard HID Javascript event listeners for Chuck HID
* Enable keyboard HID Javascript event listeners for HID.
* Adds a keydown and keyup listener to the document.
* @example
* ```ts
Expand Down
18 changes: 11 additions & 7 deletions src/wc-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,17 +1226,20 @@ var HidMsgType;
HidMsgType[HidMsgType["MOUSE_MOTION"] = 5] = "MOUSE_MOTION";
HidMsgType[HidMsgType["WHEEL_MOTION"] = 6] = "WHEEL_MOTION";
})(HidMsgType || (HidMsgType = {}));
//TODO: Update the latest mouse.ck and kb.ck files
/**
* Introducing HID (Human Interface Device) support for WebChucK. WebChucK HID
* brings mouse and keyboard support to work with the native {@link https://chuck.stanford.edu/doc/reference/io.html#Hid | Hid}
* class in ChucK. WebChucK HID wraps JavaScript mouse and keyboard event
* listeners. To get started with HID:
* Introducing HID (Human Interface Device) support for WebChucK. HID wraps
* JavaScript mouse/keyboard event listeners enabling mouse and keyboard
* communication with the native {@link https://chuck.stanford.edu/doc/reference/io.html#Hid | HID}
* class in ChucK.
*
* To get started with HID:
* @example
* ```ts
* import { Chuck, HID } from "webchuck";
*
* const theChuck = await Chuck.init([]);
* const hid = await HID.init(theChuck);
* const hid = await HID.init(theChuck); // Initialize HID with mouse and keyboard
* ```
*/
class HID {
Expand Down Expand Up @@ -1316,8 +1319,9 @@ class HID {
};
}
/**
* Enable Mouse HID Javascript event listeners for Chuck HID
* Enable Mouse HID Javascript event listeners for HID.
* Adds a mousemove, mousedown, mouseup, and wheel listener to the document.
* This will also disable the context menu on right click.
* @example
* ```ts
* // If mouse HID is not yet enabled
Expand Down Expand Up @@ -1347,7 +1351,7 @@ class HID {
document.removeEventListener("contextmenu", HID.handleContextMenu);
}
/**
* Enable keyboard HID Javascript event listeners for Chuck HID
* Enable keyboard HID Javascript event listeners for HID.
* Adds a keydown and keyup listener to the document.
* @example
* ```ts
Expand Down
10 changes: 9 additions & 1 deletion src/webchuck.js

Large diffs are not rendered by default.

0 comments on commit dd35c3e

Please sign in to comment.