SlideShare a Scribd company logo
Session
SESSION
CBWIRE v3
LED BY
Grant Copley
GRANT COPLEY
SPEAKER AT ITB2023
“”If at first you don’t succeed, call it version 1.0.” - Unknown
• Senior Dev @ Ortus
• CFML since Allaire 3.1
• CBWIRE Lead
• Nashville, TN USA
• Proud dad, husband
• Guitar noodler,
beat-maker
What is CBWIRE?
■ ColdBox module
■ Simplifies building modern, reactive CFML apps
■ Removes need for JavaScript frameworks
● Vue, React
■ Removes creating unnecessary APIs
■ Built on Livewire
■ Integrates with AlpineJS
Let’s Code
■ Create a Counter component
■ Add a button that when clicked increments the counter by 1
Thanks to our sponsors
Components
Components
■ Self-isolated, reactive UI elements
■ Components placed in ./wires folder
■ Components defined as .cfm file ( New Syntax )
■ Single outer element <div> or alternate
■ Contain a HTML block ( <cfoutput> ) and a blueprint ( <cfscript> )
■ Rendered using wire( “ComponentName” ).
How is this working?
Let’s Code
■ Use dev tools to monitor CBWIRE requests
■ Talk about HTML-over-the-wire
Thanks to our sponsors
Data Properties
Data Properties
■ Component state
● Assigned default values
■ Declared using data = { “propertyName”: “defaultValue” }
● CFSCRIPT block
■ Can be modified when Actions are called
■ Tracked by JavaScript
Data Properties
■ Values must be JavaScript friendly data types
● Strings, Numbers, Arrays, Structs, Booleans
● No complex CFML data types ( Queries, Object instances )
■ Defined using double or single quotes
■ Reference in HTML using #propertyName#
■ Reference in CFSCRIPT using data.propertyName
Let’s Code
■ Create a resetCounter action that sets the counter back to 0
■ Use data.counter = 0
■ Use reset() instead
Data Properties & Security
■ Values of data properties are included with each XHR response
■ NEVER store sensitive data
● Passwords
● SSNs
Thanks to our sponsors
Actions
Actions
■ Actions
● Modify our component’s state
○ Alter the component’s rendered HTML
● Perform some task ( sending email )
■ Declared as function actionName() {} in the CFSCRIPT block
■ Triggered by Directives
● wire:click=”actionName”
Actions
■ Can pass parameters
● wire:click=”actionName( ‘param1’, ‘param2’ )”
■ Parameters are passed to your actions
● function actionName( param1, param2 ) {}
■ Params must be JavaScript friendly data types
Let’s Code
■ Add a button that increments the counter by a set amount.
■ Pass the number to your action as a parameter. incrementBy( 100 )
■ Button click increments counter by the given amount
Thanks to our sponsors
Computed Properties
Computed Properties
■ Invokes only during component rendering
■ Declare using computed = { propertyName: function () {} } within CFSCRIPT block
■ Return any CFML data type
■ Good for returning derived values
● Queries, ORM objects, etc…
■ Not parsed by JavaScript
Computed Properties
■ Reference in HTML using #propertyName()#
■ Reference in Actions using computed.propertyName().
■ Only invoked when called
■ Cached when invoked the first time
● Prevent caching by passing false. #propertyName( false )#
Let’s Code
■ Add an isEven() computed property
● Displays if counter value is even or odd
■ Display result on the page
Let’s Code
■ Create another instance of wire( “Counter” )
Thanks to our sponsors
onMount
onMount
■ Fires only when a component is initially rendered
● Not on subsequent renders
■ Pass parameters when calling wire() that
● Intercept with onMount()
■ wire( “Counter”, { “someParam” : “someValue” } )
Coding Challenge
■ Make one of the counters start at 100 using onMount().
Thanks to our sponsors
Data Binding
Data Binding
■ Bind input elements with Data Properties using wire:model
● <input wire:model=”dataProperty” type=”text”>
● <input wire:model=”dataProperty” type=”checkbox” value=”true”>
● <input wire:model=”dataProperty” type=”radio” value=”1”>
● <select wire:model=”dataProperty”>
● <textarea wire:model=”dataProperty”>
■ As the user types or enters data, the component re-renders
Let’s Code
■ Create a form component
● Firstname and lastname input fields
■ Use wire:model to bind the inputs to data properties
■ Display the data properties on the page to see the updates
Let’s Code
■ Use wire:model.debounce to slow down server updates
■ Use wire:model.lazy to prevent server update until user clicks away from input
■ Use wire:model.defer to prevent server update until an action is called
Thanks to our sponsors
Directives
Directives
■ wire:model
■ wire:click
■ wire:submit
■ wire:keydown
■ wire:keydown.enter
■ wire:poll
■ wire:init
■ wire:loading
■ wire:loading.class
■ wire:loading.class.remove
■ wire:loading.attr
■ wire:dirty
■ wire:target
■ wire:ignore
■ ….
Thanks to our sponsors
Events
Events & Listeners
■ Components communicate using events and listeners
■ Emit events within actions using emit( “eventName” )
■ Listen for events using listeners = { “eventName” : “action” } in CFSCRIPT block
Coding Challenge
■ Emit an event from the Counter component
■ Listen for the event in another component
Counter with Emitted Event
CBWIRE v3
CBWIRE v3 announcing here @ ITB 2023
- 19 tickets completed ( 13 enhancements, 6 bugs )
- Refactored and optimized core
- New Component Syntax
- New integration with AlpineJS ( Entangle )
- Improved Component Testing
- New Lifecycle Hooks
- Documentation updates
AND MORE...
Thanks to our sponsors
RESOURCES
Thanks to our sponsors
QA
THANK YOU
Thanks to our sponsors

More Related Content

Similar to ITB_2023_CBWire_v3_Grant_Copley.pdf

Durable Azure Functions
Durable Azure FunctionsDurable Azure Functions
Durable Azure Functions
Pushkar Saraf
 
Monitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandMonitoring und Metriken im Wunderland
Monitoring und Metriken im Wunderland
D
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
Thinkful
 
Activity Recognition
Activity RecognitionActivity Recognition
Activity Recognition
AndreaNapoletani
 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
 
angular-concepts-introduction-slides.pptx
angular-concepts-introduction-slides.pptxangular-concepts-introduction-slides.pptx
angular-concepts-introduction-slides.pptx
shekharmpatil1309
 
Modern Perl Web Development with Dancer
Modern Perl Web Development with DancerModern Perl Web Development with Dancer
Modern Perl Web Development with Dancer
Dave Cross
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvcHanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvcdenemedeniz
 
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
Amazon Web Services
 
Moving From AngularJS to Angular 2
Moving From AngularJS to  Angular 2 Moving From AngularJS to  Angular 2
Moving From AngularJS to Angular 2
Exilesoft
 
Client sidescripting javascript
Client sidescripting javascriptClient sidescripting javascript
Client sidescripting javascript
Selvin Josy Bai Somu
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
Anton Ivanov
 
Intro to javascript (5:2)
Intro to javascript (5:2)Intro to javascript (5:2)
Intro to javascript (5:2)
Thinkful
 
Robust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time ChecksRobust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time Checks
Stoyan Nikolov
 
Trends and development practices in Serverless architectures
Trends and development practices in Serverless architecturesTrends and development practices in Serverless architectures
Trends and development practices in Serverless architectures
DiUS
 
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflowsBeyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
DataWorks Summit
 
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
The Grid the Brad and the Ugly: Using Grids to Improve Your ApplicationsThe Grid the Brad and the Ugly: Using Grids to Improve Your Applications
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
balassaitis
 
Netflix Machine Learning Infra for Recommendations - 2018
Netflix Machine Learning Infra for Recommendations - 2018Netflix Machine Learning Infra for Recommendations - 2018
Netflix Machine Learning Infra for Recommendations - 2018
Karthik Murugesan
 
ML Infra for Netflix Recommendations - AI NEXTCon talk
ML Infra for Netflix Recommendations - AI NEXTCon talkML Infra for Netflix Recommendations - AI NEXTCon talk
ML Infra for Netflix Recommendations - AI NEXTCon talk
Faisal Siddiqi
 

Similar to ITB_2023_CBWire_v3_Grant_Copley.pdf (20)

Durable Azure Functions
Durable Azure FunctionsDurable Azure Functions
Durable Azure Functions
 
Monitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandMonitoring und Metriken im Wunderland
Monitoring und Metriken im Wunderland
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
 
Activity Recognition
Activity RecognitionActivity Recognition
Activity Recognition
 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
 
angular-concepts-introduction-slides.pptx
angular-concepts-introduction-slides.pptxangular-concepts-introduction-slides.pptx
angular-concepts-introduction-slides.pptx
 
Modern Perl Web Development with Dancer
Modern Perl Web Development with DancerModern Perl Web Development with Dancer
Modern Perl Web Development with Dancer
 
Hanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvcHanselman lipton asp_connections_ams304_mvc
Hanselman lipton asp_connections_ams304_mvc
 
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
 
Moving From AngularJS to Angular 2
Moving From AngularJS to  Angular 2 Moving From AngularJS to  Angular 2
Moving From AngularJS to Angular 2
 
Client sidescripting javascript
Client sidescripting javascriptClient sidescripting javascript
Client sidescripting javascript
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
Intro to javascript (5:2)
Intro to javascript (5:2)Intro to javascript (5:2)
Intro to javascript (5:2)
 
Robust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time ChecksRobust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time Checks
 
Trends and development practices in Serverless architectures
Trends and development practices in Serverless architecturesTrends and development practices in Serverless architectures
Trends and development practices in Serverless architectures
 
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflowsBeyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
 
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
The Grid the Brad and the Ugly: Using Grids to Improve Your ApplicationsThe Grid the Brad and the Ugly: Using Grids to Improve Your Applications
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
 
Netflix Machine Learning Infra for Recommendations - 2018
Netflix Machine Learning Infra for Recommendations - 2018Netflix Machine Learning Infra for Recommendations - 2018
Netflix Machine Learning Infra for Recommendations - 2018
 
ML Infra for Netflix Recommendations - AI NEXTCon talk
ML Infra for Netflix Recommendations - AI NEXTCon talkML Infra for Netflix Recommendations - AI NEXTCon talk
ML Infra for Netflix Recommendations - AI NEXTCon talk
 

More from Ortus Solutions, Corp

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
ITB2024 - Keynote Day 1 - Ortus Solutions.pdf
ITB2024 - Keynote Day 1 - Ortus Solutions.pdfITB2024 - Keynote Day 1 - Ortus Solutions.pdf
ITB2024 - Keynote Day 1 - Ortus Solutions.pdf
Ortus Solutions, Corp
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Ortus Solutions, Corp
 
Ortus Government.pdf
Ortus Government.pdfOrtus Government.pdf
Ortus Government.pdf
Ortus Solutions, Corp
 
Luis Majano The Battlefield ORM
Luis Majano The Battlefield ORMLuis Majano The Battlefield ORM
Luis Majano The Battlefield ORM
Ortus Solutions, Corp
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
Ortus Solutions, Corp
 
Secure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionSecure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusion
Ortus Solutions, Corp
 
Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023
Ortus Solutions, Corp
 
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
Ortus Solutions, Corp
 
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
Ortus Solutions, Corp
 
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
Ortus Solutions, Corp
 
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
Ortus Solutions, Corp
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
Ortus Solutions, Corp
 
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
Ortus Solutions, Corp
 
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
Ortus Solutions, Corp
 
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
Ortus Solutions, Corp
 
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
Ortus Solutions, Corp
 
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
Ortus Solutions, Corp
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
Ortus Solutions, Corp
 

More from Ortus Solutions, Corp (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
ITB2024 - Keynote Day 1 - Ortus Solutions.pdf
ITB2024 - Keynote Day 1 - Ortus Solutions.pdfITB2024 - Keynote Day 1 - Ortus Solutions.pdf
ITB2024 - Keynote Day 1 - Ortus Solutions.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Ortus Government.pdf
Ortus Government.pdfOrtus Government.pdf
Ortus Government.pdf
 
Luis Majano The Battlefield ORM
Luis Majano The Battlefield ORMLuis Majano The Battlefield ORM
Luis Majano The Battlefield ORM
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
 
Secure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionSecure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusion
 
Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023
 
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
 
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
 
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
 
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
 
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
 
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
 
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
 
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
 
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
 

Recently uploaded

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 

Recently uploaded (20)

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 

ITB_2023_CBWire_v3_Grant_Copley.pdf

  • 2. GRANT COPLEY SPEAKER AT ITB2023 “”If at first you don’t succeed, call it version 1.0.” - Unknown • Senior Dev @ Ortus • CFML since Allaire 3.1 • CBWIRE Lead • Nashville, TN USA • Proud dad, husband • Guitar noodler, beat-maker
  • 3. What is CBWIRE? ■ ColdBox module ■ Simplifies building modern, reactive CFML apps ■ Removes need for JavaScript frameworks ● Vue, React ■ Removes creating unnecessary APIs ■ Built on Livewire ■ Integrates with AlpineJS
  • 4. Let’s Code ■ Create a Counter component ■ Add a button that when clicked increments the counter by 1
  • 5. Thanks to our sponsors Components
  • 6. Components ■ Self-isolated, reactive UI elements ■ Components placed in ./wires folder ■ Components defined as .cfm file ( New Syntax ) ■ Single outer element <div> or alternate ■ Contain a HTML block ( <cfoutput> ) and a blueprint ( <cfscript> ) ■ Rendered using wire( “ComponentName” ).
  • 7. How is this working?
  • 8. Let’s Code ■ Use dev tools to monitor CBWIRE requests ■ Talk about HTML-over-the-wire
  • 9. Thanks to our sponsors Data Properties
  • 10. Data Properties ■ Component state ● Assigned default values ■ Declared using data = { “propertyName”: “defaultValue” } ● CFSCRIPT block ■ Can be modified when Actions are called ■ Tracked by JavaScript
  • 11. Data Properties ■ Values must be JavaScript friendly data types ● Strings, Numbers, Arrays, Structs, Booleans ● No complex CFML data types ( Queries, Object instances ) ■ Defined using double or single quotes ■ Reference in HTML using #propertyName# ■ Reference in CFSCRIPT using data.propertyName
  • 12. Let’s Code ■ Create a resetCounter action that sets the counter back to 0 ■ Use data.counter = 0 ■ Use reset() instead
  • 13. Data Properties & Security ■ Values of data properties are included with each XHR response ■ NEVER store sensitive data ● Passwords ● SSNs
  • 14. Thanks to our sponsors Actions
  • 15. Actions ■ Actions ● Modify our component’s state ○ Alter the component’s rendered HTML ● Perform some task ( sending email ) ■ Declared as function actionName() {} in the CFSCRIPT block ■ Triggered by Directives ● wire:click=”actionName”
  • 16. Actions ■ Can pass parameters ● wire:click=”actionName( ‘param1’, ‘param2’ )” ■ Parameters are passed to your actions ● function actionName( param1, param2 ) {} ■ Params must be JavaScript friendly data types
  • 17. Let’s Code ■ Add a button that increments the counter by a set amount. ■ Pass the number to your action as a parameter. incrementBy( 100 ) ■ Button click increments counter by the given amount
  • 18. Thanks to our sponsors Computed Properties
  • 19. Computed Properties ■ Invokes only during component rendering ■ Declare using computed = { propertyName: function () {} } within CFSCRIPT block ■ Return any CFML data type ■ Good for returning derived values ● Queries, ORM objects, etc… ■ Not parsed by JavaScript
  • 20. Computed Properties ■ Reference in HTML using #propertyName()# ■ Reference in Actions using computed.propertyName(). ■ Only invoked when called ■ Cached when invoked the first time ● Prevent caching by passing false. #propertyName( false )#
  • 21. Let’s Code ■ Add an isEven() computed property ● Displays if counter value is even or odd ■ Display result on the page
  • 22. Let’s Code ■ Create another instance of wire( “Counter” )
  • 23. Thanks to our sponsors onMount
  • 24. onMount ■ Fires only when a component is initially rendered ● Not on subsequent renders ■ Pass parameters when calling wire() that ● Intercept with onMount() ■ wire( “Counter”, { “someParam” : “someValue” } )
  • 25. Coding Challenge ■ Make one of the counters start at 100 using onMount().
  • 26. Thanks to our sponsors Data Binding
  • 27. Data Binding ■ Bind input elements with Data Properties using wire:model ● <input wire:model=”dataProperty” type=”text”> ● <input wire:model=”dataProperty” type=”checkbox” value=”true”> ● <input wire:model=”dataProperty” type=”radio” value=”1”> ● <select wire:model=”dataProperty”> ● <textarea wire:model=”dataProperty”> ■ As the user types or enters data, the component re-renders
  • 28. Let’s Code ■ Create a form component ● Firstname and lastname input fields ■ Use wire:model to bind the inputs to data properties ■ Display the data properties on the page to see the updates
  • 29. Let’s Code ■ Use wire:model.debounce to slow down server updates ■ Use wire:model.lazy to prevent server update until user clicks away from input ■ Use wire:model.defer to prevent server update until an action is called
  • 30. Thanks to our sponsors Directives
  • 31. Directives ■ wire:model ■ wire:click ■ wire:submit ■ wire:keydown ■ wire:keydown.enter ■ wire:poll ■ wire:init ■ wire:loading ■ wire:loading.class ■ wire:loading.class.remove ■ wire:loading.attr ■ wire:dirty ■ wire:target ■ wire:ignore ■ ….
  • 32. Thanks to our sponsors Events
  • 33. Events & Listeners ■ Components communicate using events and listeners ■ Emit events within actions using emit( “eventName” ) ■ Listen for events using listeners = { “eventName” : “action” } in CFSCRIPT block
  • 34. Coding Challenge ■ Emit an event from the Counter component ■ Listen for the event in another component
  • 36. CBWIRE v3 CBWIRE v3 announcing here @ ITB 2023 - 19 tickets completed ( 13 enhancements, 6 bugs ) - Refactored and optimized core - New Component Syntax - New integration with AlpineJS ( Entangle ) - Improved Component Testing - New Lifecycle Hooks - Documentation updates AND MORE...
  • 37. Thanks to our sponsors RESOURCES
  • 38. Thanks to our sponsors QA
  • 39. THANK YOU Thanks to our sponsors