Skip to content

Instantly share code, notes, and snippets.

@capeterson
Created January 9, 2014 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save capeterson/8329265 to your computer and use it in GitHub Desktop.
Save capeterson/8329265 to your computer and use it in GitHub Desktop.
<apex:page controller="Thingy">
This blank canvas with our controller applied lets us invoke the remoting methods from the dev console via:
<ul>
<li><code>Thingy.regularLimits(function(response){console.log('Regular limits are:',response);});</code></li>
<li><code>Thingy.readOnlyLimits(function(response){console.log('Regular limits are:',response);});</code></li>
</ul>
</apex:page>
public class Thingy{
@RemoteAction
public static Map<String,Integer> regularLimits(){
return getLimitsData();
}
@ReadOnly
@RemoteAction
public static Map<String,Integer> readOnlyLimits(){
return getLimitsData();
}
private static Map<String,Integer> getLimitsData(){
return new Map<String,Integer>{
'getLimitCallouts()' => Limits.getLimitCallouts(),
'getLimitCpuTime()' => Limits.getLimitCpuTime(),
'getLimitDMLRows()' => Limits.getLimitDMLRows(),
'getLimitDMLStatements()' => Limits.getLimitDMLStatements(),
'getLimitFutureCalls()' => Limits.getLimitFutureCalls(),
'getLimitHeapSize()' => Limits.getLimitHeapSize(),
'getLimitQueries()' => Limits.getLimitQueries(),
'getLimitQueries()' => Limits.getLimitQueries(),
'getLimitQueryRows()' => Limits.getLimitQueryRows(),
'getLimitScriptStatements()' => Limits.getLimitScriptStatements(),
'getLimitSoslQueries()' => Limits.getLimitSoslQueries()
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment