From 2b5fc9d13e9f08857177944f7791323b7efe6f86 Mon Sep 17 00:00:00 2001 From: Pedro Gallardo Date: Wed, 21 Aug 2024 04:03:00 -0300 Subject: [PATCH] fix: typo in cancelable property --- src/events/NexoEmitter.test.ts | 2 +- src/events/NexoEvent.test.ts | 2 +- src/events/NexoEvent.ts | 8 ++++---- src/handlers/apply.test.ts | 6 +++--- src/handlers/apply.ts | 2 +- src/handlers/construct.test.ts | 6 +++--- src/handlers/construct.ts | 2 +- src/handlers/defineProperty.test.ts | 2 +- src/handlers/defineProperty.ts | 2 +- src/handlers/get.ts | 2 +- src/handlers/getOwnPropertyDescriptor.ts | 2 +- src/handlers/ownKeys.ts | 2 +- src/handlers/update.ts | 2 +- src/types/Nexo.ts | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/events/NexoEmitter.test.ts b/src/events/NexoEmitter.test.ts index 92c88a1..0204bc9 100644 --- a/src/events/NexoEmitter.test.ts +++ b/src/events/NexoEmitter.test.ts @@ -53,7 +53,7 @@ describe("NexoEmitter", () => { it("Adds the return value to the events 'returnValue' property", () => { const emitter = new NexoEmitter(); - const nexoEvent = new NexoEvent("test", { cancellable: true }); + const nexoEvent = new NexoEvent("test", { cancelable: true }); const returnValue = new Object(); emitter.on("test", (event: NexoEvent) => { diff --git a/src/events/NexoEvent.test.ts b/src/events/NexoEvent.test.ts index 78db4ad..f3a4b98 100644 --- a/src/events/NexoEvent.test.ts +++ b/src/events/NexoEvent.test.ts @@ -27,7 +27,7 @@ describe("NexoEvent", () => { }); it("Prevents the event default behaviour", () => { - const event = new NexoEvent("foo", { cancellable: true }); + const event = new NexoEvent("foo", { cancelable: true }); event.preventDefault(); expect(event.defaultPrevented).toBe(true); diff --git a/src/events/NexoEvent.ts b/src/events/NexoEvent.ts index cafb52e..672a63a 100644 --- a/src/events/NexoEvent.ts +++ b/src/events/NexoEvent.ts @@ -5,22 +5,22 @@ class NexoEvent { readonly data: Data; readonly target: Target; readonly timestamp: number; - readonly cancellable: boolean; + readonly cancelable: boolean; public returnValue: unknown; private _defaultPrevented: boolean; constructor(name: string, options: nx.events.options = {}) { - options = { cancellable: false, ...options }; + options = { cancelable: false, ...options }; this.name = name; this.data = options.data; this.target = options.target; - this.cancellable = options.cancellable; + this.cancelable = options.cancelable; this.timestamp = Date.now(); this._defaultPrevented = false; } preventDefault(): void { - if (!this.cancellable) { + if (!this.cancelable) { return; } diff --git a/src/handlers/apply.test.ts b/src/handlers/apply.test.ts index c4b301a..171745e 100644 --- a/src/handlers/apply.test.ts +++ b/src/handlers/apply.test.ts @@ -27,7 +27,7 @@ describe("apply", () => { expect(applyCallbackNexo).toHaveBeenCalledTimes(1); expect(applyEventForNexo).toBeInstanceOf(ProxyEvent); expect(applyEventForNexo.target).toBe(proxy); - expect(applyEventForNexo.cancellable).toBe(true); + expect(applyEventForNexo.cancelable).toBe(true); expect(applyEventForNexo.data).toStrictEqual({ this: _this, @@ -136,7 +136,7 @@ describe("apply", () => { expect(updateCallback).toHaveBeenCalledTimes(1); expect(updateEvent.target).toBe(expectedProxy); - expect(updateEvent.cancellable).toBe(false); + expect(updateEvent.cancelable).toBe(false); expect(updateEvent.data).toBe(expectedResult); }); @@ -167,7 +167,7 @@ describe("apply", () => { expect(updateCallback).toHaveBeenCalledTimes(1); expect(updateEvent.target).toBe(expectedProxy); - expect(updateEvent.cancellable).toBe(false); + expect(updateEvent.cancelable).toBe(false); expect(updateEvent.data).toBe(expectedResultProxy); expect(isProxy(expectedResultProxy)).toBe(true); expect(result).toBe(expectedResultProxy); diff --git a/src/handlers/apply.ts b/src/handlers/apply.ts index 3be5cff..4f874e6 100644 --- a/src/handlers/apply.ts +++ b/src/handlers/apply.ts @@ -19,7 +19,7 @@ const apply = ( const event = new ProxyEvent("apply", { target: proxy, data: { this: that, arguments: args, result: resultProxy }, - cancellable: true, + cancelable: true, }); if (event.defaultPrevented) { diff --git a/src/handlers/construct.test.ts b/src/handlers/construct.test.ts index c4c8252..67177b5 100644 --- a/src/handlers/construct.test.ts +++ b/src/handlers/construct.test.ts @@ -25,7 +25,7 @@ describe("construct", () => { expect(constructCallbackNexo).toHaveBeenCalledTimes(1); expect(constructEventForNexo.target).toBe(proxy); - expect(constructEventForNexo.cancellable).toBe(true); + expect(constructEventForNexo.cancelable).toBe(true); expect(constructEventForNexo.data).toStrictEqual({ arguments: args, @@ -126,7 +126,7 @@ describe("construct", () => { expect(updateCallback).toHaveBeenCalledTimes(1); expect(updateEvent.target).toBe(expectedProxy); - expect(updateEvent.cancellable).toBe(false); + expect(updateEvent.cancelable).toBe(false); expect(updateEvent.data).toBe(expectedResult); }); @@ -154,7 +154,7 @@ describe("construct", () => { expect(updateCallback).toHaveBeenCalledTimes(1); expect(updateEvent.target).toBe(expectedProxy); - expect(updateEvent.cancellable).toBe(false); + expect(updateEvent.cancelable).toBe(false); expect(updateEvent.data).toBeInstanceOf(constructable); expect(isProxy(result)).toBe(true); expect(result).toBe(updateEvent.data); diff --git a/src/handlers/construct.ts b/src/handlers/construct.ts index 1357034..ec0cd7f 100644 --- a/src/handlers/construct.ts +++ b/src/handlers/construct.ts @@ -15,7 +15,7 @@ const construct = (fn: nx.voidFunction, args: nx.arrayLike = []): object => { const event = new ProxyEvent("construct", { target: proxy, data: { arguments: args, result: resultProxy }, - cancellable: true, + cancelable: true, }); if (event.defaultPrevented) { diff --git a/src/handlers/defineProperty.test.ts b/src/handlers/defineProperty.test.ts index d8e8289..abdd5eb 100644 --- a/src/handlers/defineProperty.test.ts +++ b/src/handlers/defineProperty.test.ts @@ -28,7 +28,7 @@ describe("defineProperty", () => { expect(result).toBe(true); expect(definePropertyCallbackNexo).toHaveBeenCalledTimes(1); expect(definePropertyEventForNexo.target).toBe(proxy); - expect(definePropertyEventForNexo.cancellable).toBe(true); + expect(definePropertyEventForNexo.cancelable).toBe(true); expect(definePropertyEventForNexo.data).toStrictEqual({ property: "foo", diff --git a/src/handlers/defineProperty.ts b/src/handlers/defineProperty.ts index 3b68b38..10fce76 100644 --- a/src/handlers/defineProperty.ts +++ b/src/handlers/defineProperty.ts @@ -16,7 +16,7 @@ const defineProperty = ( const event = new ProxyEvent("defineProperty", { target: proxy, - cancellable: true, + cancelable: true, data: { property, descriptor, diff --git a/src/handlers/get.ts b/src/handlers/get.ts index cbf6c3f..1803112 100644 --- a/src/handlers/get.ts +++ b/src/handlers/get.ts @@ -17,7 +17,7 @@ const get = (fn: nx.voidFunction, property: nx.objectKey): unknown => { const event = new ProxyEvent("get", { target: proxy, - cancellable: true, + cancelable: true, data: { property }, }); diff --git a/src/handlers/getOwnPropertyDescriptor.ts b/src/handlers/getOwnPropertyDescriptor.ts index 86b3ba0..ade33c8 100644 --- a/src/handlers/getOwnPropertyDescriptor.ts +++ b/src/handlers/getOwnPropertyDescriptor.ts @@ -13,7 +13,7 @@ const getOwnPropertyDescriptor = ( new ProxyEvent("getOwnPropertyDescriptor", { target: proxy, - cancellable: false, + cancelable: false, data: { property, }, diff --git a/src/handlers/ownKeys.ts b/src/handlers/ownKeys.ts index 0cca44c..4221fbb 100644 --- a/src/handlers/ownKeys.ts +++ b/src/handlers/ownKeys.ts @@ -10,7 +10,7 @@ const ownKeys = (fn: nx.voidFunction): nx.objectKey[] => { new ProxyEvent("ownKeys", { target: proxy, - cancellable: false, + cancelable: false, }); // Returns the own keys from the void function target diff --git a/src/handlers/update.ts b/src/handlers/update.ts index 2837eee..0167875 100644 --- a/src/handlers/update.ts +++ b/src/handlers/update.ts @@ -17,7 +17,7 @@ const update = (proxy: nx.Proxy, value: Type): Proxy => { const event = new NexoEvent("nx.update", { target: proxy, data: value, - cancellable: false, + cancelable: false, }); /** diff --git a/src/types/Nexo.ts b/src/types/Nexo.ts index acebe6e..9ebed8b 100644 --- a/src/types/Nexo.ts +++ b/src/types/Nexo.ts @@ -48,7 +48,7 @@ declare namespace Nexo { interface options { target?: Target; data?: Data; - cancellable?: boolean; + cancelable?: boolean; } } }