Skip to content

Commit

Permalink
arraybuffer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
foomoon committed Dec 16, 2023
1 parent ccba838 commit 47be6d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/lib/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export class Frame {
* @returns {Uint8Array}
*/
toOctet() {
let output = new Uint8Array(this.leds.length * 3);
let buffer = new ArrayBuffer(this.leds.length * 3);
let output = new Uint8Array(buffer);
let offset = 0;
this.leds.forEach((led) => {
output.set(led.toOctet(), offset);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export class Frame {
* @returns {Uint8Array}
*/
toOctet(): Uint8Array {
let output = new Uint8Array(this.leds.length * 3);
let buffer = new ArrayBuffer(this.leds.length * 3);
let output = new Uint8Array(buffer);
let offset = 0;
this.leds.forEach((led) => {
output.set(led.toOctet(), offset);
Expand Down

0 comments on commit 47be6d7

Please sign in to comment.