-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
96 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import { Context } from 'egg'; | ||
import { EggContextEventBus } from '../../lib/EggContextEventBus'; | ||
import { Context } from '@eggjs/core'; | ||
import { EggContextEventBus } from '../../lib/EggContextEventBus.js'; | ||
|
||
const EVENT_BUS = Symbol.for('context#eventBus'); | ||
|
||
export default { | ||
export default class EventBusContext extends Context { | ||
[EVENT_BUS]: EggContextEventBus; | ||
|
||
get eventBus() { | ||
if (!this[EVENT_BUS]) { | ||
this[EVENT_BUS] = new EggContextEventBus(this as unknown as Context); | ||
this[EVENT_BUS] = new EggContextEventBus(this); | ||
} | ||
return this[EVENT_BUS]; | ||
}, | ||
}; | ||
} | ||
} | ||
|
||
declare module '@eggjs/core' { | ||
interface Context { | ||
get eventBus(): EggContextEventBus; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import '@eggjs/tegg-plugin'; | ||
import '@eggjs/tegg-config'; | ||
import './app/extend/application.unittest.js'; | ||
import './app/extend/context.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
plugin/eventbus/test/fixtures/apps/event-app/app/event-module/MultiEventHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
"name": "multi-module-common", | ||
"eggModule": { | ||
"name": "multi-module-common" | ||
} | ||
}, | ||
"type": "module" | ||
} |
6 changes: 2 additions & 4 deletions
6
...s/apps/event-app/config/config.default.js → ...s/apps/event-app/config/config.default.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
plugin/eventbus/test/fixtures/apps/event-app/config/plugin.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
plugin/eventbus/test/fixtures/apps/event-app/config/plugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default { | ||
tracer: { | ||
package: '@eggjs/tracer', | ||
enable: true, | ||
}, | ||
|
||
tegg: { | ||
package: '@eggjs/tegg-plugin', | ||
enable: true, | ||
}, | ||
|
||
teggConfig: { | ||
package: '@eggjs/tegg-config', | ||
enable: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"name": "event-app" | ||
"name": "event-app", | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,5 @@ | |
"baseUrl": "./" | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"test" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
"baseUrl": "./" | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"test" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1 @@ | ||
import 'egg'; | ||
import '@eggjs/tegg-plugin'; | ||
import '@eggjs/tegg-config' | ||
import { EventBus, EventWaiter } from '@eggjs/tegg'; | ||
|
||
declare module 'egg' { | ||
interface EventbusApplication { | ||
getEventbus(): Promise<EventBus>; | ||
getEventWaiter(): Promise<EventWaiter>; | ||
} | ||
|
||
interface Application extends EventbusApplication { | ||
} | ||
} |