[REF] web: change effect service API

Before this commit, effect service provided two functions:
  create(type, params)
  rainbowMan(params)

Now, it provides one function add which is create but renamed
rainbowMan function can be called by doing:
  service.add("rainbowman", ...);

closes odoo-dev/odoo#969

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Michael Mattiello (mcm)
2021-06-18 21:31:34 +02:00
committed by Aaron Bohy
parent 8d8201a8e0
commit aa819f892d
5 changed files with 10 additions and 10 deletions
@@ -8,10 +8,10 @@ export const legacyServiceProvider = {
dependencies: ["effect"],
start({ services }) {
browser.addEventListener("show-effect", (ev) => {
services.effect.create(ev.detail.type, ev.detail);
services.effect.add(ev.detail.type, ev.detail);
});
bus.on("show-effect", this, (payload) => {
services.effect.create(payload.type, payload);
services.effect.add(payload.type, payload);
});
},
};
@@ -1066,7 +1066,7 @@ function makeActionManager(env) {
await _executeCloseAction();
}
if (effect) {
env.services.effect.create(effect.type, effect);
env.services.effect.add(effect.type, effect);
}
}
@@ -91,7 +91,7 @@ export const effectService = {
* All the options for the effect.
* The options get passed to the more specific effect methods.
*/
function create(type, params = {}) {
function add(type, params = {}) {
switch (type.replace("_", "").toLowerCase()) {
case "rainbowman":
return rainbowMan(params);
@@ -100,7 +100,7 @@ export const effectService = {
}
}
return { create, rainbowMan };
return { add };
},
};