Appearance
Programmatic API
Any Fibbl script adds global Fibbl
object. You can use it to access the API methods. An example:
js
if (await Fibbl.checkModelAvailability('@demo-shoe')) {
// insert Fibbl components
}
INFO
Since all Fibbl scripts are ES6 modules, they are not loaded synchronously: type="module"
makes the script deferred (as if defer
attribute is set). That is, you have to wait until the script has been loaded, before using Fibbl
object, e.g. listen for DOMContentLoaded
event.
API methods
checkModelAvailability(productId: string): Promise<boolean>
- a method to check whether a model is available or not. Fibbl Components do this check automatically and hide themselves, when there is no model with the provided product id. However, in certain cases it's needed to get this information beforehand (e.g. if you update the UI dynamically via JS).
API limitations
Do not use any props/methods/classes/components, which are not explicitly described in this documentation. Also, never send HTTP requests to the Fibbl backend endpoints (e.g. to get/check models) - the backend API is private and can be changed at any time.
If you find that the current API is not enough to implement what you want, please, don't try to bypass the limitations - ask Fibbl managers to enhance it. Otherwise, after an API update your workarounds can be broken.