whenScriptLoaded

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.when

Detect when a script has been fully loaded

Params

  1. $script*-HTMLScriptElement

    The script element to detect the loading state

  2. cbnullFunction

    A callback if you prefer

Return

  1. -Promise

    The promise that will be resolved when the script is fully loaded

Example

import { whenScriptLoaded } from '@blackbyte/sugar/dom'
whenScriptLoaded($script).then(($script) => {
  // do something here
})

Todo

  • testsnormal