Skip to content

Commit f0dbc4f

Browse files
committed
Use custom hooks in demo. Cleanup hooks
1 parent 5e9f301 commit f0dbc4f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

examples/demo/commoners.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ const customHooks = async () => {
5050

5151
const { Hooks, DefaultHooks, CommonersUI } = require('@commoners/solidarity/ui')
5252

53-
// const ui = new CommonersUI('dark') // Included Theme
54-
// return new DefaultHooks(ui)
53+
const ui = new CommonersUI('dark') // Included Theme
54+
return new DefaultHooks(ui)
5555

5656
// const ui = new CommonersUI( { primary: '#ff5050ff', muted: '#81858bff' }) // Custom Theme
5757
// return new DefaultHooks(ui)
@@ -83,7 +83,7 @@ const config = defineConfig({
8383
// NOTE: Protocol definition is not yet tested...
8484
electron: {
8585
protocol: { scheme: 'commoners', privileges: { supportFetchAPI: true } },
86-
// hooks: customHooks
86+
hooks: customHooks
8787
},
8888

8989
pwa: {

packages/core/utils/ui/hooks.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,9 @@ export class DefaultHooks extends Hooks {
210210

211211
this.on('service:exit', (event) => {
212212
if (event.type === 'service:exit') {
213-
if (event.code === null) this.ui.service(event.service, 'Restarting...', 'info')
214-
else {
215-
const type = event.code === 0 ? 'success' : 'error'
216-
this.ui.service(event.service, `Exited with code ${event.code}`,type)
217-
}
213+
if (event.code === null) return
214+
const type = event.code === 0 ? 'success' : 'error'
215+
this.ui.service(event.service, `Exited with code ${event.code}`,type)
218216
}
219217
})
220218

0 commit comments

Comments
 (0)