Remove goog.Timer

This commit is contained in:
Neil Fraser
2018-06-12 10:58:48 -07:00
committed by Neil Fraser
parent 7886d24130
commit 05fcdc3510
3 changed files with 5 additions and 8 deletions

View File

@@ -32,7 +32,6 @@ goog.require('Blockly.Events.BlockMove');
goog.require('goog.math.Coordinate');
goog.require('goog.asserts');
goog.require('goog.Timer');
/**
@@ -267,7 +266,7 @@ Blockly.BlockDragger.prototype.maybeDeleteBlock_ = function() {
if (this.wouldDeleteBlock_) {
if (trashcan) {
goog.Timer.callOnce(trashcan.close, 100, trashcan);
setTimeout(trashcan.close.bind(trashcan), 100);
}
// Fire a move event, so we know where to go back to for an undo.
this.fireMoveEvent_();

View File

@@ -32,7 +32,6 @@ goog.require('Blockly.WorkspaceCommentSvg');
goog.require('goog.math.Coordinate');
goog.require('goog.asserts');
goog.require('goog.Timer');
/**
@@ -160,7 +159,7 @@ Blockly.BubbleDragger.prototype.maybeDeleteBubble_ = function() {
if (this.wouldDeleteBubble_) {
if (trashcan) {
goog.Timer.callOnce(trashcan.close, 100, trashcan);
setTimeout(trashcan.close.bind(trashcan), 100);
}
// Fire a move event, so we know where to go back to for an undo.
this.fireMoveEvent_();

View File

@@ -26,7 +26,6 @@
goog.provide('Blockly.Trashcan');
goog.require('goog.Timer');
goog.require('goog.dom');
goog.require('goog.math');
goog.require('goog.math.Rect');
@@ -234,7 +233,7 @@ Blockly.Trashcan.prototype.dispose = function() {
}
this.svgLid_ = null;
this.workspace_ = null;
goog.Timer.clear(this.lidTask_);
clearTimeout(this.lidTask_);
};
/**
@@ -299,7 +298,7 @@ Blockly.Trashcan.prototype.setOpen_ = function(state) {
if (this.isOpen == state) {
return;
}
goog.Timer.clear(this.lidTask_);
clearTimeout(this.lidTask_);
this.isOpen = state;
this.animateLid_();
};
@@ -319,7 +318,7 @@ Blockly.Trashcan.prototype.animateLid_ = function() {
var opacity = goog.math.lerp(0.4, 0.8, this.lidOpen_);
this.svgGroup_.style.opacity = opacity;
if (this.lidOpen_ > 0 && this.lidOpen_ < 1) {
this.lidTask_ = goog.Timer.callOnce(this.animateLid_, 20, this);
this.lidTask_ = setTimeout(this.animateLid_.bind(this), 20);
}
};