I am working with a third-party library that provides its own global "ready" function. I am creating an Ember component that will need to wait until this ready function has been called before executing some code in my didInsertElement
function. How can I wait until this global ready function to execute before calling my didInsertElement
code?
// index.html
<script src="http://ift.tt/2xJX4N6"></script>
<script>
function thirdPartyReady() {
// Do something here. Maybe window.thirdPartyReady = true ?
}
</script>
// my-component.js
export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
// wait until thirdPartyReady before using it on this element
}
});
Aucun commentaire:
Enregistrer un commentaire