Skip to content

Commit

Permalink
attempt n.2: view-transition
Browse files Browse the repository at this point in the history
  • Loading branch information
mssantos committed Dec 27, 2023
1 parent 11d2e9e commit 1cb3377
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/js/phoenix_live_view/live_socket.js
Expand Up @@ -275,7 +275,7 @@ export default class LiveSocket {
}

requestDOMUpdate(callback){
const transition = document.startViewTransition(() => this.transitions.after(callback));
this.transitions.after(callback)
}

transition(time, onStart, onDone = function(){}){
Expand Down
2 changes: 1 addition & 1 deletion assets/js/phoenix_live_view/view.js
Expand Up @@ -245,7 +245,7 @@ export default class View {
applyDiff(type, rawDiff, callback){
this.log(type, () => ["", clone(rawDiff)])
let {diff, reply, events, title} = Rendered.extract(rawDiff)
callback({diff, reply, events})
document.startViewTransition(() => callback({diff, reply, events}))
if(title){ window.requestAnimationFrame(() => DOM.putTitle(title)) }
}

Expand Down

0 comments on commit 1cb3377

Please sign in to comment.