// This config would be injected into the UserScript constinjectedConfig = { hasModernWebkitAPI:true, webkitMessageHandlerNames: ["foo", "bar", "baz"], secret:"dax", };
// Then use that config to construct platform-specific configuration constconfig = newWebkitMessagingConfig(injectedConfig);
// finally, get an instance of Messaging and start sending messages in a unified way 🚀 constmessaging = newMessaging(config); messaging.notify("hello world!", {foo:"bar"})
Description
A wrapper for messaging on WebKit platforms. It supports modern WebKit messageHandlers along with encryption for older versions (like macOS Catalina)
Note: If you wish to support Catalina then you'll need to implement the native part of the message handling, see WebkitMessagingTransport for details.