-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathcontext.tsx
More file actions
29 lines (26 loc) · 969 Bytes
/
context.tsx
File metadata and controls
29 lines (26 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react';
import $rdf, { IndexedFormula, Fetcher, UpdateManager, NamedNode } from 'rdflib'
export interface DataBrowserContextData {
store: IndexedFormula;
fetcher: Fetcher;
updater: UpdateManager;
podOrigin: string;
webId: string;
loadResource: (resourcePath: string) => void;
};
const defaultContext: DataBrowserContextData = {
podOrigin: document.location.origin,
store: $rdf.graph(),
fetcher: new Fetcher($rdf.graph(), undefined),
updater: new UpdateManager($rdf.graph()),
webId: 'http://example.com',
loadResource: () => undefined
}
/**
* The context allows the data browser to easily access global values
* everywhere in the application.
* Individual Panes, however, should get these values as properties,
* to avoid a hard dependency on the data browser.
* This will allow them to be used as e.g. individual apps or in browser extensions.
*/
export const DataBrowserContext = React.createContext(defaultContext)