@flipperdevices/fz-sdk
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -123,2 +123,3 @@ /** | ||
* @param features Array of named features to query | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
@@ -135,2 +136,3 @@ declare function doesSdkSupport(features: string[]): boolean; | ||
* @param features Array of named features to query | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
@@ -155,13 +157,46 @@ declare function checkSdkFeatures(features: string[]): void | never; | ||
/** | ||
* @brief Reads a JS value from a file | ||
* @brief Converts a string to a number | ||
* @param text The string to convert to a number | ||
* @param base Integer base (`2`...`16`), default: 10 | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
declare function parseInt(text: string, base?: number): number; | ||
/** | ||
* @brief Path to the directory containing the current script | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
declare const __dirname: string; | ||
/** | ||
* @brief Path to the current script file | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
declare const __filename: string; | ||
/** | ||
* @brief Runs a JS file and returns value from it | ||
* | ||
* Reads a file at the specified path, interprets it as a JS value and returns | ||
* said value. | ||
* Reads a file at the specified path and runs it as JS, returning the last evaluated value. | ||
* | ||
* The result is cached and this filepath will not re-evaluated on future | ||
* load() calls for this session. | ||
* | ||
* @param path The path to the file | ||
* @param scope An object to use as global scope while running this file | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
declare function load(path: string): any; | ||
declare function load(path: string, scope?: object): any; | ||
/** | ||
* @brief Return 1-byte string whose ASCII code is the integer `n` | ||
* | ||
* If `n` is not numeric or outside of `0-255` range, `null` is returned | ||
* | ||
* @param n The ASCII code to convert to string | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
declare function chr(n: number): string | null; | ||
/** | ||
* @brief Loads a natively implemented module | ||
@@ -174,2 +209,9 @@ * @param module The name of the module to load | ||
/** | ||
* @brief Exit JavaScript with given message | ||
* @param message The error message to show to user | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
declare function die(message: string): never; | ||
/** | ||
* @brief mJS Foreign Pointer type | ||
@@ -176,0 +218,0 @@ * |
@@ -33,3 +33,3 @@ /** | ||
* | `button_panel` | ❌ | | ||
* | `byte_input` | ❌ | | ||
* | `byte_input` | ✅ | | ||
* | `dialog_ex` | ✅ (as `dialog`) | | ||
@@ -126,2 +126,8 @@ * | `empty_screen` | ✅ | | ||
export declare class View<Props extends Properties> { | ||
/** | ||
* Assign value to property by name | ||
* @param property Name of the property | ||
* @param value Value to assign | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
set<P extends keyof Props>(property: P, value: Props[P]): void; | ||
@@ -131,3 +137,12 @@ } | ||
export declare class ViewFactory<Props extends Properties, V extends View<Props>> { | ||
/** | ||
* Create view instance with default values, can be changed later with set() | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
make(): V; | ||
/** | ||
* Create view instance with custom values, can be changed later with set() | ||
* @param initial Dictionary of property names to values | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
makeWith(initial: Partial<Props>): V; | ||
@@ -151,2 +166,7 @@ } | ||
/** | ||
* View object currently shown | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
currentView: View<any>; | ||
/** | ||
* Sends a number to the custom event handler | ||
@@ -153,0 +173,0 @@ * @param event number to send |
@@ -17,2 +17,3 @@ /** | ||
* motor | ||
* @version Added in JS SDK 0.1 | ||
*/ | ||
@@ -19,0 +20,0 @@ export declare function error(): void; |
{ | ||
"name": "@flipperdevices/fz-sdk", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Type declarations and documentation for native JS modules available on Flipper Zero", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
70597
1890