-
Notifications
You must be signed in to change notification settings - Fork 22
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
onChange only fires once during initialization #6
Comments
Hi @cookmscott, The problem is that you're executing the function when you pass it to the picker as a paremter. Instead, you should only pass a reference to the function (no parentheses): let fontPicker = new FontPicker(
'keysdgjlkjsdg', // Google API key
'Open Sans', // default font
{limit: 20},
foo
);
function foo() {
console.log ('font changed')
} Let me know if this works as expected :) |
It's probably unexpected behavior that the function also fires on initialization, though. I think I might change that. |
Omahgerd... Simply specifying |
Hey Samuel and friends... My expectation of the below is that foo() will execute each time the active font is changed. In other words, the onChange function of the constructor should fire every time a user selects a new font. However, it seems foo() is only executed once on initialization.
Let me know if you'd like a fiddle.
The text was updated successfully, but these errors were encountered: