Class: Turbo::ScriptMessageHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo/web_view/script_message_handler.rb

Overview

This class prevents retain cycle caused by WKUserContentController

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#delegateObject

Returns the value of attribute delegate.



5
6
7
# File 'lib/turbo/web_view/script_message_handler.rb', line 5

def delegate
  @delegate
end

Instance Method Details

#initWithDelegate(delegate) ⇒ Object



7
8
9
10
# File 'lib/turbo/web_view/script_message_handler.rb', line 7

def initWithDelegate(delegate)
  self.delegate = delegate
  self
end

#userContentController(userContentController, didReceiveScriptMessage: message) ⇒ Object



12
13
14
# File 'lib/turbo/web_view/script_message_handler.rb', line 12

def userContentController(userContentController, didReceiveScriptMessage: message)
  delegate.scriptMessageHandlerDidReceiveMessage(message) if delegate
end