- Introduction
- Installation
- Usage
The bzBond-web-template is the part of the bzBond toolset that supports web project authoring. It is an npm project with the following features:
- A build process, accessed via the command
npm run build
, which generates a single-file web project of the type required by the bzBond web project manager - The bzBond-js npm package to allow easy access to bzBond's features
- An example index.js file to demonstrate how to get started with live development and web project authoring.
The bzBond-web-template is installed via create-bzbond-app. It is included in an all in one install and is the only element of a web only install.
Web projects created with this template function are regular npm projects and can be authored as such. By default the template:
- Includes bzBond-js as a dependency in
package.json
- Includes a default entry point file: index.js which imports bzBond-js and references syles in app.scss. Note that scss files can include plain css, or be entirely plain css.
- Includes an template html file index.html into which is injected the
index.js
file.
Methods in bzBond that interact with Claris/FileMaker Pro return promises. This means you will need to use promise chaining or async/await
// Display web viewer config from Claris/FileMaker Pro
bzBond.SyncConfig()
.then((config) => {
console.log(config)
});
// Display web viewer config from Claris/FileMaker Pro
const launch = async () => {
const config = await bzBond.SyncConfig();
console.log(config)
}
launch();
or using an anonymous async function:
// Display web viewer config from Claris/FileMaker Pro
(async () => {
const config = await bzBond.SyncConfig();
console.log(config)
})();
// Run a script from a web viewer config prop
// and display the result
bzBond.SyncConfig()
.then((config) => {
bzBond.PerformScript(config.launchScript)
})
.then((scriptResult) => {
console.log(scriptResult)
});
// Run a script from a web viewer config prop
// and display the result
const launch = async () => {
const config = await bzBond.SyncConfig();
const scriptResult = await bzBond.PerformScript(config.launchScript);
console.log(scriptResult);
}
launch();
or using an anonymous async function:
// Run a script from a web viewer config prop
// and display the result
(async () => {
const config = await bzBond.SyncConfig();
const scriptResult = await bzBond.PerformScript(config.launchScript);
console.log(scriptResult);
})();
To see live changes in the browser as you development, run the command npm start
. This will open your web browser at the project page. To prevent the web browser opening run the command npm run start_silent
instead.
To use live development with projects stored in the bzBond web project manager see the debugging and live development section of the bzBond-claris documentation.
To create a web project that can be added to the bzBond web project manager:
Run the command npm run build
. This creates the single-file web project index.html file at the path dist/index.html
. See the bzBond-claris documentation for instructions on adding the web project to a Claris/FileMaker solution.