0.0.32 • Published 3 years ago

teras v0.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Teras

npm version npm downloads Library minified size Library minified + gzipped size

Teras is a wrapper-library based on redux, redux-saga and react-router. (Inspired by dva-js)

Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

npm install teras --save

or

yarn add teras

Usage

Init

import Teras from 'teras';
import terasModel from "./models/terasModel";

ReactDOM.render(
   <Teras models={[terasModel]}>
     <App />
   </Teras>
  document.getElementById('root')
);

Models

const INITIAL_STATE = {
  initlabel: 'Hello World'
};

export default {
  namespace: 'terasModel',

  state: INITIAL_STATE,

  reducers: {},

  effects: {
  },
};

App

import {core} from 'teras';

const mapStatesToProps = ({terasModel}) => ({
  terasModel,
});

function App({dispatch, terasModel}) {
  const {initlabel} = terasModel;

   return (
       <div>
        {initlabel}
      </div>
    );
}

export default core.connect(mapStateToProps)(App);

Socket Connection

function* onReceived(message, {put, select}) {
  if (!message) return;
  console.log('onReceived');
}

function* onConnected({socket}, {put, select}) {
  console.log('onConnected');
}

function* onDisconnected(query, {put, select}) {
  console.log('onDisconnected');
}

function* onError() {
  console.log('onEror');
}

export default {
  namespace: 'chatSocket',
  onReceived,
  onConnected,
  onDisconnected,
  onError,
  url: `wss://localhost,
};

License

Copyright (C) 2021 Qumon Intelligence

Released under MIT License.

0.0.32

3 years ago

0.0.31

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.19

3 years ago

0.0.12

4 years ago

0.0.15-test02

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15-test

4 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago