Piece of code to execute AFTER execution of other code
<p>I have a piece of code I want to execute after another piece of code. Now I'm using setTimeout but it's not a good solution.</p>

<p>For example, I'm using a text editor which of course needs time for initialization.</p>

<pre><code>myTextEditor.initialize();
setHeightToMyTextEditor();
</code></pre>

<p>In this example, the height to myTextEditor isn't right. It stays the same, because the text editor still isn't initialized. So, I'm using setTimeout and execute setHeightToMyTextEditor() after 3 seconds. But, if someone has much slower internet I guess it will be a problem.</p>

<p>So, how to make setHeightToMyTextEditor() execute after the text editor is initialized?</p>
