function _checkForProgramLinkCompletionAsync() {
  _checkForProgramLinkCompletionAsync = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(gl, program, progOptions) {
    var ext, checkFn, waitTime, success, err, errFn;
    return regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            ext = gl.getExtension('KHR_parallel_shader_compile');
            checkFn = ext ? function (gl, program) {
              return gl.getProgramParameter(program, ext.COMPLETION_STATUS_KHR);
            } : function () {
              return true;
            };
            waitTime = 0;

          case 3:
            _context.next = 5;
            return wait(waitTime);

          case 5:
            // must wait at least once
            waitTime = 1000 / 60;

          case 6:
            if (!checkFn(gl, program)) {
              _context.next = 3;
              break;
            }

          case 7:
            success = checkProgramStatus(gl, program, progOptions.errorCallback);
            err = success ? undefined : progOptions.errors.join('\n');

            if (!success) {
              errFn = progOptions.errorCallback || error;
              errFn(err);
              gl.deleteProgram(program); // TODO: delete shaders, but only shaders that were created newly for this
              // program

              program = null;
            }

            progOptions.callback(err, program);

          case 11:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _checkForProgramLinkCompletionAsync.apply(this, arguments);
}
Check a program's link status
@param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
@param {WebGLProgram} program Program to check
@param {ErrorCallback} [errFn] func for errors
@return {bool} true if program is ok
@private