Nuns Practicing Misanthropy
Wondering what’s next for npm?Check out our public roadmap! »

mobius-js

0.6.0 • Public • Published

Mobius

An integrated framework for building web applications, where the DOM, networking, and client/server are abstracted via lockstep execution.

Build Status

Status: Beta

Getting Started

# Install globally 
npm install -g mobius-js
# Create new project in current directory 
mobius --init
# Start service 
npm start

Documentation

Examples

Bento Box

rpetrich/mobius-sample

Simple

import * as dom from "dom";
import { db } from "secrets";
import { execute, sql } from "sql";
 
export default class extends dom.Component<{}, { clicks: number }> {
    state = { clicks: 0 }
    async componentDidMount() {
        await this.fetchClicks();
    }
    async fetchClicks() {
        const records = await execute(db, sql`SELECT count FROM counter`);
        this.setState({ clicks: records[0].count });
    }
    onClick: async () => {
        this.setState({ clicks: this.state.clicks + 1 });
        await execute(db, sql`UPDATE counter SET count = count + 1`);
        await this.fetchClicks();
    }
    render() {
        return <button onclick={this.onClick}>
            {this.state.clicks}
        </button>
    }
}

Install

npm i mobius-js

DownloadsWeekly Downloads

1

Version

0.6.0

License

MIT

Unpacked Size

862 kB

Total Files

125

Last publish

Collaborators

  • avatar