Skip to content

Commit

Permalink
clang-format core/events/block_events.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kozbial committed Aug 6, 2021
1 parent 6b7cb02 commit bd3a212
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
3 changes: 1 addition & 2 deletions core/events/events_block_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ const BlockBase = function(opt_block) {
*/
this.workspaceId = this.isBlank ? '' : opt_block.workspace.id;
};
object.inherits(BlockBase,
Abstract);
object.inherits(BlockBase, Abstract);

/**
* Encode the event as JSON.
Expand Down
16 changes: 7 additions & 9 deletions core/events/events_block_change.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const registry = goog.require('Blockly.registry');
* @extends {Events.BlockBase}
* @constructor
*/
const BlockChange = function(opt_block, opt_element, opt_name, opt_oldValue,
opt_newValue) {
const BlockChange = function(
opt_block, opt_element, opt_name, opt_oldValue, opt_newValue) {
BlockChange.superClass_.constructor.call(this, opt_block);
if (!opt_block) {
return; // Blank event to be populated by fromJson.
Expand Down Expand Up @@ -94,7 +94,7 @@ BlockChange.prototype.run = function(forward) {
const workspace = this.getEventWorkspace_();
const block = workspace.getBlockById(this.blockId);
if (!block) {
console.warn("Can't change non-existent block: " + this.blockId);
console.warn('Can\'t change non-existent block: ' + this.blockId);
return;
}
if (block.mutator) {
Expand All @@ -108,7 +108,7 @@ BlockChange.prototype.run = function(forward) {
if (field) {
field.setValue(value);
} else {
console.warn("Can't set non-existent field: " + this.name);
console.warn('Can\'t set non-existent field: ' + this.name);
}
break;
}
Expand All @@ -132,19 +132,17 @@ BlockChange.prototype.run = function(forward) {
}
if (block.domToMutation) {
const dom = Xml.textToDom(/** @type {string} */
(value) || '<mutation/>');
(value) || '<mutation/>');
block.domToMutation(dom);
}
Events.fire(new BlockChange(
block, 'mutation', null, oldMutation, value));
Events.fire(new BlockChange(block, 'mutation', null, oldMutation, value));
break;
}
default:
console.warn('Unknown change type: ' + this.element);
}
};

registry.register(registry.Type.EVENT, Events.CHANGE,
BlockChange);
registry.register(registry.Type.EVENT, Events.CHANGE, BlockChange);

exports = BlockChange;
5 changes: 2 additions & 3 deletions core/events/events_block_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ BlockCreate.prototype.run = function(forward) {
block.dispose(false);
} else if (id == this.blockId) {
// Only complain about root-level block.
console.warn("Can't uncreate non-existent block: " + id);
console.warn('Can\'t uncreate non-existent block: ' + id);
}
}
}
};

registry.register(registry.Type.EVENT, Events.CREATE,
BlockCreate);
registry.register(registry.Type.EVENT, Events.CREATE, BlockCreate);

exports = BlockCreate;
5 changes: 2 additions & 3 deletions core/events/events_block_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ BlockDelete.prototype.run = function(forward) {
block.dispose(false);
} else if (id == this.blockId) {
// Only complain about root-level block.
console.warn("Can't delete non-existent block: " + id);
console.warn('Can\'t delete non-existent block: ' + id);
}
}
} else {
Expand All @@ -109,7 +109,6 @@ BlockDelete.prototype.run = function(forward) {
}
};

registry.register(registry.Type.EVENT, Events.DELETE,
BlockDelete);
registry.register(registry.Type.EVENT, Events.DELETE, BlockDelete);

exports = BlockDelete;
12 changes: 5 additions & 7 deletions core/events/events_block_move.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ BlockMove.prototype.fromJson = function(json) {
this.newInputName = json['newInputName'];
if (json['newCoordinate']) {
const xy = json['newCoordinate'].split(',');
this.newCoordinate =
new Coordinate(Number(xy[0]), Number(xy[1]));
this.newCoordinate = new Coordinate(Number(xy[0]), Number(xy[1]));
}
if (json['recordUndo'] !== undefined) {
this.recordUndo = json['recordUndo'];
Expand Down Expand Up @@ -144,7 +143,7 @@ BlockMove.prototype.run = function(forward) {
const workspace = this.getEventWorkspace_();
const block = workspace.getBlockById(this.blockId);
if (!block) {
console.warn("Can't move non-existent block: " + this.blockId);
console.warn('Can\'t move non-existent block: ' + this.blockId);
return;
}
const parentId = forward ? this.newParentId : this.oldParentId;
Expand All @@ -154,7 +153,7 @@ BlockMove.prototype.run = function(forward) {
if (parentId) {
parentBlock = workspace.getBlockById(parentId);
if (!parentBlock) {
console.warn("Can't connect to non-existent block: " + parentId);
console.warn('Can\'t connect to non-existent block: ' + parentId);
return;
}
}
Expand All @@ -179,12 +178,11 @@ BlockMove.prototype.run = function(forward) {
if (parentConnection) {
blockConnection.connect(parentConnection);
} else {
console.warn("Can't connect to non-existent input: " + inputName);
console.warn('Can\'t connect to non-existent input: ' + inputName);
}
}
};

registry.register(registry.Type.EVENT, Events.MOVE,
BlockMove);
registry.register(registry.Type.EVENT, Events.MOVE, BlockMove);

exports = BlockMove;

0 comments on commit bd3a212

Please sign in to comment.