Is it possible to share events between custom polymer components.
I want to append a header to every request i send. For this purpose I wanted to create a custom element.
<template>
</template>
<style is="em-header-inject">
</style>
<script>
(function() {
'use strict';
Polymer({
is: 'em-header-inject',
properties: {
listeners: {
'em-send-request': 'handleRequest'
}
},
computeHeaders: function() {
return {'Authorization' : 'Bearer {' + app.accessToken + '}'};
},
handleRequest: function(request) {
console.log("handling request", request);
request.header = this.computeHeaders();
}
});
})();
</script>
in any other component I want to do something like this
this.fire('em-send-request', addRiderRequest);
But the event listener does not see the event being fired. Is this by design or am I missing something?