making sync more efficient. using new connector features. found lots of small bugs
This commit is contained in:
+3
-2
@@ -26,7 +26,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"peerjs": "~0.3.14",
|
||||
"polymer": "Polymer/polymer#~0.5.2",
|
||||
"paper-slider": "Polymer/paper-slider#~0.5.2"
|
||||
"polymer": "~0.5.2",
|
||||
"paper-slider": "Polymer/paper-slider#~0.5.2",
|
||||
"webcomponentsjs": "~0.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "webcomponentsjs",
|
||||
"main": "webcomponents.js",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"homepage": "http://webcomponents.org",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
@@ -11,13 +11,14 @@
|
||||
],
|
||||
"license": "BSD",
|
||||
"ignore": [],
|
||||
"_release": "0.5.1",
|
||||
"_release": "0.5.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.1",
|
||||
"commit": "89c466eb29642c3e5ba2594e9330eb62ade1dbab"
|
||||
"tag": "0.5.2",
|
||||
"commit": "4f469f65d3fa3c03a44326d138331003fa340337"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/webcomponentsjs.git",
|
||||
"_target": "^0.5.0",
|
||||
"_originalSource": "Polymer/webcomponentsjs"
|
||||
"_target": "~0.5.2",
|
||||
"_originalSource": "webcomponentsjs",
|
||||
"_direct": true
|
||||
}
|
||||
+4
-3
@@ -7,7 +7,7 @@
|
||||
* 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
|
||||
// @version 0.5.1-1
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
@@ -47,7 +47,7 @@ if (typeof WeakMap === "undefined") {
|
||||
(function(global) {
|
||||
var registrationsTable = new WeakMap();
|
||||
var setImmediate;
|
||||
if (/Trident/.test(navigator.userAgent)) {
|
||||
if (/Trident|Edge/.test(navigator.userAgent)) {
|
||||
setImmediate = setTimeout;
|
||||
} else if (window.setImmediate) {
|
||||
setImmediate = window.setImmediate;
|
||||
@@ -868,6 +868,7 @@ CustomElements.addModule(function(scope) {
|
||||
(function(scope) {
|
||||
var useNative = scope.useNative;
|
||||
var initializeModules = scope.initializeModules;
|
||||
var isIE11OrOlder = /Trident/.test(navigator.userAgent);
|
||||
if (useNative) {
|
||||
var nop = function() {};
|
||||
scope.watchShadow = nop;
|
||||
@@ -911,7 +912,7 @@ CustomElements.addModule(function(scope) {
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (typeof window.CustomEvent !== "function") {
|
||||
if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = function(inType, params) {
|
||||
params = params || {};
|
||||
var e = document.createEvent("CustomEvent");
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+15
-15
@@ -7,7 +7,7 @@
|
||||
* 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
|
||||
// @version 0.5.1-1
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
@@ -47,7 +47,7 @@ if (typeof WeakMap === "undefined") {
|
||||
(function(global) {
|
||||
var registrationsTable = new WeakMap();
|
||||
var setImmediate;
|
||||
if (/Trident/.test(navigator.userAgent)) {
|
||||
if (/Trident|Edge/.test(navigator.userAgent)) {
|
||||
setImmediate = setTimeout;
|
||||
} else if (window.setImmediate) {
|
||||
setImmediate = window.setImmediate;
|
||||
@@ -365,7 +365,7 @@ window.HTMLImports = window.HTMLImports || {
|
||||
};
|
||||
Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
|
||||
Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
|
||||
var isIE = /Trident/.test(navigator.userAgent);
|
||||
var isIE = /Trident|Edge/.test(navigator.userAgent);
|
||||
function whenReady(callback, doc) {
|
||||
doc = doc || rootDocument;
|
||||
whenDocumentReady(function() {
|
||||
@@ -787,12 +787,7 @@ HTMLImports.addModule(function(scope) {
|
||||
},
|
||||
addElementToDocument: function(elt) {
|
||||
var port = this.rootImportForElement(elt.__importElement || elt);
|
||||
var l = port.__insertedElements = port.__insertedElements || 0;
|
||||
var refNode = port.nextElementSibling;
|
||||
for (var i = 0; i < l; i++) {
|
||||
refNode = refNode && refNode.nextElementSibling;
|
||||
}
|
||||
port.parentNode.insertBefore(elt, refNode);
|
||||
port.parentNode.insertBefore(elt, port);
|
||||
},
|
||||
trackElement: function(elt, callback) {
|
||||
var self = this;
|
||||
@@ -972,7 +967,9 @@ HTMLImports.addModule(function(scope) {
|
||||
var base = doc.createElement("base");
|
||||
base.setAttribute("href", url);
|
||||
if (!doc.baseURI) {
|
||||
doc.baseURI = url;
|
||||
Object.defineProperty(doc, "baseURI", {
|
||||
value: url
|
||||
});
|
||||
}
|
||||
var meta = doc.createElement("meta");
|
||||
meta.setAttribute("charset", "utf-8");
|
||||
@@ -1031,16 +1028,19 @@ HTMLImports.addModule(function(scope) {
|
||||
});
|
||||
|
||||
(function(scope) {
|
||||
initializeModules = scope.initializeModules;
|
||||
var initializeModules = scope.initializeModules;
|
||||
var isIE = scope.isIE;
|
||||
if (scope.useNative) {
|
||||
return;
|
||||
}
|
||||
if (typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = function(inType, dictionary) {
|
||||
var e = document.createEvent("HTMLEvents");
|
||||
e.initEvent(inType, dictionary.bubbles === false ? false : true, dictionary.cancelable === false ? false : true, dictionary.detail);
|
||||
if (isIE && 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;
|
||||
}
|
||||
initializeModules();
|
||||
var rootDocument = scope.rootDocument;
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+8
-2
@@ -1,7 +1,7 @@
|
||||
webcomponents.js
|
||||
================
|
||||
|
||||
A suite of polyfills supporting the HTML web components specs:
|
||||
A suite of polyfills supporting the [Web Components](http://webcomponents.org) specs:
|
||||
|
||||
**Custom Elements**: allows authors to define their own custom tags ([spec](https://w3c.github.io/webcomponents/spec/custom/)).
|
||||
|
||||
@@ -14,7 +14,7 @@ This also folds in polyfills for `MutationObserver` and `WeakMap`.
|
||||
|
||||
## Releases
|
||||
|
||||
Pre-built (concatenated & minified) versions of the polyfills are maintained in the [tagged versions](https://github.com/Polymer/webcomponentsjs/releases) of this repo. There are two variants:
|
||||
Pre-built (concatenated & minified) versions of the polyfills are maintained in the [tagged versions](https://github.com/webcomponents/webcomponentsjs/releases) of this repo. There are two variants:
|
||||
|
||||
`webcomponents.js` includes all of the polyfills.
|
||||
|
||||
@@ -36,3 +36,9 @@ Now you are ready to build the polyfills with:
|
||||
gulp build
|
||||
|
||||
The builds will be placed into the `dist/` directory.
|
||||
|
||||
## Contribute
|
||||
|
||||
See the [contributing guide](CONTRIBUTING.md)
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
* 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
|
||||
// @version 0.5.1-1
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
@@ -1726,7 +1726,7 @@ window.ShadowDOMPolyfill = {};
|
||||
var originalInsertBefore = OriginalNode.prototype.insertBefore;
|
||||
var originalRemoveChild = OriginalNode.prototype.removeChild;
|
||||
var originalReplaceChild = OriginalNode.prototype.replaceChild;
|
||||
var isIe = /Trident/.test(navigator.userAgent);
|
||||
var isIe = /Trident|Edge/.test(navigator.userAgent);
|
||||
var removeChildOriginalHelper = isIe ? function(parent, child) {
|
||||
try {
|
||||
originalRemoveChild.call(parent, child);
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "webcomponentsjs",
|
||||
"main": "webcomponents.js",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"homepage": "http://webcomponents.org",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
BUILD LOG
|
||||
---------
|
||||
Build Time: 2014-12-11T12:45:39-0800
|
||||
|
||||
NODEJS INFORMATION
|
||||
==================
|
||||
nodejs: v0.10.33
|
||||
gulp: 3.8.10
|
||||
gulp-audit: 1.0.0
|
||||
gulp-concat: 2.4.2
|
||||
gulp-header: 1.2.2
|
||||
gulp-uglify: 1.0.2
|
||||
run-sequence: 1.0.2
|
||||
web-component-tester: 2.0.1
|
||||
|
||||
REPO REVISIONS
|
||||
==============
|
||||
webcomponentsjs: d83cc676df65dc61db22bca47d33da679391f5a0
|
||||
|
||||
BUILD HASHES
|
||||
============
|
||||
CustomElements.js: b221f7741515b570df70fd1c50b398bb8f731b81
|
||||
CustomElements.min.js: 6a55999d9f4895525d35c5248e2f409f176162a6
|
||||
HTMLImports.js: 72dd4ea891dc3c5256c569992288eca9f5c5e450
|
||||
HTMLImports.min.js: 1677819e83722c7d163a571598d8d36cdc8ae690
|
||||
ShadowDOM.js: a1cce2304031d5acb440978761b346b98d06e1a4
|
||||
ShadowDOM.min.js: 9371908d889872eb7e8e320e8877c394eb906732
|
||||
webcomponents-lite.js: 7b6c8fbd7f67a2bd04b797a72e808b16ab54518f
|
||||
webcomponents-lite.min.js: 41b033fa7e52bf612686f222d5a496d48bd2909c
|
||||
webcomponents.js: 523f45c65c94d71543729f7e3d32ec4b7a48ae5b
|
||||
webcomponents.min.js: 645b22d4c22bf6eaf470bc03d819d396661ac439
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "webcomponents.js",
|
||||
"version": "0.5.1-1",
|
||||
"description": "webcomponents.js",
|
||||
"main": "gulpfile.js",
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webcomponents/webcomponentsjs.git"
|
||||
},
|
||||
"author": "The Polymer Authors",
|
||||
"license": {
|
||||
"type": "BSD-3-Clause",
|
||||
"url": "http://polymer.github.io/LICENSE.txt"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/webcomponents/webcomponentsjs/issues"
|
||||
},
|
||||
"homepage": "http://webcomponents.org",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.8.8",
|
||||
"gulp-audit": "^1.0.0",
|
||||
"gulp-concat": "^2.4.1",
|
||||
"gulp-header": "^1.1.1",
|
||||
"gulp-uglify": "^1.0.1",
|
||||
"run-sequence": "^1.0.1",
|
||||
"web-component-tester": "*"
|
||||
}
|
||||
}
|
||||
+43
-16
@@ -7,7 +7,7 @@
|
||||
* 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
|
||||
// @version 0.5.1-1
|
||||
window.WebComponents = window.WebComponents || {};
|
||||
|
||||
(function(scope) {
|
||||
@@ -91,7 +91,7 @@ if (typeof WeakMap === "undefined") {
|
||||
(function(global) {
|
||||
var registrationsTable = new WeakMap();
|
||||
var setImmediate;
|
||||
if (/Trident/.test(navigator.userAgent)) {
|
||||
if (/Trident|Edge/.test(navigator.userAgent)) {
|
||||
setImmediate = setTimeout;
|
||||
} else if (window.setImmediate) {
|
||||
setImmediate = window.setImmediate;
|
||||
@@ -409,7 +409,7 @@ window.HTMLImports = window.HTMLImports || {
|
||||
};
|
||||
Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
|
||||
Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
|
||||
var isIE = /Trident/.test(navigator.userAgent);
|
||||
var isIE = /Trident|Edge/.test(navigator.userAgent);
|
||||
function whenReady(callback, doc) {
|
||||
doc = doc || rootDocument;
|
||||
whenDocumentReady(function() {
|
||||
@@ -831,12 +831,7 @@ HTMLImports.addModule(function(scope) {
|
||||
},
|
||||
addElementToDocument: function(elt) {
|
||||
var port = this.rootImportForElement(elt.__importElement || elt);
|
||||
var l = port.__insertedElements = port.__insertedElements || 0;
|
||||
var refNode = port.nextElementSibling;
|
||||
for (var i = 0; i < l; i++) {
|
||||
refNode = refNode && refNode.nextElementSibling;
|
||||
}
|
||||
port.parentNode.insertBefore(elt, refNode);
|
||||
port.parentNode.insertBefore(elt, port);
|
||||
},
|
||||
trackElement: function(elt, callback) {
|
||||
var self = this;
|
||||
@@ -1016,7 +1011,9 @@ HTMLImports.addModule(function(scope) {
|
||||
var base = doc.createElement("base");
|
||||
base.setAttribute("href", url);
|
||||
if (!doc.baseURI) {
|
||||
doc.baseURI = url;
|
||||
Object.defineProperty(doc, "baseURI", {
|
||||
value: url
|
||||
});
|
||||
}
|
||||
var meta = doc.createElement("meta");
|
||||
meta.setAttribute("charset", "utf-8");
|
||||
@@ -1075,16 +1072,19 @@ HTMLImports.addModule(function(scope) {
|
||||
});
|
||||
|
||||
(function(scope) {
|
||||
initializeModules = scope.initializeModules;
|
||||
var initializeModules = scope.initializeModules;
|
||||
var isIE = scope.isIE;
|
||||
if (scope.useNative) {
|
||||
return;
|
||||
}
|
||||
if (typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = function(inType, dictionary) {
|
||||
var e = document.createEvent("HTMLEvents");
|
||||
e.initEvent(inType, dictionary.bubbles === false ? false : true, dictionary.cancelable === false ? false : true, dictionary.detail);
|
||||
if (isIE && 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;
|
||||
}
|
||||
initializeModules();
|
||||
var rootDocument = scope.rootDocument;
|
||||
@@ -1622,6 +1622,7 @@ CustomElements.addModule(function(scope) {
|
||||
(function(scope) {
|
||||
var useNative = scope.useNative;
|
||||
var initializeModules = scope.initializeModules;
|
||||
var isIE11OrOlder = /Trident/.test(navigator.userAgent);
|
||||
if (useNative) {
|
||||
var nop = function() {};
|
||||
scope.watchShadow = nop;
|
||||
@@ -1665,7 +1666,7 @@ CustomElements.addModule(function(scope) {
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (typeof window.CustomEvent !== "function") {
|
||||
if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = function(inType, params) {
|
||||
params = params || {};
|
||||
var e = document.createEvent("CustomEvent");
|
||||
@@ -1684,6 +1685,32 @@ CustomElements.addModule(function(scope) {
|
||||
}
|
||||
})(window.CustomElements);
|
||||
|
||||
if (typeof HTMLTemplateElement === "undefined") {
|
||||
(function() {
|
||||
var TEMPLATE_TAG = "template";
|
||||
HTMLTemplateElement = function() {};
|
||||
HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
|
||||
HTMLTemplateElement.decorate = function(template) {
|
||||
if (!template.content) {
|
||||
template.content = template.ownerDocument.createDocumentFragment();
|
||||
var child;
|
||||
while (child = template.firstChild) {
|
||||
template.content.appendChild(child);
|
||||
}
|
||||
}
|
||||
};
|
||||
HTMLTemplateElement.bootstrap = function(doc) {
|
||||
var templates = doc.querySelectorAll(TEMPLATE_TAG);
|
||||
for (var i = 0, l = templates.length, t; i < l && (t = templates[i]); i++) {
|
||||
HTMLTemplateElement.decorate(t);
|
||||
}
|
||||
};
|
||||
addEventListener("DOMContentLoaded", function() {
|
||||
HTMLTemplateElement.bootstrap(document);
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
||||
(function(scope) {
|
||||
var style = document.createElement("style");
|
||||
style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
|
||||
|
||||
File diff suppressed because one or more lines are too long
+18
-17
@@ -7,7 +7,7 @@
|
||||
* 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
|
||||
// @version 0.5.1-1
|
||||
window.WebComponents = window.WebComponents || {};
|
||||
|
||||
(function(scope) {
|
||||
@@ -1760,7 +1760,7 @@ if (WebComponents.flags.shadow) {
|
||||
var originalInsertBefore = OriginalNode.prototype.insertBefore;
|
||||
var originalRemoveChild = OriginalNode.prototype.removeChild;
|
||||
var originalReplaceChild = OriginalNode.prototype.replaceChild;
|
||||
var isIe = /Trident/.test(navigator.userAgent);
|
||||
var isIe = /Trident|Edge/.test(navigator.userAgent);
|
||||
var removeChildOriginalHelper = isIe ? function(parent, child) {
|
||||
try {
|
||||
originalRemoveChild.call(parent, child);
|
||||
@@ -4695,7 +4695,7 @@ if (WebComponents.flags.shadow) {
|
||||
(function(global) {
|
||||
var registrationsTable = new WeakMap();
|
||||
var setImmediate;
|
||||
if (/Trident/.test(navigator.userAgent)) {
|
||||
if (/Trident|Edge/.test(navigator.userAgent)) {
|
||||
setImmediate = setTimeout;
|
||||
} else if (window.setImmediate) {
|
||||
setImmediate = window.setImmediate;
|
||||
@@ -5013,7 +5013,7 @@ window.HTMLImports = window.HTMLImports || {
|
||||
};
|
||||
Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
|
||||
Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
|
||||
var isIE = /Trident/.test(navigator.userAgent);
|
||||
var isIE = /Trident|Edge/.test(navigator.userAgent);
|
||||
function whenReady(callback, doc) {
|
||||
doc = doc || rootDocument;
|
||||
whenDocumentReady(function() {
|
||||
@@ -5435,12 +5435,7 @@ HTMLImports.addModule(function(scope) {
|
||||
},
|
||||
addElementToDocument: function(elt) {
|
||||
var port = this.rootImportForElement(elt.__importElement || elt);
|
||||
var l = port.__insertedElements = port.__insertedElements || 0;
|
||||
var refNode = port.nextElementSibling;
|
||||
for (var i = 0; i < l; i++) {
|
||||
refNode = refNode && refNode.nextElementSibling;
|
||||
}
|
||||
port.parentNode.insertBefore(elt, refNode);
|
||||
port.parentNode.insertBefore(elt, port);
|
||||
},
|
||||
trackElement: function(elt, callback) {
|
||||
var self = this;
|
||||
@@ -5620,7 +5615,9 @@ HTMLImports.addModule(function(scope) {
|
||||
var base = doc.createElement("base");
|
||||
base.setAttribute("href", url);
|
||||
if (!doc.baseURI) {
|
||||
doc.baseURI = url;
|
||||
Object.defineProperty(doc, "baseURI", {
|
||||
value: url
|
||||
});
|
||||
}
|
||||
var meta = doc.createElement("meta");
|
||||
meta.setAttribute("charset", "utf-8");
|
||||
@@ -5679,16 +5676,19 @@ HTMLImports.addModule(function(scope) {
|
||||
});
|
||||
|
||||
(function(scope) {
|
||||
initializeModules = scope.initializeModules;
|
||||
var initializeModules = scope.initializeModules;
|
||||
var isIE = scope.isIE;
|
||||
if (scope.useNative) {
|
||||
return;
|
||||
}
|
||||
if (typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = function(inType, dictionary) {
|
||||
var e = document.createEvent("HTMLEvents");
|
||||
e.initEvent(inType, dictionary.bubbles === false ? false : true, dictionary.cancelable === false ? false : true, dictionary.detail);
|
||||
if (isIE && 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;
|
||||
}
|
||||
initializeModules();
|
||||
var rootDocument = scope.rootDocument;
|
||||
@@ -6226,6 +6226,7 @@ CustomElements.addModule(function(scope) {
|
||||
(function(scope) {
|
||||
var useNative = scope.useNative;
|
||||
var initializeModules = scope.initializeModules;
|
||||
var isIE11OrOlder = /Trident/.test(navigator.userAgent);
|
||||
if (useNative) {
|
||||
var nop = function() {};
|
||||
scope.watchShadow = nop;
|
||||
@@ -6269,7 +6270,7 @@ CustomElements.addModule(function(scope) {
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (typeof window.CustomEvent !== "function") {
|
||||
if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
|
||||
window.CustomEvent = function(inType, params) {
|
||||
params = params || {};
|
||||
var e = document.createEvent("CustomEvent");
|
||||
|
||||
+5
-5
File diff suppressed because one or more lines are too long
+106
-78
File diff suppressed because one or more lines are too long
+106
-78
File diff suppressed because one or more lines are too long
+106
-78
File diff suppressed because one or more lines are too long
+106
-78
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
|
||||
window.onload = function(){
|
||||
window.x = document.querySelector("yatta-test");
|
||||
x.yatta.val("stuff",{otherstuff:{nostuff:"this is no stuff"}})
|
||||
x.yatta.val("stuff",{otherstuff:{nostuff:"this is no stuff"}});
|
||||
setTimeout(function(){
|
||||
var res = x.yatta.val("stuff");
|
||||
if(!(x.nostuff.val() === "this is no stuff")){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
setTimeout(function(){
|
||||
window.x = document.querySelector("yatta-test");
|
||||
// x.yatta.HB.stopGarbageCollection();
|
||||
x.yatta.val("stuff",{otherstuff:{nostuff:"this is no stuff"}})
|
||||
setTimeout(function(){
|
||||
var res = x.yatta.val("stuff");
|
||||
|
||||
+27
-12
@@ -11,23 +11,38 @@ adaptConnector = (connector, engine, HB, execution_listener)->
|
||||
connector.broadcast o
|
||||
|
||||
execution_listener.push send_
|
||||
# For the XMPPConnector: lets send it as an array
|
||||
# therefore, we have to restructure it later
|
||||
encode_state_vector = (v)->
|
||||
for name,value of v
|
||||
user: name
|
||||
state: value
|
||||
parse_state_vector = (v)->
|
||||
state_vector = {}
|
||||
for s in v
|
||||
state_vector[s.user] = s.state
|
||||
state_vector
|
||||
|
||||
sendStateVector = ()->
|
||||
HB.getOperationCounter()
|
||||
sendHb = (state_vector)->
|
||||
json = HB._encode(state_vector)
|
||||
if json.length > 0
|
||||
json
|
||||
else
|
||||
null
|
||||
applyHb = (hb)->
|
||||
if hb?
|
||||
engine.applyOpsCheckDouble hb
|
||||
else
|
||||
null
|
||||
encode_state_vector HB.getOperationCounter()
|
||||
|
||||
sendHb = (v)->
|
||||
state_vector = parse_state_vector v
|
||||
json =
|
||||
hb: HB._encode(state_vector)
|
||||
state_vector: encode_state_vector HB.getOperationCounter()
|
||||
json
|
||||
|
||||
applyHb = (res)->
|
||||
HB.renewStateVector parse_state_vector res.state_vector
|
||||
engine.applyOpsCheckDouble res.hb
|
||||
|
||||
connector.whenSyncing sendStateVector, sendHb, applyHb
|
||||
|
||||
connector.whenReceiving (sender, op)->
|
||||
if op.uid.creator isnt HB.getUserId()
|
||||
engine.applyOp op
|
||||
|
||||
HB.setInvokeSyncHandler connector.invokeSync
|
||||
|
||||
module.exports = adaptConnector
|
||||
+22
-18
@@ -30,7 +30,7 @@ class Engine
|
||||
#
|
||||
# Apply a set of operations. E.g. the operations you received from another users HB._encode().
|
||||
# @note You must not use this method when you already have ops in your HB!
|
||||
#
|
||||
###
|
||||
applyOpsBundle: (ops_json)->
|
||||
ops = []
|
||||
for o in ops_json
|
||||
@@ -39,6 +39,7 @@ class Engine
|
||||
if not o.execute()
|
||||
@unprocessed_ops.push o
|
||||
@tryUnprocessed()
|
||||
###
|
||||
|
||||
#
|
||||
# Same as applyOps but operations that are already in the HB are not applied.
|
||||
@@ -53,22 +54,25 @@ class Engine
|
||||
# Apply a set of operations. (Helper for using applyOp on Arrays)
|
||||
# @see Engine.applyOp
|
||||
applyOps: (ops_json)->
|
||||
for o in ops_json
|
||||
@applyOp o
|
||||
@applyOp ops_json
|
||||
|
||||
#
|
||||
# Apply an operation that you received from another peer.
|
||||
#
|
||||
applyOp: (op_json)->
|
||||
# $parse_and_execute will return false if $o_json was parsed and executed, otherwise the parsed operadion
|
||||
o = @parseOperation op_json
|
||||
@HB.addToCounter o
|
||||
# @HB.addOperation o
|
||||
if @HB.getOperation(o)?
|
||||
else if not o.execute()
|
||||
@unprocessed_ops.push o
|
||||
window?.unprocessed_counter++ # TODO: del this
|
||||
window?.unprocessed_types.push o.type
|
||||
# TODO: make this more efficient!!
|
||||
# - operations may only executed in order by creator, order them in object of arrays (key by creator)
|
||||
# - you can probably make something like dependencies (creator1 waits for creator2)
|
||||
applyOp: (op_json_array)->
|
||||
if op_json_array.constructor isnt Array
|
||||
op_json_array = [op_json_array]
|
||||
for op_json in op_json_array
|
||||
# $parse_and_execute will return false if $o_json was parsed and executed, otherwise the parsed operadion
|
||||
o = @parseOperation op_json
|
||||
# @HB.addOperation o
|
||||
if @HB.getOperation(o)?
|
||||
# nop
|
||||
else if (not @HB.isExpectedOperation(o)) or (not o.execute())
|
||||
@unprocessed_ops.push o
|
||||
window?.unprocessed_types.push o.type # TODO: delete this
|
||||
@tryUnprocessed()
|
||||
|
||||
#
|
||||
@@ -77,18 +81,18 @@ class Engine
|
||||
#
|
||||
tryUnprocessed: ()->
|
||||
while true
|
||||
window?.unprocessed_exec_counter++ # TODO: del this
|
||||
old_length = @unprocessed_ops.length
|
||||
unprocessed = []
|
||||
for op in @unprocessed_ops
|
||||
if @HB.getOperation(op)?
|
||||
else if not op.execute()
|
||||
# nop
|
||||
else if (not @HB.isExpectedOperation(op)) or (not op.execute())
|
||||
unprocessed.push op
|
||||
@unprocessed_ops = unprocessed
|
||||
if @unprocessed_ops.length is old_length
|
||||
break
|
||||
|
||||
|
||||
if @unprocessed_ops.length isnt 0
|
||||
@HB.invokeSync()
|
||||
|
||||
|
||||
module.exports = Engine
|
||||
|
||||
@@ -18,7 +18,7 @@ class HistoryBuffer
|
||||
@garbage = [] # Will be cleaned on next call of garbageCollector
|
||||
@trash = [] # Is deleted. Wait until it is not used anymore.
|
||||
@performGarbageCollection = true
|
||||
@garbageCollectTimeout = 30000
|
||||
@garbageCollectTimeout = 2000
|
||||
@reserved_identifier_counter = 0
|
||||
setTimeout @emptyGarbage, @garbageCollectTimeout
|
||||
|
||||
@@ -96,6 +96,10 @@ class HistoryBuffer
|
||||
else
|
||||
@operation_counter[user_id]
|
||||
|
||||
isExpectedOperation: (o)->
|
||||
@operation_counter[o.uid.creator] ?= 0
|
||||
o.uid.op_number <= @operation_counter[o.uid.creator]
|
||||
|
||||
#
|
||||
# Encode this operation in such a way that it can be parsed by remote peers.
|
||||
# TODO: Make this more efficient!
|
||||
@@ -162,14 +166,31 @@ class HistoryBuffer
|
||||
@buffer[o.uid.creator] = {}
|
||||
if @buffer[o.uid.creator][o.uid.op_number]?
|
||||
throw new Error "You must not overwrite operations!"
|
||||
if (o.uid.op_number.constructor isnt String) and (not @isExpectedOperation(o)) # you already do this in the engine, so delete it here!
|
||||
throw new Error "this operation was not expected!"
|
||||
@addToCounter(o)
|
||||
@buffer[o.uid.creator][o.uid.op_number] = o
|
||||
@number_of_operations_added_to_HB ?= 0 # TODO: Debug, remove this
|
||||
@number_of_operations_added_to_HB++
|
||||
o
|
||||
|
||||
removeOperation: (o)->
|
||||
delete @buffer[o.uid.creator]?[o.uid.op_number]
|
||||
|
||||
# When the HB determines inconsistencies, then the invokeSync
|
||||
# handler wil be called, which should somehow invoke the sync with another collaborator.
|
||||
# The parameter of the sync handler is the user_id with wich an inconsistency was determined
|
||||
setInvokeSyncHandler: (f)->
|
||||
@invokeSync = f
|
||||
|
||||
# empty per default # TODO: do i need this?
|
||||
invokeSync: ()->
|
||||
|
||||
# after you received the HB of another user (in the sync process),
|
||||
# you renew your own state_vector to the state_vector of the other user
|
||||
renewStateVector: (state_vector)->
|
||||
for user,state of state_vector
|
||||
if (not @operation_counter[user]?) or (@operation_counter[user] < state_vector[user])
|
||||
@operation_counter[user] = state_vector[user]
|
||||
|
||||
#
|
||||
# Increment the operation_counter that defines the current state of the Engine.
|
||||
#
|
||||
@@ -177,13 +198,11 @@ class HistoryBuffer
|
||||
if not @operation_counter[o.uid.creator]?
|
||||
@operation_counter[o.uid.creator] = 0
|
||||
if typeof o.uid.op_number is 'number' and o.uid.creator isnt @getUserId()
|
||||
# TODO: fix this issue better.
|
||||
# Operations should income in order
|
||||
# Then you don't have to do this..
|
||||
# TODO: check if operations are send in order
|
||||
if o.uid.op_number is @operation_counter[o.uid.creator]
|
||||
@operation_counter[o.uid.creator]++
|
||||
while @getOperation({creator:o.uid.creator, op_number: @operation_counter[o.uid.creator]})?
|
||||
@operation_counter[o.uid.creator]++
|
||||
else
|
||||
@invokeSync o.uid.creator
|
||||
|
||||
#if @operation_counter[o.uid.creator] isnt (o.uid.op_number + 1)
|
||||
#console.log (@operation_counter[o.uid.creator] - (o.uid.op_number + 1))
|
||||
|
||||
@@ -413,7 +413,7 @@ module.exports = (HB)->
|
||||
{
|
||||
'type': "Replaceable"
|
||||
'content': @content?.getUid()
|
||||
'ReplaceManager' : @parent.getUid()
|
||||
'replace_manager' : @parent.getUid()
|
||||
'prev': @prev_cl.getUid()
|
||||
'next': @next_cl.getUid()
|
||||
'uid' : @getUid()
|
||||
@@ -425,7 +425,7 @@ module.exports = (HB)->
|
||||
parser["Replaceable"] = (json)->
|
||||
{
|
||||
'content' : content
|
||||
'ReplaceManager' : parent
|
||||
'replace_manager' : parent
|
||||
'uid' : uid
|
||||
'prev': prev
|
||||
'next': next
|
||||
|
||||
+2
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user