Quickstart and Big Stones

Note

If this is your first time here, don’t glance over this. Read this page out loud to your pet duck to ensure understanding!

A Boring Chapter of Concepts

Condution’s API follows an Event Based programming paradigm. We make heavy use of the Async/Await syntax of TypeScript in order to create fast and responsive hooks into live-editing enviroments. (Remember, Workspaces exist!) So, if you don’t know what those are, read the linked resources.

If you don’t know how Condution (the app) works, please try it. Condution’s API is much easier to explain after you know how the app itself works.

Ok. I am going to assume that you tried it, and now know basic concepts.

A Quick(ish)start

1. Make yoself a package

Anything that you do with Condution’s API will likely be presented as an npm package. So, it’d be helpful for you to make one of those to work in.

When we say something is “Stable”, its tested against Node 14 and yarn 1.22. If you don’t know what those are, install this and this, but you should really teach yourself the ways of the soydev. The documentation uses these tools in these versions as well.

Once you have installed these lovely tools, open yourself a terminal, make yourself a folder, change directory into it and type npm create. Pay close attention to package name and entry point questions that NPM ask you — the former being the name of your intergration, and the latter being the file that you should be working in/launching your intergration from.

Make a file named index.js or whatever you named your entry point to be in that same folder. Finally, type yarn add @condution/engine to install Condution’s engine API package to your package. Start working there.

2. Get yoself a context

To start working with the Condution API, you will need a Context. A Context is a badge for authentication into Condution, and tells the API which servers (“Providers”) you need to connect to.

Basically every Object/Widget function needs a Context to run, otherwise it won’t know what/where to fetch.

For details, take a look at the article Context. But, for the lethargic, here’s a minimal MVP that sets up such a Context with a Firebase — the default storage option for Condution’s GUI — connection.

// import the engine
const Engine = require("@condution/engine");

// import a Context, a ReferenceManager, and a FirebaseProvider
let { ReferenceManager, Context, FirebaseProvider } = Engine;

// instantiate a FirebaseProvider with no args. This, by default
// contains the pointer to the live production database
let provider = new FirebaseProvider();

// create a ReferenceManager (also known as a "database cursor")
// with just that one provider. Feel free, of course, to instantiate
// any other Providers as you wish based on their docs and add 'em
// to the list
let rm = new ReferenceManager([provider]);

// and, finally, make the context that you've always wanted
let context = new Context(rm);

// tell context to use the Firebase provider
context.useProvider("firebase");