Wrap function in wait wrapper, it will be called after condition returns true
condition
true
import { component, wait } from 'jodit/core/decorators';import { UIElement } from 'jodit/ui';@componentclass UISomeElement extends UIElement { @wait(() => typeof jQuery !== 'undefined') protected runOnLoadJQuery(html: string): void { jQuery(this.container).html(html); alert('Run'); }}const elm = new UISomeElement(jodit);elm.runOnLoadJQuery('<h1>One</h1>'); // Do nothing// jQuery is loaded// alert Copy
import { component, wait } from 'jodit/core/decorators';import { UIElement } from 'jodit/ui';@componentclass UISomeElement extends UIElement { @wait(() => typeof jQuery !== 'undefined') protected runOnLoadJQuery(html: string): void { jQuery(this.container).html(html); alert('Run'); }}const elm = new UISomeElement(jodit);elm.runOnLoadJQuery('<h1>One</h1>'); // Do nothing// jQuery is loaded// alert
If you like Jodit - try Jodit PRO
Wait something decorator
Wrap function in wait wrapper, it will be called after
condition
returnstrue