Globals

Globals object is used to store and manage properties in the global store.

Version 3.x

Basic Usage

1
2
3
4
5
6
7
8
9
var globals = require('core/v3/globals');
var response = require('http/v3/response');

globals.set("attr1", "value1");
var attr = globals.get("attr1");

response.println("[Attribute]: " + attr);
response.flush();
response.close();

Definition

Functions


Function Description Returns
get(key) Returns the value per key from the global parameters string
set(key, value) Sets the value per key to the global parameters -

Compatibility

Rhino Nashorn V8
βœ… βœ… βœ…


Version 2.x

Basic Usage

1
2
3
4
5
6
7
8
9
10
11
12
/* globals $ */
/* eslint-env node, dirigible */

var globals = require('core/globals');
var response = require('net/http/response');

globals.set("attr1", "value1");
var attr = globals.get("attr1");

response.println("[Attribute]: " + attr);
response.flush();
response.close();

Definition

Functions


Function Description Returns
get(key) Returns the value per key from the global parameters string
set(key, value) Sets the value per key to the global parameters -

Compatibility

Rhino Nashorn V8
βœ… βœ… ❌
Edit