-
Notifications
You must be signed in to change notification settings - Fork 26
Add flow declaration file #17
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
Conversation
|
|
||
| connectedCallback() { | ||
| if (this.constructed) return | ||
| this.constructed = true |
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.
@muan I just removed this, not sure what this was doing 😬
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.
This was preventing the template from being appended every time connectedCallback is triggered since we can't add nodes to the element in constructor.
This can potentially check for existence of .crop-wrapper within the node instead. However we should probably also convert these classes to data attributes and update the CSS accordingly since these classes could conflict with the host app.
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.
This was preventing the template from being appended every time
connectedCallbackis triggered since we can't add nodes to the element in constructor.
Cool! I just pushed a commit that checks a WeakMap for the element and returns if it has added the template already.
This can potentially check for existence of
.crop-wrapperwithin the node instead. However we should probably also convert these classes to data attributes and update the CSS accordingly since these classes could conflict with the host app.
Would it be cool if I did this in a follow up?
|
|
||
| connectedCallback() { | ||
| if (this.constructed) return | ||
| this.constructed = true |
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.
This was preventing the template from being appended every time connectedCallback is triggered since we can't add nodes to the element in constructor.
This can potentially check for existence of .crop-wrapper within the node instead. However we should probably also convert these classes to data attributes and update the CSS accordingly since these classes could conflict with the host app.
| target.dispatchEvent(new CustomEvent('image-crop-change', {bubbles: true, detail: result})) | ||
| } | ||
|
|
||
| export class ImageCropElement extends HTMLElement { |
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.
Is the a reason the class is no longer exported?
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.
It's exported as default at the end of this file so I removed this named export.
Store els in constrcutedElements
Add flow declaration file and some minor refactoring.