Trying stuff

This commit is contained in:
julien Lengrand-Lambert
2017-08-16 22:04:33 +02:00
parent 95a71d018f
commit 456e135be4
3 changed files with 26 additions and 1 deletions

View File

@@ -27,6 +27,8 @@
_changeName: function(){
console.log("changing name");
// this.dispatchEvent(new CustomEvent('kick', {detail: {kicked: true}}));
this.fire('kick', {kicked: true});
this.set('element.person', {"name": "bobby"});
this.notifyPath('element');
this.notifyPath('element.person');

View File

@@ -31,5 +31,5 @@
}
}
});
</script>
</script>
</dom-module>

View File

@@ -10,5 +10,28 @@
<body>
<example-component></example-component>
<script>
document.querySelector('example-component').addEventListener('kick', function (e) {
console.log("fired");
console.log(e.kicked); // true
this.notifyPath('element');
this.notifyPath('element.person');
this.notifyPath('elements');
});
// var el = document.querySelector('example-component');
// el.addEventListener('kick', function(){
// var normalizedEvent = Polymer.dom(event);
// // logs #myButton
// console.info('rootTarget is:', normalizedEvent.rootTarget);
// // logs the instance of event-targeting that hosts #myButton
// console.info('localTarget is:', normalizedEvent.localTarget);
// // logs [#myButton, document-fragment, event-retargeting,
// // body, html, document, Window]
// console.info('path is:', normalizedEvent.path);
// });
</script>
</body>
</html>