Uint8Array.js 577 B

123456789101112131415161718
  1. import { uint8_arrays } from "../data.js";
  2. import { expect } from "https://esm.sh/v126/chai@4.3.7/X-dHMvZXhwZWN0/es2021/chai.bundle.mjs";
  3. /** @param {unknown[]} received */
  4. export const check = (received) => {
  5. for (const [i, typed_array] of uint8_arrays.entries()) {
  6. expect(received[i]).to.be.an.instanceof(Uint8Array);
  7. expect(received[i]).to.deep.equal(typed_array);
  8. }
  9. };
  10. /**
  11. * @param {import("../peerjs").DataConnection} dataConnection
  12. */
  13. export const send = (dataConnection) => {
  14. for (const typed_array of uint8_arrays) {
  15. dataConnection.send(typed_array);
  16. }
  17. };