Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equinor/fusion

Package Overview
Dependencies
Maintainers
2
Versions
485
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion

Everything a Fusion app needs to communicate with the core

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1K
decreased by-6.08%
Maintainers
2
Weekly downloads
 
Created
Source

Fusion

Everything a Fusion app needs to communicate with the core.

Version Downloads/week License

Install

Yarn

$ yarn add @equinor/fusion

NPM

$ npm install @equinor/fusion --save

Usage as Core

import React, { useRef } from "react";
import { render } from "react-dom";
import {
    AuthContainer,
    createApiClients
    createResourceCollections,
    FusionContext,
    HttpClient,
    ServiceResolver,
} from "@equinor/fusion";

const authContainer = new AuthContainer();
if(!authContainer.registerApp("{client-id}", ["http://api.url.com"])) {
    authContainer.login("{client-id}");
    return;
}

const serviceResolver: ServiceResolver = {
    getDataProxyUrl: () => "http://api.url.com",
};

const resourceCollections = createResourceCollections(serviceResolver);

const httpClient = new HttpClient(authContainer);
const apiClients = createApiClients(httpClient, resourceCollections);

const rootRef = useRef(null);
const overlayRef = useRef(null);

const Root = () => (
    <FusionContext.Provider value={{
        auth: { container: authContainer },
        http: {
            resourceCollections,
            apiClients,
        },
        refs: {
            root: rootRef,
            overlay: overlayRef,
        }
    }}>
        <div id="fusion-root" ref={rootRef}>

        </div>
        <div id="overlay-container" ref={overlayRef}>

        </div>
    </FusionContext.Provider>
);

render(<Root />, document.getElementById("app"));

Keywords

FAQs

Package last updated on 14 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc