mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
Make OperationRouter and TrivialOperationRouter 100% typed.
This commit is contained in:
@@ -46,7 +46,7 @@ ops.OperationTransformer = function OperationTransformer() {
|
||||
function operations(opspecs) {
|
||||
var ops = [];
|
||||
|
||||
opspecs.forEach(function(opspec) {
|
||||
opspecs.forEach(function (opspec) {
|
||||
ops.push(operationFactory.create(opspec));
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ ops.OperationTransformer = function OperationTransformer() {
|
||||
while ((opSpecsA.length > 0) && opSpecB) {
|
||||
transformResult = transformOpVsOp(opSpecsA.shift(), /**@type {!ops.Operation}*/(opSpecB));
|
||||
// unresolvable operation conflicts?
|
||||
if (! transformResult) {
|
||||
if (!transformResult) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ ops.OperationTransformer = function OperationTransformer() {
|
||||
while (transformResult.opSpecsB.length > 1) {
|
||||
transformListResult = transformOpListVsOp(opSpecsA, transformResult.opSpecsB.shift());
|
||||
// unresolvable operation conflicts?
|
||||
if (! transformListResult) {
|
||||
if (!transformListResult) {
|
||||
return null;
|
||||
}
|
||||
// take transformed ops of the single b
|
||||
@@ -150,7 +150,7 @@ ops.OperationTransformer = function OperationTransformer() {
|
||||
while (opSpecsB.length > 0) {
|
||||
transformResult = transformOpListVsOp(opSpecsA, opSpecsB.shift());
|
||||
// unresolvable operation conflicts?
|
||||
if (! transformResult) {
|
||||
if (!transformResult) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,10 @@ ops.TrivialOperationRouter = function TrivialOperationRouter() {
|
||||
ops.OperationRouter.signalProcessingBatchStart,
|
||||
ops.OperationRouter.signalProcessingBatchEnd
|
||||
]),
|
||||
/**@type{!ops.OperationFactory}*/
|
||||
operationFactory,
|
||||
playbackFunction,
|
||||
/**@type{number}*/
|
||||
groupIdentifier = 0;
|
||||
|
||||
/**
|
||||
@@ -95,8 +97,9 @@ ops.TrivialOperationRouter = function TrivialOperationRouter() {
|
||||
// TODO redesign this concept to work with collaborative editing
|
||||
groupIdentifier += 1;
|
||||
events.emit(ops.OperationRouter.signalProcessingBatchStart, {});
|
||||
operations.forEach(function(op) {
|
||||
var timedOp,
|
||||
operations.forEach(function (op) {
|
||||
var /**@type{?ops.Operation}*/
|
||||
timedOp,
|
||||
opspec = op.spec();
|
||||
|
||||
opspec.timestamp = (new Date()).getTime();
|
||||
@@ -109,6 +112,9 @@ ops.TrivialOperationRouter = function TrivialOperationRouter() {
|
||||
events.emit(ops.OperationRouter.signalProcessingBatchEnd, {});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {function()} cb
|
||||
*/
|
||||
this.close = function (cb) {
|
||||
cb();
|
||||
};
|
||||
@@ -118,7 +124,7 @@ ops.TrivialOperationRouter = function TrivialOperationRouter() {
|
||||
* @param {!Function} cb
|
||||
* @return {undefined}
|
||||
*/
|
||||
this.subscribe = function(eventId, cb) {
|
||||
this.subscribe = function (eventId, cb) {
|
||||
events.subscribe(eventId, cb);
|
||||
};
|
||||
|
||||
@@ -127,7 +133,7 @@ ops.TrivialOperationRouter = function TrivialOperationRouter() {
|
||||
* @param {!Function} cb
|
||||
* @return {undefined}
|
||||
*/
|
||||
this.unsubscribe = function(eventId, cb) {
|
||||
this.unsubscribe = function (eventId, cb) {
|
||||
events.unsubscribe(eventId, cb);
|
||||
};
|
||||
|
||||
|
||||
@@ -125,9 +125,11 @@ function Main(cmakeListPath) {
|
||||
"ops/OpUpdateParagraphStyle.js",
|
||||
"ops/Operation.js",
|
||||
"ops/OperationFactory.js",
|
||||
"ops/OperationRouter.js",
|
||||
"ops/Server.js",
|
||||
"ops/StepsTranslator.js",
|
||||
"ops/TextPositionFilter.js",
|
||||
"ops/TrivialOperationRouter.js",
|
||||
"xmldom/LSSerializer.js",
|
||||
"xmldom/LSSerializerFilter.js",
|
||||
"xmldom/XPath.js"
|
||||
|
||||
Reference in New Issue
Block a user