DocsPage behavior reference
On this page

Page functions reference

Register functions used by FQL expressions.

Before you begin: Component imports reference.

Page Functions

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Use registered functions by name in FQL:

FQL state configuration

Add this configuration inside your page’s {STATE} declaration. Inspect state shows its configuration; live queries and saved data run against your local site. Try a complete FQL page →

The value before .functionName(...) is always the first argument. Explicit FQL arguments follow it. Inside a list, pass $ when a function needs the full current item, such as $.status.statusLabel($). Frontbacked never supplies a hidden item argument.

Function names must be single JavaScript-style identifiers, such as formatCurrency; dotted registry names are invalid. When multiple .functionName() segments are chained, Frontbacked pipes the value through them from left to right before setting state. Built-ins are Number, String, Boolean, count, trim, lowercase, uppercase, and avatar. Built-in currency functions include moneyResolve, moneyFormat, supportedCurrencies, and setCurrency. The event binding authAction(name, body) runs a registered action that can bring the visitor back after sign-in; see Sign In and Continue an Action. Themes can also register their own formatters using Frontbacked.money.*; unknown functions fail visibly.

Money helpers keep theme markup independent from currency precision:

index.html
js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Money values arrive as { values: { USD: { amount: "125.50", currency: "USD" } } }. Use the built-in moneyResolve to select or convert a price for the visitor, followed by moneyFormat to display it. Themes can also register custom functions such as moneyAmount, moneyCurrency, or exactMoneyFormat; each receives the value before it as its first argument. Use Frontbacked.money.getAmount, Frontbacked.money.getCurrency, Frontbacked.money.format, Frontbacked.money.add, Frontbacked.money.subtract, Frontbacked.money.compare, Frontbacked.money.convertTo, and Frontbacked.money.allocate for exact money operations. Amounts are returned as strings to preserve exactness. Formatting accepts minDecimals, maxDecimals, and preserveInteger.

Continue with Attachments and security reference.