ClassBasedOnClickListener
public struct ClassBasedOnClickListener
A ClassBasedOnClickListener takes a closure which is performed if a given html class is clicked. The closure will reveice the content of the specified parameter.
Eg. A ClassBasedOnClickListener with the className quote and parameterName id with the given epub html content <section class="quote" id="12345"> would call the given closure on a click on this section with the String 12345 as parameter.
-
The name of the URL scheme which should be used. Note: Make sure that the given
Stringis a valid as scheme name.Declaration
Swift
public var schemeName: String -
The query selector for the elements which the listener should be added to. See https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector for further information about query selectors.
Declaration
Swift
public var querySelector: String -
The name of the attribute whose content should be passed to the
onClickActionaction.Declaration
Swift
public var attributeName: String -
Whether the listener should be added to all found elements or only to the first one. See https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll for further information. The default value is
true.Declaration
Swift
public var selectAll: Bool -
The closure which will be called if the specified class was clicked.
attributeContentcontains the string content of the specified attribute andtouchPointRelativeToWebViewreprsents the touch point relative to the web view.Declaration
Swift
public var onClickAction: ((_ attributeContent: String?, _ touchPointRelativeToWebView: CGPoint) -> Void) -
Initializes a
ClassBasedOnClickListenerinstance. Append it to theclassBasedOnClickListenersproperty from theFolioReaderConfigto receive on click events. The defaultselectAllvalue istrue.Declaration
Swift
public init(schemeName: String, querySelector: String, attributeName: String, selectAll: Bool = true, onClickAction: @escaping ((_ attributeContent: String?, _ touchPointRelativeToWebView: CGPoint) -> Void))Parameters
schemeNameThe name of the URL scheme which should be used. Note: Make sure that the given
Stringis a valid as scheme name.querySelectorThe query selector for the elements which the listener should be added to. See https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector for further information about query selectors.
attributeNameThe name of the attribute whose content should be passed to the
onClickActionaction.selectAllWhether the listener should be added to all found elements or only to the first one. See https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll for further information. The default value is
true.onClickActionThe closure which will be called if the specified class was clicked.
attributeContentcontains the string content of the specified attribute andtouchPointRelativeToWebViewreprsents the touch point relative to the web view.
View on GitHub
Install in Dash
ClassBasedOnClickListener Structure Reference