MCPcopy Create free account
hub / github.com/f/graphql.js / GraphQLClient

Function GraphQLClient

graphql.js:127–154  ·  view source on GitHub ↗
(url, options)

Source from the content-addressed store, hash-verified

125 }
126
127 function GraphQLClient(url, options) {
128 if (!(this instanceof GraphQLClient)) {
129 var client = new GraphQLClient(url, options, true)
130 var _lazy = client._sender
131 for (var m in client) {
132 if (typeof client[m] == 'function') {
133 _lazy[m] = client[m].bind(client)
134 if (client[m].declare) _lazy[m].declare = client[m].declare.bind(client)
135 if (client[m].run) _lazy[m].run = client[m].run.bind(client)
136 }
137 }
138 return _lazy
139 } else if (arguments[2] !== true) {
140 throw new Error("You cannot create GraphQLClient instance. Please call GraphQLClient as function.")
141 }
142 if (!options)
143 options = {}
144
145 if (!options.fragments)
146 options.fragments = {}
147
148 this.url = url
149 this.options = options || {}
150 this._fragments = this.buildFragments(options.fragments)
151 this._sender = this.createSenderFunction(options.debug)
152 this.createHelpers(this._sender)
153 this._transaction = {}
154 }
155
156 // "fragment auth.login" will be "fragment auth_login"
157 var FRAGMENT_SEPERATOR = "_"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected