0.0.32 • Published 1 year ago

teras v0.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

0.0.31

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.12

2 years ago

0.0.15-test02

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15-test

2 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago