npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

flexview-runtime-extension

v0.0.2

Published

Base FlexView runtime extension utilities

Downloads

14

Readme

Runtime Extension

This package was created to allow OHIF v3 extensions to be loaded at runtime. This concept allows the extensions to be built independently from OHIF (even on separate repositories) and injected during OHIF's initialization via configuration.

Using this package

To use this package, you must add it as a dependency of your OHIF v3 extension. As it is a private repository, you must add path reference to your extension's package.json file or use the link feature for both yarn or npm. It is also possible to configure this repository to enable HTTPS+OAuth or SSH authentication and add the repository reference directly in the package.json file. Another alternative would be to pay for npm subscriptions per user and use their private packages feature. And a last alternative would be to host our own npm registry on cloud and add this registry to our private repositories.

Whatever is the option you chose to install this package as a dependency of your extension, you should now be able to import it and use by your extension's code. Here is an example of how you can create and export your runtime extension:

import { RuntimeExtension } from '@radicalimaging/runtime-extension';

const myExtension = {
  id: '@radicalimaging/extension-my',
  preRegistration: (params) => {/* CODE */}
  getHangingProtocolModule: (params) => { /* CODE */ }
  getPanelModule: (params) => {/* CODE */}
  getCommandsModule: (params) => {/* CODE */}
  onModeEnter: () => {/* CODE */}
  onModeExit: () => {/* CODE */}
  /* Other callbacks */
}

const my = {
  hangingProtocol: '@radicalimaging/extension-my.hangingProtocolModule.hp',
  panel1: '@radicalimaging/extension-my.panelModule.panel1',
  panel2: '@radicalimaging/extension-my.panelModule.panel2',
};

const myRuntimeExtension = new RuntimeExtension(myExtension, [{
  modeId: '@ohif/mode-one',
  routePath: 'routeA',
  leftPanels: [my.panel1],
  rightPanels: [my.panel2],
  viewports: [],
  hangingProtocolOverride: my.hangingProtocol,
}]);

export default myRuntimeExtension;

After your extension is ready to go, you can export it into a single JavaScript bundle file. This file you can place directly in your OHIF v3 application root directory and reference it by the app-config.js file under the window.config.runtimeExtensions. Here is an example of the configuration:

window.config = {
  ...
  runtimeExtensions: {
    '@radicalimaging/extension-my': './runtime-extensions/my/index.umd.js',
  },
  ...
};

For the example above, the JavaScript bundle file was placed on ./runtime-extensions/my/ directory.

For more instructions on how to enable the runtime extension from the OHIF v3 side, please see this README.md file of an actual extension that was ported to runtime extensions to serve as an example.