This is an example AD4M Language project which implements simple text notes stored in IPFS objects.
The whole project compiles and bundles to one file: build/bundle.js
.
This happens in two steps:
- The Icons (AD4M-speak for UI components) ConstructorIcon.svelte and (Icon.svelte)[Icon.svelte] get compiled to
build/ConstructorIcon.js
andbuild/Icon.js
respectively as web components. This first step is configured with rollup.config.icons.js - index.ts gets compiled and bundled to
build/bundle.js
. During this bundling step,rollup-plugin-string
is used to include the two web component files that represent the Icons as string literals inside the resulting bundle.
The create()
function returned by the resulting bundle.js
will receive a parameter when executed inside Perspectivism: an instance of LanguageContext. This includes the Agent object and interfaces to storage implementations - currently only IPFS but very soon Holochain and others.
Here, the IPFS object gets passed on to the constructor of the ExpressionAdapter so it can be used to store expression in IPFS files.