@graphql-yoga/subscription
Advanced tools
Comparing version 0.0.1-beta.0 to 0.0.2-canary-2f869ad.0
32
index.js
@@ -16,11 +16,16 @@ 'use strict'; | ||
\`\`\` | ||
// yarn install @ungap/event @ungap/event-target | ||
import Event from '@ungap/event' | ||
import EventTarget from '@ungap/event-target' | ||
// yarn install --exact event-target-polyfill@0.0.3 | ||
import 'event-target-polyfill' | ||
const pubSub = createPubSub() | ||
\`\`\` | ||
Alternatively, you can provide your own custom implementation. | ||
\`\`\` | ||
const pubSub = createPubSub({ | ||
event: { | ||
event: { | ||
Event, | ||
EventTarget, | ||
} | ||
} | ||
}) | ||
@@ -41,4 +46,9 @@ \`\`\` | ||
publish(routingKey, ...args) { | ||
const event = new Event(routingKey); | ||
event.data = args[0]; | ||
var _a; | ||
const payload = (_a = args[1]) !== null && _a !== void 0 ? _a : args[0]; | ||
const topic = args[1] === undefined | ||
? routingKey | ||
: `${routingKey}:${args[0]}`; | ||
const event = new Event(topic); | ||
event.data = payload; | ||
target.dispatchEvent(event); | ||
@@ -124,6 +134,6 @@ }, | ||
Object.defineProperty(exports, 'Repeater', { | ||
enumerable: true, | ||
get: function () { | ||
return repeater.Repeater; | ||
} | ||
enumerable: true, | ||
get: function () { | ||
return repeater.Repeater; | ||
} | ||
}); | ||
@@ -130,0 +140,0 @@ exports.createPubSub = createPubSub; |
{ | ||
"name": "@graphql-yoga/subscription", | ||
"version": "0.0.1-beta.0", | ||
"version": "0.0.2-canary-2f869ad.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17929
12
350