Finished support for new connector type
This commit is contained in:
7
examples/EasyConn/README.md
Normal file
7
examples/EasyConn/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
```js
|
||||
var rid = Math.ceil(Math.random()*100 + 1);
|
||||
var conn = {key: 'h7nlefbgavh1tt9'};
|
||||
var connector = new PeerJsConnector(rid,conn);
|
||||
var yatta = new Y.JsonFramework(rid, connector)
|
||||
```
|
||||
19
examples/EasyConn/bower_components/core-component-page/.bower.json
vendored
Normal file
19
examples/EasyConn/bower_components/core-component-page/.bower.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "core-component-page",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"webcomponentsjs": "Polymer/webcomponentsjs#^0.5.0",
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"version": "0.5.1",
|
||||
"homepage": "https://github.com/Polymer/core-component-page",
|
||||
"_release": "0.5.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.1",
|
||||
"commit": "ef1f86e659fd7498755e027d1561acc963d67807"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/core-component-page.git",
|
||||
"_target": "^0.5.0",
|
||||
"_originalSource": "Polymer/core-component-page"
|
||||
}
|
||||
6
examples/EasyConn/bower_components/core-component-page/README.md
vendored
Normal file
6
examples/EasyConn/bower_components/core-component-page/README.md
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
core-component-page
|
||||
===================
|
||||
|
||||
See the [component page](http://polymer-project.org/docs/elements/core-elements.html#core-component-page) for more information.
|
||||
|
||||
Note: this is the vulcanized version of [`core-component-page-dev`](https://github.com/Polymer/core-component-page-dev) (the source).
|
||||
BIN
examples/EasyConn/bower_components/core-component-page/bowager-logo.png
vendored
Normal file
BIN
examples/EasyConn/bower_components/core-component-page/bowager-logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
9
examples/EasyConn/bower_components/core-component-page/bower.json
vendored
Normal file
9
examples/EasyConn/bower_components/core-component-page/bower.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "core-component-page",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"webcomponentsjs": "Polymer/webcomponentsjs#^0.5.0",
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"version": "0.5.1"
|
||||
}
|
||||
37
examples/EasyConn/bower_components/core-component-page/core-component-page.html
vendored
Normal file
37
examples/EasyConn/bower_components/core-component-page/core-component-page.html
vendored
Normal file
File diff suppressed because one or more lines are too long
23
examples/EasyConn/bower_components/core-component-page/demo.html
vendored
Normal file
23
examples/EasyConn/bower_components/core-component-page/demo.html
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="core-component-page.html">
|
||||
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<core-component-page></core-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
examples/EasyConn/bower_components/core-component-page/index.html
vendored
Normal file
22
examples/EasyConn/bower_components/core-component-page/index.html
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel="import" href="../core-component-page/core-component-page.html">
|
||||
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<core-component-page></core-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
41
examples/EasyConn/bower_components/peerjs-connector/.bower.json
vendored
Normal file
41
examples/EasyConn/bower_components/peerjs-connector/.bower.json
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "peerjs-connector",
|
||||
"version": "0.0.0",
|
||||
"authors": [
|
||||
"Kevin Jahns <kevin.jahns@rwth-aachen.de>"
|
||||
],
|
||||
"description": "Connect to other users via PeerJS. The interface is standardized, so you can use other connectors without changing your code.",
|
||||
"main": [
|
||||
"peerjs-connector.js",
|
||||
"peerjs-connector.html"
|
||||
],
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"peerjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#~0.5.1"
|
||||
},
|
||||
"homepage": "https://github.com/DadaMonad/peerjs-connector",
|
||||
"_release": "0.0.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.0.0",
|
||||
"commit": "3bfeb2831ff0a494531a4ed438e149a256c6fb71"
|
||||
},
|
||||
"_source": "git://github.com/DadaMonad/peerjs-connector.git",
|
||||
"_target": "~0.0.0",
|
||||
"_originalSource": "peerjs-connector",
|
||||
"_direct": true
|
||||
}
|
||||
180
examples/EasyConn/bower_components/peerjs-connector/README.md
vendored
Normal file
180
examples/EasyConn/bower_components/peerjs-connector/README.md
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
|
||||
```js
|
||||
(function() {
|
||||
var PeerJsConnector,
|
||||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
window.PeerJsConnector = PeerJsConnector = (function() {
|
||||
function PeerJsConnector(id, options) {
|
||||
var exchangeConnections, joinConnections, that;
|
||||
this.id = id;
|
||||
this._addConnection = __bind(this._addConnection, this);
|
||||
that = this;
|
||||
this.isConnected = false;
|
||||
this.computeWhenConnected = [];
|
||||
this.connections = {};
|
||||
this.unsynced_connections = {};
|
||||
this.receive_handlers = [];
|
||||
this.conn = new Peer(arguments[0], arguments[1]);
|
||||
this.conn.on('error', function(err) {
|
||||
throw new Error("Peerjs connector: " + err);
|
||||
});
|
||||
this.conn.on('disconnected', function() {
|
||||
throw new Error("Peerjs connector disconnected from signalling server. Cannot accept new connections. Not fatal, but not so good either..");
|
||||
});
|
||||
this.conn.on('disconnect', function() {
|
||||
return that.conn.reconnect();
|
||||
});
|
||||
this.conn.on('connection', this._addConnection);
|
||||
exchangeConnections = function() {
|
||||
var conns, peer, peerid;
|
||||
conns = (function() {
|
||||
var _ref, _results;
|
||||
_ref = that.connections;
|
||||
_results = [];
|
||||
for (peerid in _ref) {
|
||||
peer = _ref[peerid];
|
||||
_results.push(peerid);
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
return conns;
|
||||
};
|
||||
joinConnections = function(peers) {
|
||||
var peer, _i, _len;
|
||||
for (_i = 0, _len = peers.length; _i < _len; _i++) {
|
||||
peer = peers[_i];
|
||||
if (this.unsynced_connections[peer.peer] == null) {
|
||||
this.unsynced_connections[peer.peer] = peer;
|
||||
that.join(peer);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
this.syncProcessOrder = [exchangeConnections, joinConnections];
|
||||
}
|
||||
|
||||
PeerJsConnector.prototype.whenConnected = function(f) {
|
||||
if (this.isConnected) {
|
||||
return f.call(this);
|
||||
} else {
|
||||
return this.computeWhenConnected.push(f);
|
||||
}
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.whenReceiving = function(f) {
|
||||
return this.receive_handlers.push(f);
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.send = function(peers, message) {
|
||||
return this.whenConnected((function(_this) {
|
||||
return function() {
|
||||
var peer, _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = peers.length; _i < _len; _i++) {
|
||||
peer = peers[_i];
|
||||
_results.push(_this.connections[peer].send(message));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.broadcast = function(message) {
|
||||
return this.whenConnected((function(_this) {
|
||||
return function() {
|
||||
var peer, peerid, _ref, _results;
|
||||
_ref = _this.connections;
|
||||
_results = [];
|
||||
for (peerid in _ref) {
|
||||
peer = _ref[peerid];
|
||||
_results.push(peer.send(message));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.whenSyncing = function() {
|
||||
var f, _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = arguments.length; _i < _len; _i++) {
|
||||
f = arguments[_i];
|
||||
_results.push(this.syncProcessOrder.push(f));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.join = function(peerid) {
|
||||
var peer;
|
||||
if ((this.connections[peerid] == null) && peerid !== this.id) {
|
||||
peer = this.conn.connect(peerid, {
|
||||
reliable: true
|
||||
});
|
||||
this._addConnection(peer);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype._addConnection = function(peer) {
|
||||
return peer.on('open', (function(_this) {
|
||||
return function() {
|
||||
var current_sync_function, current_sync_i, that;
|
||||
_this.currentlyadding = peer;
|
||||
that = _this;
|
||||
peer.send(that.syncProcessOrder[0]());
|
||||
current_sync_function = that.syncProcessOrder[1];
|
||||
current_sync_i = 0;
|
||||
return peer.on('data', function(data) {
|
||||
var f, isEmpty, _i, _j, _len, _len1, _ref, _ref1, _results;
|
||||
console.log("receive data: " + (JSON.stringify(data)));
|
||||
current_sync_i++;
|
||||
if (current_sync_i < that.syncProcessOrder.length) {
|
||||
peer.send(current_sync_function.call(that, data));
|
||||
return current_sync_function = that.syncProcessOrder[current_sync_i];
|
||||
} else if (current_sync_i === that.syncProcessOrder.length) {
|
||||
that.connections[peer.peer] = peer;
|
||||
peer.on('close', function() {
|
||||
return delete that.connections[peer.peer];
|
||||
});
|
||||
delete that.unsynced_connections[peer.peer];
|
||||
isEmpty = function(os) {
|
||||
var o;
|
||||
for (o in os) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
if (isEmpty(that.unsynced_connections)) {
|
||||
that.isConnected = true;
|
||||
_ref = that.computeWhenConnected;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
f = _ref[_i];
|
||||
f.call(that);
|
||||
}
|
||||
return that.computeWhenConnected = [];
|
||||
}
|
||||
} else {
|
||||
_ref1 = that.receive_handlers;
|
||||
_results = [];
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
f = _ref1[_j];
|
||||
_results.push(f(peer.peer, data));
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
return PeerJsConnector;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=sourcemaps/peerjs-connector.js.map
|
||||
```
|
||||
30
examples/EasyConn/bower_components/peerjs-connector/bower.json
vendored
Normal file
30
examples/EasyConn/bower_components/peerjs-connector/bower.json
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "peerjs-connector",
|
||||
"version": "0.0.0",
|
||||
"authors": [
|
||||
"Kevin Jahns <kevin.jahns@rwth-aachen.de>"
|
||||
],
|
||||
"description": "Connect to other users via PeerJS. The interface is standardized, so you can use other connectors without changing your code.",
|
||||
"main": [
|
||||
"peerjs-connector.js",
|
||||
"peerjs-connector.html"
|
||||
],
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"peerjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#~0.5.1"
|
||||
}
|
||||
}
|
||||
35
examples/EasyConn/bower_components/peerjs-connector/gulpfile.coffee
vendored
Normal file
35
examples/EasyConn/bower_components/peerjs-connector/gulpfile.coffee
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
gulp = require 'gulp'
|
||||
coffee = require 'gulp-coffee'
|
||||
concat = require 'gulp-concat'
|
||||
uglify = require 'gulp-uglify'
|
||||
sourcemaps = require 'gulp-sourcemaps'
|
||||
plumber = require 'gulp-plumber'
|
||||
|
||||
paths =
|
||||
scripts: ['./lib/**/*.coffee']
|
||||
|
||||
|
||||
gulp.task 'scripts', [], ()->
|
||||
return gulp.src(paths.scripts)
|
||||
.pipe(plumber())
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(coffee())
|
||||
#.pipe(uglify())
|
||||
.pipe(sourcemaps.write('./sourcemaps/'))
|
||||
.pipe(gulp.dest('./'))
|
||||
|
||||
|
||||
# Rerun the task when a file changes
|
||||
gulp.task 'watch', ()->
|
||||
gulp.watch(paths.scripts, ['scripts'])
|
||||
|
||||
gulp.task('default', ['watch', 'scripts'])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
29
examples/EasyConn/bower_components/peerjs-connector/lib/peerjs-connector-polymer.coffee
vendored
Normal file
29
examples/EasyConn/bower_components/peerjs-connector/lib/peerjs-connector-polymer.coffee
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
new Polymer 'peerjs-connector',
|
||||
join: (id)->
|
||||
idChanged: (old_val,new_val)->
|
||||
if this.is_initialized
|
||||
throw new Error "You must not set the user_id twice!"
|
||||
else
|
||||
this.initializeConnection()
|
||||
|
||||
initializeConnection: ()->
|
||||
if this.conn_id?
|
||||
console.log("now initializing")
|
||||
options = {}
|
||||
writeIfAvailable = (name, value)->
|
||||
if value?
|
||||
options[name] = value
|
||||
writeIfAvailable 'key', this.key
|
||||
writeIfAvailable 'host', this.host
|
||||
writeIfAvailable 'port', this.port
|
||||
writeIfAvailable 'path', this.path
|
||||
writeIfAvailable 'secure', this.secure
|
||||
writeIfAvailable 'debug', this.debug
|
||||
this.is_initialized = true;
|
||||
this.connector = new PeerJsConnector this.conn_id, options
|
||||
|
||||
ready: ()->
|
||||
if this.conn_id != null
|
||||
this.initializeConnection()
|
||||
|
||||
138
examples/EasyConn/bower_components/peerjs-connector/lib/peerjs-connector.coffee
vendored
Normal file
138
examples/EasyConn/bower_components/peerjs-connector/lib/peerjs-connector.coffee
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
|
||||
window.PeerJsConnector = class PeerJsConnector
|
||||
|
||||
constructor: (@id, options)->
|
||||
that = this
|
||||
@isConnected = false
|
||||
@computeWhenConnected = []
|
||||
@connections = {}
|
||||
@unsynced_connections = {}
|
||||
@receive_handlers = []
|
||||
@conn = new Peer arguments[0], arguments[1]
|
||||
@conn.on 'error', (err)->
|
||||
throw new Error "Peerjs connector: #{err}"
|
||||
@conn.on 'disconnected', ()->
|
||||
throw new Error "Peerjs connector disconnected from signalling server. Cannot accept new connections. Not fatal, but not so good either.."
|
||||
@conn.on 'disconnect', ()->
|
||||
that.conn.reconnect()
|
||||
@conn.on 'connection', @_addConnection
|
||||
# send all connection ids
|
||||
exchangeConnections = ()->
|
||||
conns = for peerid,peer of that.connections
|
||||
peerid
|
||||
conns
|
||||
joinConnections = (peers)->
|
||||
for peer in peers
|
||||
if not @unsynced_connections[peer.peer]?
|
||||
@unsynced_connections[peer.peer] = peer
|
||||
that.join peer
|
||||
true
|
||||
@syncProcessOrder = [exchangeConnections, joinConnections]
|
||||
|
||||
|
||||
#
|
||||
# Execute an function _when_ we are connected. If not connected, wait until connected.
|
||||
# @param f {Function} Will be executed on the PeerJs-Connector context. No parameters.
|
||||
#
|
||||
whenConnected: (f)->
|
||||
if @isConnected
|
||||
f.call this
|
||||
else
|
||||
@computeWhenConnected.push f
|
||||
|
||||
#
|
||||
# Execute an function _when_ a message is received.
|
||||
# @param f {Function} Will be executed on the PeerJs-Connector context. f will be called with (sender_id, broadcast {true|false}, message).
|
||||
#
|
||||
whenReceiving: (f)->
|
||||
@receive_handlers.push f
|
||||
|
||||
#
|
||||
# Send a message to a (sub)-set of peers.
|
||||
# @param peers {Array<connection_ids>} A set of ids.
|
||||
# @param message {Object} The message to send.
|
||||
#
|
||||
send: (peers, message)->
|
||||
@whenConnected ()=>
|
||||
for peer in peers
|
||||
@connections[peer].send message
|
||||
|
||||
#
|
||||
# Broadcast a message to all connected peers.
|
||||
# @param message {Object} The message to broadcast.
|
||||
#
|
||||
broadcast: (message)->
|
||||
@whenConnected ()=>
|
||||
for peerid,peer of @connections
|
||||
peer.send message
|
||||
|
||||
|
||||
#
|
||||
# Define how you want to handle the sync process of two users.
|
||||
# This is a synchronous handshake. Every user will perform exactly the same actions at the same time. E.g.
|
||||
# @example
|
||||
# whenSyncing(function(){ // first call must not have parameters!
|
||||
# return this.id; // Send the id of this connector.
|
||||
# },function(peerid){ // you receive the peerid of the other connections.
|
||||
# // you can do something with the peerid
|
||||
# // return "you are my friend"; // you could send another massage.
|
||||
# }); // this is the end of the sync process.
|
||||
#
|
||||
whenSyncing: ()->
|
||||
for f in arguments
|
||||
@syncProcessOrder.push f
|
||||
|
||||
#
|
||||
# Join a communication room. In case of peerjs, you just have to join to one other client. This connector will join to the other peers automatically.
|
||||
# @param id {String} The connection id of another client.
|
||||
#
|
||||
join: (peerid)->
|
||||
if not @connections[peerid]? and peerid isnt @id
|
||||
peer = @conn.connect peerid, {reliable: true}
|
||||
@_addConnection peer
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
_addConnection: (peer)=>
|
||||
peer.on 'open', ()=>
|
||||
@currentlyadding = peer
|
||||
that = @
|
||||
peer.send that.syncProcessOrder[0]()
|
||||
current_sync_function = that.syncProcessOrder[1];
|
||||
current_sync_i = 0
|
||||
peer.on 'data', (data)->
|
||||
console.log("receive data: #{JSON.stringify data}")
|
||||
current_sync_i++
|
||||
if current_sync_i < that.syncProcessOrder.length
|
||||
peer.send current_sync_function.call that, data
|
||||
current_sync_function = that.syncProcessOrder[current_sync_i]
|
||||
else if current_sync_i is that.syncProcessOrder.length
|
||||
that.connections[peer.peer] = peer
|
||||
peer.on 'close', ()->
|
||||
delete that.connections[peer.peer]
|
||||
delete that.unsynced_connections[peer.peer]
|
||||
isEmpty = (os)->
|
||||
for o of os
|
||||
return false
|
||||
return true
|
||||
if isEmpty(that.unsynced_connections)
|
||||
that.isConnected = true
|
||||
for f in that.computeWhenConnected
|
||||
f.call(that)
|
||||
that.computeWhenConnected = []
|
||||
else
|
||||
for f in that.receive_handlers
|
||||
f peer.peer, data
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
25
examples/EasyConn/bower_components/peerjs-connector/package.json
vendored
Normal file
25
examples/EasyConn/bower_components/peerjs-connector/package.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "peerjs-connector",
|
||||
"version": "0.0.0",
|
||||
"description": "Connect to other users via PeerJS. The interface is standardized, so you can use other connectors without changing your code. ",
|
||||
"main": "peerjs-connector.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"peerjs"
|
||||
],
|
||||
"author": "Kevin Jahns <kevin.jahns@rwth-aachen.de>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"peerjs": "~0.3.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-sourcemaps": "~1.2.8",
|
||||
"gulp-concat": "~2.4.1",
|
||||
"gulp-coffee": "~2.2.0",
|
||||
"gulp-uglify": "~1.0.1",
|
||||
"gulp": "~3.8.10",
|
||||
"coffee-script": "~1.8.0"
|
||||
}
|
||||
}
|
||||
40
examples/EasyConn/bower_components/peerjs-connector/peerjs-connector-polymer.js
vendored
Normal file
40
examples/EasyConn/bower_components/peerjs-connector/peerjs-connector-polymer.js
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
(function() {
|
||||
new Polymer('peerjs-connector', {
|
||||
join: function(id) {},
|
||||
idChanged: function(old_val, new_val) {
|
||||
if (this.is_initialized) {
|
||||
throw new Error("You must not set the user_id twice!");
|
||||
} else {
|
||||
return this.initializeConnection();
|
||||
}
|
||||
},
|
||||
initializeConnection: function() {
|
||||
var options, writeIfAvailable;
|
||||
if (this.conn_id != null) {
|
||||
console.log("now initializing");
|
||||
options = {};
|
||||
writeIfAvailable = function(name, value) {
|
||||
if (value != null) {
|
||||
return options[name] = value;
|
||||
}
|
||||
};
|
||||
writeIfAvailable('key', this.key);
|
||||
writeIfAvailable('host', this.host);
|
||||
writeIfAvailable('port', this.port);
|
||||
writeIfAvailable('path', this.path);
|
||||
writeIfAvailable('secure', this.secure);
|
||||
writeIfAvailable('debug', this.debug);
|
||||
this.is_initialized = true;
|
||||
return this.connector = new PeerJsConnector(this.conn_id, options);
|
||||
}
|
||||
},
|
||||
ready: function() {
|
||||
if (this.conn_id !== null) {
|
||||
return this.initializeConnection();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=sourcemaps/peerjs-connector-polymer.js.map
|
||||
10
examples/EasyConn/bower_components/peerjs-connector/peerjs-connector.html
vendored
Normal file
10
examples/EasyConn/bower_components/peerjs-connector/peerjs-connector.html
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<link rel="import" href="../bower_components/polymer/polymer.html">
|
||||
|
||||
<polymer-element name="peerjs-connector" hidden attributes="conn_id connector key host port path secure debug">
|
||||
<script src="../bower_components/peerjs/peer.min.js"></script>
|
||||
<script src="./peerjs-connector.js"></script>
|
||||
<template>
|
||||
</template>
|
||||
<script src="./peerjs-connector-polymer.js"></script>
|
||||
|
||||
</polymer-element>
|
||||
177
examples/EasyConn/bower_components/peerjs-connector/peerjs-connector.js
vendored
Normal file
177
examples/EasyConn/bower_components/peerjs-connector/peerjs-connector.js
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
(function() {
|
||||
var PeerJsConnector,
|
||||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
window.PeerJsConnector = PeerJsConnector = (function() {
|
||||
function PeerJsConnector(id, options) {
|
||||
var exchangeConnections, joinConnections, that;
|
||||
this.id = id;
|
||||
this._addConnection = __bind(this._addConnection, this);
|
||||
that = this;
|
||||
this.isConnected = false;
|
||||
this.computeWhenConnected = [];
|
||||
this.connections = {};
|
||||
this.unsynced_connections = {};
|
||||
this.receive_handlers = [];
|
||||
this.conn = new Peer(arguments[0], arguments[1]);
|
||||
this.conn.on('error', function(err) {
|
||||
throw new Error("Peerjs connector: " + err);
|
||||
});
|
||||
this.conn.on('disconnected', function() {
|
||||
throw new Error("Peerjs connector disconnected from signalling server. Cannot accept new connections. Not fatal, but not so good either..");
|
||||
});
|
||||
this.conn.on('disconnect', function() {
|
||||
return that.conn.reconnect();
|
||||
});
|
||||
this.conn.on('connection', this._addConnection);
|
||||
exchangeConnections = function() {
|
||||
var conns, peer, peerid;
|
||||
conns = (function() {
|
||||
var _ref, _results;
|
||||
_ref = that.connections;
|
||||
_results = [];
|
||||
for (peerid in _ref) {
|
||||
peer = _ref[peerid];
|
||||
_results.push(peerid);
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
return conns;
|
||||
};
|
||||
joinConnections = function(peers) {
|
||||
var peer, _i, _len;
|
||||
for (_i = 0, _len = peers.length; _i < _len; _i++) {
|
||||
peer = peers[_i];
|
||||
if (this.unsynced_connections[peer.peer] == null) {
|
||||
this.unsynced_connections[peer.peer] = peer;
|
||||
that.join(peer);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
this.syncProcessOrder = [exchangeConnections, joinConnections];
|
||||
}
|
||||
|
||||
PeerJsConnector.prototype.whenConnected = function(f) {
|
||||
if (this.isConnected) {
|
||||
return f.call(this);
|
||||
} else {
|
||||
return this.computeWhenConnected.push(f);
|
||||
}
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.whenReceiving = function(f) {
|
||||
return this.receive_handlers.push(f);
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.send = function(peers, message) {
|
||||
return this.whenConnected((function(_this) {
|
||||
return function() {
|
||||
var peer, _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = peers.length; _i < _len; _i++) {
|
||||
peer = peers[_i];
|
||||
_results.push(_this.connections[peer].send(message));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.broadcast = function(message) {
|
||||
return this.whenConnected((function(_this) {
|
||||
return function() {
|
||||
var peer, peerid, _ref, _results;
|
||||
_ref = _this.connections;
|
||||
_results = [];
|
||||
for (peerid in _ref) {
|
||||
peer = _ref[peerid];
|
||||
_results.push(peer.send(message));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.whenSyncing = function() {
|
||||
var f, _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = arguments.length; _i < _len; _i++) {
|
||||
f = arguments[_i];
|
||||
_results.push(this.syncProcessOrder.push(f));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype.join = function(peerid) {
|
||||
var peer;
|
||||
if ((this.connections[peerid] == null) && peerid !== this.id) {
|
||||
peer = this.conn.connect(peerid, {
|
||||
reliable: true
|
||||
});
|
||||
this._addConnection(peer);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
PeerJsConnector.prototype._addConnection = function(peer) {
|
||||
return peer.on('open', (function(_this) {
|
||||
return function() {
|
||||
var current_sync_function, current_sync_i, that;
|
||||
_this.currentlyadding = peer;
|
||||
that = _this;
|
||||
peer.send(that.syncProcessOrder[0]());
|
||||
current_sync_function = that.syncProcessOrder[1];
|
||||
current_sync_i = 0;
|
||||
return peer.on('data', function(data) {
|
||||
var f, isEmpty, _i, _j, _len, _len1, _ref, _ref1, _results;
|
||||
console.log("receive data: " + (JSON.stringify(data)));
|
||||
current_sync_i++;
|
||||
if (current_sync_i < that.syncProcessOrder.length) {
|
||||
peer.send(current_sync_function.call(that, data));
|
||||
return current_sync_function = that.syncProcessOrder[current_sync_i];
|
||||
} else if (current_sync_i === that.syncProcessOrder.length) {
|
||||
that.connections[peer.peer] = peer;
|
||||
peer.on('close', function() {
|
||||
return delete that.connections[peer.peer];
|
||||
});
|
||||
delete that.unsynced_connections[peer.peer];
|
||||
isEmpty = function(os) {
|
||||
var o;
|
||||
for (o in os) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
if (isEmpty(that.unsynced_connections)) {
|
||||
that.isConnected = true;
|
||||
_ref = that.computeWhenConnected;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
f = _ref[_i];
|
||||
f.call(that);
|
||||
}
|
||||
return that.computeWhenConnected = [];
|
||||
}
|
||||
} else {
|
||||
_ref1 = that.receive_handlers;
|
||||
_results = [];
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
f = _ref1[_j];
|
||||
_results.push(f(peer.peer, data));
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
return PeerJsConnector;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=sourcemaps/peerjs-connector.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["peerjs-connector-polymer.coffee"],"names":[],"mappings":"AACA;AAAA,EAAI,IAAA,OAAA,CAAQ,kBAAR,EACF;AAAA,IAAA,IAAA,EAAM,SAAC,EAAD,GAAA,CAAN;AAAA,IACA,SAAA,EAAW,SAAC,OAAD,EAAS,OAAT,GAAA;AACT,MAAA,IAAG,IAAI,CAAC,cAAR;AACE,cAAU,IAAA,KAAA,CAAM,qCAAN,CAAV,CADF;OAAA,MAAA;eAGE,IAAI,CAAC,oBAAL,CAAA,EAHF;OADS;IAAA,CADX;AAAA,IAOA,oBAAA,EAAsB,SAAA,GAAA;AACpB,UAAA,yBAAA;AAAA,MAAA,IAAG,oBAAH;AACE,QAAA,OAAO,CAAC,GAAR,CAAY,kBAAZ,CAAA,CAAA;AAAA,QACA,OAAA,GAAU,EADV,CAAA;AAAA,QAEA,gBAAA,GAAmB,SAAC,IAAD,EAAO,KAAP,GAAA;AACjB,UAAA,IAAG,aAAH;mBACE,OAAQ,CAAA,IAAA,CAAR,GAAgB,MADlB;WADiB;QAAA,CAFnB,CAAA;AAAA,QAKA,gBAAA,CAAiB,KAAjB,EAAwB,IAAI,CAAC,GAA7B,CALA,CAAA;AAAA,QAMA,gBAAA,CAAiB,MAAjB,EAAyB,IAAI,CAAC,IAA9B,CANA,CAAA;AAAA,QAOA,gBAAA,CAAiB,MAAjB,EAAyB,IAAI,CAAC,IAA9B,CAPA,CAAA;AAAA,QAQA,gBAAA,CAAiB,MAAjB,EAAyB,IAAI,CAAC,IAA9B,CARA,CAAA;AAAA,QASA,gBAAA,CAAiB,QAAjB,EAA2B,IAAI,CAAC,MAAhC,CATA,CAAA;AAAA,QAUA,gBAAA,CAAiB,OAAjB,EAA0B,IAAI,CAAC,KAA/B,CAVA,CAAA;AAAA,QAWA,IAAI,CAAC,cAAL,GAAsB,IAXtB,CAAA;eAYA,IAAI,CAAC,SAAL,GAAqB,IAAA,eAAA,CAAgB,IAAI,CAAC,OAArB,EAA8B,OAA9B,EAbvB;OADoB;IAAA,CAPtB;AAAA,IAuBA,KAAA,EAAO,SAAA,GAAA;AACL,MAAA,IAAG,IAAI,CAAC,OAAL,KAAgB,IAAnB;eACE,IAAI,CAAC,oBAAL,CAAA,EADF;OADK;IAAA,CAvBP;GADE,CAAJ,CAAA;AAAA","file":"peerjs-connector-polymer.js","sourceRoot":"/source/","sourcesContent":["\nnew Polymer 'peerjs-connector',\n join: (id)->\n idChanged: (old_val,new_val)->\n if this.is_initialized\n throw new Error \"You must not set the user_id twice!\"\n else\n this.initializeConnection() \n\n initializeConnection: ()-> \n if this.conn_id?\n console.log(\"now initializing\")\n options = {}\n writeIfAvailable = (name, value)->\n if value?\n options[name] = value\n writeIfAvailable 'key', this.key\n writeIfAvailable 'host', this.host\n writeIfAvailable 'port', this.port\n writeIfAvailable 'path', this.path\n writeIfAvailable 'secure', this.secure\n writeIfAvailable 'debug', this.debug\n this.is_initialized = true;\n this.connector = new PeerJsConnector this.conn_id, options\n \n ready: ()->\n if this.conn_id != null\n this.initializeConnection()\n \n"]}
|
||||
1
examples/EasyConn/bower_components/peerjs-connector/sourcemaps/peerjs-connector.js.map
vendored
Normal file
1
examples/EasyConn/bower_components/peerjs-connector/sourcemaps/peerjs-connector.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
34
examples/EasyConn/bower_components/peerjs/.bower.json
vendored
Normal file
34
examples/EasyConn/bower_components/peerjs/.bower.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "peerjs",
|
||||
"version": "0.3.14",
|
||||
"homepage": "http://peerjs.com",
|
||||
"authors": [
|
||||
"Michelle Bu <michelle@michellebu.com>"
|
||||
],
|
||||
"description": "Simple peer-to-peer data and media using WebRTC.",
|
||||
"main": "peer.js",
|
||||
"keywords": [
|
||||
"WebRTC",
|
||||
"peer",
|
||||
"peerjs",
|
||||
"p2p"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"_release": "0.3.14",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.3.14",
|
||||
"commit": "708cb482682a3c7599dd177090e789722e2b8346"
|
||||
},
|
||||
"_source": "git://github.com/peers/bower-peerjs.git",
|
||||
"_target": "~0.3.14",
|
||||
"_originalSource": "peerjs",
|
||||
"_direct": true
|
||||
}
|
||||
5
examples/EasyConn/bower_components/peerjs/README.md
vendored
Normal file
5
examples/EasyConn/bower_components/peerjs/README.md
vendored
Normal file
File diff suppressed because one or more lines are too long
24
examples/EasyConn/bower_components/peerjs/bower.json
vendored
Normal file
24
examples/EasyConn/bower_components/peerjs/bower.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "peerjs",
|
||||
"version": "0.3.14",
|
||||
"homepage": "http://peerjs.com",
|
||||
"authors": [
|
||||
"Michelle Bu <michelle@michellebu.com>"
|
||||
],
|
||||
"description": "Simple peer-to-peer data and media using WebRTC.",
|
||||
"main": "peer.js",
|
||||
"keywords": [
|
||||
"WebRTC",
|
||||
"peer",
|
||||
"peerjs",
|
||||
"p2p"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
2939
examples/EasyConn/bower_components/peerjs/peer.js
vendored
Normal file
2939
examples/EasyConn/bower_components/peerjs/peer.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
examples/EasyConn/bower_components/peerjs/peer.min.js
vendored
Normal file
2
examples/EasyConn/bower_components/peerjs/peer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
32
examples/EasyConn/bower_components/polymer/.bower.json
vendored
Normal file
32
examples/EasyConn/bower_components/polymer/.bower.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "polymer",
|
||||
"description": "Polymer is a new type of library for the web, built on top of Web Components, and designed to leverage the evolving web platform on modern browsers.",
|
||||
"homepage": "http://www.polymer-project.org/",
|
||||
"keywords": [
|
||||
"util",
|
||||
"client",
|
||||
"browser",
|
||||
"web components",
|
||||
"web-components"
|
||||
],
|
||||
"author": "Polymer Authors <polymer-dev@googlegroups.com>",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"core-component-page": "Polymer/core-component-page#^0.5.0",
|
||||
"webcomponentsjs": "Polymer/webcomponentsjs#^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tools": "Polymer/tools#master",
|
||||
"web-component-tester": "Polymer/web-component-tester#^1.4.2"
|
||||
},
|
||||
"version": "0.5.1",
|
||||
"_release": "0.5.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.1",
|
||||
"commit": "c654b2b4996a643e79234ac624d7bc38179dfc2c"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/polymer.git",
|
||||
"_target": "~0.5.1",
|
||||
"_originalSource": "Polymer/polymer"
|
||||
}
|
||||
16
examples/EasyConn/bower_components/polymer/README.md
vendored
Normal file
16
examples/EasyConn/bower_components/polymer/README.md
vendored
Normal file
File diff suppressed because one or more lines are too long
23
examples/EasyConn/bower_components/polymer/bower.json
vendored
Normal file
23
examples/EasyConn/bower_components/polymer/bower.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "polymer",
|
||||
"description": "Polymer is a new type of library for the web, built on top of Web Components, and designed to leverage the evolving web platform on modern browsers.",
|
||||
"homepage": "http://www.polymer-project.org/",
|
||||
"keywords": [
|
||||
"util",
|
||||
"client",
|
||||
"browser",
|
||||
"web components",
|
||||
"web-components"
|
||||
],
|
||||
"author": "Polymer Authors <polymer-dev@googlegroups.com>",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"core-component-page": "Polymer/core-component-page#^0.5.0",
|
||||
"webcomponentsjs": "Polymer/webcomponentsjs#^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tools": "Polymer/tools#master",
|
||||
"web-component-tester": "Polymer/web-component-tester#^1.4.2"
|
||||
},
|
||||
"version": "0.5.1"
|
||||
}
|
||||
26
examples/EasyConn/bower_components/polymer/build.log
vendored
Normal file
26
examples/EasyConn/bower_components/polymer/build.log
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
BUILD LOG
|
||||
---------
|
||||
Build Time: 2014-11-12T14:32:18
|
||||
|
||||
NODEJS INFORMATION
|
||||
==================
|
||||
nodejs: v0.10.33
|
||||
grunt: 0.4.5
|
||||
grunt-audit: 1.0.0
|
||||
grunt-contrib-concat: 0.5.0
|
||||
grunt-contrib-copy: 0.7.0
|
||||
grunt-contrib-uglify: 0.6.0
|
||||
grunt-string-replace: 1.0.0
|
||||
web-component-tester: 1.6.0
|
||||
|
||||
REPO REVISIONS
|
||||
==============
|
||||
polymer-expressions: 1288fe573dc57cde304f66f0833d0644c766158c
|
||||
polymer-gestures: 94660a514772e182d27f79c3d8d1bb88796a2327
|
||||
polymer: da75e633f39b7761494cc3139a60733c488b2215
|
||||
|
||||
BUILD HASHES
|
||||
============
|
||||
dist/polymer.js: 59e0d3e669a3a1d163d8337766aa63bf809bfe79
|
||||
dist/polymer.min.js: a9145f911c5b9fecc0d4aa422ac658d1d462d15a
|
||||
dist/layout.html: 348d358a91712ecc2f8811efa430fcd954b4590c
|
||||
286
examples/EasyConn/bower_components/polymer/layout.html
vendored
Normal file
286
examples/EasyConn/bower_components/polymer/layout.html
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<style shim-shadowdom>
|
||||
/*******************************
|
||||
Flex Layout
|
||||
*******************************/
|
||||
|
||||
html /deep/ [layout][horizontal], html /deep/ [layout][vertical] {
|
||||
display: -ms-flexbox;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
html /deep/ [layout][horizontal][inline], html /deep/ [layout][vertical][inline] {
|
||||
display: -ms-inline-flexbox;
|
||||
display: -webkit-inline-flex;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
html /deep/ [layout][horizontal] {
|
||||
-ms-flex-direction: row;
|
||||
-webkit-flex-direction: row;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
html /deep/ [layout][horizontal][reverse] {
|
||||
-ms-flex-direction: row-reverse;
|
||||
-webkit-flex-direction: row-reverse;
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
html /deep/ [layout][vertical] {
|
||||
-ms-flex-direction: column;
|
||||
-webkit-flex-direction: column;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
html /deep/ [layout][vertical][reverse] {
|
||||
-ms-flex-direction: column-reverse;
|
||||
-webkit-flex-direction: column-reverse;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
html /deep/ [layout][wrap] {
|
||||
-ms-flex-wrap: wrap;
|
||||
-webkit-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
html /deep/ [layout][wrap-reverse] {
|
||||
-ms-flex-wrap: wrap-reverse;
|
||||
-webkit-flex-wrap: wrap-reverse;
|
||||
flex-wrap: wrap-reverse;
|
||||
}
|
||||
|
||||
html /deep/ [flex] {
|
||||
-ms-flex: 1 1 0.000000001px;
|
||||
-webkit-flex: 1;
|
||||
flex: 1;
|
||||
-webkit-flex-basis: 0.000000001px;
|
||||
flex-basis: 0.000000001px;
|
||||
}
|
||||
|
||||
html /deep/ [vertical][layout] > [flex][auto-vertical], html /deep/ [vertical][layout]::shadow [flex][auto-vertical] {
|
||||
-ms-flex: 1 1 auto;
|
||||
-webkit-flex-basis: auto;
|
||||
flex-basis: auto;
|
||||
}
|
||||
|
||||
html /deep/ [flex][auto] {
|
||||
-ms-flex: 1 1 auto;
|
||||
-webkit-flex-basis: auto;
|
||||
flex-basis: auto;
|
||||
}
|
||||
|
||||
html /deep/ [flex][none] {
|
||||
-ms-flex: none;
|
||||
-webkit-flex: none;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
html /deep/ [flex][one] {
|
||||
-ms-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
html /deep/ [flex][two] {
|
||||
-ms-flex: 2;
|
||||
-webkit-flex: 2;
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
html /deep/ [flex][three] {
|
||||
-ms-flex: 3;
|
||||
-webkit-flex: 3;
|
||||
flex: 3;
|
||||
}
|
||||
|
||||
html /deep/ [flex][four] {
|
||||
-ms-flex: 4;
|
||||
-webkit-flex: 4;
|
||||
flex: 4;
|
||||
}
|
||||
|
||||
html /deep/ [flex][five] {
|
||||
-ms-flex: 5;
|
||||
-webkit-flex: 5;
|
||||
flex: 5;
|
||||
}
|
||||
|
||||
html /deep/ [flex][six] {
|
||||
-ms-flex: 6;
|
||||
-webkit-flex: 6;
|
||||
flex: 6;
|
||||
}
|
||||
|
||||
html /deep/ [flex][seven] {
|
||||
-ms-flex: 7;
|
||||
-webkit-flex: 7;
|
||||
flex: 7;
|
||||
}
|
||||
|
||||
html /deep/ [flex][eight] {
|
||||
-ms-flex: 8;
|
||||
-webkit-flex: 8;
|
||||
flex: 8;
|
||||
}
|
||||
|
||||
html /deep/ [flex][nine] {
|
||||
-ms-flex: 9;
|
||||
-webkit-flex: 9;
|
||||
flex: 9;
|
||||
}
|
||||
|
||||
html /deep/ [flex][ten] {
|
||||
-ms-flex: 10;
|
||||
-webkit-flex: 10;
|
||||
flex: 10;
|
||||
}
|
||||
|
||||
html /deep/ [flex][eleven] {
|
||||
-ms-flex: 11;
|
||||
-webkit-flex: 11;
|
||||
flex: 11;
|
||||
}
|
||||
|
||||
html /deep/ [flex][twelve] {
|
||||
-ms-flex: 12;
|
||||
-webkit-flex: 12;
|
||||
flex: 12;
|
||||
}
|
||||
|
||||
/* alignment in cross axis */
|
||||
|
||||
html /deep/ [layout][start] {
|
||||
-ms-flex-align: start;
|
||||
-webkit-align-items: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
html /deep/ [layout][center], html /deep/ [layout][center-center] {
|
||||
-ms-flex-align: center;
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
html /deep/ [layout][end] {
|
||||
-ms-flex-align: end;
|
||||
-webkit-align-items: flex-end;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
/* alignment in main axis */
|
||||
|
||||
html /deep/ [layout][start-justified] {
|
||||
-ms-flex-pack: start;
|
||||
-webkit-justify-content: flex-start;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
html /deep/ [layout][center-justified], html /deep/ [layout][center-center] {
|
||||
-ms-flex-pack: center;
|
||||
-webkit-justify-content: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
html /deep/ [layout][end-justified] {
|
||||
-ms-flex-pack: end;
|
||||
-webkit-justify-content: flex-end;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
html /deep/ [layout][around-justified] {
|
||||
-ms-flex-pack: distribute;
|
||||
-webkit-justify-content: space-around;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
html /deep/ [layout][justified] {
|
||||
-ms-flex-pack: justify;
|
||||
-webkit-justify-content: space-between;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* self alignment */
|
||||
|
||||
html /deep/ [self-start] {
|
||||
-ms-align-self: flex-start;
|
||||
-webkit-align-self: flex-start;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
html /deep/ [self-center] {
|
||||
-ms-align-self: center;
|
||||
-webkit-align-self: center;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
html /deep/ [self-end] {
|
||||
-ms-align-self: flex-end;
|
||||
-webkit-align-self: flex-end;
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
html /deep/ [self-stretch] {
|
||||
-ms-align-self: stretch;
|
||||
-webkit-align-self: stretch;
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
Other Layout
|
||||
*******************************/
|
||||
|
||||
html /deep/ [block] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ie support for hidden */
|
||||
html /deep/ [hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
html /deep/ [relative] {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
html /deep/ [fit] {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
body[fullbleed] {
|
||||
margin: 0;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/*******************************
|
||||
Other
|
||||
*******************************/
|
||||
|
||||
html /deep/ [segment], html /deep/ segment {
|
||||
display: block;
|
||||
position: relative;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin: 1em 0.5em;
|
||||
padding: 1em;
|
||||
background-color: white;
|
||||
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
12
examples/EasyConn/bower_components/polymer/polymer.html
vendored
Normal file
12
examples/EasyConn/bower_components/polymer/polymer.html
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="layout.html">
|
||||
|
||||
<script src="polymer.js"></script>
|
||||
11829
examples/EasyConn/bower_components/polymer/polymer.js
vendored
Normal file
11829
examples/EasyConn/bower_components/polymer/polymer.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14
examples/EasyConn/bower_components/polymer/polymer.min.js
vendored
Normal file
14
examples/EasyConn/bower_components/polymer/polymer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
23
examples/EasyConn/bower_components/webcomponentsjs/.bower.json
vendored
Normal file
23
examples/EasyConn/bower_components/webcomponentsjs/.bower.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "webcomponentsjs",
|
||||
"main": "webcomponents.js",
|
||||
"version": "0.5.1",
|
||||
"homepage": "http://webcomponents.org",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"webcomponents"
|
||||
],
|
||||
"license": "BSD",
|
||||
"ignore": [],
|
||||
"_release": "0.5.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.1",
|
||||
"commit": "89c466eb29642c3e5ba2594e9330eb62ade1dbab"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/webcomponentsjs.git",
|
||||
"_target": "^0.5.0",
|
||||
"_originalSource": "Polymer/webcomponentsjs"
|
||||
}
|
||||
931
examples/EasyConn/bower_components/webcomponentsjs/CustomElements.js
vendored
Normal file
931
examples/EasyConn/bower_components/webcomponentsjs/CustomElements.js
vendored
Normal file
@@ -0,0 +1,931 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
// @version 0.5.1
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
var counter = Date.now() % 1e9;
|
||||
var WeakMap = function() {
|
||||
this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
|
||||
};
|
||||
WeakMap.prototype = {
|
||||
set: function(key, value) {
|
||||
var entry = key[this.name];
|
||||
if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
|
||||
value: [ key, value ],
|
||||
writable: true
|
||||
});
|
||||
return this;
|
||||
},
|
||||
get: function(key) {
|
||||
var entry;
|
||||
return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
|
||||
},
|
||||
"delete": function(key) {
|
||||
var entry = key[this.name];
|
||||
if (!entry || entry[0] !== key) return false;
|
||||
entry[0] = entry[1] = undefined;
|
||||
return true;
|
||||
},
|
||||
has: function(key) {
|
||||
var entry = key[this.name];
|
||||
if (!entry) return false;
|
||||
return entry[0] === key;
|
||||
}
|
||||
};
|
||||
window.WeakMap = WeakMap;
|
||||
})();
|
||||
}
|
||||
|
||||
(function(global) {
|
||||
var registrationsTable = new WeakMap();
|
||||
var setImmediate;
|
||||
if (/Trident/.test(navigator.userAgent)) {
|
||||
setImmediate = setTimeout;
|
||||
} else if (window.setImmediate) {
|
||||
setImmediate = window.setImmediate;
|
||||
} else {
|
||||
var setImmediateQueue = [];
|
||||
var sentinel = String(Math.random());
|
||||
window.addEventListener("message", function(e) {
|
||||
if (e.data === sentinel) {
|
||||
var queue = setImmediateQueue;
|
||||
setImmediateQueue = [];
|
||||
queue.forEach(function(func) {
|
||||
func();
|
||||
});
|
||||
}
|
||||
});
|
||||
setImmediate = function(func) {
|
||||
setImmediateQueue.push(func);
|
||||
window.postMessage(sentinel, "*");
|
||||
};
|
||||
}
|
||||
var isScheduled = false;
|
||||
var scheduledObservers = [];
|
||||
function scheduleCallback(observer) {
|
||||
scheduledObservers.push(observer);
|
||||
if (!isScheduled) {
|
||||
isScheduled = true;
|
||||
setImmediate(dispatchCallbacks);
|
||||
}
|
||||
}
|
||||
function wrapIfNeeded(node) {
|
||||
return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
|
||||
}
|
||||
function dispatchCallbacks() {
|
||||
isScheduled = false;
|
||||
var observers = scheduledObservers;
|
||||
scheduledObservers = [];
|
||||
observers.sort(function(o1, o2) {
|
||||
return o1.uid_ - o2.uid_;
|
||||
});
|
||||
var anyNonEmpty = false;
|
||||
observers.forEach(function(observer) {
|
||||
var queue = observer.takeRecords();
|
||||
removeTransientObserversFor(observer);
|
||||
if (queue.length) {
|
||||
observer.callback_(queue, observer);
|
||||
anyNonEmpty = true;
|
||||
}
|
||||
});
|
||||
if (anyNonEmpty) dispatchCallbacks();
|
||||
}
|
||||
function removeTransientObserversFor(observer) {
|
||||
observer.nodes_.forEach(function(node) {
|
||||
var registrations = registrationsTable.get(node);
|
||||
if (!registrations) return;
|
||||
registrations.forEach(function(registration) {
|
||||
if (registration.observer === observer) registration.removeTransientObservers();
|
||||
});
|
||||
});
|
||||
}
|
||||
function forEachAncestorAndObserverEnqueueRecord(target, callback) {
|
||||
for (var node = target; node; node = node.parentNode) {
|
||||
var registrations = registrationsTable.get(node);
|
||||
if (registrations) {
|
||||
for (var j = 0; j < registrations.length; j++) {
|
||||
var registration = registrations[j];
|
||||
var options = registration.options;
|
||||
if (node !== target && !options.subtree) continue;
|
||||
var record = callback(options);
|
||||
if (record) registration.enqueue(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var uidCounter = 0;
|
||||
function JsMutationObserver(callback) {
|
||||
this.callback_ = callback;
|
||||
this.nodes_ = [];
|
||||
this.records_ = [];
|
||||
this.uid_ = ++uidCounter;
|
||||
}
|
||||
JsMutationObserver.prototype = {
|
||||
observe: function(target, options) {
|
||||
target = wrapIfNeeded(target);
|
||||
if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
|
||||
throw new SyntaxError();
|
||||
}
|
||||
var registrations = registrationsTable.get(target);
|
||||
if (!registrations) registrationsTable.set(target, registrations = []);
|
||||
var registration;
|
||||
for (var i = 0; i < registrations.length; i++) {
|
||||
if (registrations[i].observer === this) {
|
||||
registration = registrations[i];
|
||||
registration.removeListeners();
|
||||
registration.options = options;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!registration) {
|
||||
registration = new Registration(this, target, options);
|
||||
registrations.push(registration);
|
||||
this.nodes_.push(target);
|
||||
}
|
||||
registration.addListeners();
|
||||
},
|
||||
disconnect: function() {
|
||||
this.nodes_.forEach(function(node) {
|
||||
var registrations = registrationsTable.get(node);
|
||||
for (var i = 0; i < registrations.length; i++) {
|
||||
var registration = registrations[i];
|
||||
if (registration.observer === this) {
|
||||
registration.removeListeners();
|
||||
registrations.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
this.records_ = [];
|
||||
},
|
||||
takeRecords: function() {
|
||||
var copyOfRecords = this.records_;
|
||||
this.records_ = [];
|
||||
return copyOfRecords;
|
||||
}
|
||||
};
|
||||
function MutationRecord(type, target) {
|
||||
this.type = type;
|
||||
this.target = target;
|
||||
this.addedNodes = [];
|
||||
this.removedNodes = [];
|
||||
this.previousSibling = null;
|
||||
this.nextSibling = null;
|
||||
this.attributeName = null;
|
||||
this.attributeNamespace = null;
|
||||
this.oldValue = null;
|
||||
}
|
||||
function copyMutationRecord(original) {
|
||||
var record = new MutationRecord(original.type, original.target);
|
||||
record.addedNodes = original.addedNodes.slice();
|
||||
record.removedNodes = original.removedNodes.slice();
|
||||
record.previousSibling = original.previousSibling;
|
||||
record.nextSibling = original.nextSibling;
|
||||
record.attributeName = original.attributeName;
|
||||
record.attributeNamespace = original.attributeNamespace;
|
||||
record.oldValue = original.oldValue;
|
||||
return record;
|
||||
}
|
||||
var currentRecord, recordWithOldValue;
|
||||
function getRecord(type, target) {
|
||||
return currentRecord = new MutationRecord(type, target);
|
||||
}
|
||||
function getRecordWithOldValue(oldValue) {
|
||||
if (recordWithOldValue) return recordWithOldValue;
|
||||
recordWithOldValue = copyMutationRecord(currentRecord);
|
||||
recordWithOldValue.oldValue = oldValue;
|
||||
return recordWithOldValue;
|
||||
}
|
||||
function clearRecords() {
|
||||
currentRecord = recordWithOldValue = undefined;
|
||||
}
|
||||
function recordRepresentsCurrentMutation(record) {
|
||||
return record === recordWithOldValue || record === currentRecord;
|
||||
}
|
||||
function selectRecord(lastRecord, newRecord) {
|
||||
if (lastRecord === newRecord) return lastRecord;
|
||||
if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
|
||||
return null;
|
||||
}
|
||||
function Registration(observer, target, options) {
|
||||
this.observer = observer;
|
||||
this.target = target;
|
||||
this.options = options;
|
||||
this.transientObservedNodes = [];
|
||||
}
|
||||
Registration.prototype = {
|
||||
enqueue: function(record) {
|
||||
var records = this.observer.records_;
|
||||
var length = records.length;
|
||||
if (records.length > 0) {
|
||||
var lastRecord = records[length - 1];
|
||||
var recordToReplaceLast = selectRecord(lastRecord, record);
|
||||
if (recordToReplaceLast) {
|
||||
records[length - 1] = recordToReplaceLast;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
scheduleCallback(this.observer);
|
||||
}
|
||||
records[length] = record;
|
||||
},
|
||||
addListeners: function() {
|
||||
this.addListeners_(this.target);
|
||||
},
|
||||
addListeners_: function(node) {
|
||||
var options = this.options;
|
||||
if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
|
||||
if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
|
||||
if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
|
||||
if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
|
||||
},
|
||||
removeListeners: function() {
|
||||
this.removeListeners_(this.target);
|
||||
},
|
||||
removeListeners_: function(node) {
|
||||
var options = this.options;
|
||||
if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
|
||||
if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
|
||||
if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
|
||||
if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
|
||||
},
|
||||
addTransientObserver: function(node) {
|
||||
if (node === this.target) return;
|
||||
this.addListeners_(node);
|
||||
this.transientObservedNodes.push(node);
|
||||
var registrations = registrationsTable.get(node);
|
||||
if (!registrations) registrationsTable.set(node, registrations = []);
|
||||
registrations.push(this);
|
||||
},
|
||||
removeTransientObservers: function() {
|
||||
var transientObservedNodes = this.transientObservedNodes;
|
||||
this.transientObservedNodes = [];
|
||||
transientObservedNodes.forEach(function(node) {
|
||||
this.removeListeners_(node);
|
||||
var registrations = registrationsTable.get(node);
|
||||
for (var i = 0; i < registrations.length; i++) {
|
||||
if (registrations[i] === this) {
|
||||
registrations.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
handleEvent: function(e) {
|
||||
e.stopImmediatePropagation();
|
||||
switch (e.type) {
|
||||
case "DOMAttrModified":
|
||||
var name = e.attrName;
|
||||
var namespace = e.relatedNode.namespaceURI;
|
||||
var target = e.target;
|
||||
var record = new getRecord("attributes", target);
|
||||
record.attributeName = name;
|
||||
record.attributeNamespace = namespace;
|
||||
var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
|
||||
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
||||
if (!options.attributes) return;
|
||||
if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
|
||||
return;
|
||||
}
|
||||
if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
|
||||
return record;
|
||||
});
|
||||
break;
|
||||
|
||||
case "DOMCharacterDataModified":
|
||||
var target = e.target;
|
||||
var record = getRecord("characterData", target);
|
||||
var oldValue = e.prevValue;
|
||||
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
||||
if (!options.characterData) return;
|
||||
if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
|
||||
return record;
|
||||
});
|
||||
break;
|
||||
|
||||
case "DOMNodeRemoved":
|
||||
this.addTransientObserver(e.target);
|
||||
|
||||
case "DOMNodeInserted":
|
||||
var target = e.relatedNode;
|
||||
var changedNode = e.target;
|
||||
var addedNodes, removedNodes;
|
||||
if (e.type === "DOMNodeInserted") {
|
||||
addedNodes = [ changedNode ];
|
||||
removedNodes = [];
|
||||
} else {
|
||||
addedNodes = [];
|
||||
removedNodes = [ changedNode ];
|
||||
}
|
||||
var previousSibling = changedNode.previousSibling;
|
||||
var nextSibling = changedNode.nextSibling;
|
||||
var record = getRecord("childList", target);
|
||||
record.addedNodes = addedNodes;
|
||||
record.removedNodes = removedNodes;
|
||||
record.previousSibling = previousSibling;
|
||||
record.nextSibling = nextSibling;
|
||||
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
||||
if (!options.childList) return;
|
||||
return record;
|
||||
});
|
||||
}
|
||||
clearRecords();
|
||||
}
|
||||
};
|
||||
global.JsMutationObserver = JsMutationObserver;
|
||||
if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
|
||||
})(this);
|
||||
|
||||
window.CustomElements = window.CustomElements || {
|
||||
flags: {}
|
||||
};
|
||||
|
||||
(function(scope) {
|
||||
var flags = scope.flags;
|
||||
var modules = [];
|
||||
var addModule = function(module) {
|
||||
modules.push(module);
|
||||
};
|
||||
var initializeModules = function() {
|
||||
modules.forEach(function(module) {
|
||||
module(scope);
|
||||
});
|
||||
};
|
||||
scope.addModule = addModule;
|
||||
scope.initializeModules = initializeModules;
|
||||
scope.hasNative = Boolean(document.registerElement);
|
||||
scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
|
||||
})(CustomElements);
|
||||
|
||||
CustomElements.addModule(function(scope) {
|
||||
var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
|
||||
function forSubtree(node, cb) {
|
||||
findAllElements(node, function(e) {
|
||||
if (cb(e)) {
|
||||
return true;
|
||||
}
|
||||
forRoots(e, cb);
|
||||
});
|
||||
forRoots(node, cb);
|
||||
}
|
||||
function findAllElements(node, find, data) {
|
||||
var e = node.firstElementChild;
|
||||
if (!e) {
|
||||
e = node.firstChild;
|
||||
while (e && e.nodeType !== Node.ELEMENT_NODE) {
|
||||
e = e.nextSibling;
|
||||
}
|
||||
}
|
||||
while (e) {
|
||||
if (find(e, data) !== true) {
|
||||
findAllElements(e, find, data);
|
||||
}
|
||||
e = e.nextElementSibling;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function forRoots(node, cb) {
|
||||
var root = node.shadowRoot;
|
||||
while (root) {
|
||||
forSubtree(root, cb);
|
||||
root = root.olderShadowRoot;
|
||||
}
|
||||
}
|
||||
var processingDocuments;
|
||||
function forDocumentTree(doc, cb) {
|
||||
processingDocuments = [];
|
||||
_forDocumentTree(doc, cb);
|
||||
processingDocuments = null;
|
||||
}
|
||||
function _forDocumentTree(doc, cb) {
|
||||
doc = wrap(doc);
|
||||
if (processingDocuments.indexOf(doc) >= 0) {
|
||||
return;
|
||||
}
|
||||
processingDocuments.push(doc);
|
||||
var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
|
||||
for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
|
||||
if (n.import) {
|
||||
_forDocumentTree(n.import, cb);
|
||||
}
|
||||
}
|
||||
cb(doc);
|
||||
}
|
||||
scope.forDocumentTree = forDocumentTree;
|
||||
scope.forSubtree = forSubtree;
|
||||
});
|
||||
|
||||
CustomElements.addModule(function(scope) {
|
||||
var flags = scope.flags;
|
||||
var forSubtree = scope.forSubtree;
|
||||
var forDocumentTree = scope.forDocumentTree;
|
||||
function addedNode(node) {
|
||||
return added(node) || addedSubtree(node);
|
||||
}
|
||||
function added(node) {
|
||||
if (scope.upgrade(node)) {
|
||||
return true;
|
||||
}
|
||||
attached(node);
|
||||
}
|
||||
function addedSubtree(node) {
|
||||
forSubtree(node, function(e) {
|
||||
if (added(e)) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
function attachedNode(node) {
|
||||
attached(node);
|
||||
if (inDocument(node)) {
|
||||
forSubtree(node, function(e) {
|
||||
attached(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
|
||||
scope.hasPolyfillMutations = hasPolyfillMutations;
|
||||
var isPendingMutations = false;
|
||||
var pendingMutations = [];
|
||||
function deferMutation(fn) {
|
||||
pendingMutations.push(fn);
|
||||
if (!isPendingMutations) {
|
||||
isPendingMutations = true;
|
||||
setTimeout(takeMutations);
|
||||
}
|
||||
}
|
||||
function takeMutations() {
|
||||
isPendingMutations = false;
|
||||
var $p = pendingMutations;
|
||||
for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
|
||||
p();
|
||||
}
|
||||
pendingMutations = [];
|
||||
}
|
||||
function attached(element) {
|
||||
if (hasPolyfillMutations) {
|
||||
deferMutation(function() {
|
||||
_attached(element);
|
||||
});
|
||||
} else {
|
||||
_attached(element);
|
||||
}
|
||||
}
|
||||
function _attached(element) {
|
||||
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
|
||||
if (!element.__attached && inDocument(element)) {
|
||||
element.__attached = true;
|
||||
if (element.attachedCallback) {
|
||||
element.attachedCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function detachedNode(node) {
|
||||
detached(node);
|
||||
forSubtree(node, function(e) {
|
||||
detached(e);
|
||||
});
|
||||
}
|
||||
function detached(element) {
|
||||
if (hasPolyfillMutations) {
|
||||
deferMutation(function() {
|
||||
_detached(element);
|
||||
});
|
||||
} else {
|
||||
_detached(element);
|
||||
}
|
||||
}
|
||||
function _detached(element) {
|
||||
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
|
||||
if (element.__attached && !inDocument(element)) {
|
||||
element.__attached = false;
|
||||
if (element.detachedCallback) {
|
||||
element.detachedCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function inDocument(element) {
|
||||
var p = element;
|
||||
var doc = wrap(document);
|
||||
while (p) {
|
||||
if (p == doc) {
|
||||
return true;
|
||||
}
|
||||
p = p.parentNode || p.host;
|
||||
}
|
||||
}
|
||||
function watchShadow(node) {
|
||||
if (node.shadowRoot && !node.shadowRoot.__watched) {
|
||||
flags.dom && console.log("watching shadow-root for: ", node.localName);
|
||||
var root = node.shadowRoot;
|
||||
while (root) {
|
||||
observe(root);
|
||||
root = root.olderShadowRoot;
|
||||
}
|
||||
}
|
||||
}
|
||||
function handler(mutations) {
|
||||
if (flags.dom) {
|
||||
var mx = mutations[0];
|
||||
if (mx && mx.type === "childList" && mx.addedNodes) {
|
||||
if (mx.addedNodes) {
|
||||
var d = mx.addedNodes[0];
|
||||
while (d && d !== document && !d.host) {
|
||||
d = d.parentNode;
|
||||
}
|
||||
var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
|
||||
u = u.split("/?").shift().split("/").pop();
|
||||
}
|
||||
}
|
||||
console.group("mutations (%d) [%s]", mutations.length, u || "");
|
||||
}
|
||||
mutations.forEach(function(mx) {
|
||||
if (mx.type === "childList") {
|
||||
forEach(mx.addedNodes, function(n) {
|
||||
if (!n.localName) {
|
||||
return;
|
||||
}
|
||||
addedNode(n);
|
||||
});
|
||||
forEach(mx.removedNodes, function(n) {
|
||||
if (!n.localName) {
|
||||
return;
|
||||
}
|
||||
detachedNode(n);
|
||||
});
|
||||
}
|
||||
});
|
||||
flags.dom && console.groupEnd();
|
||||
}
|
||||
function takeRecords(node) {
|
||||
node = wrap(node);
|
||||
if (!node) {
|
||||
node = wrap(document);
|
||||
}
|
||||
while (node.parentNode) {
|
||||
node = node.parentNode;
|
||||
}
|
||||
var observer = node.__observer;
|
||||
if (observer) {
|
||||
handler(observer.takeRecords());
|
||||
takeMutations();
|
||||
}
|
||||
}
|
||||
var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
|
||||
function observe(inRoot) {
|
||||
if (inRoot.__observer) {
|
||||
return;
|
||||
}
|
||||
var observer = new MutationObserver(handler);
|
||||
observer.observe(inRoot, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
inRoot.__observer = observer;
|
||||
}
|
||||
function upgradeDocument(doc) {
|
||||
doc = wrap(doc);
|
||||
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
|
||||
addedNode(doc);
|
||||
observe(doc);
|
||||
flags.dom && console.groupEnd();
|
||||
}
|
||||
function upgradeDocumentTree(doc) {
|
||||
forDocumentTree(doc, upgradeDocument);
|
||||
}
|
||||
var originalCreateShadowRoot = Element.prototype.createShadowRoot;
|
||||
Element.prototype.createShadowRoot = function() {
|
||||
var root = originalCreateShadowRoot.call(this);
|
||||
CustomElements.watchShadow(this);
|
||||
return root;
|
||||
};
|
||||
scope.watchShadow = watchShadow;
|
||||
scope.upgradeDocumentTree = upgradeDocumentTree;
|
||||
scope.upgradeSubtree = addedSubtree;
|
||||
scope.upgradeAll = addedNode;
|
||||
scope.attachedNode = attachedNode;
|
||||
scope.takeRecords = takeRecords;
|
||||
});
|
||||
|
||||
CustomElements.addModule(function(scope) {
|
||||
var flags = scope.flags;
|
||||
function upgrade(node) {
|
||||
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
||||
var is = node.getAttribute("is");
|
||||
var definition = scope.getRegisteredDefinition(is || node.localName);
|
||||
if (definition) {
|
||||
if (is && definition.tag == node.localName) {
|
||||
return upgradeWithDefinition(node, definition);
|
||||
} else if (!is && !definition.extends) {
|
||||
return upgradeWithDefinition(node, definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function upgradeWithDefinition(element, definition) {
|
||||
flags.upgrade && console.group("upgrade:", element.localName);
|
||||
if (definition.is) {
|
||||
element.setAttribute("is", definition.is);
|
||||
}
|
||||
implementPrototype(element, definition);
|
||||
element.__upgraded__ = true;
|
||||
created(element);
|
||||
scope.attachedNode(element);
|
||||
scope.upgradeSubtree(element);
|
||||
flags.upgrade && console.groupEnd();
|
||||
return element;
|
||||
}
|
||||
function implementPrototype(element, definition) {
|
||||
if (Object.__proto__) {
|
||||
element.__proto__ = definition.prototype;
|
||||
} else {
|
||||
customMixin(element, definition.prototype, definition.native);
|
||||
element.__proto__ = definition.prototype;
|
||||
}
|
||||
}
|
||||
function customMixin(inTarget, inSrc, inNative) {
|
||||
var used = {};
|
||||
var p = inSrc;
|
||||
while (p !== inNative && p !== HTMLElement.prototype) {
|
||||
var keys = Object.getOwnPropertyNames(p);
|
||||
for (var i = 0, k; k = keys[i]; i++) {
|
||||
if (!used[k]) {
|
||||
Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
|
||||
used[k] = 1;
|
||||
}
|
||||
}
|
||||
p = Object.getPrototypeOf(p);
|
||||
}
|
||||
}
|
||||
function created(element) {
|
||||
if (element.createdCallback) {
|
||||
element.createdCallback();
|
||||
}
|
||||
}
|
||||
scope.upgrade = upgrade;
|
||||
scope.upgradeWithDefinition = upgradeWithDefinition;
|
||||
scope.implementPrototype = implementPrototype;
|
||||
});
|
||||
|
||||
CustomElements.addModule(function(scope) {
|
||||
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
||||
var upgrade = scope.upgrade;
|
||||
var upgradeWithDefinition = scope.upgradeWithDefinition;
|
||||
var implementPrototype = scope.implementPrototype;
|
||||
var useNative = scope.useNative;
|
||||
function register(name, options) {
|
||||
var definition = options || {};
|
||||
if (!name) {
|
||||
throw new Error("document.registerElement: first argument `name` must not be empty");
|
||||
}
|
||||
if (name.indexOf("-") < 0) {
|
||||
throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
|
||||
}
|
||||
if (isReservedTag(name)) {
|
||||
throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
|
||||
}
|
||||
if (getRegisteredDefinition(name)) {
|
||||
throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
|
||||
}
|
||||
if (!definition.prototype) {
|
||||
definition.prototype = Object.create(HTMLElement.prototype);
|
||||
}
|
||||
definition.__name = name.toLowerCase();
|
||||
definition.lifecycle = definition.lifecycle || {};
|
||||
definition.ancestry = ancestry(definition.extends);
|
||||
resolveTagName(definition);
|
||||
resolvePrototypeChain(definition);
|
||||
overrideAttributeApi(definition.prototype);
|
||||
registerDefinition(definition.__name, definition);
|
||||
definition.ctor = generateConstructor(definition);
|
||||
definition.ctor.prototype = definition.prototype;
|
||||
definition.prototype.constructor = definition.ctor;
|
||||
if (scope.ready) {
|
||||
upgradeDocumentTree(document);
|
||||
}
|
||||
return definition.ctor;
|
||||
}
|
||||
function overrideAttributeApi(prototype) {
|
||||
if (prototype.setAttribute._polyfilled) {
|
||||
return;
|
||||
}
|
||||
var setAttribute = prototype.setAttribute;
|
||||
prototype.setAttribute = function(name, value) {
|
||||
changeAttribute.call(this, name, value, setAttribute);
|
||||
};
|
||||
var removeAttribute = prototype.removeAttribute;
|
||||
prototype.removeAttribute = function(name) {
|
||||
changeAttribute.call(this, name, null, removeAttribute);
|
||||
};
|
||||
prototype.setAttribute._polyfilled = true;
|
||||
}
|
||||
function changeAttribute(name, value, operation) {
|
||||
name = name.toLowerCase();
|
||||
var oldValue = this.getAttribute(name);
|
||||
operation.apply(this, arguments);
|
||||
var newValue = this.getAttribute(name);
|
||||
if (this.attributeChangedCallback && newValue !== oldValue) {
|
||||
this.attributeChangedCallback(name, oldValue, newValue);
|
||||
}
|
||||
}
|
||||
function isReservedTag(name) {
|
||||
for (var i = 0; i < reservedTagList.length; i++) {
|
||||
if (name === reservedTagList[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
|
||||
function ancestry(extnds) {
|
||||
var extendee = getRegisteredDefinition(extnds);
|
||||
if (extendee) {
|
||||
return ancestry(extendee.extends).concat([ extendee ]);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
function resolveTagName(definition) {
|
||||
var baseTag = definition.extends;
|
||||
for (var i = 0, a; a = definition.ancestry[i]; i++) {
|
||||
baseTag = a.is && a.tag;
|
||||
}
|
||||
definition.tag = baseTag || definition.__name;
|
||||
if (baseTag) {
|
||||
definition.is = definition.__name;
|
||||
}
|
||||
}
|
||||
function resolvePrototypeChain(definition) {
|
||||
if (!Object.__proto__) {
|
||||
var nativePrototype = HTMLElement.prototype;
|
||||
if (definition.is) {
|
||||
var inst = document.createElement(definition.tag);
|
||||
var expectedPrototype = Object.getPrototypeOf(inst);
|
||||
if (expectedPrototype === definition.prototype) {
|
||||
nativePrototype = expectedPrototype;
|
||||
}
|
||||
}
|
||||
var proto = definition.prototype, ancestor;
|
||||
while (proto && proto !== nativePrototype) {
|
||||
ancestor = Object.getPrototypeOf(proto);
|
||||
proto.__proto__ = ancestor;
|
||||
proto = ancestor;
|
||||
}
|
||||
definition.native = nativePrototype;
|
||||
}
|
||||
}
|
||||
function instantiate(definition) {
|
||||
return upgradeWithDefinition(domCreateElement(definition.tag), definition);
|
||||
}
|
||||
var registry = {};
|
||||
function getRegisteredDefinition(name) {
|
||||
if (name) {
|
||||
return registry[name.toLowerCase()];
|
||||
}
|
||||
}
|
||||
function registerDefinition(name, definition) {
|
||||
registry[name] = definition;
|
||||
}
|
||||
function generateConstructor(definition) {
|
||||
return function() {
|
||||
return instantiate(definition);
|
||||
};
|
||||
}
|
||||
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
||||
function createElementNS(namespace, tag, typeExtension) {
|
||||
if (namespace === HTML_NAMESPACE) {
|
||||
return createElement(tag, typeExtension);
|
||||
} else {
|
||||
return domCreateElementNS(namespace, tag);
|
||||
}
|
||||
}
|
||||
function createElement(tag, typeExtension) {
|
||||
var definition = getRegisteredDefinition(typeExtension || tag);
|
||||
if (definition) {
|
||||
if (tag == definition.tag && typeExtension == definition.is) {
|
||||
return new definition.ctor();
|
||||
}
|
||||
if (!typeExtension && !definition.is) {
|
||||
return new definition.ctor();
|
||||
}
|
||||
}
|
||||
var element;
|
||||
if (typeExtension) {
|
||||
element = createElement(tag);
|
||||
element.setAttribute("is", typeExtension);
|
||||
return element;
|
||||
}
|
||||
element = domCreateElement(tag);
|
||||
if (tag.indexOf("-") >= 0) {
|
||||
implementPrototype(element, HTMLElement);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
function cloneNode(deep) {
|
||||
var n = domCloneNode.call(this, deep);
|
||||
upgrade(n);
|
||||
return n;
|
||||
}
|
||||
var domCreateElement = document.createElement.bind(document);
|
||||
var domCreateElementNS = document.createElementNS.bind(document);
|
||||
var domCloneNode = Node.prototype.cloneNode;
|
||||
var isInstance;
|
||||
if (!Object.__proto__ && !useNative) {
|
||||
isInstance = function(obj, ctor) {
|
||||
var p = obj;
|
||||
while (p) {
|
||||
if (p === ctor.prototype) {
|
||||
return true;
|
||||
}
|
||||
p = p.__proto__;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
} else {
|
||||
isInstance = function(obj, base) {
|
||||
return obj instanceof base;
|
||||
};
|
||||
}
|
||||
document.registerElement = register;
|
||||
document.createElement = createElement;
|
||||
document.createElementNS = createElementNS;
|
||||
Node.prototype.cloneNode = cloneNode;
|
||||
scope.registry = registry;
|
||||
scope.instanceof = isInstance;
|
||||
scope.reservedTagList = reservedTagList;
|
||||
scope.getRegisteredDefinition = getRegisteredDefinition;
|
||||
document.register = document.registerElement;
|
||||
});
|
||||
|
||||
(function(scope) {
|
||||
var useNative = scope.useNative;
|
||||
var initializeModules = scope.initializeModules;
|
||||
if (useNative) {
|
||||
var nop = function() {};
|
||||
scope.watchShadow = nop;
|
||||
scope.upgrade = nop;
|
||||
scope.upgradeAll = nop;
|
||||
scope.upgradeDocumentTree = nop;
|
||||
scope.upgradeSubtree = nop;
|
||||
scope.takeRecords = nop;
|
||||
scope.instanceof = function(obj, base) {
|
||||
return obj instanceof base;
|
||||
};
|
||||
} else {
|
||||
initializeModules();
|
||||
}
|
||||
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
||||
if (!window.wrap) {
|
||||
if (window.ShadowDOMPolyfill) {
|
||||
window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
|
||||
window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
|
||||
} else {
|
||||
window.wrap = window.unwrap = function(node) {
|
||||
return node;
|
||||
};
|
||||
}
|
||||
}
|
||||
function bootstrap() {
|
||||
upgradeDocumentTree(wrap(document));
|
||||
if (window.HTMLImports) {
|
||||
HTMLImports.__importsParsingHook = function(elt) {
|
||||
upgradeDocumentTree(wrap(elt.import));
|
||||
};
|
||||
}
|
||||
CustomElements.ready = true;
|
||||
setTimeout(function() {
|
||||
CustomElements.readyTime = Date.now();
|
||||
if (window.HTMLImports) {
|
||||
CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
|
||||
}
|
||||
document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
||||
bubbles: true
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = function(inType, params) {
|
||||
params = params || {};
|
||||
var e = document.createEvent("CustomEvent");
|
||||
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
|
||||
return e;
|
||||
};
|
||||
window.CustomEvent.prototype = window.Event.prototype;
|
||||
}
|
||||
if (document.readyState === "complete" || scope.flags.eager) {
|
||||
bootstrap();
|
||||
} else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
|
||||
bootstrap();
|
||||
} else {
|
||||
var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
|
||||
window.addEventListener(loadEvent, bootstrap);
|
||||
}
|
||||
})(window.CustomElements);
|
||||
11
examples/EasyConn/bower_components/webcomponentsjs/CustomElements.min.js
vendored
Normal file
11
examples/EasyConn/bower_components/webcomponentsjs/CustomElements.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1055
examples/EasyConn/bower_components/webcomponentsjs/HTMLImports.js
vendored
Normal file
1055
examples/EasyConn/bower_components/webcomponentsjs/HTMLImports.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
examples/EasyConn/bower_components/webcomponentsjs/HTMLImports.min.js
vendored
Normal file
11
examples/EasyConn/bower_components/webcomponentsjs/HTMLImports.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
examples/EasyConn/bower_components/webcomponentsjs/README.md
vendored
Normal file
16
examples/EasyConn/bower_components/webcomponentsjs/README.md
vendored
Normal file
File diff suppressed because one or more lines are too long
4248
examples/EasyConn/bower_components/webcomponentsjs/ShadowDOM.js
vendored
Normal file
4248
examples/EasyConn/bower_components/webcomponentsjs/ShadowDOM.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13
examples/EasyConn/bower_components/webcomponentsjs/ShadowDOM.min.js
vendored
Normal file
13
examples/EasyConn/bower_components/webcomponentsjs/ShadowDOM.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
14
examples/EasyConn/bower_components/webcomponentsjs/bower.json
vendored
Normal file
14
examples/EasyConn/bower_components/webcomponentsjs/bower.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "webcomponentsjs",
|
||||
"main": "webcomponents.js",
|
||||
"version": "0.5.1",
|
||||
"homepage": "http://webcomponents.org",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"webcomponents"
|
||||
],
|
||||
"license": "BSD",
|
||||
"ignore": []
|
||||
}
|
||||
1692
examples/EasyConn/bower_components/webcomponentsjs/webcomponents-lite.js
vendored
Normal file
1692
examples/EasyConn/bower_components/webcomponentsjs/webcomponents-lite.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
examples/EasyConn/bower_components/webcomponentsjs/webcomponents-lite.min.js
vendored
Normal file
11
examples/EasyConn/bower_components/webcomponentsjs/webcomponents-lite.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6374
examples/EasyConn/bower_components/webcomponentsjs/webcomponents.js
vendored
Normal file
6374
examples/EasyConn/bower_components/webcomponentsjs/webcomponents.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14
examples/EasyConn/bower_components/webcomponentsjs/webcomponents.min.js
vendored
Normal file
14
examples/EasyConn/bower_components/webcomponentsjs/webcomponents.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
examples/EasyConn/index.html
Normal file
21
examples/EasyConn/index.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8 />
|
||||
<title>PeerJs Json Example</title>
|
||||
<script src="./bower_components/peerjs/peer.js"></script>
|
||||
<script src="../../build/browser/Frameworks/JsonFramework.js"></script>
|
||||
<script src="./bower_components/peerjs-connector/peerjs-connector.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1> PeerJs + Json Tutorial</h1>
|
||||
<p> Collaborative Json editing with <a href="https://github.com/DadaMonad/Yatta/">Yatta</a>
|
||||
and <a href="http://peerjs.com/">PeerJs</a> (WebRTC). </p>
|
||||
|
||||
|
||||
<p> <a href="https://github.com/DadaMonad/Yatta/">Yatta</a> is a Framework for Real-Time collaboration on arbitrary data structures.
|
||||
You can find the code for this example <a href="https://github.com/DadaMonad/Yatta/tree/master/examples/PeerJs-Json">here</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
6
examples/EasyConn/index.js
Normal file
6
examples/EasyConn/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var rid = Math.ceil(Math.random()*100 + 1);
|
||||
var conn = {key: 'h7nlefbgavh1tt9'};
|
||||
var connector = new PeerJsConnector(rid,conn);
|
||||
var yatta = new Y.JsonFramework(rid, connector)
|
||||
@@ -0,0 +1,74 @@
|
||||
## IWC + JSON Example
|
||||
Here, I will give a short overview on how to use the IwcJson Framework in Role-SDK widgets.
|
||||
First you have to include the following libraries in your widget file:
|
||||
```
|
||||
<script src="http://open-app.googlecode.com/files/openapp.js"></script>
|
||||
<script src="http://dbis.rwth-aachen.de/gadgets/iwc/lib/iwc.js"></script>
|
||||
<script src="http://dbis.rwth-aachen.de/~jahns/role-widgets/widgetbundles/libraries/DUIClient.js"></script>
|
||||
<script src="../../build/browser/Frameworks/JsonFramework.min.js"></script>
|
||||
<script src="../../build/browser/Connectors/IwcConnector.min.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
```
|
||||
A working widget implementation is [IwcJson.xml](./IwcJson.xml) and the js-file is [index.js](./index.js)
|
||||
|
||||
|
||||
```js
|
||||
function init(){
|
||||
Y.createIwcConnector(function(Connector, user_id){
|
||||
```
|
||||
|
||||
|
||||
yatta is the shared json object. If you change something on this object,
|
||||
it will be instantly shared with all the other collaborators.
|
||||
|
||||
|
||||
```js
|
||||
yatta = new Y.JsonYatta(user_id, Connector);
|
||||
```
|
||||
|
||||
|
||||
You may want to get the created DUI client (you must not create two DUI/IWC clients!!),
|
||||
or set an IwcHandler.
|
||||
|
||||
|
||||
```js
|
||||
var duiclient = yatta.getConnector().duiclient;
|
||||
function iwcHandler (intent) {
|
||||
console.log("Received intent: "+JSON.stringify(intent));
|
||||
}
|
||||
yatta.getConnector().setIwcHandler(iwcHandler);
|
||||
```
|
||||
|
||||
|
||||
Add a integer-property like this
|
||||
|
||||
|
||||
```js
|
||||
yatta.val('x', 7);
|
||||
```
|
||||
|
||||
|
||||
Get the value of property x like this
|
||||
|
||||
|
||||
```js
|
||||
console.log(yatta.val('x') === 7); // true
|
||||
```
|
||||
|
||||
|
||||
A string property can be either mutable or immutable.
|
||||
|
||||
|
||||
```js
|
||||
yatta.val('mutable_string', "text", "mutable");
|
||||
yatta.val('immutable_string', "text", "immutable");
|
||||
|
||||
console.log(yatta.val('immutable_string') === "text"); // true
|
||||
yatta.val('mutable_string').insertText(2,"XXX"); // position, string
|
||||
yatta.val('mutable_string').deleteText(0,1); // position, deletion length
|
||||
console.log(yatta.val('mutable_string').val() === "eXXXxt"); // true
|
||||
|
||||
})
|
||||
}
|
||||
window.onload = init
|
||||
```
|
||||
|
||||
@@ -32,7 +32,7 @@ For now, you can use my API key.
|
||||
|
||||
|
||||
```js
|
||||
// var conn = {key: 'h7nlefbgavh1tt9'};
|
||||
var conn = {key: 'h7nlefbgavh1tt9'};
|
||||
```
|
||||
|
||||
|
||||
@@ -42,13 +42,14 @@ or set up your own server.
|
||||
|
||||
|
||||
```js
|
||||
var conn = {
|
||||
/*var conn = {
|
||||
host: "terrific-peerjs.herokuapp.com",
|
||||
port: "", // this works because heroku can forward to the right port.
|
||||
// debug: true,
|
||||
};
|
||||
};*/
|
||||
var rid = Math.floor(Math.random()*100 + 1)
|
||||
|
||||
Y.createPeerJsConnector(conn, function(Connector, user_id){
|
||||
Y.createPeerJsConnector(rid, conn, function(Connector, user_id){
|
||||
|
||||
yatta = new Y.XmlFramework(user_id, Connector);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user