INNER CODE UNIT · TypeScript
createClient
enisdenjo/graphql-sse · src/client.ts:282
export function createClient<SingleConnection extends boolean = false>(
options: ClientOptions<SingleConnection>,
): Client<SingleConnection> {
const {
singleConnection = false,
lazy = true,
lazyCloseTimeout = 0,
onNonLazyError = console.error,
/**
* Generates a v4 UUID to be used as the ID using `Math`
* as the random number generator. Supply your own generator
* in case you need more uniqueness.
*
* Reference: https://gist.github.com/jed/982883
*/
generateID = function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0,