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.

import { Messaging, WebkitMessagingConfig } from "@duckduckgo/content-scope-scripts/lib/messaging.js"

// This config would be injected into the UserScript
const injectedConfig = {
hasModernWebkitAPI: true,
webkitMessageHandlerNames: ["foo", "bar", "baz"],
secret: "dax",
};

// Then use that config to construct platform-specific configuration
const config = new WebkitMessagingConfig(injectedConfig);

// finally, get an instance of Messaging and start sending messages in a unified way 🚀
const messaging = new Messaging(config);
messaging.notify("hello world!", {foo: "bar"})

Index

Classes

Generated using TypeDoc