mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-20 09:14:22 +01:00
tweak: rename event
This commit is contained in:
@@ -78,8 +78,8 @@ export namespace Session {
|
|||||||
export type ShareInfo = z.output<typeof ShareInfo>
|
export type ShareInfo = z.output<typeof ShareInfo>
|
||||||
|
|
||||||
export const Event = {
|
export const Event = {
|
||||||
Started: Bus.event(
|
Created: Bus.event(
|
||||||
"session.started",
|
"session.created",
|
||||||
z.object({
|
z.object({
|
||||||
info: Info,
|
info: Info,
|
||||||
}),
|
}),
|
||||||
@@ -173,7 +173,7 @@ export namespace Session {
|
|||||||
}
|
}
|
||||||
log.info("created", result)
|
log.info("created", result)
|
||||||
await Storage.write(["session", Instance.project.id, result.id], result)
|
await Storage.write(["session", Instance.project.id, result.id], result)
|
||||||
Bus.publish(Event.Started, {
|
Bus.publish(Event.Created, {
|
||||||
info: result,
|
info: result,
|
||||||
})
|
})
|
||||||
const cfg = await Config.get()
|
const cfg = await Config.get()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ describe("session.started event", () => {
|
|||||||
let eventReceived = false
|
let eventReceived = false
|
||||||
let receivedInfo: Session.Info | undefined
|
let receivedInfo: Session.Info | undefined
|
||||||
|
|
||||||
const unsub = Bus.subscribe(Session.Event.Started, (event) => {
|
const unsub = Bus.subscribe(Session.Event.Created, (event) => {
|
||||||
eventReceived = true
|
eventReceived = true
|
||||||
receivedInfo = event.properties.info as Session.Info
|
receivedInfo = event.properties.info as Session.Info
|
||||||
})
|
})
|
||||||
@@ -45,7 +45,7 @@ describe("session.started event", () => {
|
|||||||
fn: async () => {
|
fn: async () => {
|
||||||
const events: string[] = []
|
const events: string[] = []
|
||||||
|
|
||||||
const unsubStarted = Bus.subscribe(Session.Event.Started, () => {
|
const unsubStarted = Bus.subscribe(Session.Event.Created, () => {
|
||||||
events.push("started")
|
events.push("started")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user