From 4bd44469759bb4517d2d28bc7b6f0ed390f7bf5b Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 8 Jun 2021 13:18:39 +0200 Subject: [PATCH] Async 'served' event --- fiori/server.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fiori/server.js b/fiori/server.js index 41294b50..a2d911a2 100644 --- a/fiori/server.js +++ b/fiori/server.js @@ -1,5 +1,13 @@ 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)=>{ app.use ('/orders/webapp', _from('@capire/orders/app/orders/webapp/manifest.json')) app.use ('/bookshop', _from('@capire/bookshop/app/vue/index.html'))