Skip to content
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

Add changeSource parameter to instance object passed on 'change' event. #245

Closed
wants to merge 4 commits into from

Conversation

dmarman
Copy link

@dmarman dmarman commented Sep 5, 2020

Based on this issue.

The 'change' event coming from the preview fires many times per second. This doesn't allow to add an event listener that takes long to run >30ms, otherwise the preview gets blocked. So any heavy calculation has to go to 'changestop' event and only light calculations on 'change'.
The problem is that 'changestop' won't fire from the input, so I cannot fire any heavy calculation when the user changes the input.

Adding extra events like 'inputChange', 'previewChange' or 'swatchChange' feels like duplicating functionality.
Adding an extra parameter to the event callback will break things since it will look like (color, changeSource, instance) and the instance parameter would change from the second to the third position.

So the fastest and non-breaking solution was adding an extra property to pickr

I also changed the dev url to the current one. localhost:8080 doesn't work anymore.

@simonwep
Copy link
Owner

simonwep commented Dec 5, 2020

Thank you for your efforts, as in #193 I'll fire changestop on user-input too and add a source-property to the eventy. Adding another property is too specific for a single use case and might be confusing.

@simonwep simonwep closed this Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants