Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#69089 Definitions for eventbusjs by @Longq…
Browse files Browse the repository at this point in the history
…in88888

Co-authored-by: longfeng <[email protected]>
  • Loading branch information
Longqin88888 and longfeng authored Mar 22, 2024
1 parent d98e6c5 commit 1abb6a1
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
5 changes: 5 additions & 0 deletions types/eventbusjs/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
11 changes: 11 additions & 0 deletions types/eventbusjs/eventbusjs-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Type definitions for eventbusjs 0.2.0
// Project: https://github.com/krasimir/EventBus

import * as EventBus from "eventbusjs"

function myFunction() { };
EventBus.addEventListener('my_function_event', myFunction);
let isEvent: boolean = EventBus.hasEventListener('my_function_event', myFunction);
let events: string = EventBus.getEvents();
EventBus.dispatch('my_function_event');
EventBus.removeEventListener('my_function_event', myFunction);
16 changes: 16 additions & 0 deletions types/eventbusjs/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Type definitions for eventbusjs 0.2.0
// Project: https://github.com/krasimir/EventBus

export type EventListener = (...args: any) => any;

export function addEventListener(type: string, listener?: EventListener, scope?: object): void;

export function removeEventListener(type: string, listener?: EventListener, scope?: object): void;

export function hasEventListener(type: string, listener?: EventListener, scope?: object): boolean;

export function dispatch(type: string, target?: object, arg?: string, arg2?: string): void;

export function getEvents(): string;

export as namespace EventBus;
17 changes: 17 additions & 0 deletions types/eventbusjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"name": "@types/eventbusjs",
"version": "0.2.9999",
"projects": [
"https://github.com/krasimir/EventBus"
],
"devDependencies": {
"@types/eventbusjs": "workspace:."
},
"owners": [
{
"name": "long2014",
"githubUsername": "Longqin88888"
}
]
}
19 changes: 19 additions & 0 deletions types/eventbusjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "node16",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"eventbusjs-tests.ts"
]
}

0 comments on commit 1abb6a1

Please sign in to comment.