Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated README to support AMD.

  • Loading branch information...
commit 3b4227fe9f5054ef287cce2c455b63e85fae7547 1 parent 5d0754c
@jbeard4 authored
Showing with 13 additions and 5 deletions.
  1. +13 −5 README.md
View
18 README.md
@@ -121,8 +121,6 @@ There are then **4 steps** that must be performed to go from an SCXML document t
<script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/1.2.4/es5-shim.min.js"></script>
<script type="text/javascript" src="http://jbeard4.github.com/SCION/builds/latest/scion-min.js"></script>
<script>
- var scion = require('scion');
-
$(document).ready(function(){
var rect = document.getElementById("rect");
@@ -223,7 +221,7 @@ Furthermore, for the `onTransition` callback, argument `targetStateIds` will be
# Usage in Browser
-Add the following script tags to your web page:
+Add the following script tags to your web page, which will make SCION available as a global variable `scion`:
```html
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
@@ -231,12 +229,22 @@ Add the following script tags to your web page:
<script type="text/javascript" src="http://jbeard4.github.com/SCION/builds/latest/scion.js"></script>
```
+SCION is also available as an AMD module, so if you are using RequireJS in your page, then you can do the following:
+
+```html
+<script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/1.2.4/es5-shim.min.js"></script>
+<script src="http://cdnjs.cloudflare.com/ajax/libs/require-jquery/0.25.0/require-jquery.min.js "></script>
+
+require(["http://jbeard4.github.com/SCION/builds/latest/scion-min.js"],function(scion){
+ //use SCION here
+});
+```
+
Note that SCION assumes the presence of jQuery to handle cross-browser XMLHTTPRequest, however an alternative Ajax library could instead be used. This is set up in the following way:
```javascript
//perform this setup once, before SCION is used
- var platform = require('platform');
- platform.ajax = {
+ scion.platformModule.platform.ajax = {
get : function(url,successCallback,dataType){
//call your preferred Ajax library here to do HTTP GET
//if dataType is 'xml', the Ajax response must be parsed as DOM
Please sign in to comment.
Something went wrong with that request. Please try again.