Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Web Worker #60

Merged
merged 1 commit into from
Dec 21, 2020
Merged

Updates for Web Worker #60

merged 1 commit into from
Dec 21, 2020

Conversation

SinanMtl
Copy link
Contributor

Problem

When I was imported graphql.js on Web Worker, I saw these error messages on console:

Uncaught TypeError: Cannot set property 'graphql' of undefined
  at Object.<anonymous> (graphql.js:524)
ReferenceError: headers is not defined
  at caller (graphql.js:321)
ReferenceError: __doRequest is not defined
  at __request (graphql.js:109)

Solutions

self added for callback context.

;(function (root, factory) {
  ...
}(this || self, function () {
  return GraphQLClient
}))

Added var keyword to headers variable.

GraphQLClient.prototype.createSenderFunction = function (debug) {
  ...
  var headers = ...
  ...
}

__doRequest has been changed like below:

var __doRequest
  ....

if (typeof XMLHttpRequest !== 'undefined') {
  __doRequest = function () {
    ....
  }
} else if (typeof require === 'function') {
  __doRequest = function () {
    ....
  }
}

@f f merged commit d1d3bf4 into f:master Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants