Skip to content

Instantly share code, notes, and snippets.

View zerobias's full-sized avatar
💭
Set your status

Dmitry zerobias

💭
Set your status
View GitHub Profile
@zerobias
zerobias / h.ts
Last active April 18, 2022 08:23
Declarative stack-based DOM api
import {
createStore,
createEvent,
is,
clearNode,
forward,
sample,
Store,
Event,
launch
@zerobias
zerobias / proposal_tasks.md
Last active July 18, 2019 22:07
effector proposal: tasks

Tasks

try it

Current effect behavior

const fx = createEffect({
  handler(params) {
    console.log(params)
  },
{
"type": "root",
"children": [
{
"type": "thematicBreak",
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
import React from 'react'
import ReactDOM from 'react-dom'
function iterate(unit) {
const source = createEvent()
const begin = createEvent()
const end = createEvent()
const iteration = createEvent()
const item = iteration.map(({value}) => value)
import {createEvent, createStore, Event, forward, Store} from 'effector'
export class Iteration<T> {
index: number
item: T
list: T[]
constructor(index: number, item: T, list: T[]) {
this.index = index
this.item = item
this.list = list
@zerobias
zerobias / index.js
Created June 16, 2019 21:15
todolist for effector-react with hooks
import React from 'react'
import ReactDOM from 'react-dom'
import {createEvent, createStore, createApi, sample, combine} from 'effector'
import {useStore} from 'effector-react'
const inputStore = createStore('')
const todos = createStore([])
const visibilityFilter = createStore(todos => todos)
const submit = createEvent('sumbit form')
@zerobias
zerobias / element.js
Created June 8, 2019 03:43
example reactive dom with effector https://dist-ccpqbn9uk.now.sh/
//@flow
/* eslint-disable no-unused-vars */
import {createStore, createEvent, type Store, type Event} from 'effector'
declare export function element<P, R>(tag: (props: P) => R, props: P): R
declare export function element(
tag: 'span',
props: {
class?: {[field: string]: string},
content: Store<string>,
[
"foo",
"bar"
]
@zerobias
zerobias / effector.prettify.es.js
Created May 22, 2019 09:14
effector 0.18.10 with prettier
function e({
node: e,
child: t = [],
from: n = [],
scope: r = {},
meta: o = {},
}) {
return {from: n.map(Q), seq: e, next: t.map(Q), meta: o, scope: r}
}
function t(e) {
//@flow
'use strict'
/* eslint-disable no-self-compare,max-len */
//=========================================================================
// Data
let jg
let stack = new Array(0)
const hist = new Array(0)
const words = {}