ome

0.5.2 • Public • Published

omega

ONE STATE, ONE APP!

A simple data driven frontend library using JSX.

There are some major differences to render based libraries like React:

  • no render cycle, no shadow DOM, no complicated change detection
  • data is set with observables
npm i -S ome

example:

import {omega, Store} from 'ome';
 
const App = (props, state, data) => {
  const entries = data.entries.map(
    (value) => (
      <span style={
        value.transform(v => v && {color: v.color})
      }>
        {value.child('title')}
      </span>
    )
  );
 
  return (
    <div className="app">
      <h1>{props.title}</h1>
      <p>{entries}</p>
    </div>
  );
};
 
App.data = {
  entries: 'app',
};
 
const initialState = {
  'app': [
    {title: 'Hello', color: '#fe8d00'},
    {title: 'World', color: '#333333'},
  ],
};
 
export const store = new Store(initialState);
 
omega.render(
  <App title="Omega is awesome!"/>,
  document.body,
  store,
);

Package Sidebar

Install

npm i ome

Weekly Downloads

0

Version

0.5.2

License

AGPL-3.0

Unpacked Size

67.1 kB

Total Files

14

Last publish

Collaborators

  • shynrou