...
The name of the constant quotesDetailNew
, determines where and when the code will be triggered. List of possible names is in Unity under System Configuration / Interceptors /wiki/spaces/UDEV/pages/3814555767. When you are exporting non existing name from your interceptor, for example because of typo, Unity will display an error with unknown method names.
...
When Unity triggers a function which is in your exported constant, it will pass an object parameter to the functionit. This object has properties, which contains API functions and data related to the triggered action which was triggered.
Code Block | ||
---|---|---|
| ||
export const quotesDetailNew = (parameter) => { console.log(parameter); }; |
…The content of passed parameter can vary. There is a common set which you get all the time. It is under key name api
and it contains generic functions which you can use in all pfx modules. If you know, that you will need api
, you can use JavaScript shortcuts to obtain it.
Code Block | ||
---|---|---|
| ||
export const quotesDetailNew = ({api}) => {
api.notify.success('New quote created interceptor');
}; |
This example will show green notification when a user create a new quote.
Or in case that you know exactly what you need you can squeeze it a little bit more.
Code Block | ||
---|---|---|
| ||
export const quotesDetailNew = ({ api: { notify } }) => {
notify.success("New quote created interceptor 2");
}; |
If you have no clue what you get, you can always observe that parameter thru web browser developer tools by using key word debugger.
Code Block |
---|
export const quotesDetailNew = (parameter) => {
debugger;
}; |