{"id":19505929,"url":"https://github.com/morlay/reflux-vue","last_synced_at":"2025-07-06T12:03:49.269Z","repository":{"id":57352145,"uuid":"42504682","full_name":"morlay/reflux-vue","owner":"morlay","description":null,"archived":false,"fork":false,"pushed_at":"2015-09-15T09:07:50.000Z","size":128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-23T17:07:06.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morlay.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-15T08:17:33.000Z","updated_at":"2017-12-09T15:17:25.000Z","dependencies_parsed_at":"2022-09-14T19:53:09.534Z","dependency_job_id":null,"html_url":"https://github.com/morlay/reflux-vue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Freflux-vue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Freflux-vue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Freflux-vue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Freflux-vue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morlay","download_url":"https://codeload.github.com/morlay/reflux-vue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240754364,"owners_count":19852189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T22:35:00.249Z","updated_at":"2025-02-25T22:15:50.489Z","avatar_url":"https://github.com/morlay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reflux Vue\n\nA mixin helpers link the [Reflux](https://github.com/reflux/reflux-core) and the [Vue](https://github.com/yyx990803/vue)\n\n[![Build Status](https://img.shields.io/travis/morlay/reflux-vue.svg?style=flat-square)](https://travis-ci.org/morlay/reflux-vue)\n[![Coverage](https://img.shields.io/coveralls/morlay/reflux-vue.svg?style=flat-square)](https://coveralls.io/r/morlay/reflux-vue)\n\n\n## Usages\n\nmost usages are same as [Reflux](https://github.com/reflux/refluxjs), only the mixins for Vue component have little differences.\n\n``` js\nimport Reflux from 'reflux-vue'\n```\n\n### Convenience mixin for React\n\n``` js\nconst vm = new Vue({\n\n  mixins: [Reflux.ListenerMixin],\n  \n  compiled() {\n    this.listenTo(TheStore, this.onStoreUpdate);\n  },\n    \n  methods {\n    onStoreUpdate(state){\n      // update the data of TheStore to vm\n      this.state = state;\n    }\n  }\n});\n```\n\n### Using Reflux.listenTo\n\n``` js\nconst vm = new Vue({\n  mixins: [\n    Reflux.listenTo(TheStore, 'onStoreUpdate')\n  ],\n  \n  methods {\n    onStoreUpdate(state){\n      this.state = state;\n      // or \n    }\n  }\n});\n```\n\n### Using Reflux.connect\n\nFor `connect` method, we prefer to set the `getInitialState` to initial the data structure which need to sync.\n\n``` js\nconst TheStore = Reflux.createStore({\n  getInitialState: function() {\n    return { \n      state: 'open'\n    }\n  },\n  \n  onSomeActionCallback(){\n    this.trigger({ \n      state: 'open' \n    })\n  }\n});\n\n```\n\n\n``` js\nconst vm = new Vue({\n  mixins: [\n    Reflux.connect(TheStore)\n  ],\n    \n  methods:{\n    getStateFromTheStore(){\n      // this.state === 'open'\n    }\n  }\n});\n```\n\n\n### Using Reflux.connectFilter\n\n\n``` js\nconst vm = new Vue({\n  mixins: [\n    Reflux.connectFilter(TheStore, function(stateData) {\n      return {\n        state: stateData.state === 'open' ? 'open!!!' : ''\n      }\n    }))\n  ],\n    \n  methods:{\n    getStateFromTheStore(){\n      // this.state === 'open!!!'\n    }\n  }\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Freflux-vue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorlay%2Freflux-vue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Freflux-vue/lists"}