[Webkit-unassigned] [Bug 134330] New: Why is the WKScriptMessage API only one way?
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jun 25 20:37:52 PDT 2014
https://bugs.webkit.org/show_bug.cgi?id=134330
Summary: Why is the WKScriptMessage API only one way?
Product: WebKit
Version: 528+ (Nightly build)
Platform: Unspecified
OS/Version: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebKit API
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: webkit.org at ricciadams.com
The WKScriptMessage/WKScriptMessageHandler API is very useful for sending JSON/plist-esque messages up to the Objective-C from JavaScript. However, it's currently a pain to do the reverse and send messages down to the JavaScript layer (unless I have missed an API call somewhere ;) )
I understand that -[WKWebView evaluateJavaScript:completionHandler:] is being added, and that's great! However, if I want to send a Plist-esque object down to JavaScript, it's still a pain to go through. From an API perspective, it seems weird that you have this nice JS object->Obj-C object converter, but it's only one way and you like a nice Obj-C -> JS object converter.
What I would like to see is something like the following:
1) Add -[WKUserContentController postMessageWithBody:name:]. Body would take an (NSNumber, NSString, NSDate, NSArray, NSDictionary, or NSNull). Name would be the name of the message handler
2) On the JavaScript side, this would dispatch a ScriptMessageEvent event that users could listen to via window.webkit.messageHandlers.<name>.addEventListener("message"...
(API name are just a suggestion, I'm more concerned about the functionality).
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list