https://github.com/markshust/hymn-core
Core API for Hymn.
https://github.com/markshust/hymn-core
Last synced: 8 months ago
JSON representation
Core API for Hymn.
- Host: GitHub
- URL: https://github.com/markshust/hymn-core
- Owner: markshust
- License: mit
- Created: 2016-08-12T02:11:23.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-12T04:00:38.000Z (almost 10 years ago)
- Last Synced: 2025-01-14T10:52:11.460Z (over 1 year ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hymn-core
Core API for Hymn.
### 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 [`hymn-composer`](https://github.com/markoshust/hymn-komposer) and [`hymn-di`](https://github.com/markoshust/hymn-di).
That's purely for the ease of use.
The base of this project stems from mantra-core. It is not intended to be backwards-compatible, as it will introduce breaking updates & new features.
### Differences from mantra-core
* Ability to module-namespace actions
- See https://github.com/kadirahq/mantra/issues/199 for details
* Updates from latest hymn-composer and hymn-di
* Future updates planned
### Installation
```
npm i --save hymn-core react
```
### App API
```js
import MyComp from './myComp';
import {createApp} from 'hymn-core';
// Here's a simple Hymn 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();
```