Computed Properties
Create dynamic properties for your UI Wires.
If you are on CBWIRE version 2.3.x and have enabled the configuration property useComputedPropertiesProxy, then you will need to follow this guide here instead as this fundamentally changes how computed properties are referenced and accessed.
Computed Properties are dynamic properties and are helpful for deriving values from a database or another persistent store like a cache.
Computed Properties are similar to Data Properties with some key differences:
They are declared as inline functions using
computed
.They can return any type of CFML value or object, not just values that can be serialized and parsed by JavaScript like Data Properties.
See the Wire Lifecycle page for details on when Computed Properties are executed.
Defining Properties
You can define Computed Properties on your Wires using computed
. Each Computed Property is invoked only once during a single request cycle.
Accessing Properties
You can access your Computed Properties from within your Actions using computed.[propertyName]
.
Getters
Getters are automatically created based on the property's name.
In the example below, you to access the property using this.getAllTasks()
. You can use this as an alternative to using computed
.
Templates
You can access Computed Properties in your Template via the args
scope.
Last updated