Commit bd56f720 authored by Wolfgang's avatar Wolfgang

Add property to pb-view to make it wait for a pb-update event rather than...

Add property to pb-view to make it wait for a pb-update event rather than loading its content automatically
parent 9cbeeec4
......@@ -208,6 +208,14 @@
map: {
type: String
},
/**
* If set to true, the component will not load automatically. Instead it will wait until it receives a `pb-update`
* event. Use this to make one `pb-view` component dependent on another one. Default is 'false'.
*/
onUpdate: {
type: Boolean,
value: false
},
/**
* Message to display if no content was returned by the server.
* Set to empty string to show nothing.
......@@ -319,8 +327,11 @@
this.subscribeTo('pb-zoom', ev => {
this.zoom(ev.detail.direction);
});
this.wait(() => Polymer.RenderStatus.afterNextRender(this, () => this._refresh()));
if (this.onUpdate) {
this.subscribeTo('pb-update', this._refresh.bind(this));
} else {
this.wait(() => Polymer.RenderStatus.afterNextRender(this, () => this._refresh()));
}
}
/**
......@@ -463,7 +474,9 @@
const eventOptions = {
data: resp,
root: elem,
params: this.$.loadContent.params
params: this.$.loadContent.params,
id: this.xmlId,
position: this.nodeId
};
this.emitTo('pb-update', eventOptions);
this.emitTo('pb-end-update', null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment