-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: convert some classes to ES6 classes #5928
Changes from 1 commit
b01b042
300c259
51c3956
f741d21
cfe0d3e
19b254b
de7af56
46f7ffd
f7950c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -405,7 +405,8 @@ class Mutator extends Icon { | |
*/ | ||
workspaceChanged_(e) { | ||
if (!(e.isUiEvent || | ||
(e.type === eventUtils.CHANGE && /** @type {!BlockChange} */(e).element === 'disabled') || | ||
(e.type === eventUtils.CHANGE && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please correct me if I'm wrong, but I believe that we use the the I assume that developers may be using the type property since events are frequently used externally. But if the event class and the type property are expected to be in sync then using the actual class name instead of the property might be easier to manage for most internal use. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other reason to use Do you see any downsides to changing to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried changing to require and it broke compilation because there is a circular dependency that it can't break. I'm going to punt this and continue using type instead of instanceof. |
||
/** @type {!BlockChange} */ (e).element === 'disabled') || | ||
e.type === eventUtils.CREATE)) { | ||
this.updateWorkspace_(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -609,7 +609,8 @@ class Trashcan extends DeleteArea { | |
* @private | ||
*/ | ||
onDelete_(event) { | ||
if (this.workspace_.options.maxTrashcanContents <= 0 || event.type !== eventUtils.BLOCK_DELETE) { | ||
if (this.workspace_.options.maxTrashcanContents <= 0 || | ||
event.type !== eventUtils.BLOCK_DELETE) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd even consider using |
||
return; | ||
} | ||
const deleteEvent = /** @type {!BlockDelete} */ (event); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't change this, but while you're here this needs a
?
. I guess this doesn't matter as long as the Typescript conversion tool that we eventually use still knows that this is nullable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.