diff --git a/README.md b/README.md index f1aa4e7..69e2262 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,10 @@ config :my_app, MyAppWeb.Endpoint, ] ``` -Next, you'll need to listen for the `"phx:live_reload:connected"` event and enable client logging by calling the reloader's `enableServerLogs()` function, for example: +Next, you'll need to listen for the `"phx:live_reload:attached"` event and enable client logging by calling the reloader's `enableServerLogs()` function, for example: ```javascript -window.addEventListener("phx:live_reload:connected", ({detail: reloader}) => { +window.addEventListener("phx:live_reload:attached", ({detail: reloader}) => { // enable server log streaming to client. // disable with reloader.disableServerLogs() reloader.enableServerLogs() @@ -55,10 +55,10 @@ Many times it's useful to inspect the HTML DOM tree to find where markup is bein export PLUG_EDITOR="vscode://file/__FILE__:__LINE__" ``` -The `vscode://` protocol URL will open vscode with placeholders of `__FILE__:__LINE__` substited at runtime. Check your editor's documentation on protocol URL support. To open your configured editor URL when an element is clicked, say with alt-click, you can wire up an event listener within your `"phx:live_reload:connected"` callback and make use of the reloader's `openEditorAtCaller` and `openEditorAtDef` functions, passing the event target as the DOM node to reference for HEEx file:line annotation information. For example: +The `vscode://` protocol URL will open vscode with placeholders of `__FILE__:__LINE__` substited at runtime. Check your editor's documentation on protocol URL support. To open your configured editor URL when an element is clicked, say with alt-click, you can wire up an event listener within your `"phx:live_reload:attached"` callback and make use of the reloader's `openEditorAtCaller` and `openEditorAtDef` functions, passing the event target as the DOM node to reference for HEEx file:line annotation information. For example: ```javascript -window.addEventListener("phx:live_reload:connected", ({detail: reloader}) => { +window.addEventListener("phx:live_reload:attached", ({detail: reloader}) => { // Enable server log streaming to client. Disable with reloader.disableServerLogs() reloader.enableServerLogs() diff --git a/priv/static/phoenix_live_reload.js b/priv/static/phoenix_live_reload.js index c2266b4..ab4ae19 100644 --- a/priv/static/phoenix_live_reload.js +++ b/priv/static/phoenix_live_reload.js @@ -121,7 +121,7 @@ class LiveReloader { } dispatchConnected(){ - parent.dispatchEvent(new CustomEvent("phx:live_reload:connected", {detail: this})) + parent.dispatchEvent(new CustomEvent("phx:live_reload:attached", {detail: this})) } log(level, str){