tur-nr/polymer-redux
소개
Polymer bindings for Redux.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalPolymer Redux
Polymer bindings for Redux. Bind store state to properties and dispatch actions from within Polymer Elements.
Polymer is a modern library for creating Web Components within an application. Redux is a state container for managing predictable data. Binding the two libraries together allows developers to create powerful and complex applications faster and simpler. This approach allows the components you build with Polymer to be more focused on functionality than the applications state.
Polymer 3
Polymer 3 is currently under beta release, checkout: https://github.com/tur-nr/polymer-redux/tree/dev/v2.x
Installation
bower install --save polymer-redux
Example
// Create a Redux store
const store = Redux.createStore((state = {}, action) => state)
// Create the PolymerRedux mixin
const ReduxMixin = PolymerRedux(store)
// Bind Elements using the mixin
class MyElement extends ReduxMixin(Polymer.Element) {
static get is() {
return 'my-element'
}
connectedCallback() {
super.connectedCallback();
const state = this.getState();
}
}
// Define your Element
customElements.define(MyElement.is, MyElement)
Now MyElement has a connection to the Redux store and can bind properties to
it's state and dispatch actions.
Documentation
See the documentation page: https://tur-nr.github.io/polymer-redux/docs.
API
PolymerRedux
new PolymerRedux(<store>)
storeObject, Redux store.
Returns a ReduxMixin function.
Redux Mixin
These methods are available on the instance of the component, the element.
#getState()
Returns current store's state.
#dispatch(<name>, [args, ...])
nameString, action name in the actions list.arg...*, Arguments to pass to action function.
Returns the action object.
#dispatch(<fn>)
fnFunction, Redux middleware dispatch function.
Returns the action object.
#dispatch(<action>)
actionObject, the action object.
Returns the action object.
Events
state-changed
Fires when the store's state has changed.
License
Copyright (c) 2017 Christopher Turner
관련 프로젝트 살펴보기
불러오는 중…