hymn-core

Core API for Hymn.


License
MIT
Install
npm install hymn-core@1.1.0

Documentation

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 and 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

Installation

npm i --save hymn-core react

App API

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();