daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. exports._getVisualforce = function(just){
  2.     return function(nothing){
  3.         if (typeof Visualforce !== "undefined" &&
  4.             typeof Visualforce.remoting !== "undefined" &&
  5.             typeof Visualforce.remoting.Manager !== "undefined") {
  6.             return just(Visualforce);
  7.         }
  8.         else {
  9.            return nothing;
  10.         }
  11.     }
  12. }
  13.  
  14. exports._callApex = function(Visualforce_,
  15.                               fullyQualifiedApexMethodName,
  16.                               apexMethodParameters,
  17.                               apexCallConfiguration,
  18.                               error,
  19.                               success){
  20.     return function (onError, onSuccess) { // and callbacks
  21.         console.log('hello world2');
  22.         var responseHandler = function(result, event){
  23.             console.log(event);
  24.             if (event.status){
  25.                 onSuccess(success(result));
  26.             }
  27.             else
  28.                 onSuccess(error(event.message));
  29.         }
  30.  
  31.         if (typeof Visualforce_ !== "undefined" &&
  32.             typeof Visualforce_.remoting !== "undefined" &&
  33.             typeof Visualforce_.remoting.Manager !== "undefined") {
  34.    
  35.             var req = Visualforce_.remoting.Manager.invokeAction(fullyQualifiedApexMethodName,
  36.                                                                 apexMethodParameters,
  37.                                                                 responseHandler,
  38.                                                                 apexCallConfiguration);
  39.         }
  40.         else {
  41.             onSuccess(error("Could not find Visualforce Remote Object", ""));
  42.         }
  43.  
  44.         // Return a canceler, which is just another Aff effect.
  45.         return function (cancelError, cancelerError, cancelerSuccess) {
  46.             console.log('hello world3');
  47.             req.cancel(); // cancel the request
  48.             cancelerSuccess(); // invoke the success callback for the canceler
  49.         };
  50.     }
  51.  
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top