-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `FrameController` depends on the application's singleton `Session` instance in several ways: * it drives the `History` * it determines whether or not an `Element` is "enabled" to navigate a page or frame * it preloads links * it dispatches `turbo:frame-render` and `turbo:frame-load` events * it can initiate a `Visit` This commit codifies those dependent behaviors by creating the `DriveDelegate` interface and declaring the `Session` class as an extension of that interface. With the codification of the `DriveDelegate` responsibilities established, managing `turbo:frame-render` and `turbo:frame-load` events feels out of scope. To resolve that, this commit migrates the `Session.frameRendered` and `Session.frameLoaded` methods to the `FrameController`, and omits them from the `DriveDelegate` interface. The `FrameController` still directly imports the singleton instance of the `Session` from the `src/core/index` module, but assigns it to a `delegate: DriveDelegate` property for use throughout the class. The next step would be to find a way to forward the `session` instance into the [FrameElement.delegateConstructor][] assignment. [FrameElement.delegateConstructor]: https://github.com/hotwired/turbo/blob/3a18111412cb4190b818b96c9c6aad7264cc4441/src/elements/index.ts#L6
- Loading branch information
1 parent
80ea697
commit 680b662
Showing
5 changed files
with
64 additions
and
62 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
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