0.0.2 • Published 1 year ago

@vyke/context v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Installation

npm i @vyke/context

API

defineContext

Defines a context that can be used to run code in a specific context

const context = defineContext('test')

const context1 = 'test 1'
const context2 = 'test 2'
const context3 = 'test 3'

context.run(context1, () => {
	console.log(context.getValue(context1)) // test 1

	context.run(context2, () => {
		console.log(context.getValue(context2)) // test 2

		context.run(context3, () => {
			console.log(context.getValue(context3)) // test 3
		})

		console.log(context.getValue(context2)) // test 2
	})

	console.log(context.getValue(context1)) // test 1
})

Others vyke projects

0.0.2

1 year ago