How to reproduce
beforeSave hooks for the same class:Parse.Cloud.beforeSave('TestClass', (req, res) => {
console.log('Test');
res.success();
});
Parse.Cloud.beforeSave('TestClass', (req, res) => {
console.log('Test 2');
res.success();
});
Expected outcome:
Two console logs - Test and Test2
Actual outcome:
Only one console log of last added hook - Test2
So is it not possible to have multiple hooks for the same object?
Why would you like to do that anyways?
@jonas-db - Why old 'event' is deleted when I add new one? It's like removing all click events on page, when adding new one.
I add beforeSave event from more than one place in my codebase.
Those are not events, but hooks. Only the last one will be processed.
And no, this is not possible also, that prevents aweful side effects as you can't really guarantee the order of execution