Client side JavaScript library for JSTP
CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
coffee
example
js
README.md

README.md

browser-jstp

Client side (browser) ready JavaScript library for JSTP.

Here you can find the Node.js implementation

Download

Plain JavaScript: download

CoffeeScript: download

Usage

(you can find this example in the example folder

In the HTML:

<!doctype html>
<html>
  <head>
    <title>Some JSTP sample</title>
    <script type="text/javascript" src="jstp.js"></script>
    <script type="text/javascript">
      function doSomething() {
        JSTP.post({
          resource: ['Salutation'],
          body: "Hello World!"  
        });
      }
      
      var actions = {
        salute: function (dispatch) {
          document.write(dispatch.body);
        }
      }
      
      JSTP.bind({
        endpoint: {
          method: 'POST',
          resource: ['Salutation']
        }
      }, actions.salute, actions);
    </script>
  </head>

  <body>
    <button onclick="doSomething()">Do something</button>
  </body>
</html>

License

Copyright © 2013 SouthLogics

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.