Commit 8e5935b9 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[feature] Handling suggested resources

parent 7e27f7be81de
......@@ -268,6 +268,12 @@ function onReachedResource(resource: ResourceData): void {
});
}
/**
* When a resource has been suggested by the rendered view for expansion
* @param uri The URI of the resource
*/
function onSuggestedResource(uri: string): void {}
/**
* Creates a new rendering context
* @param resource The resource
......@@ -364,14 +370,20 @@ class MainViewer {
while (root.hasChildNodes()) {
root.removeChild(root.lastChild);
}
this.render(root);
let rendering = this.render(root);
if (rendering != null) {
rendering.suggestedResources.forEach((uri: string) => {
onSuggestedResource(uri);
});
}
}
/**
* Renders the application
* @param root The root DOM element to render to
*/
private render(root: HTMLElement) {
private render(root: HTMLElement): application.ViewRendering {
let result = null;
let sub = document.createElement("div");
sub.style.width = "90%";
sub.style.marginLeft = "5%";
......@@ -393,7 +405,7 @@ class MainViewer {
div.appendChild(document.createTextNode(this.state.message));
sub.appendChild(div);
} else if (this.state.stateType == StateType.Displaying) {
let result = this.renderer.render(
result = this.renderer.render(
this.state.context,
this.state.context.root
);
......@@ -443,6 +455,7 @@ class MainViewer {
sub.appendChild(div);
}
root.appendChild(sub);
return result;
}
}
......
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