@joystick.js/ui

Settings

Access environment settings in Joystick components.

Environment settings can be accessed in components via the default joystick export from @joystick.js/ui at joystick.settings. In a client-side environment, only joystick.settings.public and joystick.settings.global are exposed—joystick.settings.private is intentionally excluded for the sake of security.

Example Usage

ui/pages/index/index.js

import joystick from '@joystick.js/ui';

console.log(joystick.settings);
// { global: { ... }, public: { ... } }

Node Process Polyfill

In addition to your app's environment settings, a polyfill is provided in browsers for the Node.js process object in order to provide access to process.env.NODE_ENV. This polyfill is made accessible globally at window.process, or just process.

API

Definition

joystick.settings: {
  global: object;
  public: object;
  private: object; // server-only
}

process: {
  env: {
    NODE_ENV: string;
  }
}

Parameters

joystick.settings object required
An object containing environment settings defined in your Joystick app.
global object
Environment settings that are always available in both server and client environments.
public object
Environment settings explicitly marked as public. These are accessible in client-side code.
private object
Environment settings only available in server-side code. Not exposed in client environments for security reasons.
process object required
A Node.js process polyfill available in client environments for compatibility.
env object required
Contains environment variables, including NODE_ENV for determining the current environment (e.g., 'development' or 'production').