Messaging

Hierarchy

  • DebugToolsMessages

Methods

  • The initial handshake - this is the first thing called to determine the feature set supported by the native platform in question

    {
    "features": {
    "remoteResources": {
    "resources": [
    {
    "id": "privacy-configuration",
    "url": "https://staticcdn.duckduckgo.com/trackerblocking/config/v2/macos-config.json",
    "name": "Privacy Config"
    },
    {
    "id": "tracker-data-set",
    "url": "https://staticcdn.duckduckgo.com/trackerblocking/v3/apple-tds.json",
    "name": "Tracker Data Set (TDS)"
    }
    ]
    }
    }
    }

    Returns Promise<GetFeaturesResponse>

  • Retrieve a single Remote Resource.

    In this example current represents what the platform has currently applied. See RemoteResource for the other variants (for example, a debug-tools override)

    {
    "id": "privacy-configuration",
    "url": "https://staticcdn.duckduckgo.com/trackerblocking/config/v2/macos-config.json",
    "name": "Privacy Config",
    "current": {
    "source": {
    "remote": {
    "url": "https://staticcdn.duckduckgo.com/trackerblocking/config/v2/macos-config.json",
    "fetchedAt": "2023-07-05T12:34:56Z"
    }
    },
    "contents": "{\n \"foo\": \"bar\"\n}",
    "contentType": "application/json"
    }
    }

    Parameters

    Returns Promise<RemoteResource>

  • Get the currently open tabs. This is used to target certain modifications to a particular domain if possible.

    For example, applying a domain exception for a particular feature

    {
    "tabs": [
    {
    "id": "957670663",
    "url": "https://duckduckgo.com/extension-success?atb=v386-1",
    "title": "Privacy, simplified. — DuckDuckGo Browser Extension & Mobile App"
    },
    {
    "id": "957670668",
    "url": "https://browsersync.io/",
    "title": "Browsersync - Time-saving synchronised browser testing"
    }
    ]
    }

    Returns Promise<GetTabsResponse>

  • Updating a resource is used in all cases where we want to make a change, for example

    • refreshing the currently applied file
    • overriding the current resource with a new URL
    • overriding the current resource with a string from the debug panel

    For native implementors, you should assume any message received here is an indication to reload any rules/resources related to it. It's a fresh start for the resource in question.

    Example: updating to a new remote resource

    This occurs when we want to fetch a resource fresh and apply it. Note this URL might match what's already applied - and that's fine, you should ALWAYS re-fetch it.

    params:

    {
    "id": "privacy-configuration",
    "source": {
    "remote": {
    "url": "https://example.com/macos-config.json"
    }
    }
    }

    returns: RemoteResource


    Example: applying local edits

    This occurs when a resource was edited in the panel.

    Note You should accept the string verbatim, just as you would from a remote. And then re-apply any relevant rules

    {
    "id": "privacy-configuration",
    "source": {
    "debugTools": {
    "content": "{ \"foo\": \"baz\" }"
    }
    }
    }

    returns: RemoteResource

    Parameters

    Returns Promise<RemoteResource>

Generated using TypeDoc