BSB Developer Docs
Loading...
Searching...
No Matches
js_app_manifest.h File Reference

JavaScript application manifest library. More...

#include <toolbox/semver.h>

Go to the source code of this file.

Data Structures

struct  JsAppManifestInfo
 JsAppManifest information structure. More...
 

Typedefs

typedef struct JsAppManifest JsAppManifest
 JsAppManifest opaque type.
 

Functions

JsAppManifest * js_app_manifest_alloc (void)
 Create a JsAppManifest instance.
 
void js_app_manifest_free (JsAppManifest *instance)
 Delete a JsAppManifest instance.
 
bool js_app_manifest_load_from_file (JsAppManifest *instance, const char *file_path)
 Load a JsAppManifest instance from a JSON description file.
 
bool js_app_manifest_get_info (const JsAppManifest *instance, JsAppManifestInfo *info)
 Get the manifest information (its contents).
 

Detailed Description

JavaScript application manifest library.

A JS application manifest contains the properties necessary to properly display and run an application.

The manifest file is stored using the following JSON format:

{
"format_version": 1,
"id": "app_id",
"name": "Free form app name",
"version": "1.2.3",
"api_version": "4.5.6",
"description": "Free form description", // Optional, default: ""
"author": "Application author", // Optional, default: ""
"heap_size_kib": 128, // Optional, default: 128
"debug": false // Optional, default: false
}

Fields marked as optional may be omitted, in which case they will be assigned their respective default values.

See also
JavaScript Applications for more info on the application manifests.

Function Documentation

◆ js_app_manifest_alloc()

JsAppManifest * js_app_manifest_alloc ( void )

Create a JsAppManifest instance.

Returns
pointer to the created instance

◆ js_app_manifest_free()

void js_app_manifest_free ( JsAppManifest * instance)

Delete a JsAppManifest instance.

Warning
All JsAppManifestInfo objects associated with the instance will become invalid after a call to this function.
Parameters
[in,out]instancepointer to the instance to be deleted

◆ js_app_manifest_get_info()

bool js_app_manifest_get_info ( const JsAppManifest * instance,
JsAppManifestInfo * info )

Get the manifest information (its contents).

Parameters
[in]instancepointer to the instance to be queried
[out]infopointer to the output structure to be filled out with info (must be allocated)
Returns
true if valid information was present, false otherwise

◆ js_app_manifest_load_from_file()

bool js_app_manifest_load_from_file ( JsAppManifest * instance,
const char * file_path )

Load a JsAppManifest instance from a JSON description file.

Warning
All JsAppManifestInfo objects associated with the instance will become invalid after a call to this function.
Parameters
[in,out]instancepointer to the instance to be loaded
[in]file_pathzero-terminated string containing the path to the manifest file
Returns
true if the manifest was loaded successfully, false otherwise