# bridge-module

> Send modules and their dependencies to the browser

Latest version **0.48.0** (published 2021-01-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install bridge-module
pnpm add bridge-module
yarn add bridge-module
bun add bridge-module
```

## 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.48.0 |
| Published | 2021-01-01 |
| First published | 2016-07-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | erikpukinskis |

## Links

- npm: https://www.npmjs.com/package/bridge-module
- Repository: https://github.com/erikpukinskis/bridge-module
- Homepage: https://github.com/erikpukinskis/bridge-module#readme
- Issues: https://github.com/erikpukinskis/bridge-module/issues
- npm.io page: https://npm.io/package/bridge-module

## Dependencies (3)

- [string-tree](https://npm.io/package/string-tree.md) *
- [function-call](https://npm.io/package/function-call.md) *
- [module-library](https://npm.io/package/module-library.md) ^0.96.0

## Recent versions

- 0.48.0 (latest) — 2021-01-01
- 0.47.0 — 2019-04-25
- 0.46.0 — 2019-04-09
- 0.45.0 — 2019-04-08
- 0.44.0 — 2019-04-08
- 0.43.0 — 2019-04-08
- 0.42.0 — 2019-04-08
- 0.41.0 — 2019-04-07
- 0.40.0 — 2019-03-02
- 0.39.0 — 2019-02-27
- 0.38.0 — 2019-02-27
- 0.37.0 — 2018-11-01
- 0.36.0 — 2018-10-31
- 0.35.0 — 2018-10-18
- 0.34.0 — 2017-04-12
- … 28 more at https://npm.io/package/bridge-module/versions

## README

**bridge-module** lets you define modules with dependencies on a [browser bridge](https://github.com/erikpukinskis/browser-bridge):

```javascript
var BrowserBridge = require("browser-bridge")
var bridgeModule = require("bridge-module")
var site = require("web-site")

var library = require("module-library")(require)

library.define(
  "cook-dinner",
  ["fire"],
  function(fire) {

    function cook(ingredients) {
      fire.light()
      ingredients.map(fire.add)
    }

    return cook
  }
)

library.define(
  "fire",
  function() {
    function Fire() {}

    Fire.prototype.light = function() {
      console.log("WHOOSH")
    }

    Fire.prototype.add = function(item) {
      console.log("adding", item, "to fire")
    }

    return new Fire()
  }
)

library.using(
  ["cook-dinner", "bridge-module", "browser-bridge", "web-site"],
  function(cook, bridgeModule, BrowserBridge, site) {
    var bridge = new BrowserBridge()

    var cookInBrowser = bridgeModule(library, "cook-dinner", bridge)

    bridge.asap(
      cookInBrowser.withArgs(["potato"])
    )

    site.addRoute("get", "/", bridge.sendPage())

    site.start(8000)
  }
)

```

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