lpio
Version:
The last dashboard app you'll ever need
51 lines (45 loc) • 1.55 kB
HTML
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../lp-imports/jquery.html">
<link rel="import" href="../../lp-imports/underscore.html">
<script>
window.ReduxBehaviors = window.ReduxBehaviors || {};
/**
*
* @polymerBehavior ReduxBehaviors.Base
*
**/
ReduxBehaviors.BaseImpl = {
created: function(){
this._addReducer(this.baseReducer);
},
baseReducer: function(action){
switch (action.type){
case 'setLoading':
return this.setLoading(action);
case 'setLoadingDone':
return this.setLoadingDone(action);
case 'setSaving':
return this.setSaving(action);
case 'setSavingDone':
return this.setSavingDone(action);
}
},
setLoading: function(action){
var key = action.key || 'app';
this.mutate(key+'.isLoading',true);
},
setLoadingDone: function(action){
var key = action.key || 'app';
this.mutate(key+'.isLoading',false);
},
setSaving: function(action){
var key = action.key || 'app';
this.mutate(key+'.isSaving',true);
},
setSavingDone: function(action){
var key = action.key || 'app';
this.mutate(key+'.isSaving',false);
}
};
ReduxBehaviors.Base = [ReduxBehaviors.BaseImpl];
</script>