# greenhouse

> reactive dependency inversion container

Latest version **1.7.0** (published 2015-08-02) · BSD license · 0 weekly downloads

## Install

```sh
npm install greenhouse
pnpm add greenhouse
yarn add greenhouse
bun add greenhouse
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2015-08-02 |
| First published | 2015-07-29 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Josh Chisholm |
| Maintainers | joshski |

## Links

- npm: https://www.npmjs.com/package/greenhouse
- npm.io page: https://npm.io/package/greenhouse

## Dependencies (3)

- [esprima](https://npm.io/package/esprima.md) ^2.4.1
- [toposort](https://npm.io/package/toposort.md) ^0.2.10
- [esglobals](https://npm.io/package/esglobals.md) ^1.1.0

## Recent versions

- 1.7.0 (latest) — 2015-08-02
- 1.6.0 — 2015-08-01
- 1.5.0 — 2015-08-01
- 1.4.0 — 2015-08-01
- 1.3.1 — 2015-08-01
- 1.3.0 — 2015-08-01
- 1.2.0 — 2015-07-30
- 1.1.1 — 2015-07-30
- 1.1.0 — 2015-07-30
- 1.0.3 — 2015-07-29
- 1.0.2 — 2015-07-29
- 1.0.1 — 2015-07-29
- 1.0.0 — 2015-07-29

## README

# Greenhouse

A container for JavaScript modules. It's a dependency injection framework,
which sounds bad, but it's actually good.

## Why?

Reloading code when it changes is difficult with `require`. Greenhouse makes it
easy to build reactive interfaces for editing code e.g. in a web browser.

## Modules

To avoid using `require` behaviour at all, Greenhouse assumes that modules are
very small. That way any global variables can be considered as dependencies.
Greenhouse takes charge of interpreting the JavaScript code in each module and
re-interpreting modules when their dependencies are updated.

## Registration

```JavaScript
var Greenhouse = require('greenhouse');

var house = new Greenhouse();

house.module({
  name: 'bomb',
  body: 'clock.atNoon(function() { explode() })'
});

house.module({
  name: 'clock',
  body: 'return { atNoon: function(callback) { callback() } }'
});

house.module({
  name: 'explode',
  body: 'return function() { alert("BANG!") }'
});

house.resolve('bomb'); // -> alerts "BANG!"

house.module({
  name: 'bomb',
  body: 'return clock.atNoon(function() { explode(); explode(); })'
});

house.resolve('bomb'); // -> alerts "BANG!" twice

```

## Doesn't this make a big dirty old global scope? what about namespaces?

Avoid naming collisions by making small modules.

## license

BSD

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