mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
feat!: allow blocks to receive their own delete events (#6337)
* feat!: allow blocks to receive their own delete events * fix: move block tests back into main directory * chore: add a test for disposing of callers * chore: add test for delete being received * chore: add comment about why we have to run the clock twice * chore: fix whitespace * chore: fix whitespace * chore: fix imports in tests * chore: bump mocha timeout * chore: bump timeout again? * chore: eliminate the possibility that tests are actually timing out * chore: change timeout back * chore: remove tests that might be the problematic ones * chore: attempt enabling delete event test * chore: enable lists tests * chore: try ternary test as well * chore: actually add block test files * chore: enable remaining tests
This commit is contained in:
@@ -316,18 +316,18 @@ export class Block implements IASTNodeLocation, IDeletable {
|
||||
*/
|
||||
dispose(healStack: boolean) {
|
||||
if (this.disposed) {
|
||||
// Already deleted.
|
||||
return;
|
||||
}
|
||||
// Terminate onchange event calls.
|
||||
if (this.onchangeWrapper_) {
|
||||
this.workspace.removeChangeListener(this.onchangeWrapper_);
|
||||
}
|
||||
|
||||
this.unplug(healStack);
|
||||
if (eventUtils.isEnabled()) {
|
||||
eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_DELETE))!(this));
|
||||
}
|
||||
|
||||
if (this.onchangeWrapper_) {
|
||||
this.workspace.removeChangeListener(this.onchangeWrapper_);
|
||||
}
|
||||
|
||||
eventUtils.disable();
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user