Class: Turbo::JavaScriptVisit

Inherits:
Visit
  • Object
show all
Defined in:
lib/turbo/visit/javascript_visit.rb

Overview

A JavaScript managed visit through the Turbo library All visits are JavaScriptVisits except the initial ColdBootVisit or if a reload() is issued

Instance Attribute Summary collapse

Attributes inherited from Visit

#bridge, #delegate, #hasCachedSnapshot, #location, #options, #restorationIdentifier, #state, #visitable

Instance Method Summary collapse

Methods inherited from Visit

#cancel, #complete, #completeVisit, #fail, #start

Instance Attribute Details

#hasCachedSnapshot=(value) ⇒ Object (writeonly)

Sets the attribute hasCachedSnapshot



6
7
8
# File 'lib/turbo/visit/javascript_visit.rb', line 6

def hasCachedSnapshot=(value)
  @hasCachedSnapshot = value
end

#identifierObject



7
8
9
# File 'lib/turbo/visit/javascript_visit.rb', line 7

def identifier
  @identifier ||= "(pending)"
end

Instance Method Details

#cancelVisitObject



27
28
29
30
31
# File 'lib/turbo/visit/javascript_visit.rb', line 27

def cancelVisit
  log("cancelVisit")
  bridge.cancelVisitWithIdentifier(identifier)
  finishRequest
end

#descriptionObject



17
18
19
# File 'lib/turbo/visit/javascript_visit.rb', line 17

def description
  "<#{dynamicType} #{identifier}: state=#{state} location=#{location}>"
end

#failVisitObject



33
34
35
36
# File 'lib/turbo/visit/javascript_visit.rb', line 33

def failVisit
  log("failVisit")
  finishRequest
end

#initWithVisitable(visitable, options: options, bridge: bridge, restorationIdentifier: restorationIdentifier) ⇒ Object



11
12
13
14
15
# File 'lib/turbo/visit/javascript_visit.rb', line 11

def initWithVisitable(visitable, options: options, bridge: bridge, restorationIdentifier: restorationIdentifier)
  initWithVisitable(visitable, options: options, bridge: bridge)
  self.restorationIdentifier = restorationIdentifier
  self
end

#startVisitObject



21
22
23
24
25
# File 'lib/turbo/visit/javascript_visit.rb', line 21

def startVisit
  log("startVisit")
  bridge.visitDelegate = self
  bridge.visitLocation(location, withOptions: options, restorationIdentifier: restorationIdentifier)
end

#webView(webView, didCompleteVisitWithIdentifier: identifier, restorationIdentifier: restorationIdentifier) ⇒ Object

WebViewVisitDelegate



40
41
42
43
44
45
46
# File 'lib/turbo/visit/javascript_visit.rb', line 40

def webView(webView, didStartVisitWithIdentifier: identifier, hasCachedSnapshot: hasCachedSnapshot)
  log("didStartVisitWithIdentifier", arguments: { identifier: identifier, hasCachedSnapshot: hasCachedSnapshot })
  self.identifier = identifier
  self.hasCachedSnapshot = hasCachedSnapshot

  delegate.visitDidStart(self) if delegate
end