comunication between components

This commit is contained in:
Mario Romano
2016-04-07 20:38:44 +01:00
parent ed8dd1dafb
commit c7597bb1ec
37 changed files with 25254 additions and 2 deletions

View File

@@ -8,3 +8,11 @@ To install simply run:
```
bower install --save file-upload
```
# publish-subscribe functionality
Add the code below to the main index.html in order to publish an event when a file is uploaded. This event is used by the others components to refresh or make action.
<template is="dom-bind" id="alfresco-app">
<iron-signals on-iron-signal-uploaded="uploadedSignal"></iron-signals>
</template>
```

View File

@@ -17,7 +17,8 @@ Example:
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../bower_components/paper-progress/paper-progress.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-signals/iron-signals.html">
<dom-module id="file-upload">
@@ -37,6 +38,14 @@ Example:
@apply(--file-upload-upload-border-hover);
}
.file{
width: 100%;
}
.name{
width: 100%;
}
#UploadBorder{
vertical-align: middle;
color: #555;
@@ -494,6 +503,9 @@ Example:
if (xhr.status === 200) {
self.fire("success", {xhr: xhr});
self.set(prefix + ".complete", true);
if(document.querySelector("#alfresco-app")) {
document.querySelector('#alfresco-app').fire('iron-signal', {name: "uploaded", data: "uploaded!"});
}
} else {
self.set(prefix + ".error", true);
self.set(prefix + ".complete", false);