@storybook/mantra-core
Core API for Mantra
Last updated 3 years ago by danielduan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @storybook/mantra-core 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.7.2                                ...           latest (3 years ago)

2 Versions

  • 1.7.2                                ...           3 years ago
  • 1.7.1                                ...           3 years ago
Downloads
Today 2
This Week 271
This Month 1,217
Last Day 78
Last Week 429
Last Month 2,271
Dev Dependencies (13)

Copyright 2014 - 2016 © taobao.org |