From bbb85a4df944dc2be6a149cbc3be133cb4bf22ea Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 22 Oct 2024 02:38:21 +0100 Subject: [PATCH] JS: Third batch of OFW PR changes --- applications/system/js_app/modules/js_math.c | 2 +- applications/system/js_app/types/badusb/index.d.ts | 2 +- applications/system/js_app/types/math/index.d.ts | 3 +++ documentation/js/js_math.md | 6 +++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/applications/system/js_app/modules/js_math.c b/applications/system/js_app/modules/js_math.c index 7d54cf9b9..cf66b6a44 100644 --- a/applications/system/js_app/modules/js_math.c +++ b/applications/system/js_app/modules/js_math.c @@ -308,7 +308,7 @@ void js_math_trunc(struct mjs* mjs) { static void* js_math_create(struct mjs* mjs, mjs_val_t* object, JsModules* modules) { UNUSED(modules); mjs_val_t math_obj = mjs_mk_object(mjs); - mjs_set(mjs, math_obj, "is_equal", ~0, MJS_MK_FN(js_math_is_equal)); + mjs_set(mjs, math_obj, "isEqual", ~0, MJS_MK_FN(js_math_is_equal)); mjs_set(mjs, math_obj, "abs", ~0, MJS_MK_FN(js_math_abs)); mjs_set(mjs, math_obj, "acos", ~0, MJS_MK_FN(js_math_acos)); mjs_set(mjs, math_obj, "acosh", ~0, MJS_MK_FN(js_math_acosh)); diff --git a/applications/system/js_app/types/badusb/index.d.ts b/applications/system/js_app/types/badusb/index.d.ts index 4fbda5ef8..57c2662cd 100644 --- a/applications/system/js_app/types/badusb/index.d.ts +++ b/applications/system/js_app/types/badusb/index.d.ts @@ -40,7 +40,7 @@ export type KeyCode = MainKey | ModifierKey | number; * * @param settings USB device settings. Omit to select default parameters */ -export declare function setup(settings?: { vid: number, pid: number, mfrName?: string, prodName?: string, layoutPath: string }): void; +export declare function setup(settings?: { vid: number, pid: number, mfrName?: string, prodName?: string, layoutPath?: string }): void; /** * @brief Tells whether the virtual USB HID device has successfully connected diff --git a/applications/system/js_app/types/math/index.d.ts b/applications/system/js_app/types/math/index.d.ts index 25abca4af..4924eea7e 100644 --- a/applications/system/js_app/types/math/index.d.ts +++ b/applications/system/js_app/types/math/index.d.ts @@ -1,3 +1,4 @@ +export function isEqual(a: number, b: number, tolerance: number): boolean; export function abs(n: number): number; export function acos(n: number): number; export function acosh(n: number): number; @@ -12,6 +13,7 @@ export function clz32(n: number): number; export function cos(n: number): number; export function exp(n: number): number; export function floor(n: number): number; +export function log(n: number): number; export function max(n: number, m: number): number; export function min(n: number, m: number): number; export function pow(n: number, m: number): number; @@ -21,4 +23,5 @@ export function sin(n: number): number; export function sqrt(n: number): number; export function trunc(n: number): number; declare const PI: number; +declare const E: number; declare const EPSILON: number; diff --git a/documentation/js/js_math.md b/documentation/js/js_math.md index 12dae8fb3..ca16a9111 100644 --- a/documentation/js/js_math.md +++ b/documentation/js/js_math.md @@ -223,7 +223,7 @@ math.floor(45.05); // 45 math.floor(45.95); // 45 ``` -## is_equal +## isEqual Return true if the difference between numbers `a` and `b` is less than the specified parameter `e`. ### Parameters @@ -236,8 +236,8 @@ True if the difference between numbers `a` and `b` is less than the specified pa ### Example ```js -math.is_equal(1.4, 1.6, 0.2); // false -math.is_equal(3.556, 3.555, 0.01); // true +math.isEqual(1.4, 1.6, 0.2); // false +math.isEqual(3.556, 3.555, 0.01); // true ``` ## max