0.1.0 • Published 3 years ago
@just-web/contexts v0.1.0
@just-web/contexts
@just-web/contexts
provides an API where components and plugins can interact with the application.
Usage
getReadonlyContext
getReadonlyContext()
returns a ReadonlyContext
after the application is started
(i.e. createContext()
is called).
import { getReadonlyContext } from '@just-app/contexts'
function work() {
const context = getReadonlyContext()
}
Note that you cannot call getReadonlyContext()
at load time.
The application needs to start before the context is available.
Context
Plugin's activate
function will receive a context
from the application.
Plugin can use it to interact with the system.
import { Context } from '@just-web/contexts'
export function activate(context: Context) {
// code away
}
0.1.0
3 years ago