0.1.3 • Published 1 year ago

autonoma-datamanager v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Autonoma Datamanager

This tool enables third party developers to interact with the Autonoma database in a easy to use manner.

Installation

Install the Autonoma Datamanager with npm

  npm install autonoma-datamanager

After installation you have to copy the worker.js file (/node_modules/autonoma-datamanager/src/worker/worker.js) into your public directory. It must be accessible from root (E.g.: https://myDomain.com/worker.js)

Initialisation

import {initDatamanager} from "autonoma-datamanager";

initDatamanager(Your_Autonoma_Token);

The datamanger is linked to the window object and accessible through window.$dataManager afterwards.

Your can find your Autonoma Token in your Autonoma Profile. Click here for more information.

Usage

Create a function that you call when you want to load data. Inside this function, the Datamanager tries to load the data and call itself if data has changed.

// This example loads 
function loadData() {
	// GraphQL styled query
	const query = `{
		name
		image
		id
	}`;

	// Every instance needs a unique ID
	let id = (Math.random() + 1).toString(36).substring(7);

	window.$dataManager
		.get(id, "device", "*", query, () => {
			this.loadExample();
		})
		.then((response) => {
			// Do something with the response
		})
		.catch(() => {
			// Some error occured
		});
}

License

MIT

Model reference documentation

Here you can find the models and all relations that can be queried. Documentation

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago