Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports._getVisualforce = function(just){
- return function(nothing){
- if (typeof Visualforce !== "undefined" &&
- typeof Visualforce.remoting !== "undefined" &&
- typeof Visualforce.remoting.Manager !== "undefined") {
- return just(Visualforce);
- }
- else {
- return nothing;
- }
- }
- }
- exports._callApex = function(Visualforce_,
- fullyQualifiedApexMethodName,
- apexMethodParameters,
- apexCallConfiguration,
- error,
- success){
- return function (onError, onSuccess) { // and callbacks
- console.log('hello world2');
- var responseHandler = function(result, event){
- console.log(event);
- if (event.status){
- onSuccess(success(result));
- }
- else
- onSuccess(error(event.message));
- }
- if (typeof Visualforce_ !== "undefined" &&
- typeof Visualforce_.remoting !== "undefined" &&
- typeof Visualforce_.remoting.Manager !== "undefined") {
- var req = Visualforce_.remoting.Manager.invokeAction(fullyQualifiedApexMethodName,
- apexMethodParameters,
- responseHandler,
- apexCallConfiguration);
- }
- else {
- onSuccess(error("Could not find Visualforce Remote Object", ""));
- }
- // Return a canceler, which is just another Aff effect.
- return function (cancelError, cancelerError, cancelerSuccess) {
- console.log('hello world3');
- req.cancel(); // cancel the request
- cancelerSuccess(); // invoke the success callback for the canceler
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement