function jsonp(url, callback, errback, callbackParam) {
  const script = document.createElement('script');
  const key = 'olc_' + getUid(callback);
  function cleanup() {
    delete window[key];
    script.parentNode.removeChild(script);
  }
  script.async = true;
  script.src =
    url +
    (url.includes('?') ? '&' : '?') +
    (callbackParam || 'callback') +
    '=' +
    key;
  const timer = setTimeout(function () {
    cleanup();
    if (errback) {
      errback();
    }
  }, 10000);
  window[key] = function (data) {
    clearTimeout(timer);
    cleanup();
    callback(data);
  };
  document.head.appendChild(script);
}
Simple JSONP helper. Supports error callbacks and a custom callback param.
The error callback will be called when no JSONP is executed after 10 seconds.

@param {string} url Request url. A 'callback' query parameter will be
    appended.
@param {Function} callback Callback on success.
@param {Function} [errback] Callback on error.
@param {string} [callbackParam] Custom query parameter for the JSONP
    callback. Default is 'callback'.