1.0.7 • Published 6 months ago

flecs v1.0.7

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

Flecs JavaScript client library (c) 2023, Sander Mertens, MIT license Thin wrapper around the Flecs REST API.

Resources: Flecs repository: https://github.com/SanderMertens/flecs API manual: https://www.flecs.dev/flecs/md_docs_RestApi.html API console: https://www.flecs.dev/explorer/console

Functions:

  • flecs.connect(host : string) Initializes the client library with the host address of the server. Example: flecs.connect("http://localhost:27750");

  • flecs.entity(path : string, params : object, recv : function, err : function) Retrieves an entity from the server. By default the response is formatted as a JavaScript object with the following properties: - parent : string - name : string - tags : array - pairs : object - components : object - type_info : object (optional) - alerts : array (optional)

    When the "raw" parameter is set to true, the response format is as described in the REST API manual. When the "raw" parameter is set to false or omitted the response will return labels instead of full paths for tags and components. To retrieve full paths, set the "full_paths" parameter to true.

    To poll for changes, set the "poll_interval" parameter to the number of milliseconds between requests. To abort polling, call abort() on the object returned by the function.

    Return: Object with the following members: - abort() : function Aborts the request. - url : string

    Example: flecs.entity("flecs.core.World", {}, (response) => { console.log(response); });

  • flecs.query(query, params, recv, err) Retrieves entities from the server that match the provided query. By default the response is formatted as a JavaScript object with the following properties: - type_info : object (optional) - entities : array - parent : string - name : string - tags : array - pairs : object - components : object - vars : object (optional)

    When the "raw" parameter is set to true, the response format is as described in the REST API manual. When the "raw" parameter is set to false or omitted the response will return labels instead of full paths for tags and components. To retrieve full paths, set the "full_paths" parameter to true.

    To poll for changes, set the "poll_interval" parameter to the number of milliseconds between requests. To abort polling, call abort() on the object returned by the function.

    Return: Object with the following members: - abort() : function Aborts the request. - url : string

    Example: flecs.query("Position, Velocity", {}, (response) => { console.log(response); });

  • flecs.query_name(query_name, params, recv, err) Same as flecs.query but for a named query.

    Return: Object with the following members: - abort() : function Aborts the request. - url : string

    Example: flecs.query_name("queries.my_query", {}, (response) => { console.log(response); });

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago

0.0.1

3 years ago