summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-09-06 21:34:13 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2015-09-06 21:34:13 +0200
commitbcf3120d437da01fda78397a345bf805b008eb7a (patch)
tree9f4e81ca4c8e3e5fe659cc465020b076b11c82d9 /src
downloadbeer-duke-bcf3120d437da01fda78397a345bf805b008eb7a.tar.gz
beer-duke-bcf3120d437da01fda78397a345bf805b008eb7a.tar.bz2
beer-duke-bcf3120d437da01fda78397a345bf805b008eb7a.tar.xz
beer-duke-bcf3120d437da01fda78397a345bf805b008eb7a.zip
wip
Diffstat (limited to 'src')
-rw-r--r--src/beer-duke.js31
-rw-r--r--src/config.js417
-rw-r--r--src/index.html18
3 files changed, 466 insertions, 0 deletions
diff --git a/src/beer-duke.js b/src/beer-duke.js
new file mode 100644
index 0000000..8178836
--- /dev/null
+++ b/src/beer-duke.js
@@ -0,0 +1,31 @@
+import angular from 'angular';
+
+function run() {
+ function onConnect() {
+ // Once a connection has been made, make a subscription and send a message.
+ console.log("onConnect");
+ client.subscribe("/World");
+ let message = new Paho.MQTT.Message("Hello");
+ message.destinationName = "/World";
+ client.send(message);
+ }
+
+ function onConnectionLost(responseObject) {
+ if (responseObject.errorCode !== 0)
+ console.log("onConnectionLost:" + responseObject.errorMessage);
+ }
+
+ function onMessageArrived(message) {
+ console.log("onMessageArrived:" + message.payloadString);
+ client.disconnect();
+ }
+
+ //let client = new Paho.MQTT.Client("trygvis.io", 9001, "/", "clientId");
+ let client = new Paho.MQTT.Client("wss://trygvis.io:9001/", "clientId");
+ client.onConnectionLost = onConnectionLost;
+ client.onMessageArrived = onMessageArrived;
+ client.connect({onSuccess: onConnect});
+}
+
+angular.module('BeerDuke', [])
+ .run(run);
diff --git a/src/config.js b/src/config.js
new file mode 100644
index 0000000..7b73f04
--- /dev/null
+++ b/src/config.js
@@ -0,0 +1,417 @@
+System.config({
+ defaultJSExtensions: true,
+ transpiler: "babel",
+ babelOptions: {
+ "optional": [
+ "runtime",
+ "optimisation.modules.system"
+ ]
+ },
+ paths: {
+ "github:*": "jspm_packages/github/*",
+ "npm:*": "jspm_packages/npm/*"
+ },
+
+ map: {
+ "angular": "github:angular/bower-angular@1.4.4",
+ "babel": "npm:babel-core@5.8.22",
+ "babel-runtime": "npm:babel-runtime@5.8.20",
+ "core-js": "npm:core-js@1.1.1",
+ "jasmine-node": "npm:jasmine-node@1.14.5",
+ "mhevery/jasmine-node": "github:mhevery/jasmine-node@1.14.5",
+ "mqtt_over_websockets": "npm:mqtt_over_websockets@0.0.1-b",
+ "github:jspm/nodelibs-assert@0.1.0": {
+ "assert": "npm:assert@1.3.0"
+ },
+ "github:jspm/nodelibs-buffer@0.1.0": {
+ "buffer": "npm:buffer@3.4.3"
+ },
+ "github:jspm/nodelibs-constants@0.1.0": {
+ "constants-browserify": "npm:constants-browserify@0.0.1"
+ },
+ "github:jspm/nodelibs-crypto@0.1.0": {
+ "crypto-browserify": "npm:crypto-browserify@3.9.14"
+ },
+ "github:jspm/nodelibs-events@0.1.1": {
+ "events": "npm:events@1.0.2"
+ },
+ "github:jspm/nodelibs-http@1.7.1": {
+ "Base64": "npm:Base64@0.2.1",
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "inherits": "npm:inherits@2.0.1",
+ "stream": "github:jspm/nodelibs-stream@0.1.0",
+ "url": "github:jspm/nodelibs-url@0.1.0",
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ },
+ "github:jspm/nodelibs-https@0.1.0": {
+ "https-browserify": "npm:https-browserify@0.0.0"
+ },
+ "github:jspm/nodelibs-os@0.1.0": {
+ "os-browserify": "npm:os-browserify@0.1.2"
+ },
+ "github:jspm/nodelibs-path@0.1.0": {
+ "path-browserify": "npm:path-browserify@0.0.0"
+ },
+ "github:jspm/nodelibs-process@0.1.1": {
+ "process": "npm:process@0.10.1"
+ },
+ "github:jspm/nodelibs-stream@0.1.0": {
+ "stream-browserify": "npm:stream-browserify@1.0.0"
+ },
+ "github:jspm/nodelibs-url@0.1.0": {
+ "url": "npm:url@0.10.3"
+ },
+ "github:jspm/nodelibs-util@0.1.0": {
+ "util": "npm:util@0.10.3"
+ },
+ "github:jspm/nodelibs-vm@0.1.0": {
+ "vm-browserify": "npm:vm-browserify@0.0.4"
+ },
+ "npm:asn1.js@2.2.0": {
+ "assert": "github:jspm/nodelibs-assert@0.1.0",
+ "bn.js": "npm:bn.js@2.2.0",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "inherits": "npm:inherits@2.0.1",
+ "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
+ "vm": "github:jspm/nodelibs-vm@0.1.0"
+ },
+ "npm:assert@1.3.0": {
+ "util": "npm:util@0.10.3"
+ },
+ "npm:babel-runtime@5.8.20": {
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:browserify-aes@1.0.3": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "buffer-xor": "npm:buffer-xor@1.0.2",
+ "create-hash": "npm:create-hash@1.1.1",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "inherits": "npm:inherits@2.0.1",
+ "stream": "github:jspm/nodelibs-stream@0.1.0",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:browserify-rsa@2.0.1": {
+ "bn.js": "npm:bn.js@2.2.0",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "constants": "github:jspm/nodelibs-constants@0.1.0",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "randombytes": "npm:randombytes@2.0.1"
+ },
+ "npm:browserify-sign@3.0.3": {
+ "bn.js": "npm:bn.js@2.2.0",
+ "browserify-rsa": "npm:browserify-rsa@2.0.1",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "create-hash": "npm:create-hash@1.1.1",
+ "create-hmac": "npm:create-hmac@1.1.3",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "elliptic": "npm:elliptic@3.1.0",
+ "inherits": "npm:inherits@2.0.1",
+ "parse-asn1": "npm:parse-asn1@3.0.1",
+ "stream": "github:jspm/nodelibs-stream@0.1.0"
+ },
+ "npm:buffer-xor@1.0.2": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:buffer@3.4.3": {
+ "base64-js": "npm:base64-js@0.0.8",
+ "ieee754": "npm:ieee754@1.1.6",
+ "is-array": "npm:is-array@1.0.1"
+ },
+ "npm:coffee-script@1.9.3": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "module": "github:jspm/nodelibs-module@0.1.0",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "repl": "github:jspm/nodelibs-repl@0.1.0",
+ "vm": "github:jspm/nodelibs-vm@0.1.0"
+ },
+ "npm:commander@2.1.0": {
+ "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:constants-browserify@0.0.1": {
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:core-js@1.1.1": {
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:core-util-is@1.0.1": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0"
+ },
+ "npm:create-ecdh@2.0.1": {
+ "bn.js": "npm:bn.js@2.2.0",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "elliptic": "npm:elliptic@3.1.0"
+ },
+ "npm:create-hash@1.1.1": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "inherits": "npm:inherits@2.0.1",
+ "ripemd160": "npm:ripemd160@1.0.1",
+ "sha.js": "npm:sha.js@2.4.2",
+ "stream": "github:jspm/nodelibs-stream@0.1.0"
+ },
+ "npm:create-hmac@1.1.3": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "create-hash": "npm:create-hash@1.1.1",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "inherits": "npm:inherits@2.0.1",
+ "stream": "github:jspm/nodelibs-stream@0.1.0"
+ },
+ "npm:crypto-browserify@3.9.14": {
+ "browserify-aes": "npm:browserify-aes@1.0.3",
+ "browserify-sign": "npm:browserify-sign@3.0.3",
+ "create-ecdh": "npm:create-ecdh@2.0.1",
+ "create-hash": "npm:create-hash@1.1.1",
+ "create-hmac": "npm:create-hmac@1.1.3",
+ "diffie-hellman": "npm:diffie-hellman@3.0.2",
+ "inherits": "npm:inherits@2.0.1",
+ "pbkdf2": "npm:pbkdf2@3.0.4",
+ "public-encrypt": "npm:public-encrypt@2.0.1",
+ "randombytes": "npm:randombytes@2.0.1"
+ },
+ "npm:diffie-hellman@3.0.2": {
+ "bn.js": "npm:bn.js@2.2.0",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "miller-rabin": "npm:miller-rabin@2.0.1",
+ "randombytes": "npm:randombytes@2.0.1",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:elliptic@3.1.0": {
+ "bn.js": "npm:bn.js@2.2.0",
+ "brorand": "npm:brorand@1.0.5",
+ "hash.js": "npm:hash.js@1.0.3",
+ "inherits": "npm:inherits@2.0.1",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:fileset@0.1.8": {
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "glob": "npm:glob@3.2.11",
+ "minimatch": "npm:minimatch@0.2.14",
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ },
+ "npm:gaze@0.3.4": {
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "fileset": "npm:fileset@0.1.8",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "minimatch": "npm:minimatch@0.2.14",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ },
+ "npm:glob@3.2.11": {
+ "assert": "github:jspm/nodelibs-assert@0.1.0",
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "inherits": "npm:inherits@2.0.1",
+ "minimatch": "npm:minimatch@0.3.0",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:growl@1.7.0": {
+ "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "os": "github:jspm/nodelibs-os@0.1.0",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:hash.js@1.0.3": {
+ "inherits": "npm:inherits@2.0.1"
+ },
+ "npm:https-browserify@0.0.0": {
+ "http": "github:jspm/nodelibs-http@1.7.1"
+ },
+ "npm:inherits@2.0.1": {
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ },
+ "npm:jasmine-growl-reporter@0.0.3": {
+ "growl": "npm:growl@1.7.0",
+ "path": "github:jspm/nodelibs-path@0.1.0"
+ },
+ "npm:jasmine-node@1.14.5": {
+ "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+ "coffee-script": "npm:coffee-script@1.9.3",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "gaze": "npm:gaze@0.3.4",
+ "jasmine-growl-reporter": "npm:jasmine-growl-reporter@0.0.3",
+ "jasmine-reporters": "npm:jasmine-reporters@1.0.2",
+ "mkdirp": "npm:mkdirp@0.3.5",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "requirejs": "npm:requirejs@2.1.20",
+ "sys": "github:jspm/nodelibs-util@0.1.0",
+ "underscore": "npm:underscore@1.8.3",
+ "util": "github:jspm/nodelibs-util@0.1.0",
+ "vm": "github:jspm/nodelibs-vm@0.1.0",
+ "walkdir": "npm:walkdir@0.0.10"
+ },
+ "npm:jasmine-reporters@1.0.2": {
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "mkdirp": "npm:mkdirp@0.3.5",
+ "path": "github:jspm/nodelibs-path@0.1.0"
+ },
+ "npm:miller-rabin@2.0.1": {
+ "bn.js": "npm:bn.js@2.2.0",
+ "brorand": "npm:brorand@1.0.5"
+ },
+ "npm:minimatch@0.2.14": {
+ "lru-cache": "npm:lru-cache@2.6.5",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "sigmund": "npm:sigmund@1.0.1"
+ },
+ "npm:minimatch@0.3.0": {
+ "lru-cache": "npm:lru-cache@2.6.5",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "sigmund": "npm:sigmund@1.0.1"
+ },
+ "npm:mkdirp@0.3.5": {
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:mqtt_over_websockets@0.0.1-b": {
+ "node-localstorage": "npm:node-localstorage@0.3.4",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "ws": "npm:ws@0.4.32"
+ },
+ "npm:nan@1.0.0": {
+ "path": "github:jspm/nodelibs-path@0.1.0"
+ },
+ "npm:node-localstorage@0.3.4": {
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "path": "github:jspm/nodelibs-path@0.1.0"
+ },
+ "npm:options@0.0.6": {
+ "fs": "github:jspm/nodelibs-fs@0.1.2"
+ },
+ "npm:os-browserify@0.1.2": {
+ "os": "github:jspm/nodelibs-os@0.1.0"
+ },
+ "npm:parse-asn1@3.0.1": {
+ "asn1.js": "npm:asn1.js@2.2.0",
+ "browserify-aes": "npm:browserify-aes@1.0.3",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "create-hash": "npm:create-hash@1.1.1",
+ "pbkdf2": "npm:pbkdf2@3.0.4",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:path-browserify@0.0.0": {
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:pbkdf2@3.0.4": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+ "create-hmac": "npm:create-hmac@1.1.3",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ },
+ "npm:public-encrypt@2.0.1": {
+ "bn.js": "npm:bn.js@2.2.0",
+ "browserify-rsa": "npm:browserify-rsa@2.0.1",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "create-hash": "npm:create-hash@1.1.1",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "parse-asn1": "npm:parse-asn1@3.0.1",
+ "randombytes": "npm:randombytes@2.0.1"
+ },
+ "npm:punycode@1.3.2": {
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:randombytes@2.0.1": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:readable-stream@1.1.13": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "core-util-is": "npm:core-util-is@1.0.1",
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "inherits": "npm:inherits@2.0.1",
+ "isarray": "npm:isarray@0.0.1",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "stream-browserify": "npm:stream-browserify@1.0.0",
+ "string_decoder": "npm:string_decoder@0.10.31"
+ },
+ "npm:requirejs@2.1.20": {
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "vm": "github:jspm/nodelibs-vm@0.1.0"
+ },
+ "npm:ripemd160@1.0.1": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:sha.js@2.4.2": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "inherits": "npm:inherits@2.0.1",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:sigmund@1.0.1": {
+ "http": "github:jspm/nodelibs-http@1.7.1",
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ },
+ "npm:stream-browserify@1.0.0": {
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "inherits": "npm:inherits@2.0.1",
+ "readable-stream": "npm:readable-stream@1.1.13"
+ },
+ "npm:string_decoder@0.10.31": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0"
+ },
+ "npm:url@0.10.3": {
+ "assert": "github:jspm/nodelibs-assert@0.1.0",
+ "punycode": "npm:punycode@1.3.2",
+ "querystring": "npm:querystring@0.2.0",
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ },
+ "npm:util@0.10.3": {
+ "inherits": "npm:inherits@2.0.1",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:vm-browserify@0.0.4": {
+ "indexof": "npm:indexof@0.0.1"
+ },
+ "npm:walkdir@0.0.10": {
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.1"
+ },
+ "npm:ws@0.4.32": {
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "commander": "npm:commander@2.1.0",
+ "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+ "events": "github:jspm/nodelibs-events@0.1.1",
+ "http": "github:jspm/nodelibs-http@1.7.1",
+ "https": "github:jspm/nodelibs-https@0.1.0",
+ "nan": "npm:nan@1.0.0",
+ "options": "npm:options@0.0.6",
+ "process": "github:jspm/nodelibs-process@0.1.1",
+ "stream": "github:jspm/nodelibs-stream@0.1.0",
+ "tinycolor": "npm:tinycolor@0.0.1",
+ "tls": "github:jspm/nodelibs-tls@0.1.0",
+ "url": "github:jspm/nodelibs-url@0.1.0",
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ }
+ }
+});
diff --git a/src/index.html b/src/index.html
new file mode 100644
index 0000000..463f704
--- /dev/null
+++ b/src/index.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+ <script type="application/javascript" src="jspm_packages/system.js"></script>
+ <script type="application/javascript" src="../org.eclipse.paho.mqtt.javascript/src/mqttws31.js"></script>
+ <script type="application/javascript" src="config.js"></script>
+ <!--<script type="application/javascript" src="beer-duke.js"></script>-->
+ <script type="application/javascript">
+ Promise.all([
+ System.import('angular'),
+ System.import('beer-duke')])
+ .then(function (modules) {
+ modules[0].bootstrap(document, ['BeerDuke']);
+ });
+ </script>
+</head>
+<body>
+</body>
+</html>