Class: Turbo::Session
- Inherits:
-
Object
- Object
- Turbo::Session
- Includes:
- NavigationDelegateMethods, SessionDelegateMethods, VisitDelegateMethods, VisitableDelegateMethods, WebViewDelegateMethods
- Defined in:
- lib/turbo/session/session.rb,
lib/turbo/session/visit_delegate_methods.rb,
lib/turbo/session/session_delegate_methods.rb,
lib/turbo/session/web_view_delegate_methods.rb,
lib/turbo/session/visitable_delegate_methods.rb,
lib/turbo/session/navigation_delegate_methods.rb
Overview
A Session represents the main interface for managing a Turbo app in a web view. Each Session manages a single web view so you should create multiple sessions to have multiple web views, for example when using modals or tabs
Defined Under Namespace
Modules: NavigationDelegateMethods, SessionDelegateMethods, VisitDelegateMethods, VisitableDelegateMethods, WebViewDelegateMethods
Instance Attribute Summary collapse
-
#activatedVisitable ⇒ Object
readonly
Returns the value of attribute activatedVisitable.
-
#bridge ⇒ Object
writeonly
Sets the attribute bridge.
-
#currentVisit ⇒ Object
readonly
Returns the value of attribute currentVisit.
-
#delegate ⇒ Object
Returns the value of attribute delegate.
-
#initialized ⇒ Object
readonly
Returns the value of attribute initialized.
-
#pathConfiguration ⇒ Object
Returns the value of attribute pathConfiguration.
-
#refreshing ⇒ Object
readonly
Returns the value of attribute refreshing.
-
#topmostVisit ⇒ Object
readonly
Returns the value of attribute topmostVisit.
-
#topmostVisitable ⇒ Object
readonly
The topmost visitable is the visitable that has most recently completed a visit.
-
#webView ⇒ Object
Returns the value of attribute webView.
Attributes included from NavigationDelegateMethods
Instance Method Summary collapse
-
#activeVisitable ⇒ Object
The active visitable is the visitable that currently owns the web view.
- #clearSnapshotCache ⇒ Object
- #init ⇒ Object
- #initWithConfiguration(configuration) ⇒ Object
- #initWithWebView(webView) ⇒ Object
- #makeVisit(visitable, options: options) ⇒ Object
- #reload ⇒ Object
- #visitVisitable(visitable, options: options, reload: reload) ⇒ Object
Methods included from NavigationDelegateMethods
#externallyOpenableURL, #isMainFrameNavigation, #policy, #shouldOpenURLExternally, #shouldReloadPage
Methods included from SessionDelegateMethods
#session, #sessionDidFinishFormSubmission, #sessionDidFinishRequest, #sessionDidLoadWebView, #sessionDidStartFormSubmission, #sessionDidStartRequest
Methods included from WebViewDelegateMethods
Methods included from VisitableDelegateMethods
#visitableDidRequestRefresh, #visitableDidRequestReload, #visitableViewDidAppear, #visitableViewWillAppear
Methods included from VisitDelegateMethods
#visit, #visitDidComplete, #visitDidFail, #visitDidFinish, #visitDidInitializeWebView, #visitDidRender, #visitDidStart, #visitRequestDidFinish, #visitRequestDidStart, #visitWillLoadResponse, #visitWillStart
Instance Attribute Details
#activatedVisitable ⇒ Object (readonly)
Returns the value of attribute activatedVisitable.
14 15 16 |
# File 'lib/turbo/session/session.rb', line 14 def activatedVisitable @activatedVisitable end |
#bridge=(value) ⇒ Object
Sets the attribute bridge
13 14 15 |
# File 'lib/turbo/session/session.rb', line 13 def bridge=(value) @bridge = value end |
#currentVisit ⇒ Object (readonly)
Returns the value of attribute currentVisit.
14 15 16 |
# File 'lib/turbo/session/session.rb', line 14 def currentVisit @currentVisit end |
#delegate ⇒ Object
Returns the value of attribute delegate.
13 14 15 |
# File 'lib/turbo/session/session.rb', line 13 def delegate @delegate end |
#initialized ⇒ Object (readonly)
Returns the value of attribute initialized.
14 15 16 |
# File 'lib/turbo/session/session.rb', line 14 def initialized @initialized end |
#pathConfiguration ⇒ Object
Returns the value of attribute pathConfiguration.
13 14 15 |
# File 'lib/turbo/session/session.rb', line 13 def pathConfiguration @pathConfiguration end |
#refreshing ⇒ Object (readonly)
Returns the value of attribute refreshing.
14 15 16 |
# File 'lib/turbo/session/session.rb', line 14 def refreshing @refreshing end |
#topmostVisit ⇒ Object (readonly)
Returns the value of attribute topmostVisit.
14 15 16 |
# File 'lib/turbo/session/session.rb', line 14 def topmostVisit @topmostVisit end |
#topmostVisitable ⇒ Object (readonly)
The topmost visitable is the visitable that has most recently completed a visit
56 57 58 |
# File 'lib/turbo/session/session.rb', line 56 def topmostVisitable @topmostVisitable end |
#webView ⇒ Object
Returns the value of attribute webView.
13 14 15 |
# File 'lib/turbo/session/session.rb', line 13 def webView @webView end |
Instance Method Details
#activeVisitable ⇒ Object
The active visitable is the visitable that currently owns the web view
61 62 63 |
# File 'lib/turbo/session/session.rb', line 61 def activeVisitable activatedVisitable end |
#clearSnapshotCache ⇒ Object
113 114 115 |
# File 'lib/turbo/session/session.rb', line 113 def clearSnapshotCache bridge.clearSnapshotCache end |
#init ⇒ Object
21 22 23 |
# File 'lib/turbo/session/session.rb', line 21 def init initWithConfiguration(WKWebViewConfiguration.alloc.init) end |
#initWithConfiguration(configuration) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/turbo/session/session.rb', line 25 def initWithConfiguration(configuration) webViewConfiguration = configuration webView = WKWebView.alloc.initWithFrame(CGRectZero, configuration: webViewConfiguration) webView.layer.borderColor = UIColor.blueColor webView.layer.borderWidth = 2 initWithWebView(webView) end |
#initWithWebView(webView) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/turbo/session/session.rb', line 34 def initWithWebView(webView) @webView = webView @initialized = false @refreshing = false setup self end |
#makeVisit(visitable, options: options) ⇒ Object
97 98 99 100 101 102 103 104 |
# File 'lib/turbo/session/session.rb', line 97 def makeVisit(visitable, options: ) if initialized restorationIdentifier = restorationIdentifierForVisitable(visitable) JavaScriptVisit.alloc.initWithVisitable(visitable, options: , bridge: bridge, restorationIdentifier: restorationIdentifier) else ColdBootVisit.alloc.initWithVisitable(visitable, options: , bridge: bridge) end end |
#reload ⇒ Object
106 107 108 109 110 111 |
# File 'lib/turbo/session/session.rb', line 106 def reload return unless visitable = topmostVisitable @initialized = false visitVisitable(visitable) @topmostVisit = currentVisit end |
#visitVisitable(visitable, options: options, reload: reload) ⇒ Object
65 66 67 |
# File 'lib/turbo/session/session.rb', line 65 def visitVisitable(visitable) visitVisitable(visitable, options: nil) end |