This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/** | |
* This function calls subscribe method of empApi component | |
* to receive events | |
* @author Manish Choudhari | |
* @version 1.0.0 | |
* */ | |
subscribe: function(component, event, helper) { | |
// Get the empApi component. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component access="global"> | |
<!-- ChannelName, which needs to subscribed --> | |
<aura:attribute name="channelName" type="String" required="true"/> | |
<!-- Save the reference of current subscription, which can be unsubscribe later on --> | |
<aura:attribute name="subscription" type="Object"/> | |
<!-- This event is fired when a component is destroyed. | |
Handle this event if you need to do custom cleanup when a component is destroyed.--> | |
<aura:handler name="destroy" value="{!this}" action="{!c.unsubscribe}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This event will be fired whenever new record change has been captured by RecordChangeEventHandler component --> | |
<aura:event type="COMPONENT" description="Event template"> | |
<aura:attribute name="recordData" type="Object" /> | |
</aura:event> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add standard object list here if any new standard object supports change data events | |
//At the time of winter19 below object support change data events | |
window.supportedObjectForChangeEvents = ['Account','Asset','Campaign','Case','Contact','ContractLineItem','Entitlement','Lead', | |
'LiveChatTranscript','Opportunity','Order','OrderItem','Product2','Quote','QuoteLineItem','ServiceContract']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.THIS .div-container{ | |
border: red; | |
border-width: medium; | |
border-style: double; | |
margin: 0px 20px; | |
padding: 10px; | |
width: fit-content; | |
font-size: 14px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/** | |
* Read the balance from div container of your org's component (c namespace) | |
* */ | |
checkBalance : function(component, event, helper) { | |
if(document.querySelector('#c-mybalance')){ | |
//Successfully read the data | |
const htmlData = document.createElement('div'); | |
htmlData.style.color = "red"; | |
htmlData.textContent = "Haaa!!! GOTCHA!! Here is your balance: "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Managed Package component | |
This component will try to read the DOM from your Org's custom component | |
@author Manish Choudhari | |
--> | |
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" > | |
<aura:attribute name="color" type="String" default="green" /> | |
<div> | |
<p>I am a lightning:card within managed package SFFscts.</p> | |
<p>I will try to read your account balance. Stop me if you can.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Custom Component2 | |
This is normal component within namespace "c" | |
@author Manish Choudhari | |
--> | |
<aura:component access="global" > | |
<p id="c-paragraph"> | |
<div id="c-textDiv"> | |
<p>I am Custom Component2 sits within "c" namespace.</p> | |
<p><strong>I hide top secret account balance that no one can hack!!</strong></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/** | |
* Read all data and display at the bottom of the component | |
* */ | |
readAllData: function(component, event, helper) { | |
component.set("v.showAll", "block"); | |
//Read c:CustomComponent2 inner HTML | |
document.querySelector('#all-custom-output').textContent = document.querySelector('#div-custom').innerHTML; | |
//Read ui:outputText inner HTML | |
document.querySelector('#all-ui-output').textContent = document.querySelector('#div-ui').innerHTML; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Custom Component1 | |
This component will include all different component from different namespace | |
to demonstrate locker service | |
@author Manish Choudhari | |
--> | |
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" > | |
<aura:attribute name="showAll" type="String" default="none" /> | |
<lightning:card title="I am Parent Custom Component sits within 'c' namespace"> |