# cross-domain-worker-url

> convert a cross-domain url to an available url

Latest version **0.0.5** (published 2018-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install cross-domain-worker-url
pnpm add cross-domain-worker-url
yarn add cross-domain-worker-url
bun add cross-domain-worker-url
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2018-10-29 |
| First published | 2018-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | huaxiabuluo |
| Maintainers | huaxiabuluo |
| Keywords | web workers, cross domain, transform url |

## Links

- npm: https://www.npmjs.com/package/cross-domain-worker-url
- Repository: https://github.com/huaxiabuluo/cross-domain-worker-url
- Issues: https://github.com/huaxiabuluo/cross-domain-worker-url/issues
- npm.io page: https://npm.io/package/cross-domain-worker-url

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.5 (latest) — 2018-10-29
- 0.0.4 — 2018-10-29
- 0.0.3 — 2018-10-29
- 0.0.2 — 2018-10-29
- 0.0.1 — 2018-10-28

## README

# cross-domain-worker-url

#### Convert a cross-domain url to an available url.

If your current domain is `http://www.a.com/`, but you want to try `const myWorker = new Worker('http://www.b.com/hello.js')`, it will throw cross-domain error.

##### We can solve the problem by using `cross-domain-worker-url`

```js
import { getLocalWorkerUrl } from 'cross-domain-worker-url';

// If in async function, you can use in this way:
// const localWorkerUrl = await getLocalWorkerUrl(originWorkerUrl);
getLocalWorkerUrl(originWorkerUrl).then(localWorkerUrl => {
    const myWorker = new Worker(localWorkerUrl);
});
```

## MIT Licenced

---
_Source: https://npm.io/package/cross-domain-worker-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
