microwebchat

0.1.18 • Public • Published

Microwebchat

scripts

start : starts sample app

build : builds app

test : starts test

coverage : shows test coverage

Usage

import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import store from "./store";
import MicroWebchat from "./components/microwebchat";

const sendMessage = (type, payload) => {
  // When user types new message, this function will be called
};

// How to add a new messages, call this function
// msg is a json object representing one message
//
//   store.dispatch({
//     type: "ADD_MICROWEBCHAT_MESSAGE",
//     arg: msg
//   });

// How to add batch o messages
// msgs is an array of messages
//
//   store.dispatch({
//     type: "UPDATE_MICROWEBCHAT_MESSAGES",
//     arg: msgs
//   });

ReactDOM.render(
  <Provider store={store}>
    <MicroWebchat sendMessage={sendMessage} />
  </Provider>,
  document.getElementById("app")
);

/microwebchat/

    Package Sidebar

    Install

    npm i microwebchat

    Weekly Downloads

    1

    Version

    0.1.18

    License

    none

    Unpacked Size

    3.91 MB

    Total Files

    16

    Last publish

    Collaborators

    • amhaish