-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop turbo dependency and rely on vanilla action cable
- Loading branch information
1 parent
5c80e36
commit 1e7cd99
Showing
20 changed files
with
3,503 additions
and
10,602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class HotwireSpark::Channel < ActionCable::Channel::Base | ||
def subscribed | ||
stream_from "hotwire_spark" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import "./stream_actions" | ||
import HotwireSpark from "./index.js" | ||
|
||
export function log(...args) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { HtmlReloader } from "./reloaders/html_reloader.js" | ||
import { CssReloader } from "./reloaders/css_reloader.js"; | ||
import { StimulusReloader } from "./reloaders/stimulus_reloader.js"; | ||
import { nameFromFilePath } from "./helpers.js"; | ||
import { createConsumer } from "@rails/actioncable" | ||
|
||
export class ReloadingMonitor { | ||
static start() { | ||
new ReloadingMonitor().start() | ||
} | ||
|
||
start() { | ||
const consumer = createConsumer() | ||
|
||
consumer.subscriptions.create({ channel: "HotwireSpark::Channel" }, { | ||
received(data) { | ||
this.dispatchMessage(data) | ||
}, | ||
|
||
dispatchMessage({ action, path }) { | ||
const filePath = nameFromFilePath(path) | ||
switch (action) { | ||
case "reload_html": | ||
this.reloadHtml() | ||
break | ||
case "reload_css": | ||
this.reloadCss(filePath) | ||
break | ||
case "reload_stimulus": | ||
this.reloadStimulus(filePath) | ||
break | ||
} | ||
}, | ||
|
||
reloadHtml() { | ||
HtmlReloader.reload() | ||
}, | ||
|
||
reloadCss(path) { | ||
CssReloader.reload(new RegExp(path)) | ||
}, | ||
|
||
reloadStimulus(path) { | ||
StimulusReloader.reload(new RegExp(path)) | ||
} | ||
}) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
app/javascript/hotwire_spark/stream_actions/reload_stimulus.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require "turbo-rails" | ||
require "action_cable/server/base" | ||
|
||
module HotwireSpark | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters