1.3.7 • Published 7 years ago

visualforce-sim v1.3.7

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

visualforce-sim

Salesforce javascript remoting simulator

Installation

npm install -g visualforce-sim

Running the simulator using default port 3000

cd <web application project>
visualforce-sim

Running the simulator using custom port (4000)

cd <web application project>
PORT=4000 visualforce-sim

Running the simulator to use live @RemoteAction methods

If SF_INSTANCE is not set, it will use https://login.salesforce.com

cd <web application project>
export SF_USERNAME=<username>
export SF_PASSWORD=<password>
export SF_INSTANCE=<instance url>
visualforce-sim -l

Auto reload browser when editing files in <web application project>

cd <web application project>
visualforce-sim -w

Custom filter

If you want to show the default filter being passed in executeAnonymous

visualforce-sim -s

If you want set your custom filter

visualforce-sim -f filter.txt

Show command line usage

visualforce-sim --help

Sample remoting for mocked Apex classes

Right now visualforce-sim javascript client requires jQuery

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="node_modules/visualforce-sim/visualforce-sim-client.js"></script>
<script>
    function callback(data) {
        console.log(data);
        // Output will be [{name:"One",value:1},{name:"Two",value:2}]
    }
    Visualforce.remoting.Manager.invokeAction('ApexController.getList', callback, {escape:true});
</script>

Create a class in <web application project>/apex-remote/ApexController.js

var ApexController = (function () {
    function ApexController() {
    }
    ApexController.prototype.getList = function () {
        return [
            {name:"One", value:1},
            {name:"Two", value:2}
        ];
    };
    return ApexController;
}());
exports.default = ApexController;

Setting custom api base path

<script>
    ...
    Visualforce.remoting.Manager.serverApiBasePath = 'http://localhost:4000';
</script>
1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.11

7 years ago

1.1.10

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago