API: context
Source:
core/context.ts
API Context
- Provides a static interface for accessing and manipulating key-value pairs in a global, application-wide context.
Usage
javascript
import { context } from "sdk/core";
import { response } from "sdk/http";
context.set("attr1", "value1");
let attr = context.get("attr1");
response.println("[Attribute]: " + attr);
response.flush();
response.close();Classes
Context
API Context
* Provides a static interface for accessing and manipulating key-value pairs in a global, application-wide context.
Methods
get
get (name:string):any|undefinedRetrieves the value associated with the specified name from the global context.
@param name The name of the context variable.
@returns The context value, orundefinedif the name is not found or the value is null.
set
set (name:string, value:any):voidStores a value in the global context under the specified name.
If the name already exists, its value is overwritten.
@param name The name of the context variable.
@param value The value to store.