You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hoodie client needs to do some asynchronous cross-module initialisation, see hoodiehq/hoodie-client#3. Tradition events did not work for us as we for example need to be able to intercept a signout if the user has local changes and sync did fail.
For a lack of better alternatives, we introduced hidden events that pass options.hooks that can be used to add promises which have to be resolved before the actual method gets executed.
Example:
hoodie.account.on('pre:signout',function(options){options.hooks.push(function(){returnhoodie.store.push().catch(function(error){if(error.status!==401){throwerror}error.message='Local changes could not be synced, sign in first'throwerror})})})
hoodie.account.hook.before('signout',function(options){returnhoodie.store.push().catch(function(error){if(error.status!==401){throwerror}error.message='Local changes could not be synced, sign in first'throwerror})})
The text was updated successfully, but these errors were encountered:
📋 part of hoodiehq/camp#101
Hoodie client needs to do some asynchronous cross-module initialisation, see hoodiehq/hoodie-client#3. Tradition events did not work for us as we for example need to be able to intercept a signout if the user has local changes and sync did fail.
For a lack of better alternatives, we introduced hidden events that pass
options.hooks
that can be used to add promises which have to be resolved before the actual method gets executed.Example:
Based on the discussion at hoodiehq/hoodie-client#42 I created before-after-hook with which we can change the above to
The text was updated successfully, but these errors were encountered: