MCPcopy Index your code
hub / github.com/anomalyco/opencode / footer

Function footer

packages/opencode/test/cli/run/runtime.test.ts:84–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82}
83
84function footer(): FooterApi {
85 let closed = false
86 const closes = new Set<() => void>()
87
88 const notify = () => {
89 for (const fn of closes) fn()
90 }
91
92 return {
93 get isClosed() {
94 return closed
95 },
96 onPrompt: () => () => {},
97 onQueuedRemove: () => () => {},
98 onClose(fn) {
99 if (closed) {
100 fn()
101 return () => {}
102 }
103
104 closes.add(fn)
105 return () => {
106 closes.delete(fn)
107 }
108 },
109 event() {},
110 append() {},
111 idle() {
112 return Promise.resolve()
113 },
114 close() {
115 if (closed) {
116 return
117 }
118
119 closed = true
120 notify()
121 },
122 destroy() {
123 if (closed) {
124 return
125 }
126
127 closed = true
128 notify()
129 },
130 }
131}
132
133afterEach(() => {
134 mock.restore()

Callers 1

runtime.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected