-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intercepting beforeRemove or remove events #227
Comments
This might be counter-intuitive but "beforeRemove" is a static event emitted by the constructor (the model-definition), and the You can try creating a listener on the constructor itself like this: geddy.model.Photo.on('beforeRemove', function () { // Do stuff }); |
I found out the problem... The Placing the (I wanted the callbacks inside the model file) Thanks! |
Glad you were able to figure it out! |
@mde , there is a problem that I'm facing right now... Because of that, I'm not able to do async stuff, because i don't have the model properties... Just found a bug? |
The 'beforeRemove' might be better implemented as an instance method, yes. Let's reopen and reexamine. |
In my mind, it should follow the same patter as before[Something], witch is: calling the event handler with a parameter that is the model itself. The problem with that, is that it won't be compatible with older versions (since the current one callsback with the Id only). So, we have two options that I can think about:
What do you think? |
My model looks like this:
It should be listening for
beforeRemove
events, but it isn't... The max I get, is theafterCreate
callback.Have tried this before, but without succeeding (inside the model):
Is there anything in the docs explaining this?
Thanks
The text was updated successfully, but these errors were encountered: