Tuesday, July 11, 2017
Monday, July 10, 2017
Open folders and files with Sublime Text 3 from windows explorer context menu
This file contains 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
@echo off | |
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe | |
rem add it for all file types | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f | |
rem add it for folders | |
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f | |
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f | |
pause |
Friday, July 7, 2017
lightning:spinner component
<aura:application controller="echoController" extends="force:slds">
<lightning:button label="Toggle" variant="brand" onclick="{!c.showSpinner}"/>
<div class="exampleHolder">
<lightning:spinner aura:id="mySpinner" class="slds-hide"/>
</div>
</aura:application>
({
showSpinner: function (component, event, helper) {
helper.showSpinner(component);
var action = component.get('c.echo');
action.setCallback(this,function(response){
var state = response.getState();
if (state === "SUCCESS") {
helper.hideSpinner(component);
}
});
$A.enqueueAction(action);
}
})
({
showSpinner: function (component, event, helper) {
var spinner = component.find("mySpinner");
$A.util.removeClass(spinner, "slds-hide");
},
hideSpinner: function (component, event, helper) {
var spinner = component.find("mySpinner");
$A.util.addClass(spinner, "slds-hide");
}
})
public class echoController {
@AuraEnabled
public static String echo(String message) {
return message;
}
}
Wednesday, June 28, 2017
Lightning: Advanced Events Example
This example is built on the simpler component and application event examples. It uses one notifier component and one handler component that work with both component and application events.
This file contains 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
<!--c:compEvent--> | |
<aura:event type="COMPONENT"> | |
<!-- pass context of where the event was fired to the handler. --> | |
<aura:attribute name="context" type="String"/> | |
</aura:event> | |
<!--c:appEvent--> | |
<aura:event type="APPLICATION"> | |
<!-- pass context of where the event was fired to the handler. --> | |
<aura:attribute name="context" type="String"/> | |
</aura:event> |
This file contains 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
<!--c:eventsNotifier--> | |
<aura:component> | |
<aura:attribute name="parentName" type="String"/> | |
<aura:registerEvent name="componentEventFired" type="c:compEvent"/> | |
<aura:registerEvent name="appEvent" type="c:appEvent"/> | |
<div> | |
<h3>This is {!v.parentName}'s eventsNotifier.cmp instance</h3> | |
<p> | |
<lightning:button label="Click here to fire a component event" onclick="{!c.fireComponentEvent}" /> | |
</p> | |
<p> | |
<lightning:button label="Click here to fire an application event" onclick="{!c.fireApplicationEvent}" /> | |
</p> | |
</div> | |
</aura:component> | |
/* eventsNotifierController.js */ | |
{ | |
fireComponentEvent : function(cmp, event) { | |
var parentName = cmp.get("v.parentName"); | |
// Look up event by name, not by type | |
var compEvents = cmp.getEvent("componentEventFired"); | |
compEvents.setParams({ "context" : parentName }); | |
compEvents.fire(); | |
}, | |
fireApplicationEvent : function(cmp, event) { | |
var parentName = cmp.get("v.parentName"); | |
// note different syntax for getting application event | |
var appEvent = $A.get("e.c:appEvent"); | |
appEvent.setParams({ "context" : parentName }); | |
appEvent.fire(); | |
} | |
} | |
/* eventsNotifier.css */ | |
.cEventsNotifier { | |
display: block; | |
margin: 10px; | |
padding: 10px; | |
border: 1px solid black; | |
} |
This file contains 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
<!--c:eventsHandler--> | |
<aura:component> | |
<aura:attribute name="name" type="String"/> | |
<aura:attribute name="mostRecentEvent" type="String" default="Most recent event handled:"/> | |
<aura:attribute name="numComponentEventsHandled" type="Integer" default="0"/> | |
<aura:attribute name="numApplicationEventsHandled" type="Integer" default="0"/> | |
<aura:handler event="c:appEvent" action="{!c.handleApplicationEventFired}"/> | |
<aura:handler name="componentEventFired" event="c:compEvent" action="{!c.handleComponentEventFired}"/> | |
<div> | |
<h3>This is {!v.name}</h3> | |
<p>{!v.mostRecentEvent}</p> | |
<p># component events handled: {!v.numComponentEventsHandled}</p> | |
<p># application events handled: {!v.numApplicationEventsHandled}</p> | |
<c:eventsNotifier parentName="{#v.name}" /> | |
</div> | |
</aura:component> | |
/* eventsHandlerController.js */ | |
{ | |
handleComponentEventFired : function(cmp, event) { | |
var context = event.getParam("context"); | |
cmp.set("v.mostRecentEvent", | |
"Most recent event handled: COMPONENT event, from " + context); | |
var numComponentEventsHandled = | |
parseInt(cmp.get("v.numComponentEventsHandled")) + 1; | |
cmp.set("v.numComponentEventsHandled", numComponentEventsHandled); | |
}, | |
handleApplicationEventFired : function(cmp, event) { | |
var context = event.getParam("context"); | |
cmp.set("v.mostRecentEvent", | |
"Most recent event handled: APPLICATION event, from " + context); | |
var numApplicationEventsHandled = | |
parseInt(cmp.get("v.numApplicationEventsHandled")) + 1; | |
cmp.set("v.numApplicationEventsHandled", numApplicationEventsHandled); | |
} | |
} | |
/* eventsHandler.css */ | |
.cEventsHandler { | |
display: block; | |
margin: 10px; | |
padding: 10px; | |
border: 1px solid black; | |
} |
This file contains 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:application extends="force:slds"> | |
<c:eventsHandler name="eventsHandler1"/> | |
<c:eventsHandler name="eventsHandler2"/> | |
</aura:application> |
Reference: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_demo.htm
Subscribe to:
Posts (Atom)