Polymer elements support bind, creation of new elements, overwrite with simple object, events

This commit is contained in:
DadaMonad 2014-12-26 13:36:45 +00:00
parent fd1128d456
commit 6790355232
84 changed files with 249 additions and 31221 deletions

View File

@ -25,6 +25,7 @@
"tests"
],
"dependencies": {
"peerjs": "~0.3.14"
"peerjs": "~0.3.14",
"polymer": "Polymer/polymer#~0.5.2"
}
}

View File

@ -19,22 +19,21 @@
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.5.1"
"polymer": "Polymer/polymer#~0.5.1",
"peerjs": "~0.3.14"
},
"homepage": "https://github.com/DadaMonad/Connector",
"_release": "35f8d81ce7",
"_release": "27a5fbf2af",
"_resolution": {
"type": "branch",
"branch": "master",
"commit": "35f8d81ce73ecac317b3dd7fabf32a871a4926a6"
"commit": "27a5fbf2af5c336df0dc4b27adbe43a0959bbdb1"
},
"_source": "git://github.com/DadaMonad/Connector.git",
"_target": "*",
"_originalSource": "DadaMonad/Connector",
"_direct": true
"_originalSource": "DadaMonad/Connector"
}

View File

@ -20,11 +20,11 @@
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.5.1"
"polymer": "Polymer/polymer#~0.5.1",
"peerjs": "~0.3.14"
}
}

View File

@ -14,7 +14,10 @@ class Connector
@receive_handlers = []
# A list of functions that are executed (left to right) when syncing with a peer.
@sync_process_order = []
getUniqueConnectionId: ->
@id # make sure, that every connector implementation does it like this
#
# Execute a function _when_ we are connected. If not connected, wait until connected.
# @param f {Function} Will be executed on the PeerJs-Connector context.

View File

@ -5,7 +5,7 @@ new Polymer 'peerjs-connector',
if this.is_initialized
throw new Error "You must not set the user_id twice!"
else
this.initializeConnection()
this.initializeConnection()
initializeConnection: ()->
if this.conn_id?
@ -22,8 +22,7 @@ new Polymer 'peerjs-connector',
writeIfAvailable 'debug', this.debug
this.is_initialized = true;
this.connector = new PeerJsConnector this.conn_id, options
ready: ()->
if this.conn_id != null
this.initializeConnection()

View File

@ -1,4 +1,3 @@
<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>
@ -6,5 +5,4 @@
<template>
</template>
<script src="./peerjs-connector-polymer.min.js"></script>
</polymer-element>

View File

@ -19,14 +19,14 @@
"tools": "Polymer/tools#master",
"web-component-tester": "Polymer/web-component-tester#^1.4.2"
},
"version": "0.5.1",
"_release": "0.5.1",
"version": "0.5.2",
"_release": "0.5.2",
"_resolution": {
"type": "version",
"tag": "0.5.1",
"commit": "c654b2b4996a643e79234ac624d7bc38179dfc2c"
"tag": "0.5.2",
"commit": "2a9ca53fa79ca09907e818f1adf806765409ec9c"
},
"_source": "git://github.com/Polymer/polymer.git",
"_target": "~0.5.1",
"_target": "^0.5.0",
"_originalSource": "Polymer/polymer"
}

View File

@ -8,11 +8,11 @@ For more detailed info goto [http://polymer-project.org/](http://polymer-project
Polymer is a new type of library for the web, designed to leverage the existing browser infrastructure to provide the encapsulation and extendability currently only available in JS libraries.
Polymer is based on a set of future technologies, including [Shadow DOM](https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html), [Custom Elements](https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html) and Model Driven Views. Currently these technologies are implemented as polyfills or shims, but as browsers adopt these features natively, the platform code that drives Polymer evacipates, leaving only the value-adds.
Polymer is based on a set of future technologies, including [Shadow DOM](http://w3c.github.io/webcomponents/spec/shadow/), [Custom Elements](http://w3c.github.io/webcomponents/spec/custom/) and Model Driven Views. Currently these technologies are implemented as polyfills or shims, but as browsers adopt these features natively, the platform code that drives Polymer evacipates, leaving only the value-adds.
## Tools & Testing
For running tests or building minified files, consult the [tooling information](http://polymer-project.org/resources/tooling-strategy.html).
For running tests or building minified files, consult the [tooling information](https://www.polymer-project.org/resources/tooling-strategy.html).
## Releases

View File

@ -19,5 +19,5 @@
"tools": "Polymer/tools#master",
"web-component-tester": "Polymer/web-component-tester#^1.4.2"
},
"version": "0.5.1"
"version": "0.5.2"
}

View File

@ -1,6 +1,6 @@
BUILD LOG
---------
Build Time: 2014-11-12T14:32:18
Build Time: 2014-12-11T12:46:30
NODEJS INFORMATION
==================
@ -11,16 +11,15 @@ 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
polymer-expressions: 197c3a0150e7a13374cfcc72e7066113723a623d
polymer-gestures: 17a6304916521be39409af292e8adf899bae0ce7
polymer: a74e9f36526361dccb6df91be439ff9c3e043f41
BUILD HASHES
============
dist/polymer.js: 59e0d3e669a3a1d163d8337766aa63bf809bfe79
dist/polymer.min.js: a9145f911c5b9fecc0d4aa422ac658d1d462d15a
dist/polymer.js: b9ad4c86af79c748cf4ea722f6d56671079fadf7
dist/polymer.min.js: 2f2021ba9682b0bb702ee7fb68fb6fbfd288eac2
dist/layout.html: 348d358a91712ecc2f8811efa430fcd954b4590c

View File

@ -939,7 +939,7 @@ window.PolymerGestures = {};
};
})(window.PolymerGestures);
(function (scope) {
(function(scope) {
var dispatcher = scope.dispatcher;
var pointermap = dispatcher.pointermap;
// radius around touchend that swallows mouse events
@ -948,10 +948,22 @@ window.PolymerGestures = {};
var WHICH_TO_BUTTONS = [0, 1, 4, 2];
var CURRENT_BUTTONS = 0;
var HAS_BUTTONS = false;
try {
HAS_BUTTONS = new MouseEvent('test', {buttons: 1}).buttons === 1;
} catch (e) {}
var FIREFOX_LINUX = /Linux.*Firefox\//i;
var HAS_BUTTONS = (function() {
// firefox on linux returns spec-incorrect values for mouseup.buttons
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.buttons#See_also
// https://codereview.chromium.org/727593003/#msg16
if (FIREFOX_LINUX.test(navigator.userAgent)) {
return false;
}
try {
return new MouseEvent('test', {buttons: 1}).buttons === 1;
} catch (e) {
return false;
}
})();
// handler block for native mouse events
var mouseEvents = {
@ -1273,7 +1285,7 @@ window.PolymerGestures = {};
d.forEach(function(p) {
this.cancel(p);
pointermap.delete(p.pointerId);
});
}, this);
}
},
touchstart: function(inEvent) {
@ -2047,7 +2059,9 @@ window.PolymerGestures = {};
'cancel'
],
exposes: [
'pinchstart',
'pinch',
'pinchend',
'rotate'
],
defaultActions: {
@ -2065,11 +2079,19 @@ window.PolymerGestures = {};
diameter: points.diameter,
target: scope.targetFinding.LCA(points.a.target, points.b.target)
};
this.firePinch('pinchstart', points.diameter, points);
}
},
up: function(inEvent) {
var p = pointermap.get(inEvent.pointerId);
var num = pointermap.pointers();
if (p) {
if (num === 2) {
// fire 'pinchend' before deleting pointer
var points = this.calcChord();
this.firePinch('pinchend', points.diameter, points);
}
pointermap.delete(inEvent.pointerId);
}
},
@ -2084,9 +2106,9 @@ window.PolymerGestures = {};
cancel: function(inEvent) {
this.up(inEvent);
},
firePinch: function(diameter, points) {
firePinch: function(type, diameter, points) {
var zoom = diameter / this.reference.diameter;
var e = eventFactory.makeGestureEvent('pinch', {
var e = eventFactory.makeGestureEvent(type, {
bubbles: true,
cancelable: true,
scale: zoom,
@ -2113,7 +2135,7 @@ window.PolymerGestures = {};
var diameter = points.diameter;
var angle = this.calcAngle(points);
if (diameter != this.reference.diameter) {
this.firePinch(diameter, points);
this.firePinch('pinch', diameter, points);
}
if (angle != this.reference.angle) {
this.fireRotate(angle, points);
@ -3258,7 +3280,7 @@ window.PolymerGestures = {};
},
setValue: function(model, newValue) {
if (this.path.length == 1);
if (this.path.length == 1)
model = findScope(model, this.path[0]);
return this.path.setValueFrom(model, newValue);
@ -8132,7 +8154,7 @@ head.insertBefore(style, head.firstChild);
/**
* Force any pending data changes to be observed before
* the next task. Data changes are processed asynchronously but are guaranteed
* to be processed, for example, before paintin. This method should rarely be
* to be processed, for example, before painting. This method should rarely be
* needed. It does nothing when Object.observe is available;
* when Object.observe is not available, Polymer automatically flushes data
* changes approximately every 1/10 second.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
```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)
```

View File

@ -1,19 +0,0 @@
{
"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"
}

View File

@ -1,6 +0,0 @@
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).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -1,9 +0,0 @@
{
"name": "core-component-page",
"private": true,
"dependencies": {
"webcomponentsjs": "Polymer/webcomponentsjs#^0.5.0",
"polymer": "Polymer/polymer#^0.5.0"
},
"version": "0.5.1"
}

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
<!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>

View File

@ -1,22 +0,0 @@
<!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>

View File

@ -1,41 +0,0 @@
{
"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
}

View File

@ -1,180 +0,0 @@
```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
```

View File

@ -1,30 +0,0 @@
{
"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"
}
}

View File

@ -1,35 +0,0 @@
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'])

View File

@ -1,29 +0,0 @@
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()

View File

@ -1,138 +0,0 @@
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

View File

@ -1,25 +0,0 @@
{
"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"
}
}

View File

@ -1,40 +0,0 @@
(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

View File

@ -1,10 +0,0 @@
<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>

View File

@ -1,177 +0,0 @@
(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

View File

@ -1 +0,0 @@
{"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"]}

File diff suppressed because one or more lines are too long

View File

@ -1,34 +0,0 @@
{
"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
}

File diff suppressed because one or more lines are too long

View File

@ -1,24 +0,0 @@
{
"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"
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,32 +0,0 @@
{
"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"
}

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
{
"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"
}

View File

@ -1,26 +0,0 @@
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

View File

@ -1,286 +0,0 @@
<!--
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>

View File

@ -1,12 +0,0 @@
<!--
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>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
{
"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"
}

View File

@ -1,931 +0,0 @@
/**
* @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);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,14 +0,0 @@
{
"name": "webcomponentsjs",
"main": "webcomponents.js",
"version": "0.5.1",
"homepage": "http://webcomponents.org",
"authors": [
"The Polymer Authors"
],
"keywords": [
"webcomponents"
],
"license": "BSD",
"ignore": []
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,21 +0,0 @@
<!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>

View File

@ -1,6 +0,0 @@
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)

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Video upload" description="Upload videos in Sevianno" author="Kevin Jahns, Chair of Computer Science 5, RWTH Aachen University, Germany" author_email="jahns@dbis.rwth-aachen.de" scrolling="true">
<Require feature="dynamic-height"/>
</ModulePrefs>
<Content type="html"><![CDATA[
<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>
<h1> Collaborative Json Widget </h1>
]]></Content>
</Module>

View File

@ -1,74 +0,0 @@
## 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
```

View File

@ -1,57 +0,0 @@
/**
## 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)
*/
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.
*/
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.
*/
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
*/
yatta.val('x', 7);
/**
Get the value of property x like this
*/
console.log(yatta.val('x') === 7); // true
/**
A string property can be either mutable or immutable.
*/
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

View File

@ -1,40 +0,0 @@
## 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){
```
You don't have to use the proposed user_id.
```js
// console.log("me is number 1");
// yatta = new JsonYatta(1, Connector);
```
Though, it is recommended to use the user_id
```js
yatta = new Y.JsonYatta(user_id, Connector);
})
}
window.onload = init
```

View File

@ -1,32 +0,0 @@
/**
## 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)
*/
function init(){
Y.createIwcConnector(function(Connector, user_id){
/**
You don't have to use the proposed user_id.
*/
// console.log("me is number 1");
// yatta = new JsonYatta(1, Connector);
/**
Though, it is recommended to use the user_id
*/
yatta = new Y.JsonYatta(user_id, Connector);
})
}
window.onload = init

View File

@ -1,26 +0,0 @@
/**
## 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)
*/
function init(){
Y.createIwcConnector(function(Connector, user_id){
/**
You don't have to use the proposed user_id.
*/
console.log("me is number 2")
yatta = new Y.JsonYatta(2, Connector);
})
}
window.onload = init

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Video upload" description="Upload videos in Sevianno" author="Kevin Jahns, Chair of Computer Science 5, RWTH Aachen University, Germany" author_email="jahns@dbis.rwth-aachen.de" scrolling="true">
<Require feature="dynamic-height"/>
</ModulePrefs>
<Content type="html"><![CDATA[
<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/Connectors/IwcConnector.min.js"></script>
<script src="../../build/browser/Frameworks/JsonFramework.min.js"></script>
<script src="./index1.js"></script>
<h1> Collaborative Json Widget 1</h1>
]]></Content>
</Module>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Video upload" description="Upload videos in Sevianno" author="Kevin Jahns, Chair of Computer Science 5, RWTH Aachen University, Germany" author_email="jahns@dbis.rwth-aachen.de" scrolling="true">
<Require feature="dynamic-height"/>
</ModulePrefs>
<Content type="html"><![CDATA[
<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/Connectors/IwcConnector.min.js"></script>
<script src="../../build/browser/Frameworks/JsonFramework.min.js"></script>
<script src="./index2.js"></script>
<h1> Collaborative Json Widget 2</h1>
]]></Content>
</Module>

View File

@ -5,15 +5,14 @@
<title>PeerJs Json Example</title>
<script src="../../bower_components/peerjs/peer.js"></script>
<script src="../../bower_components/connector/peerjs-connector/peerjs-connector.js"></script>
<script src="../../bower_components/connector/test-connector/test-connector.js"></script>
<script src="../../build/browser/yatta.js"></script>
<script src="../../yatta.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>

View File

@ -3,9 +3,9 @@
<head>
<meta charset=utf-8 />
<title>PeerJs Json Example</title>
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script src="../../build/browser/Frameworks/TextFramework.js"></script>
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
<script src="../../bower_components/peerjs/peer.js"></script>
<script src="../../bower_components/connector/peerjs-connector/peerjs-connector.js"></script>
<script src="../../build/browser/yatta.js"></script>
<script src="./index.js"></script>
</head>
<body>

View File

@ -11,14 +11,15 @@
First you have to include the following libraries in your html file:
```
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script src="../../build/browser/Frameworks/TextFramework.js"></script>
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
<script src="../../bower_components/peerjs/peer.js"></script>
<script src="../../bower_components/connector/peerjs-connector/peerjs-connector.js"></script>
<script src="../../yatta.js"></script>
<script src="./index.js"></script>
```
Open [index.html](./index.html) in order to start collaboration.
*/
var yatta;
var connector;
function init(){
/**
@ -30,25 +31,26 @@ function init(){
This will connect to the server owned by the peerjs team.
For now, you can use my API key.
*/
// var conn = {key: 'h7nlefbgavh1tt9'};
var options = {key: 'h7nlefbgavh1tt9'};
/**
This will connect to one of my peerjs instances.
I can't guaranty that this will be always up. This is why you should use the previous method with the api key,
or set up your own server.
*/
var conn = {
/*var options = {
host: "terrific-peerjs.herokuapp.com",
port: "", // this works because heroku can forward to the right port.
// debug: true,
};
Y.createPeerJsConnector(conn, function(Connector, user_id){
};*/
var user_id = Math.ceil(Math.random()*1000);
connector = new PeerJsConnector(user_id, options);
/**
TextFramework is a shared text object. If you change something on this object,
it will be instantaneously shared with all the other collaborators.
*/
yatta = new Y.TextFramework(user_id, Connector);
yatta = new Yatta(connector);
yatta.val()
/**
Get the url of this frame. If it has a url-encoded parameter
@ -68,7 +70,7 @@ function init(){
Connect to other peer.
*/
if (peer_id.length > 0){
yatta.connector.connectToPeer(peer_id);
yatta.connector.join(peer_id);
}
/**
@ -77,7 +79,14 @@ function init(){
The .bind property is a method of the Word class. You can also use it with all the other Frameworks in Yatta (e.g. Json).
*/
var textbox = document.getElementById("textfield");
yatta.bind(textbox);
});
function textbind(){
yatta.val("textbox").bind(textbox);
}
if(peer_id.length > 0){
connector.whenSynced([textbind]);
} else {
yatta.val("textbox",textbox.value)
textbind()
}
}
window.onload = init

View File

@ -1,92 +0,0 @@
## PeerJs + JSON Example
Here, I will give a short overview on how to enable collaborative json with the
[PeerJs](http://peerjs.com/) Connector and the Json Framework. Open
[index.html](http://dadamonad.github.io/Yatta/examples/PeerJs-Json/index.html) in your Browser and
use the console to explore Yatta!
[PeerJs](http://peerjs.com) is a Framework that enables you to connect to other peers. You just need the
user-id of the peer (browser/client). And then you can connect to it.
First you have to include the following libraries in your html file:
```
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script src="../../build/browser/Frameworks/JsonFramework.js"></script>
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
<script src="./index.js"></script>
```
### Create Connector
The PeerJs Framework requires an API key, or you need to set up your own PeerJs server.
Get an API key from the [Website](http://peerjs.com/peerserver).
The first parameter of `createPeerJsConnector` is forwarded as the options object in PeerJs.
Therefore, you may also specify the server/port here, if you have set up your own server.
```js
var yatta, yattaHandler;
```
This will connect to the server owned by the peerjs team.
For now, you can use my API key.
```js
// var conn = {key: 'h7nlefbgavh1tt9'};
```
This will connect to one of my peerjs instances.
I can't guaranty that this will be always up. This is why you should use the previous method with the api key,
or set up your own server.
```js
var conn = {
host: "terrific-peerjs.herokuapp.com",
port: "", // this works because heroku can forward to the right port.
// debug: true
};
Y.createPeerJsConnector(conn, function(Connector, user_id){
```
You can also specify your own user_id with peerjs.
But then you have to make sure that no other client associated to your API-key has the same user_id.
```
Y.createPeerJsConnector("unique_id", conn, function(Connector, user_id){
```
### Yatta
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.JsonFramework(user_id, Connector);
console.log(yatta.getUserId());
function show(o){
if (o.type === "JsonType"){
return JSON.stringify(o.toJson());
} else if (o.type === "WordType") {
return o.val();
} else if (o.constructor === {}.constructor) { // It's an Object
return JSON.stringify(o);
} else { // It's a primitive data type (E.g. string, int)
return o;
}
}
function addProperty(event_name, property_name, op){
// op is the operation that changed the objects value. In addProperty it is most likely to be a 'Replaceable' (see doc).
console.log("Property '" + property_name + "' was created by '"+op.creator+"'!");
console.log("Value: " + show(this.val(property_name))); // 'this' is the object on which the property was created.
};
yatta.on('addProperty', addProperty);
});
```

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>PeerJs Json Example</title>
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script src="../../build/browser/Frameworks/JsonFramework.js"></script>
<script src="../../build/browser/Connectors/PeerJsConnector.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>

View File

@ -1,83 +0,0 @@
/**
## PeerJs + JSON Example
Here, I will give a short overview on how to enable collaborative json with the
[PeerJs](http://peerjs.com/) Connector and the Json Framework. Open
[index.html](http://dadamonad.github.io/Yatta/examples/PeerJs-Json/index.html) in your Browser and
use the console to explore Yatta!
[PeerJs](http://peerjs.com) is a Framework that enables you to connect to other peers. You just need the
user-id of the peer (browser/client). And then you can connect to it.
First you have to include the following libraries in your html file:
```
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script src="../../build/browser/Frameworks/JsonFramework.js"></script>
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
<script src="./index.js"></script>
```
### Create Connector
The PeerJs Framework requires an API key, or you need to set up your own PeerJs server.
Get an API key from the [Website](http://peerjs.com/peerserver).
The first parameter of `createPeerJsConnector` is forwarded as the options object in PeerJs.
Therefore, you may also specify the server/port here, if you have set up your own server.
*/
var yatta, yattaHandler;
/**
This will connect to the server owned by the peerjs team.
For now, you can use my API key.
*/
// var conn = {key: 'h7nlefbgavh1tt9'};
/**
This will connect to one of my peerjs instances.
I can't guaranty that this will be always up. This is why you should use the previous method with the api key,
or set up your own server.
*/
var conn = {
host: "terrific-peerjs.herokuapp.com",
port: "", // this works because heroku can forward to the right port.
// debug: true
};
Y.createPeerJsConnector(conn, function(Connector, user_id){
/**
You can also specify your own user_id with peerjs.
But then you have to make sure that no other client associated to your API-key has the same user_id.
```
Y.createPeerJsConnector("unique_id", conn, function(Connector, user_id){
```
*/
/**
### Yatta
yatta is the shared json object. If you change something on this object,
it will be instantly shared with all the other collaborators.
*/
yatta = new Y.JsonFramework(user_id, Connector);
console.log(yatta.getUserId());
function show(o){
if (o.type === "JsonType"){
return JSON.stringify(o.toJson());
} else if (o.type === "WordType") {
return o.val();
} else if (o.constructor === {}.constructor) { // It's an Object
return JSON.stringify(o);
} else { // It's a primitive data type (E.g. string, int)
return o;
}
}
function addProperty(event_name, property_name, op){
// op is the operation that changed the objects value. In addProperty it is most likely to be a 'Replaceable' (see doc).
console.log("Property '" + property_name + "' was created by '"+op.creator+"'!");
console.log("Value: " + show(this.val(property_name))); // 'this' is the object on which the property was created.
};
yatta.on('addProperty', addProperty);
});

View File

@ -25,7 +25,7 @@ gulp.task 'default', ['deploy']
files =
lib : ['./lib/**/*.coffee']
build : ['./build/**']
browser : './lib/Yatta.coffee'
browser : ['./lib/yatta.coffee','./lib/yatta-element.coffee']
#test : ['./test/**/*_test.coffee']
test : ['./test/JsonYatta_test.coffee', './test/TextYatta_test.coffee']
gulp : ['./gulpfile.coffee']
@ -55,7 +55,6 @@ gulp.task 'build_browser', ->
extensions: ['.coffee']
debug : true
.pipe rename
basename: "yatta"
extname: ".js"
.pipe gulp.dest './build/browser/'
.pipe uglify()

View File

@ -52,7 +52,7 @@ module.exports = (HB)->
for name,o of @map
if not o.isContentDeleted()
obj = o.val()
if obj instanceof types.ImmutableObject or obj instanceof MapManager
if obj instanceof types.ImmutableObject # or obj instanceof MapManager TODO: do you want deep json?
obj = obj.val()
result[name] = obj
result

View File

@ -206,34 +206,34 @@ module.exports = (HB)->
word = @
textfield.value = @val()
@on "insert", (event, op)->
o_pos = op.getPosition()
fix = (cursor)->
if cursor <= o_pos
cursor
else
cursor += 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
@observe (events)->
for event in events
if event.type is "insert"
o_pos = event.position
fix = (cursor)->
if cursor <= o_pos
cursor
else
cursor += 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
textfield.value = word.val()
textfield.setSelectionRange left, right
textfield.value = word.val()
textfield.setSelectionRange left, right
else if event.type is "delete"
o_pos = event.position
fix = (cursor)->
if cursor < o_pos
cursor
else
cursor -= 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
@on "delete", (event, op)->
o_pos = op.getPosition()
fix = (cursor)->
if cursor < o_pos
cursor
else
cursor -= 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
textfield.value = word.val()
textfield.setSelectionRange left, right
textfield.value = word.val()
textfield.setSelectionRange left, right
# consume all text-insert changes.
textfield.onkeypress = (event)->

View File

@ -1,41 +0,0 @@
json_types_uninitialized = require "./Types/JsonTypes"
HistoryBuffer = require "./HistoryBuffer"
Engine = require "./Engine"
adaptConnector = require "./ConnectorAdapter"
createYatta = (connector)->
user_id = connector.id # TODO: change to getUniqueId()
HB = new HistoryBuffer user_id
type_manager = json_types_uninitialized HB
types = type_manager.types
#
# Framework for Json data-structures.
# Known values that are supported:
# * String
# * Integer
# * Array
#
class Yatta extends types.JsonType
#
# @param {String} user_id Unique id of the peer.
# @param {Connector} Connector the connector class.
#
constructor: ()->
@connector = connector
@HB = HB
@types = types
@engine = new Engine @HB, type_manager.parser
adaptConnector @connector, @engine, @HB, type_manager.execution_listener
super
getConnector: ()->
@connector
return new Yatta(HB.getReservedUniqueIdentifier()).execute()
module.exports = createYatta
if window? and not window.Yatta?
window.Yatta = createYatta

View File

@ -8,7 +8,7 @@ _ = require("underscore")
chai.use(sinonChai)
Connector = require "../bower_components/connector/lib/test-connector/test-connector.coffee"
Yatta = require "../lib/Yatta.coffee"
Yatta = require "../lib/yatta.coffee"
Test = require "./TestSuite"

View File

@ -7,7 +7,7 @@ _ = require("underscore")
chai.use(sinonChai)
Yatta = require "../lib/Yatta"
Yatta = require "../lib/yatta"
Connector = require "../bower_components/connector/lib/test-connector/test-connector.coffee"
Test = require "./TestSuite"

File diff suppressed because one or more lines are too long