Class: Dommy::Rack::PageNavigationDelegate
- Inherits:
-
Object
- Object
- Dommy::Rack::PageNavigationDelegate
- Defined in:
- lib/dommy/rack/session.rb
Overview
The NavigationDelegate (Dommy::Navigation port) attached to each page's window: it forwards a page-initiated navigation/traversal intent to the owning Session (which defers and performs it at the next drain). Bound to the specific window so a stale, navigated-away page cannot steer the session — the Session checks window identity before recording.
Instance Method Summary collapse
-
#initialize(session, window) ⇒ PageNavigationDelegate
constructor
A new instance of PageNavigationDelegate.
- #navigate(url:, source:, method: "GET", body: nil, params: nil, enctype: nil, headers: {}, replace: false) ⇒ Object
- #traverse(delta) ⇒ Object
Constructor Details
#initialize(session, window) ⇒ PageNavigationDelegate
Returns a new instance of PageNavigationDelegate.
15 16 17 18 |
# File 'lib/dommy/rack/session.rb', line 15 def initialize(session, window) @session = session @window = window end |
Instance Method Details
#navigate(url:, source:, method: "GET", body: nil, params: nil, enctype: nil, headers: {}, replace: false) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/dommy/rack/session.rb', line 20 def navigate(url:, source:, method: "GET", body: nil, params: nil, enctype: nil, headers: {}, replace: false) @session.(@window, { url: url, method: method, body: body, params: params, enctype: enctype, headers: headers, replace: replace, source: source }) end |
#traverse(delta) ⇒ Object
27 28 29 |
# File 'lib/dommy/rack/session.rb', line 27 def traverse(delta) @session.__enqueue_page_traverse__(@window, delta) end |