Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added missing file lib/scion.js

  • Loading branch information...
commit a31ff0e14dcf08b45f35a982da46e4cd8ee331e6 1 parent 1a064fa
@jbeard4 authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 lib/scion.js
View
32 lib/scion.js
@@ -0,0 +1,32 @@
+//this module provides a single point of access to all important user-facing modules in scion,
+//and detects the environment, exposing an environment-specific module.
+
+//FIXME: this might be a good candidate to apply inversion of control,
+//to facilitate extension by the user without patching this file.
+
+function isRhino(){
+ return typeof Packages !== "undefined";
+}
+
+function isNode(){
+ return typeof process !== "undefined" && typeof module !== "undefined";
+}
+
+function isBrowser(){
+ return typeof window !== "undefined" && typeof document !== "undefined";
+}
+
+if(isRhino()){
+ module.exports = require('./rhino/SCXML');
+}else if(isNode()){
+ module.exports = require('./node/SCXML');
+}else if(isBrowser()){
+ module.exports = require('./browser/SCXML');
+}else{
+ //something else, perhaps a spartan shell environment
+ module.exports = {
+ annotator : require('./util/annotate-scxml-json'),
+ json2model : require('./scxml/json2model'),
+ scxml : require('./scxml/SCXML')
+ };
+}
Please sign in to comment.
Something went wrong with that request. Please try again.