The eitri-bifrost
is the bridge to interact with device and Eitri platform APIs. It's a library that makes those APIs available to eitri-apps. Functionalities such as navigation and access to other device resources can be accessed through this library.
To use the library's resources, simply import it into a .js
file.
import Eitri from "eitri-bifrost";
The eitri-bifrost
works in conjunction with another component of Eitri technology called eitri-machine
.
The eitri-machine
is a set of libraries that are installed in the main application and create the environment for eitri-apps to run. They are: eitri-android
, eitri-ios
, and react-native-eitri
.
Some functionalities depend directly on the version of eitri-machine
installed in the main app. It is important for an eitri-app developer to know this relationship and handle it properly so that their code is secure and provides the best experience for each client.
It is necessary to validate if a functionality is present on the device that is running. Given that some people do not automatically update their devices, it is possible that a client is running an older version version of eitri-machine, without support for a particular functionality that was present during the development of your eitri-app on your test device.
This concept is similar to others seen in technologies like browsers and in operating systems like Android and iOS.
Example of a functionality support table in browsers on MDN - Browser Support or caniuse.
Throughout the documentation, you will see in each method a description of which API_LEVEL
is required to use it. With this information, you can perform an availability check as shown in the example below:
// method definition: canIUse(apiLevel: number) : boolean
if (Eitri.canIUse(3)) {
const value = await Eitri.exampleNamespace.exampleMethod()
// ...
} else {
// handle or implement different code for those who do not yet have the eitri-machine with support for API Level 3
}
Control of the API_LEVEL
is necessary, especially for versions still in distribution. By monitoring the adoption of the eitri-machine
in your app, you can relax validations for older versions. For usage and adoption charts of the eitri-machine
in the installed base of your app, consult your Eitri console.
Generated using TypeDoc