Skip to content

Commit b62da0f

Browse files
committed
Embed setSphericalProperties in an anonymous js function to omit the invalid return type
#69
1 parent 765ab32 commit b62da0f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Sources/API/YouTubePlayer+360DegreePerspectiveAPI.swift

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public extension YouTubePlayer {
4646
function: "setSphericalProperties",
4747
parameters: jsonString
4848
)
49+
.embedInAnonymousFunction()
4950
)
5051
}
5152

Sources/WebView/YouTubePlayerWebView+Evaluate.swift

+11
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ extension YouTubePlayerWebView.JavaScript {
5656

5757
}
5858

59+
// MARK: - YouTubePlayerWebView+JavaScript+embedInAnonymousFunction
60+
61+
extension YouTubePlayerWebView.JavaScript {
62+
63+
/// Embed JavaScript in an anonymous function
64+
func embedInAnonymousFunction() -> Self {
65+
.init("(function(){\(self.rawValue)})()")
66+
}
67+
68+
}
69+
5970
// MARK: - YouTubePlayerWebView+evaluate
6071

6172
extension YouTubePlayerWebView {

0 commit comments

Comments
 (0)