Skip to content

Commit

Permalink
fix: elimina event emmiter
Browse files Browse the repository at this point in the history
  • Loading branch information
drusco committed Aug 11, 2023
1 parent 36dc145 commit 1088d98
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
7 changes: 1 addition & 6 deletions src/Emulator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ browser.useRef("window", win);
const window = nodejs.useRef("window", global);

describe("(lib) Emulator", () => {
it("Can simulate a browser window's context", () => {
// nodejs.addEventListener("proxy", (evt: any) => {
// console.log("proxy event", evt, evt.target);
// });
// expect(await nodejs.get(window.innerWidth)).toBe(600);

it("Can simulate a browser window's context", async () => {
expect(window).toBeTruthy();
});
});
2 changes: 1 addition & 1 deletion src/types/Exotic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare namespace Exotic {
encoded: boolean;
};

interface Emulator extends EventTarget {
interface Emulator {
use(value?: any): Proxy;
useRef(ref: key, value?: any): Proxy;
getId(value: traceable): number;
Expand Down
25 changes: 0 additions & 25 deletions src/utils/createProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,6 @@ import isTraceable from "./isTraceable";
import mockPrototype from "./mockPrototype";
import traps from "./traps";

// class EmulatorEvent extends Event {
// data: any;
// constructor(type: string, data?: any) {
// super(type, {});
// this.data = data;
// }
// }

// class MockTarget extends EventTarget {
// #mock: Exotic.Mock;
// constructor(mock: Exotic.Mock) {
// super();
// this.#mock = mock;
// }

// get mock() {
// return this.#mock;
// }
// }

const createProxy = (
scope: Exotic.Emulator,
target?: any,
Expand Down Expand Up @@ -58,7 +38,6 @@ const createProxy = (
function () {},
mockPrototype,
) as Exotic.Mock;
// const mockTarget = new MockTarget(mock);
const sandbox = Object.create(null);
const traceable = isTraceable(target);

Expand Down Expand Up @@ -106,10 +85,6 @@ const createProxy = (
map.targets.set(target, proxy);
}

//mockTarget.addEventListener("proxy", (event: EmulatorEvent) => {});

// mockTarget.dispatchEvent(new EmulatorEvent("proxy", proxy));

return proxy;
};

Expand Down

0 comments on commit 1088d98

Please sign in to comment.