Commit fdfc92d4 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Refactoring the popup UI

parent e40d3a5dd85b
......@@ -33,7 +33,8 @@ import {
ResourceUserCommand,
DocumentSource,
DocumentObservations,
ORIGIN_KIND_DIRECT
ORIGIN_KIND_DIRECT,
Origin
} from "../common/data";
import {
getResourceContent,
......@@ -107,7 +108,7 @@ export interface LDBrowser {
* When an URI has been reached
* @param uri The URI
*/
onReachedUri(uri: string): Promise<void>;
onReachedUri(uri: string, origin?: Origin): Promise<void>;
/**
* Navigates the browser to an URI
* @param uri The URI to navigate to
......@@ -461,9 +462,10 @@ class LDBrowserImpl implements LDBrowser {
* When an URI has been reached
* @param uri The URI
*/
public async onReachedUri(uri: string): Promise<void> {
public async onReachedUri(uri: string, origin?: Origin): Promise<void> {
this.handler.onLoad("Loading data");
let data = await this.resolveResourceData(this.resolveResource(uri));
if (origin) data.observations[uri].origin = origin;
this.currentData = data;
let store = await this.resolveRdfStore(data);
let context = this.newRenderingContext(data, store);
......
......@@ -100,7 +100,7 @@ function main() {
sendHead(observation);
if (observation.preemptable) {
let browser = initializeBrowser();
browser.onReachedUri(window.location.href);
browser.onReachedUri(window.location.href, observation.origin);
} else if (
observation.negotiated != null &&
observation.negotiated != undefined
......
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