SlideShare a Scribd company logo
1 of 27
Download to read offline
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
As c on Ja c t i L h n
Com n us S C ax
28 JU
t
SA , 2018
1
Sikha Baid
baid.sikha@gmail.com
@sikhabaid
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
I am S a d
Sr. Salesforce Developer
Cognizant Technology Solutions
Twitter: @sikhabaid
Hello!
2
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
“Jav p i t l an e t
I’m a of t o l e t
do ’t e t e n or y ar
us t.” - DO S OC R
3
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 4
Wha ’s i r
● The Problem
● Handy ES6 or EcmaScript 6 Features
● What’s all the buzz about JS Promises
● The Callback Hell
● Welcome – SFDC Lax powered by JS Promises
● Let’s write some code using Lax
● Things to Remember
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
The l – Wha
ar ol g
5
● Need to write elegant JavaScript in LC
● JavaScript is a first class citizen like Apex
● Solving the Traditional Callback Hell Problem
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 6
Han ES6 or E Sc t 6 Fe t e
● Are you still using the age old JS ?!?
● Have you explored the new JS features –
❏ Let/Const Keywords
❏ Arrow Functions
❏ Promises
❏ And much MOAR……
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 7
ES6 – Let/Con
Let - declare variable in limited scope
Const - Constants which cannot be assigned again, it’s fixed.
Let’s e t co !
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 8
ES6 – Ar o F n on
Functions syntax has changed a bit with ES6.
1. Declare and assign variable as a function.
2. Body of the function.
Let’s e t co !
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 9
The b Hel
It consists of multiple nested callbacks
which makes code hard to read,
debug and maintain.
It is understandable how one
might unknowingly get caught in
Callback Hell while dealing with
asynchronous logic.
Let’s e t co !
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
● It ain’t any new feature.
● A syntactic sugar to write async. JS more
elegantly
● Write more readable and intuitive JS than
ever!
● Could be a little overwhelming but trust me
will be easier soon ;-)
Wha ’s a t z a t J o s
10
Let’s e t co !
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
What if you could write Async JS in
Lightning avoiding the complexities
of Promises ?!?
Wel – S C ax re y
J ro s
11
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
● Write a clear asynchronous JavaScript code
● Efficiently call Apex with powerful exception
handling
● Ton of utility techniques
● Start writing JS in the modern approach
Wh D ax ?
12
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 13
Wit la v/s wi l
Let’s e t co !
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 14
2 3
Set g La
Deploy using either of the the listed
1. Hit the url
https://githubsfdeploy.herokuapp.com/app/githubdeploy/ruslan-k
urchenko/sfdc-lax and hit deploy.
2. Visit the github repo mentioned in the references and deploy using
the ‘Deploy to Salesforce’ button.
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 15
Let’s it e c u n
Lax
Dem e
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 16
Create an account
with details entered
on UI
Create a contact
record linking it to
created contact
Send an email
notification to the
email address
confirming the account
creation.
Resolve
Resolve
Show error/exception
on UI
Reject
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 17
2 3
Wha n S C ax ?
● Performing multiple chained actions
lax.enqueue(name[, params[,
options]]).then(callback).then(callback)
● Performing multiple concurrent actions
lax.enqueueAll(actions).then(callback)
● Create and return LaxAction builder
lax.action(name)
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 18
2 3
Wha n S C ax ?
● function to load a record template to the LDS targetRecord
attribute
lax.lds(id).getNewRecord(sobjectType[,
recordTypeId[, skipCache]])
● the function to save the record that loaded to LDS in the edit EDIT
mode
lax.lds(id).saveRecord()
● the function to delete a record using LDS
lax.lds(id).deleteRecord()
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 19
2 3
Wha n S C ax ?
● creates an object with LaxEventBuilder prototype and the context
event by provided name
lax.event(eventName)
● creates a component(s) from a type and a set of attributes
lax.createComponent(type[, attributes])
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 20
● SFDC Lax is just a service Lightning
Component to welcome you to the world
of Promises
● You can build your own Promise based
Components too!
● It’s never too late and you can still write
better JS!
● Taking a moment to thank the SFDC Lax
creator - Ruslan Kurchenko
Thi s R em
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 21
Ref ce
● ES6 - https://hackernoon.com/es6-for-beginners-f98120b57414
● Promises - https://scotch.io/tutorials/javascript-promises-for-dummies
● Lax - https://github.com/ruslan-kurchenko/sfdc-lax
● API Reference - https://ruslan-kurchenko.github.io/sfdc-lax/
● Execute anonymous JS -
https://es6console.com/
https://repl.it/repls/TrimCleanLine
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 22
Q & A
Ple on’t u ;-)
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTEwww.jaipurdevfest.com @jaipurdevfest jaipurdevfest@googlegroups.com #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 23
ThanksYou can find me at @sikhabaid on twitter or email : baid.sikha@gmail..com
www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE
28 JU
t
SA , 2018
26
Accelerating Technology. Activating Communities.

More Related Content

What's hot

Grokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the MagicGrokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the MagicGrokking VN
 
Junior.next(BathDigitalFestival)
Junior.next(BathDigitalFestival)Junior.next(BathDigitalFestival)
Junior.next(BathDigitalFestival)Tara Ojo
 
Designing with Microsoft Expression Web: Today and Tomorrow
Designing with Microsoft Expression Web: Today and TomorrowDesigning with Microsoft Expression Web: Today and Tomorrow
Designing with Microsoft Expression Web: Today and Tomorrowgoodfriday
 
FirefoxOS app making for beginners
FirefoxOS app making for beginnersFirefoxOS app making for beginners
FirefoxOS app making for beginnersSiddhartha Rao
 

What's hot (6)

Grokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the MagicGrokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the Magic
 
Social Bookmark Api
Social Bookmark ApiSocial Bookmark Api
Social Bookmark Api
 
Junior.next(BathDigitalFestival)
Junior.next(BathDigitalFestival)Junior.next(BathDigitalFestival)
Junior.next(BathDigitalFestival)
 
Designing with Microsoft Expression Web: Today and Tomorrow
Designing with Microsoft Expression Web: Today and TomorrowDesigning with Microsoft Expression Web: Today and Tomorrow
Designing with Microsoft Expression Web: Today and Tomorrow
 
FirefoxOS app making for beginners
FirefoxOS app making for beginnersFirefoxOS app making for beginners
FirefoxOS app making for beginners
 
Gdg 3.12.2014
Gdg 3.12.2014Gdg 3.12.2014
Gdg 3.12.2014
 

Similar to Introduction to JavaScript Promises and Lax in Lightning

No Code IBM Watson Integration with External Services and Flows
No Code IBM Watson Integration with External Services and FlowsNo Code IBM Watson Integration with External Services and Flows
No Code IBM Watson Integration with External Services and FlowsShruti Sridharan
 
Get ready for lightning ready!
Get ready for lightning ready!Get ready for lightning ready!
Get ready for lightning ready!Praful Gadge
 
Gear up for Continuous Integration with Salesforce DX, Circle CI and Clayton
Gear up for Continuous Integration with Salesforce DX, Circle CI and ClaytonGear up for Continuous Integration with Salesforce DX, Circle CI and Clayton
Gear up for Continuous Integration with Salesforce DX, Circle CI and ClaytonDaniel Stange
 
Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsRasheed Waraich
 
Front End Sadness to Happiness: The React on Rails Story
Front End Sadness to Happiness: The React on Rails StoryFront End Sadness to Happiness: The React on Rails Story
Front End Sadness to Happiness: The React on Rails StoryJustin Gordon
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesFab L
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...DevSecCon
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 
JavaScript All The Things
JavaScript All The ThingsJavaScript All The Things
JavaScript All The ThingsJordan Yaker
 
JS digest. April 2018
JS digest. April 2018JS digest. April 2018
JS digest. April 2018ElifTech
 
When it all GOes right
When it all GOes rightWhen it all GOes right
When it all GOes rightPavlo Golub
 
Towards component based web UI with ReactJS
Towards component based web UI with ReactJSTowards component based web UI with ReactJS
Towards component based web UI with ReactJSOliver Häger
 
Lean frontend development
Lean frontend developmentLean frontend development
Lean frontend developmentMatteo Guidotto
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistMark Fayngersh
 
Past and today of Metasepi project
Past and today of Metasepi projectPast and today of Metasepi project
Past and today of Metasepi projectKiwamu Okabe
 
Scala services in action
Scala services in actionScala services in action
Scala services in actionUnderscore
 

Similar to Introduction to JavaScript Promises and Lax in Lightning (20)

Get Struck By Lightning
Get Struck By LightningGet Struck By Lightning
Get Struck By Lightning
 
Js basics
Js basicsJs basics
Js basics
 
No Code IBM Watson Integration with External Services and Flows
No Code IBM Watson Integration with External Services and FlowsNo Code IBM Watson Integration with External Services and Flows
No Code IBM Watson Integration with External Services and Flows
 
Get ready for lightning ready!
Get ready for lightning ready!Get ready for lightning ready!
Get ready for lightning ready!
 
Gear up for Continuous Integration with Salesforce DX, Circle CI and Clayton
Gear up for Continuous Integration with Salesforce DX, Circle CI and ClaytonGear up for Continuous Integration with Salesforce DX, Circle CI and Clayton
Gear up for Continuous Integration with Salesforce DX, Circle CI and Clayton
 
Graalvm with Groovy and Kotlin - Greach 2019
Graalvm with Groovy and Kotlin - Greach 2019Graalvm with Groovy and Kotlin - Greach 2019
Graalvm with Groovy and Kotlin - Greach 2019
 
Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web Apps
 
Front End Sadness to Happiness: The React on Rails Story
Front End Sadness to Happiness: The React on Rails StoryFront End Sadness to Happiness: The React on Rails Story
Front End Sadness to Happiness: The React on Rails Story
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation Slides
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
JavaScript All The Things
JavaScript All The ThingsJavaScript All The Things
JavaScript All The Things
 
JS digest. April 2018
JS digest. April 2018JS digest. April 2018
JS digest. April 2018
 
When it all GOes right
When it all GOes rightWhen it all GOes right
When it all GOes right
 
Graalvm with Groovy and Kotlin - Madrid GUG 2019
Graalvm with Groovy and Kotlin - Madrid GUG 2019Graalvm with Groovy and Kotlin - Madrid GUG 2019
Graalvm with Groovy and Kotlin - Madrid GUG 2019
 
Towards component based web UI with ReactJS
Towards component based web UI with ReactJSTowards component based web UI with ReactJS
Towards component based web UI with ReactJS
 
Lean frontend development
Lean frontend developmentLean frontend development
Lean frontend development
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
Past and today of Metasepi project
Past and today of Metasepi projectPast and today of Metasepi project
Past and today of Metasepi project
 
Scala services in action
Scala services in actionScala services in action
Scala services in action
 

More from Sikha Baid ☁

Reimagine Component Designing
Reimagine Component DesigningReimagine Component Designing
Reimagine Component DesigningSikha Baid ☁
 
#FunLearnSeason2 - Talk 3 : Health and Fitness
#FunLearnSeason2 - Talk 3 : Health and Fitness#FunLearnSeason2 - Talk 3 : Health and Fitness
#FunLearnSeason2 - Talk 3 : Health and FitnessSikha Baid ☁
 
#FunLearnSeason2 - Talk 2 : Publishing your App on Appexchange
#FunLearnSeason2 - Talk 2 : Publishing your App on Appexchange#FunLearnSeason2 - Talk 2 : Publishing your App on Appexchange
#FunLearnSeason2 - Talk 2 : Publishing your App on AppexchangeSikha Baid ☁
 
FunLearn Season 2 - Talk 1 - Salesforce Security
FunLearn Season 2 - Talk 1 - Salesforce SecurityFunLearn Season 2 - Talk 1 - Salesforce Security
FunLearn Season 2 - Talk 1 - Salesforce SecuritySikha Baid ☁
 
FunLearn Season 1 - Talk 1 - salesforce lightning communities
FunLearn Season 1 - Talk 1 - salesforce lightning communitiesFunLearn Season 1 - Talk 1 - salesforce lightning communities
FunLearn Season 1 - Talk 1 - salesforce lightning communitiesSikha Baid ☁
 
FunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyle
FunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyleFunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyle
FunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyleSikha Baid ☁
 
FunLearn Season 1 - Talk 2 - Ace with journey builder
FunLearn Season 1 - Talk 2 - Ace with journey builderFunLearn Season 1 - Talk 2 - Ace with journey builder
FunLearn Season 1 - Talk 2 - Ace with journey builderSikha Baid ☁
 
Salesforce Shield – Enhanced Data Security
Salesforce Shield – Enhanced Data SecuritySalesforce Shield – Enhanced Data Security
Salesforce Shield – Enhanced Data SecuritySikha Baid ☁
 
Scet sfdc for students - workshop content
Scet   sfdc for students - workshop contentScet   sfdc for students - workshop content
Scet sfdc for students - workshop contentSikha Baid ☁
 

More from Sikha Baid ☁ (9)

Reimagine Component Designing
Reimagine Component DesigningReimagine Component Designing
Reimagine Component Designing
 
#FunLearnSeason2 - Talk 3 : Health and Fitness
#FunLearnSeason2 - Talk 3 : Health and Fitness#FunLearnSeason2 - Talk 3 : Health and Fitness
#FunLearnSeason2 - Talk 3 : Health and Fitness
 
#FunLearnSeason2 - Talk 2 : Publishing your App on Appexchange
#FunLearnSeason2 - Talk 2 : Publishing your App on Appexchange#FunLearnSeason2 - Talk 2 : Publishing your App on Appexchange
#FunLearnSeason2 - Talk 2 : Publishing your App on Appexchange
 
FunLearn Season 2 - Talk 1 - Salesforce Security
FunLearn Season 2 - Talk 1 - Salesforce SecurityFunLearn Season 2 - Talk 1 - Salesforce Security
FunLearn Season 2 - Talk 1 - Salesforce Security
 
FunLearn Season 1 - Talk 1 - salesforce lightning communities
FunLearn Season 1 - Talk 1 - salesforce lightning communitiesFunLearn Season 1 - Talk 1 - salesforce lightning communities
FunLearn Season 1 - Talk 1 - salesforce lightning communities
 
FunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyle
FunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyleFunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyle
FunLearn Season 1 - Talk 3 - Holistic approach to healthy lifestyle
 
FunLearn Season 1 - Talk 2 - Ace with journey builder
FunLearn Season 1 - Talk 2 - Ace with journey builderFunLearn Season 1 - Talk 2 - Ace with journey builder
FunLearn Season 1 - Talk 2 - Ace with journey builder
 
Salesforce Shield – Enhanced Data Security
Salesforce Shield – Enhanced Data SecuritySalesforce Shield – Enhanced Data Security
Salesforce Shield – Enhanced Data Security
 
Scet sfdc for students - workshop content
Scet   sfdc for students - workshop contentScet   sfdc for students - workshop content
Scet sfdc for students - workshop content
 

Recently uploaded

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 

Recently uploaded (20)

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 

Introduction to JavaScript Promises and Lax in Lightning

  • 1. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE As c on Ja c t i L h n Com n us S C ax 28 JU t SA , 2018 1 Sikha Baid baid.sikha@gmail.com @sikhabaid
  • 2. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE I am S a d Sr. Salesforce Developer Cognizant Technology Solutions Twitter: @sikhabaid Hello! 2
  • 3. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE “Jav p i t l an e t I’m a of t o l e t do ’t e t e n or y ar us t.” - DO S OC R 3
  • 4. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 4 Wha ’s i r ● The Problem ● Handy ES6 or EcmaScript 6 Features ● What’s all the buzz about JS Promises ● The Callback Hell ● Welcome – SFDC Lax powered by JS Promises ● Let’s write some code using Lax ● Things to Remember
  • 5. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE The l – Wha ar ol g 5 ● Need to write elegant JavaScript in LC ● JavaScript is a first class citizen like Apex ● Solving the Traditional Callback Hell Problem
  • 6. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 6 Han ES6 or E Sc t 6 Fe t e ● Are you still using the age old JS ?!? ● Have you explored the new JS features – ❏ Let/Const Keywords ❏ Arrow Functions ❏ Promises ❏ And much MOAR……
  • 7. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 7 ES6 – Let/Con Let - declare variable in limited scope Const - Constants which cannot be assigned again, it’s fixed. Let’s e t co !
  • 8. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 8 ES6 – Ar o F n on Functions syntax has changed a bit with ES6. 1. Declare and assign variable as a function. 2. Body of the function. Let’s e t co !
  • 9. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 9 The b Hel It consists of multiple nested callbacks which makes code hard to read, debug and maintain. It is understandable how one might unknowingly get caught in Callback Hell while dealing with asynchronous logic. Let’s e t co !
  • 10. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE ● It ain’t any new feature. ● A syntactic sugar to write async. JS more elegantly ● Write more readable and intuitive JS than ever! ● Could be a little overwhelming but trust me will be easier soon ;-) Wha ’s a t z a t J o s 10 Let’s e t co !
  • 11. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE What if you could write Async JS in Lightning avoiding the complexities of Promises ?!? Wel – S C ax re y J ro s 11
  • 12. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE ● Write a clear asynchronous JavaScript code ● Efficiently call Apex with powerful exception handling ● Ton of utility techniques ● Start writing JS in the modern approach Wh D ax ? 12
  • 13. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 13 Wit la v/s wi l Let’s e t co !
  • 14. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 14 2 3 Set g La Deploy using either of the the listed 1. Hit the url https://githubsfdeploy.herokuapp.com/app/githubdeploy/ruslan-k urchenko/sfdc-lax and hit deploy. 2. Visit the github repo mentioned in the references and deploy using the ‘Deploy to Salesforce’ button.
  • 15. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 15 Let’s it e c u n Lax Dem e
  • 16. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 16 Create an account with details entered on UI Create a contact record linking it to created contact Send an email notification to the email address confirming the account creation. Resolve Resolve Show error/exception on UI Reject
  • 17. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 17 2 3 Wha n S C ax ? ● Performing multiple chained actions lax.enqueue(name[, params[, options]]).then(callback).then(callback) ● Performing multiple concurrent actions lax.enqueueAll(actions).then(callback) ● Create and return LaxAction builder lax.action(name)
  • 18. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 18 2 3 Wha n S C ax ? ● function to load a record template to the LDS targetRecord attribute lax.lds(id).getNewRecord(sobjectType[, recordTypeId[, skipCache]]) ● the function to save the record that loaded to LDS in the edit EDIT mode lax.lds(id).saveRecord() ● the function to delete a record using LDS lax.lds(id).deleteRecord()
  • 19. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 19 2 3 Wha n S C ax ? ● creates an object with LaxEventBuilder prototype and the context event by provided name lax.event(eventName) ● creates a component(s) from a type and a set of attributes lax.createComponent(type[, attributes])
  • 20. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 20 ● SFDC Lax is just a service Lightning Component to welcome you to the world of Promises ● You can build your own Promise based Components too! ● It’s never too late and you can still write better JS! ● Taking a moment to thank the SFDC Lax creator - Ruslan Kurchenko Thi s R em
  • 21. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 21 Ref ce ● ES6 - https://hackernoon.com/es6-for-beginners-f98120b57414 ● Promises - https://scotch.io/tutorials/javascript-promises-for-dummies ● Lax - https://github.com/ruslan-kurchenko/sfdc-lax ● API Reference - https://ruslan-kurchenko.github.io/sfdc-lax/ ● Execute anonymous JS - https://es6console.com/ https://repl.it/repls/TrimCleanLine
  • 22. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 22 Q & A Ple on’t u ;-)
  • 23. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTEwww.jaipurdevfest.com @jaipurdevfest jaipurdevfest@googlegroups.com #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 23 ThanksYou can find me at @sikhabaid on twitter or email : baid.sikha@gmail..com
  • 24.
  • 25.
  • 26. www.jaipurdevfest.com @jaipurdevfest #JDF18 - CONFIDENTIAL | DO NOT DISTRIBUTE 28 JU t SA , 2018 26