2.0.0 • Published 8 years ago

contextjs v2.0.0

Weekly downloads
31
License
MIT
Repository
github
Last release
8 years ago

ContextJS

Context-oriented Programming (COP) for JavaScript

Example Code

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

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".

2.0.0

8 years ago

1.0.0

8 years ago

0.0.5

8 years ago

0.0.1

8 years ago