Skip to content

Commit

Permalink
fixes #55 adds warning for defined actions prop
Browse files Browse the repository at this point in the history
  • Loading branch information
tur-nr committed Apr 3, 2017
1 parent 4c774c8 commit 9ed1322
Show file tree
Hide file tree
Showing 2 changed files with 5,946 additions and 2 deletions.
10 changes: 8 additions & 2 deletions polymer-redux.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
global['PolymerRedux'] = factory();
}
})(this, function() {
var warning = 'Polymer Redux: <%s>.%s has "notify" enabled, two-way bindings goes against Redux\'s paradigm';
var twoWayWarning = 'Polymer Redux: <%s>.%s has "notify" enabled, two-way bindings goes against Redux\'s paradigm';
var actionsWarning = 'Polymyer Redux: <%s>.actions inaccessible property. "actions" is reserved for Action Creators.';

/**
* Returns property bindings found on a given Element/Behavior.
Expand All @@ -25,10 +26,15 @@
if (obj.properties != null) {
Object.keys(obj.properties).forEach(function(name) {
var prop = obj.properties[name];
// actions, inaccessible property
if (name === 'actions') {
console.warn(actionsWarning, element.is);
}

if (prop.hasOwnProperty('statePath')) {
// notify flag, warn against two-way bindings
if (prop.notify && !prop.readOnly) {
console.warn(warning, element.is, name);
console.warn(twoWayWarning, element.is, name);
}
props.push({
name: name,
Expand Down
Loading

0 comments on commit 9ed1322

Please sign in to comment.