Skip to content

_Prtcl dev guide 7: Displaying an entity

guillem.cordoba edited this page Nov 12, 2019 · 4 revisions

In your index.html, let's include these elements inside our body:

<module-container>
    <cortex-entity id="root-entity"></cortex-entity>
</module-container>

The module-container element serves to access any dependency stored in the MicroOrchestrator from any element defined inside its structure.

And (more importantly) the cortex-entity element serves to fetch and render any kind of content-addressable object from its hash, using all the modules we have loaded in our application. It is the entry point for the @uprtcl/lenses generic rendering engine framework.

Now, let's create a text-node using our documentsProvider:

const createdDocumentId = await documentsProvider.createTextNode({
  text: 'Hi!',
  type: TextType.Paragraph,
  links: []
});

document.getElementById('root-entity').hash = createdDocumentId;

And that's it! If you load your project in a browser, you should see your text rendered.

Nice work! If you want to power up the funcionalities of your app, follow the trail to 8 - Adding the Evees module.

Developer guide

1 - Installing the tools

2 - Looking around

3 - Cortex modules

4 - Configuring service providers

5 - Configuring modules

6 - Loading modules with micro-orchestrator

7 - Displaying an entity

8 - Adding the Evees module

9 - Adding multiple backends

[TBD]10 - adding lens selection

[TBD] Using Cortex without modules

[TBD] Building a pattern

[TBD] Building a lens

[TBD] Building a service provider

[TBD] Building a Cortex module

[TBD] Customizing the lenses module

[TBD] Building a plugin for the lenses module

Clone this wiki locally