Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

effector-vue

Package Overview
Dependencies
Maintainers
0
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

effector-vue - npm Package Versions

1245

20.4.2

Diff

Changelog

Source

effector-react 20.7.3, effector-vue 20.4.2

  • Fix regression in effector-react/compat and effector-vue/compat compatibility with IE11
drelliot
published 20.4.1 •

Changelog

Source

effector-vue 20.4.1

  • Improve typescript typings for usage via Vue.extend (PR #343)
drelliot
published 20.4.0 •

Changelog

Source

effector-vue 20.4.0

import {createStore} from 'effector'
import {createComponent} from 'effector-vue'

const counter = createStore(0)

const component = createComponent(
  {
    template: '<div>{{ counter }}</div>',
    watch: {
      counter() {
        /* side-effects here */
      },
    },
  },
  {counter},
)
drelliot
published 20.3.3 •

Changelog

Source

effector-react 20.6.2, effector-vue 20.3.3

  • Fix umd build of effector-react and effector-vue

Cdn with umd build of effector-react Cdn with umd build of effector-vue

drelliot
published 20.3.2 •

Changelog

Source

effector 20.3.2

  • Allow typescript to refine type with split method (PR)
  • Improve type inference of effects with optional arguments in Typescript (PR)
  • Ensure that effect handler is called only after effect update itself, thereby preventing side-effects from interrupting pure computations
import React from 'react'
import ReactDOM from 'react-dom'
import {createStore, createEvent, createEffect, sample} from 'effector'
import {useList} from 'effector-react'

const updateItem = createEvent()
const resetItems = createEvent()
const processClicked = createEvent()

const processItemsFx = createEffect({
  async handler(items) {
    for (let {id} of items) {
      //event call inside effect
      //should be applied to items$
      //only after processItemsFx itself
      updateItem({id, status: 'PROCESS'})
      await new Promise(r => setTimeout(r, 3000))
      updateItem({id, status: 'DONE'})
    }
  },
})

const $items = createStore([
  {id: 0, status: 'NEW'},
  {id: 1, status: 'NEW'},
])
  .on(updateItem, (items, {id, status}) =>
    items.map(item => (item.id === id ? {...item, status} : item)),
  )
  .on(processItemsFx, items => items.map(({id}) => ({id, status: 'WAIT'})))
  .reset(resetItems)

sample({
  source: $items,
  clock: processClicked,
  target: processItemsFx,
})

const App = () => (
  <section>
    <header>
      <h1>Jobs list</h1>
    </header>
    <button onClick={processClicked}>run tasks</button>
    <button onClick={resetItems}>reset</button>
    <ol>
      {useList($items, ({status}) => (
        <li>{status}</li>
      ))}
    </ol>
  </section>
)

ReactDOM.render(<App />, document.getElementById('root'))

Try it

drelliot
published 20.3.1 •

Changelog

Source

effector 20.3.1

  • Fix edge case when clearNode been called on store belonged to certain domain led to the removal of the entire domain
drelliot
published 20.3.0 •

Changelog

Source

effector-vue 20.3.0

  • Add createComponent HOC for TypeScript usage. This HOC provides type-safe properties in vue components.
// component.vue
import {value createStore, value createApi} from 'effector'
import {value createComponent} from 'effector-vue'

const $counter = createStore(0)
const {update} = createApi($counter, {
  update: (_, value: number) => value,
})

export default createComponent(
  {
    name: 'Counter',
    methods: {
      update,
      handleClick() {
        const value = this.$counter + 1 // this.$counter <- number ( typescript tips )
        this.update(value)
      },
    },
  },
  {$counter},
)
drelliot
published 20.2.1 •

Changelog

Source

effector-vue 20.2.1

const counter = createStore(0)

new Vue({
  effector: {
    counter, // would create `counter` in template
  },
})
drelliot
published 20.2.0 •

Changelog

Source

effector-vue 20.2.0

  • Add support for object shape
const counter = createStore(0)

new Vue({
  effector: {
    counter, // would create `counter` in template
  },
})
drelliot
published 20.1.2 •

Changelog

Source

effector 20.1.2

  • Allow typescript to refine type of payload if event.filter({fn}) got a predicate function as a callback PR
import {value createEvent} from 'effector'

const event = createEvent<string | number>()

const isString = (value: any): value is string => typeof value === 'string'
const isNumber = (value: any): value is number => typeof value === 'number'

const str = event.filter({fn: isString}) // Event<string>
const num = event.filter({fn: isNumber}) // Event<number>

str.watch(value => value.slice()) // OK now
num.watch(value => value.toFixed(2)) // OK now
  • Allow typescript to refine type with is methods PR
import {value is} from 'effector'

//result has type Event<any> | void
function getEvent(obj: unknown) {
  if (is.event(obj)) return obj
  if (is.store(obj)) return obj.updates
}
  • Add new fields to definition of graph nodes (discussion)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc