New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-yoga/typed-event-target

Package Overview
Dependencies
Maintainers
4
Versions
908
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-yoga/typed-event-target - npm Package Compare versions

Comparing version 0.1.1 to 1.0.0-alpha-20220920120038-f79bce94

31

cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveGlobalConfig = void 0;
const resolveGlobalConfig = (api = globalThis) => {
if (!api.Event || !api.EventTarget) {
throw new Error(`
[@graphql-yoga/subscription] 'createPubSub' uses the Event and EventTarget APIs.
In modern JavaScript environments those are part of the global scope. However, if you are using an older version of Node.js (< 16.x.x), those APIs must be polyfilled.
You can provide polyfills to the 'createPubSub' function:
\`\`\`
// 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,
EventTarget,
}
})
\`\`\`
`);
}
return globalThis;
};
exports.resolveGlobalConfig = resolveGlobalConfig;

30

esm/index.js

@@ -1,29 +0,1 @@

export const resolveGlobalConfig = (api = globalThis) => {
if (!api.Event || !api.EventTarget) {
throw new Error(`
[@graphql-yoga/subscription] 'createPubSub' uses the Event and EventTarget APIs.
In modern JavaScript environments those are part of the global scope. However, if you are using an older version of Node.js (< 16.x.x), those APIs must be polyfilled.
You can provide polyfills to the 'createPubSub' function:
\`\`\`
// 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,
EventTarget,
}
})
\`\`\`
`);
}
return globalThis;
};
export {};

3

package.json
{
"name": "@graphql-yoga/typed-event-target",
"version": "0.1.1",
"version": "1.0.0-alpha-20220920120038-f79bce94",
"description": "",
"sideEffects": false,
"dependencies": {

@@ -6,0 +7,0 @@ "@repeaterjs/repeater": "^3.0.4",

@@ -1,20 +0,12 @@

export declare type TypedEvent = Event & {
data?: unknown;
};
export interface TypedEventListener<TEvent extends TypedEvent> extends EventListener {
export interface TypedEventListener<TEvent extends CustomEvent> {
(evt: TEvent): void;
}
export interface TypedEventListenerObject<TEvent extends TypedEvent> extends EventListener {
export interface TypedEventListenerObject<TEvent extends CustomEvent> {
handleEvent(object: TEvent): void;
}
export declare type TypedEventListenerOrEventListenerObject<TEvent extends TypedEvent> = TypedEventListener<TEvent> | TypedEventListenerObject<TEvent>;
export interface TypedEventTarget<TEvent extends TypedEvent> extends EventTarget {
addEventListener(type: string, callback: TypedEventListenerOrEventListenerObject<TEvent>, options?: AddEventListenerOptions | boolean): void;
export declare type TypedEventListenerOrEventListenerObject<TEvent extends CustomEvent> = TypedEventListener<TEvent> | TypedEventListenerObject<TEvent>;
export interface TypedEventTarget<TEvent extends CustomEvent> extends EventTarget {
addEventListener(type: string, callback: TypedEventListenerOrEventListenerObject<TEvent> | null, options?: AddEventListenerOptions | boolean): void;
dispatchEvent(event: TEvent): boolean;
removeEventListener(type: string, callback: TypedEventListenerOrEventListenerObject<TEvent>, options?: EventListenerOptions | boolean): void;
removeEventListener(type: string, callback: TypedEventListenerOrEventListenerObject<TEvent> | null, options?: EventListenerOptions | boolean): void;
}
export declare type EventAPI = {
Event: typeof Event;
EventTarget: typeof EventTarget;
};
export declare const resolveGlobalConfig: (api?: EventAPI) => EventAPI;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc