Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mvc-tsx

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvc-tsx

MVC based on React

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

MVC-TSX (alpha version)

CI status

With MVC-TSX you can write imperative code for creating reactive applications.

import React from "react";
import * as ReactDOM from "react-dom";
import {Model, View, Controller, on, arg} from "mvc-tsx";

// define Model
class LoginModel extends Model {
    login: string = "";
    password: string = "";
}

// define Controller
class LoginController extends Controller<LoginModel> {

    @on("change", ".Login--loginInput")
    onChangeLogin( @arg("target", "value") inputValue ) {
        this.model.set({
            login: inputValue
        });
    }

    @on("change", ".Login--passInput")
    onChangePassword( @arg("target", "value") inputValue ) {
        this.model.set({
            password: inputValue
        });
    }

    @on("click", ".User--loginBtn")
    onClickLogin() {
        const {login, password} = this.model;
        // do login ...
    }
}

// define View
class LoginView extends View<LoginModel> {
    
    // list of Controllers
    controllers() {
        return [
            LoginController
        ];
    }

    template(loginModel: LoginModel>) {
        return (<div className="Login">
            <input className="Login--loginInput"/>
            <input className="Login--passInput"/>
        </div>);
    }

}

// and render
const loginModel = new LoginModel();

ReactDOM.render(
    <LoginView model={loginModel}/>,
    document.getElementById("root")
);

Downloads

minify + React + EventEmitter + MVC

React + EventEmitter + MVC

minify + MVC

MVC

Examples

clock
counter
cart

Keywords

FAQs

Package last updated on 24 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc