M
M
mistermister2019-02-07 20:27:34
JavaScript
mistermister, 2019-02-07 20:27:34

How to call a function only after the external strip is fully loaded?

I have a react app.
There is a script that, after loading and executing, adds the window.anyFunc function.
How to track that the script has already loaded?
That is, when window.anyFunc exists, call it, passing values ​​to it with redux.
The problem is that I call a function in the componentDidMount of the main application component, but at that moment the script may not yet be loaded and called.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
y0u, 2019-02-08
@mistermister

For example like this https://www.npmjs.com/package/react-load-script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question