JavaScript examples
JavaScript examples are in contentauth/c2pa-js-examples. The examples are mirrored from the examples directory in the contentauth/c2pa-js repository.
note
As noted in the overview, the JavaScript library uses a number of modern JavaScript technologies such as WebAssembly (Wasm) and Web Workers. To understand the JavaScript examples, you should be familiar with these technologies, TypeScript and at least one bundler tool such as Webpack, Rollup, or Vite.
Additionally, the JavaScript examples use TypeScript for type safety.
Examples
Example | Tooling | UI framework | Notes |
---|---|---|---|
esm-imports | None | None | The simplest example using vanilla JavaScript (ECMAScript). |
minimal-ts-webpack | Webpack | None | Uses TypeScript. |
minimal-ts-rollup | Rollup | None | Uses TypeScript. |
minimal-ts-vite | Vite | None | Uses TypeScript. Includes multiple examples; see below. |
react-ts-vite | Vite | React | Uses TypeScript. |
Minimal-ts-vite examples
The minimal-ts-vite
example directory contains these examples:
- active-manifest: Displays a simple table with info on the active manifest.
- cdn: Illustrates loading the JavaScript library from a content delivery network (CDN).
- check-provenance: Illustrates how to determine whether asset files have provenance.
- quick-start: Dumps the manifest store and active manifest to the JavaScript developer console.
- web-components: Displays a test image with the Content Credentials pin, using c2pa-wc