[FIX] developer: effect service

closes odoo/documentation#1325

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Bruno Boi 2021-11-18 13:04:54 +00:00
parent 24d0a9f71d
commit 2d93b03dd0

View File

@ -200,7 +200,7 @@ Here's how this can be displayed:
const effectService = useService("effect"); const effectService = useService("effect");
effectService.add({ effectService.add({
type: "rainbow_man", type: "rainbow_man", // can be omitted, default type is already "rainbow_man"
message: "Boom! Team record for the past 30 days.", message: "Boom! Team record for the past 30 days.",
}); });
@ -220,9 +220,11 @@ The options are defined by:
.. code-block:: ts .. code-block:: ts
@typedef {Object} [EffectOptions] interface EffectOptions {
@property {string} [type="rainbow_man"]
// The name of the desired effect // The name of the desired effect
type?: string;
[paramName: string]: any;
}
Available effects Available effects
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
@ -243,35 +245,39 @@ RainbowMan
* - Name * - Name
- Type - Type
- Description - Description
* - `params.Component`
- `owl.Component?`
- Component class to instantiate inside the RainbowMan (will replace the message).
* - `params.props`
- `object?={}`
- If params.Component is given, its props can be passed with this argument.
* - `params.message` * - `params.message`
- `string?="Well Done"` - `string?="Well Done!"`
- The message in the notice the rainbowman holds or the content of the notification if effects are disabled. - Message is the notice the rainbowman holds.
Can be a simple a string. If effects are disabled for the user, the rainbowman won't appear and a simple notification
will get displayed as a fallback.
Can be a string representation of html (prefer component if you want interactions in the DOM). If effects are enabled and params.Component is given, params.message is not used.
The message is a simple string or a string representing html
(prefer using params.Component if you want interactions in the DOM).
* - `params.messageIsHtml`
- `boolean?=false`
- Set to true if the message represents html, s.t. it will be correctly inserted into the DOM.
* - `params.img_url` * - `params.img_url`
- `string?=/web/static/img/smile.svg` - `string?=/web/static/img/smile.svg`
- The url of the image to display inside the rainbow. - The url of the image to display inside the rainbow.
* - `params.messageIsHtml`
- `boolean?=false`
- Set to true if the message encodes html, s.t. it will be correctly inserted into the DOM.
* - `params.fadeout` * - `params.fadeout`
- `("slow"|"medium"|"fast"|"no")?="medium"` - `("slow"|"medium"|"fast"|"no")?="medium"`
- Delay for rainbowman to disappear. - Delay for rainbowman to disappear.
`"fast"` will make rainbowman dissapear quickly. `"fast"` will make rainbowman dissapear quickly.
`"medium"` and 'slow' will wait little longer before disappearing (can be used when `options.message` is longer). `"medium"` and `"slow"` will wait little longer before disappearing (can be used when `params.message` is longer).
`"no"` will keep rainbowman on screen until user clicks anywhere outside rainbowman. `"no"` will keep rainbowman on screen until user clicks anywhere outside rainbowman.
* - `params.Component`
- `owl.Component?=RainbowMan`
- Component class to instantiate (if effects aren't disabled).
* - `params.props`
- `object?={}`
- If params.Component is given, its props can be passed with this argument.
How to add an effect How to add an effect
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~