All Projects → mantrajs → Mantra Core

mantrajs / Mantra Core

Licence: mit
Collection of Core APIs used in Mantra

Programming Languages

javascript
184084 projects - #8 most used programming language

#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 and react-simple-di. That's purely for the ease of use.

Installation

npm i --save mantra-core react

App API

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();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].