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

Replace initialization "hack' with a proper event listener #48

Open
markhalliwell opened this issue May 17, 2015 · 3 comments
Open

Replace initialization "hack' with a proper event listener #48

markhalliwell opened this issue May 17, 2015 · 3 comments
Labels
Milestone

Comments

@markhalliwell
Copy link
Contributor

https://github.com/truckingsim/Ajax-Bootstrap-Select/blob/master/src/js/classes/AjaxBootstrapSelect.js#L246-L251

This code uses a setTimeout in a very hack-ish way (basically, hope that bootstrap-select has been initialized first within 500ms). This is really unreliable and should be listening for an event instead.

We're actually waiting for the bootstrap-select project to create an initialized event that they themselves will trigger after their plugin has been created (see snapappointments/bootstrap-select#1026).

This will allow us to ensure that bootstrap-select has indeed initialized before attempting to initialize our plugin.

@truckingsim
Copy link
Owner

Looks like this has been added and will be part of 1.7.0.

@markhalliwell
Copy link
Contributor Author

Indeed, as loaded.bs.select. Also, makes me wonder if we should be doing any sort of "version check"?

@truckingsim
Copy link
Owner

I think we'll have to on this update as it won't work without the events. It looks like they expose the version so should be easy to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants