Introduction
CBWIRE is a ColdBox module that helps you build modern, reactive CFML applications in record time - without using much JavaScript or building backend APIs. Become a web development hero with CBWIRE!
Last updated
CBWIRE is a ColdBox module that helps you build modern, reactive CFML applications in record time - without using much JavaScript or building backend APIs. Become a web development hero with CBWIRE!
Last updated
Download and install CommandBox. From your CLI, start CommandBox by typing 'box'. Then run the following:
Let's insert a counter element into our Main layout using wire( "Counter" ).
Let's define our Counter component using the path ./wires/Counter.cfm.
You now have a reactive counter that increments when you click the plus button without any page refreshing or writing JavaScript! 🤯
CBWIRE automatically processes the HTML template, data properties, and actions of our component, then displays the component with its initial settings (which begin at 0).
When a user clicks a button, CBWIRE initiates an XMLHTTPRequest (XHR) to communicate with the server.
CBWIRE captures this XMLHTTPRequest and triggers the 'increment()' action, leading to an update in our data property.
Following this, CBWIRE updates the HTML template and includes this revised HTML in the XMLHTTPRequest response.
CBWIRE monitors any state changes and employs JavaScript and DOM comparison techniques to refresh the display on the screen.
We developed a responsive counter using just one file: wires/Counter.cfm.
We avoided writing any JavaScript code.
We didn't need to create an API.
There was no need for page refreshes.
We skipped using webpack or dealing with JavaScript compilation.
CBWIRE is transforming the way we build CFML applications, and we think you're going to love it too!
CBWIRE uses Livewire for its client-side functionality and DOM diffing and wouldn't exist without the awesome work of Caleb Porzio ( creator of Livewire, Alpine.js ).
The CBWIRE module for ColdBox is written and maintained by Grant Copley, Luis Majano, and Ortus Solutions.
Please consider becoming one of our lovingly esteemed Patreon supporters.
We stayed entirely within the CFML environment.