Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

JS: Bootstrap

Bootstrap

An application starts the framework one time, registers its gclasses, builds the yuno and plays it.

Source code: src/gobj.js


gobj_start_up()

Starts the framework. Call it one time, before every other call.

gobj_start_up(
    jn_global_settings,
    load_persistent_attrs_fn,
    save_persistent_attrs_fn,
    remove_persistent_attrs_fn,
    list_persistent_attrs_fn,
    global_command_parser_fn,
    global_stats_parser_fn
)

Parameters

KeyTypeDescription
jn_global_settingsobjectThe settings of the application. A gclass reads its own section by its name.
load_persistent_attrs_fnfunctionLoads the persistent attributes.
save_persistent_attrs_fnfunctionSaves the persistent attributes.
remove_persistent_attrs_fnfunctionDeletes the persistent attributes.
list_persistent_attrs_fnfunctionLists the persistent attributes.
global_command_parser_fnfunctionThe parser of the commands, for a gclass that gives no table.
global_stats_parser_fnfunctionThe parser of the statistics.

Returns

Returns 0.

Notes

The function declares the global events of the framework, and EV_STATE_CHANGED is one of them.

Give the four functions of dbsimple to keep the persistent attributes in the local storage of the browser.


A complete start

import {
    gobj_start_up, gobj_create_yuno, gobj_start_tree, gobj_play,
    register_c_yuno, register_c_timer, register_c_ievent_cli,
    db_load_persistent_attrs, db_save_persistent_attrs,
    db_remove_persistent_attrs, db_list_persistent_attrs,
    command_parser, stats_parser
} from "@yuneta/gobj-js";

gobj_start_up(
    settings,
    db_load_persistent_attrs,
    db_save_persistent_attrs,
    db_remove_persistent_attrs,
    db_list_persistent_attrs,
    command_parser,
    stats_parser
);

register_c_yuno();
register_c_timer();
register_c_ievent_cli();
register_c_my_app();

const yuno = gobj_create_yuno("my_app", "C_MY_APP", {});
gobj_start_tree(yuno);
gobj_play(yuno);

The order matters. Every gclass that a creation names must have its registration first.


YUNETA_VERSION

The version of the framework, as a string.