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
...
<script>exportdefault{onstate({ changed, current, previous }){/** * This fires on every state change, before the render. * The first time it runs, `previous` is undefined. * * Since this happens before the actual render, any manual * DOM access/manipulation should be done in the 'onupdate' lifecycle. */if(changed.time){console.log(`time changed: ${previous&&previous.time} -> ${current.time}`);}},oncreate(){/** This fires when the component has been rendered to the DOM */console.log('in oncreate');this.interval=setInterval(()=>{this.set({time: newDate()});},1000);},onupdate({ changed, current, previous }){/** * This fires after 'oncreate', and after every state * change once the DOM is synchronised with the data */console.log(`The DOM has been updated`);},ondestroy(){/** This fires when the component is removed from the DOM */console.log('in ondestroy');clearInterval(this.interval);}}...</script>
Related to: sveltejs/svelte#1522 (comment)
My first attempt:
cc @jacwright
The text was updated successfully, but these errors were encountered: