Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mantrajs/mantra-core
Collection of Core APIs used in Mantra
https://github.com/mantrajs/mantra-core
Last synced: 6 days ago
JSON representation
Collection of Core APIs used in Mantra
- Host: GitHub
- URL: https://github.com/mantrajs/mantra-core
- Owner: mantrajs
- License: mit
- Created: 2016-01-27T09:35:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-13T15:55:17.000Z (about 8 years ago)
- Last Synced: 2024-10-14T06:34:49.617Z (3 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 65
- Watchers: 7
- Forks: 36
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
#mantra-core
Core API for Mantra.
### Introduction
This repo contains the core APP api where we create an mantra app and initialize it.
Also, this package contains exported functions from both [`react-komposer`](https://github.com/kadirahq/react-komposer) and [`react-simple-di`](https://github.com/kadirahq/react-simple-di).
That's purely for the ease of use.### Installation
```
npm i --save mantra-core react
```### App API
```js
import MyComp from './myComp';
import {createApp} from 'mantra-core';// Here's a simple Mantra Module
const module = {
routes(injectDeps) {
const InjectedComp = injectDeps(MyComp);
// load routes and put `InjectedComp` to the screen.
},
load(context, actions) {
// do any module initialization
},
actions: {
myNamespace: {
doSomething: (context, arg1) => {}
}
}
};const context = {
client: new DataClient()
};const app = createApp(context);
app.loadModule(module);
// app.loadModule(someOtherModule);
app.init();
```