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
Change Hook Running On Init #68
Comments
That’s intentional. The let init = true;
picker.on('change', function(r, g, b, a) {
if (init) {
return;
}
console.log([r, g, b, a]);
init = false; // Update the state here!
}); |
Thanks, that's exactly how i solved the issue. |
FYI, you can also make custom hook inside another hook. In your case, that would be something like this: function onChangeOnce(r, g, b, a) {
this.fire('start', [r, g, b, a]);
this.off('change', onChangeOnce);
}
picker.on('change', onChangeOnce); Later, you can trigger your initialization function via the picker.on('start', function(r, g, b, a) {
console.log('Once!');
}); |
This seems weird. Why would we need to design around a test/validation? It's not logical that |
@evolross There’s a |
Hi guys,
I have a weird issue the change hook is running on plugin initializing, here is the test i did:
The text was updated successfully, but these errors were encountered: