Async 'served' event

This commit is contained in:
Daniel
2021-06-08 13:18:39 +02:00
parent a54b0124ea
commit 4bd4446975

View File

@@ -1,5 +1,13 @@
const cds = require ('@sap/cds') const cds = require ('@sap/cds')
cds.emit = function (event,...args) {
switch (event) {
case 'served': return this.served = Promise.all (this.listeners(event).map (each => each.call(this,...args)))
case 'listening': return this.served.then (()=> this.__proto__.emit.call (this, event, ...args))
default: return this.__proto__.emit.call (this, event, ...args)
}
}
cds.once('bootstrap',(app)=>{ cds.once('bootstrap',(app)=>{
app.use ('/orders/webapp', _from('@capire/orders/app/orders/webapp/manifest.json')) app.use ('/orders/webapp', _from('@capire/orders/app/orders/webapp/manifest.json'))
app.use ('/bookshop', _from('@capire/bookshop/app/vue/index.html')) app.use ('/bookshop', _from('@capire/bookshop/app/vue/index.html'))