
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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, event} from "mvc-tsx";
// define Model
class LoginModel extends Model {
login: string = "";
password: string = "";
}
// define View
class LoginView extends View<LoginModel> {
// declare interactive elements
static ui = {
loginInput: ".Login--loginInput",
passInput: ".Login--passInput",
// ctrl + click on key "loginButton"
// can jump to method onClickLogin
loginButton: ".Login--loginBtn"
};
template(loginModel: LoginModel) {
return (<div className="Login">
<input className="Login--loginInput"/>
<input className="Login--passInput"/>
<button className="Login--loginBtn"></button>
</div>);
}
}
// define Controller
@forView(LoginView)
class LoginController extends Controller<LoginModel> {
@on("change", LoginView.ui.loginInput)
onChangeLogin( @event("target", "value") inputValue: string ) {
this.model.set({
login: inputValue
});
}
@on("change", LoginView.ui.passInput)
onChangePassword( @event("target", "value") inputValue: string ) {
this.model.set({
password: inputValue
});
}
@on("click", LoginView.ui.loginButton)
onClickLogin() {
const {login, password} = this.model;
// do login ...
}
}
// and render
const loginModel = new LoginModel();
ReactDOM.render(
<LoginView model={loginModel}/>,
document.getElementById("root")
);
minify + React + EventEmitter + MVC
FAQs
MVC based on React
The npm package mvc-tsx receives a total of 3 weekly downloads. As such, mvc-tsx popularity was classified as not popular.
We found that mvc-tsx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.