# contextjs

> Context Oriented Programming (COP) for ECMAScript 6

Latest version **2.0.0** (published 2016-07-13) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2016-07-13 |
| First published | 2016-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/contextjs) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | HPI Software Architecture Group |
| Maintainers | mariannet |
| Keywords | COP, Context, Oriented, Programming |

## Links

- npm: https://www.npmjs.com/package/contextjs
- Repository: https://github.com/LivelyKernel/ContextJS
- Homepage: https://github.com/LivelyKernel/ContextJS#readme
- Issues: https://github.com/LivelyKernel/ContextJS/issues
- npm.io page: https://npm.io/package/contextjs

## Recent versions

- 2.0.0 (latest) — 2016-07-13
- 1.0.0 — 2016-07-13
- 0.0.5 — 2016-07-12
- 0.0.1 — 2016-07-12

## README

# ContextJS

Context-oriented Programming (COP) for JavaScript


## Example Code 

```JS
import { layer, proceed, withLayers } from "https://lively-kernel.org/lively4/ContextJS"

class Foo {
	bar() {
		return 3
	}
}

const L1 = layer("L1")
L1.refineClass(Foo, {
	bar() { return proceed() + 4}
})

let o = new Foo()
o.bar()  // 3
withLayers([L1], () => o.bar())  // 7
```

## Further Functionality

Further functionality can be added via

```JS
import { withoutLayers, Layer } from "https://lively-kernel.org/lively4/ContextJS"
import * as cop from "https://lively-kernel.org/lively4/ContextJS/Layer.js"
```

# Global import of ContextJS

If you would like to add the functions and classes exported from the
`contetxjs` Module (proceed, withLayers etc.) into the `window` or `global`
object, so you do not have to enumerate the identifiers in the import statement
and do not need to prefix them with a "namespace", you can write `import
"https://lively-kernel.org/lively4/ContextJS/module_import.js"`.

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