0.0.2-rc.2 • Published 3 years ago

@pulsor/core v0.0.2-rc.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@puslor/core

Core runtime for the pulsor framework

Installation

npm install @pulsor/core

Basic usage

import { run } from '@pulsor/core';

const app = // app definition ...

run(app);

The app is a single tree of vNodes describing the whole app.

import { run } from '@pulsor/core';

// App definition
const app = {
  type: 'div',
  children: [
    {
      type: 'h1',
      children: 'Hello world'
    }
  ]
};

// Run app
run(app);
import { run, h } from '@pulsor/core';

// App definition
const app = (
  h('div', {}, [
    h('h1', {}, 'Hello world')
  ])
);

// Run app
run(app);

h stands for HyperScript: h(type, props, ...children)

import { run } from '@pulsor/core';

// App definition
const app = (
  <div>
    <h1>Hello world</h1>
  </div>
)

// Run app
run(app);

Counter

import { run } from '@pulsor/core';

const Init = { count: 0 };
const Decrement = (state) => ({ count: state.count - 1 });
const Increment = (state) => ({ count: state.count + 1 });

const app = (
  <main init={Init}>
    <h1>{(state) => state.count}</h1>
    <button onclick={Decrement}>-</button>
    <button onclick={Increment}>+</button>
  </main>
);

run(app);

Docs coming soon!

0.0.2-rc.2

3 years ago

0.0.2-rc.1

3 years ago

0.0.1-rc.18

3 years ago

0.0.1-rc.17

3 years ago

0.0.1-rc.16

3 years ago

0.0.1-rc.15

3 years ago

0.0.1-rc.14

3 years ago

0.0.1-rc.13

3 years ago

0.0.1-rc.12

3 years ago

0.0.1-rc.11

4 years ago

0.0.1-rc.10

4 years ago

0.0.1-rc.9

4 years ago

0.0.1-rc.8

4 years ago

0.0.1-rc.7

4 years ago

0.0.1-rc.6

4 years ago

0.0.1-rc.5

4 years ago

0.0.1-rc.4

4 years ago

0.0.1-rc.3

4 years ago

0.0.1-rc.2

4 years ago

0.0.1-rc.1

4 years ago