With Dreamforce 14 Salesforce announced its new mobile device development framework called Salesforce1 Lightning. This blog is to get started with Salesforce Lightning by understanding basics of why to use Lightning, What different components are required to be built to get Lightning work.
Following are the key points which are covered in this post
1. What is Salesforce1 Lightning Framework ?
2. Why to use Lightning Framework ?
3. How it works ?
1. What is Salesforce1 Lightning Framework ?
Salesforce1 Lightning Framework is the MVC architecture, UI framework which is primarily used for developing dynamic web apps for mobile and Desktop Customers. Lightning components are all built on top of Aura framework. Aura Framework uses JavaScript at the client side and Java at the Server side. When you use Salesforce1 Lightning Framework you can use Java Script at client side and Apex at Salesforce(Server) end.
2.Why to use Lightning Framework ?
Following are the number of advantages Lightning Framework has which makes it first choice to choose.
Following are the key points which are covered in this post
1. What is Salesforce1 Lightning Framework ?
2. Why to use Lightning Framework ?
3. How it works ?
1. What is Salesforce1 Lightning Framework ?
Salesforce1 Lightning Framework is the MVC architecture, UI framework which is primarily used for developing dynamic web apps for mobile and Desktop Customers. Lightning components are all built on top of Aura framework. Aura Framework uses JavaScript at the client side and Java at the Server side. When you use Salesforce1 Lightning Framework you can use Java Script at client side and Apex at Salesforce(Server) end.
2.Why to use Lightning Framework ?
Following are the number of advantages Lightning Framework has which makes it first choice to choose.
- 2.1. Out-Of-the-box Component Set : Salesforce1 Lightning Framework provides an entire set of out of the box components which you can directly use without you need to spend time in making them work for all different devices.
- 2.2. Performance : It uses Stateful client and stateless server architecture which uses Javascript at client side to maintain the state. All the data between the client and server passed only when required and Javascript takes care of values and state of the page. Whenever a page component value if updated it is javascript at client side which takes care of sending that value to server and processing the response so as to update the page. Framework uses JSON to communicate between server and client.
- 2.3. Faster Development : With in-built support for a large number of ready to use components which works on different devices. It also provides multi-tier component parallel working where you can built the client side component independent of server logic which makes it easy and fast to develop.
- 2.4. Event Driven Architecture : Uses an event-driven architecture for better decoupling between components. Any component can subscribe to an application event, or to a component event they can see.
3. How it Works ?
Lightning component framework uses stateful client side javascript and stateless server which makes it very quick and gives server all the time in the world to serve other requests. Following is the flow when you copy the application URL in the browser and hit enter.
Before I explain the first request flow, let me briefly tell you what are the different components you have to create for creating a lightning application or custom component.
Application (.app) : This is considered to be the main container holding all your components which you can load in application, starting point for building your components.
Component (.cmp): This is the actual component which are self contained and reusable units of app. They mainly represents a reusable section of the UI. They have prebuilt components which you can include and just like the Visualforce pages these components can contains html, css, Javascript, any other custom lightning component and everything that is web enabled. Components interact with their environment by listening to or publishing events. You can register the event listeners here for all the events and components which you think important and needs some processing.
Controller (.js): Controller is the stateful javascript code which gets invoked whenever you change any page values or an event is triggered which this controller registered as listener. It requires three parameters when an event occurs , Component to which this controller belongs, the event that the action is handling and the helper.
Helper (.js): Helper is the javascript code class for storing the reusable code which you want to use between different components. You can use the helpers to call server side controllers and it can also be used as the callback methods which are mainly used to handle the response from the server and how that response will be displayed on the page.
Style (.css): Styles are used for storing your component related styling(css) information.
There are two more components Documentation and Renderer but for understanding the application request flow these are the main components.
So now lets understand the first request call to server when you copy the application URL in the browser.
1. You copy the URL in the browser and hit enter.
2. Salesforce on receiving the first request loads the application/components definition and the lightning component/s definition executed at server end and is then rendered as HTML markup.
3. Salesforce reply to the client request with the rendered HTML markup.
4. On receiving the html markup the client side javascript controller for the lightning component is initialised and it registers all the events which you mentioned at the component definition and attach each event with the helper method.
5. HTML is rendered on the browser and you see the application. From here onwards the client side controller (javascript) listens to all the events on the page and based on the registered one it decides whether to call the server side controller method through the helper class or not.
Lightning component framework uses stateful client side javascript and stateless server which makes it very quick and gives server all the time in the world to serve other requests. Following is the flow when you copy the application URL in the browser and hit enter.
Before I explain the first request flow, let me briefly tell you what are the different components you have to create for creating a lightning application or custom component.
Application (.app) : This is considered to be the main container holding all your components which you can load in application, starting point for building your components.
Component (.cmp): This is the actual component which are self contained and reusable units of app. They mainly represents a reusable section of the UI. They have prebuilt components which you can include and just like the Visualforce pages these components can contains html, css, Javascript, any other custom lightning component and everything that is web enabled. Components interact with their environment by listening to or publishing events. You can register the event listeners here for all the events and components which you think important and needs some processing.
Controller (.js): Controller is the stateful javascript code which gets invoked whenever you change any page values or an event is triggered which this controller registered as listener. It requires three parameters when an event occurs , Component to which this controller belongs, the event that the action is handling and the helper.
Helper (.js): Helper is the javascript code class for storing the reusable code which you want to use between different components. You can use the helpers to call server side controllers and it can also be used as the callback methods which are mainly used to handle the response from the server and how that response will be displayed on the page.
Style (.css): Styles are used for storing your component related styling(css) information.
There are two more components Documentation and Renderer but for understanding the application request flow these are the main components.
So now lets understand the first request call to server when you copy the application URL in the browser.
1. You copy the URL in the browser and hit enter.
2. Salesforce on receiving the first request loads the application/components definition and the lightning component/s definition executed at server end and is then rendered as HTML markup.
3. Salesforce reply to the client request with the rendered HTML markup.
4. On receiving the html markup the client side javascript controller for the lightning component is initialised and it registers all the events which you mentioned at the component definition and attach each event with the helper method.
5. HTML is rendered on the browser and you see the application. From here onwards the client side controller (javascript) listens to all the events on the page and based on the registered one it decides whether to call the server side controller method through the helper class or not.
No comments:
Post a Comment