Open ghstahl opened 8 years ago
Can we start a Gotchas readme?
RiotControl .on and .off need to match in your riotjs tags. Don't forget to unregister your RiotControl event handlers if you are registering them in your mount.
<myTag> <script> var self = this; self.onAspNetRolesChanged = (data) =>{ console.log('aspnet_roles_changed',data) } self.onAspNetUserChanged= (data) =>{ console.log('aspnet_user_changed',data) } self.on('before-mount',function(){ console.log('on before-mount: aspnet-user-detail'); RiotControl.on('aspnet_roles_changed', self.onAspNetRolesChanged); RiotControl.on('aspnet_user_changed', self.onAspNetUserChanged); }); self.on('unmount', function() { RiotControl.off('aspnet_roles_changed', self.onAspNetRolesChanged); RiotControl.off('aspnet_user_changed', self.onAspNetUserChanged); }) </script> </myTag>
I was wondering why my self.onAspNetUserChanged kept stacking. On every subsequent mount, I was adding a new event handler.
Goes along with #18
Can we start a Gotchas readme?
RiotControl .on and .off need to match in your riotjs tags.
Don't forget to unregister your RiotControl event handlers if you are registering them in your mount.
I was wondering why my self.onAspNetUserChanged kept stacking. On every subsequent mount, I was adding a new event handler.