crs-client
The JavaScript client library for crs
Installaion
npm install crs-client --save
Usage
Typescript / ESNext
; // Create a command class and bound to a CRS commmand@ { thishello = hello; } // create a new endpoint where {server url} is your server URL (empty is same origin) // and {crs endpoint} is the path to the CRS endpointconst endpoint = '{server url}/{crs endpoint}'; // initialize the endpointendpoint; // send the commandemitter ;
ES5 in browser
First, include the library crs-client.js
in your HTML
<script src="crs-client.js"></script>
The script will add the Crs
object on the window
object.
// Specify the command name. CrsSuperCmd { thishello = hello;} // create a new endpointvar endpoint = '{server url}/{crs endpoint}'; // initialize the endpointendpoint; // send the commandconst response = await endpoint;