open-index/open-npm huggingface dataset:
npm package: @medmain/ensure-browser
Description: Ensure the current browser is supported
Latest version: 0.1.2

# `ensure-browser` package

A simple script to be included in Medmain web applications, to ensure that the browser is supported.

If the browser is not supported, an error message is displayed and the React application is not rendered.

## How to use it

### Step 1

In `index.html`:

- Include a `<script>` tag to load it from a CDN
- Call `ensureBrowser(browsers)` function to specify the supported browsers.

```html
<script
  crossorigin
  src="https://unpkg.com/@medmain/ensure-browser@0.1.0/dist/browser/ensure-browser.js"
></script>
<script>
  window.IS_SUPPORTED_BROWSER = window.ensureBrowser([
    {name: 'firefox', version: '10'},
    {name: 'chrome', version: '20'}
  ]);
</script>
```

Optional: in addition of the `name` property, specify a `displayName` to customize the way the supported browsers are displayed in the error message.

### Step 2

In `src/index.js`, don't render the application if the browser is not supported.

```jsx
if (window.IS_SUPPORTED_BROWSER === false) {
  throw new Error('Your browser is not supported!');
}

(async () => {
  let element;
  try {
    await app.initialize();
    element = (
      <BaseRoot app={app}>
        <Root />
      </BaseRoot>
    );
  } catch (err) {
    console.error(err);
    element = renderError(err);
  }

  ReactDOM.render(element, document.getElementById('main'));
})();
```

## Available browser names

The `name` property of the supported browsers can be one of the following values:

- `chrome`
- `chrome mobile`
- `electron`
- `firefox`
- `firefox for ios`
- `ie`
- `microsoft edge`
- `phantomjs`
- `safari`
- `seamonkey`
- `silk`
- `opera mini`
- `opera`

This list was extracted from [Platform.js v1.3.5](https://github.com/bestiejs/platform.js) code. All names were converted to lower case.
npm package: @medmain/image-annotations-openseadragon-plugin
Description: Medmain's Image Annotations OpenSeadragon plugin
Latest version: 1.0.7

This plugin allows you to draw vector annotations over [OpenSeadragon](https://openseadragon.github.io/) deep zoom images.
The plugin creates the drawings on a SVG overlay that scales with the image.

## Usage

### Installation

You will need both OpenSeadragon and this plugin loaded to your page.  
You can [download](https://github.com/medmain/medmain-image-viewer-annotations) the plugin manually for now.

```console
npm install openseadragon @medmain/image-annotations-openseadragon-plugin --save-dev
```

You can start an OpenSeadragon viewer with Annotations plugin using:

```javascript
const viewer = OpenSeadragon(options);

const annotations = new OpenSeadragon.Annotations({
  viewer,
  values,
  onChange: async action => {
    const annotations = await Annotations.save(this.annotations.getAnnotationsXY);
  },
  beforeDelete: async () => {
    return confirm('Delete?')
  }
});