Partial Match
This plugin enables users to map matches of assets to any arbitrary value in a partial-match-registry. For each asset in a resolved view, the matches will be computed.
Usage
Create a registry and add matches:
import { Registry } from "@player-ui/partial-match-registry";
const registry = new Registry([[{ type: "action" }, "ABC"]]);
Add the registy to a plugin:
import { Player } from "@player-ui/player";import { PartialMatchFingerprintPlugin } from "@player-ui/partial-match-fingerprint-plugin";
const matchPlugin = new PartialMatchFingerprintPlugin(registry);
const player = new Player({ plugins: [matchPlugin],});
Query the plugin for matches:
const value = matchPlugin.get("asset-id"); // 'ABC'
This plugin is used by BaseAssetRegistry
to handle matching resolved asset nodes with their native implementation, to decode for rendering. It is unlikely to be needed to be used directly in iOS use cases.
CocoaPods
Add the subspec to your Podfile
pod 'PlayerUI'
Swift Usage
let plugin = PartialMatchFingerprintPlugin()
// iOS usage links the array position of a registered asset to its requested match object// The JavaScript part of this plugin will populate matches when the view is resolvingplugin.register(match: ["type": "text"], index: 1)
// get the index for the asset with matching ID if it was resolved in the core pluginplugin.get(assetId: "test")