Skip to content
Titanium SDK
Version12.6.2

You are reading 12.6.2. See this page in 13.4.1.

process

pseudoAndroidiPhoneiPadmacOSsince 8.1.0

Extends EventEmitter

A Node.js-compatible implementation of the core process module

Titanium provides a number of shims and ports of core Node.js module functionality.

This module is intended to provide a Node-compatible port of the process core module.

More details on the Node.js API can be found in their process module documentation

Note that this particular shim has many unimplemented, no-op, or unsupported APIs and events.

The process object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require(). It can also be explicitly accessed using require():

const process = require('process');

Properties 22

arch

String

Returns the operating system CPU architecture for which the binary was compiled. Possible values are return 'arm', 'arm64', 'ia32', 'x64', 'mips', and 'unknown'.

The return value is equivalent to os.arch. Relates strongly to Titanium.Platform.architecture.

argv

Array<String>

The process.argv property returns an array containing the command-line arguments passed when the Node.js process was launched. The first element will be process.execPath. See process.argv0 if access to the original value of argv[0] is needed. The second element will be the path to the JavaScript file being executed. The remaining elements will be any additional command-line arguments.

argv0

Stringread-only

The process.argv0 property stores a read-only copy of the original value of argv[0] passed when Node.js starts.

Value ""

channel

Object

Always undefined in Titanium.

Value "undefined"

config

Object

Always {} in Titanium.

connected

Boolean

Always false in Titanium.

Value false

debugPort

Number

The port used by the debugger when enabled.

env

Object

This is an object whose keys are environment variable names and whose values are the related environmnet variable values.

In Titanium, we will pass along environment variables from the system/CLI to the app for 'development' builds, but will not do so for 'production' builds!

execArgv

Array<String>

Always [] in Titanium.

exitCode

Number

Unused in Titanium.

Value "undefined"

The process.noDeprecation property indicates whether the --no-deprecation flag is set on the current Node.js process. See the documentation for the 'warning' event and the emitWarning() method for more information about this flag's behavior.

Default: false

pid

Number

The process.pid property returns the PID of the process. Always returns 0 in Titanium.

Value 0

ppid

Number

The process.ppid property returns the PID of the parent of the current process. Always returns 0 in Titanium.

Value 0

stderr

Object

The process.stderr property returns a stream connected to stderr.

stdout

Object

The process.stdout property returns a stream connected to stdout.

The initial value of process.throwDeprecation indicates whether the --throw-deprecation flag is set on the current Node.js process. process.throwDeprecation is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the 'warning' event and the emitWarning() method for more information.

Default: false

The process.traceDeprecation property indicates whether the --trace-deprecation flag is set on the current Node.js process. See the documentation for the 'warning' event and the emitWarning() method for more information about this flag's behavior.

Default: false

versions

Object

An object containing version information for included dependencies

Methods 26

This is not intended as user-facing API and will throw an Error if invoked.

This is unsupported on Titanium and will throw an Error if invoked.

Returns a dummy object with 0-ed out values.

Returns Object

Returns the value of __dirname on Titanium.

Returns String

This is unsupported on Titanium and will throw an Error if invoked.

Inherited from EventEmitter

Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

Returns true if the event had listeners, false otherwise.

Parameters
ParametersTypeDescription
eventNameString

The event name

args?any

Optional arguments to pass along to event listeners

Returns Boolean

The process.emitWarning() method can be used to emit custom or application specific process warnings. These can be listened for by adding a handler to the 'warning' event.

Parameters
ParametersTypeDescription
warningString | Error

The warning to emit.

options?String | EmitWarningOptions

When warning is a String, type is the name to use for the type of warning being emitted.

4 fields
code? String

A unique identifier for the warning instance being emitted.

ctor? Function

When warning is a String, ctor is an optional function used to limit the generated stack trace.

detail? String

Additional text to include with the error.

type? String

When warning is a String, type is the name to use for the type of warning being emitted.

code?String

A unique identifier for the warning instance being emitted.

ctor?Function

When warning is a String, ctor is an optional function used to limit the generated stack trace.

Inherited from EventEmitter

Returns an array listing the events for which the emitter has registered listeners.

Returns Array<String>

This is unsupported on Titanium and will throw an Error if invoked.

Inherited from EventEmitter

Returns the number of listeners listening to the event named eventName.

Parameters
ParametersTypeDescription
eventNameString

The event name

Returns Number

Inherited from EventEmitter

Returns a copy of the array of listeners for the event named eventName.

Parameters
ParametersTypeDescription
eventNameString

The event name

Returns Array<Function>

Inherited from EventEmitter

Adds the listener function to the end of the listeners array for the event named eventName.

Parameters
ParametersTypeDescription
eventNameString

The event name

listenerFunction

The event listener/callback function

Returns EventEmitter

Inherited from EventEmitter

Adds a one-time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

Parameters
ParametersTypeDescription
eventNameString

The event name

listenerFunction

The event listener/callback function

Returns EventEmitter

Inherited from EventEmitter

Adds the listener function to the beginning of the listeners array for the event named eventName.

Parameters
ParametersTypeDescription
eventNameString

The event name

listenerFunction

The event listener/callback function

Returns EventEmitter

Inherited from EventEmitter

Adds a one-time listener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

Parameters
ParametersTypeDescription
eventNameString

The event name

listenerFunction

The event listener/callback function

Returns EventEmitter

Inherited from EventEmitter

Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

Parameters
ParametersTypeDescription
eventNameString

The event name

Returns Array<Function>

Inherited from EventEmitter

Removes the specified listener from the listener array for the event named eventName.

Parameters
ParametersTypeDescription
eventNameString

The event name

listenerFunction

The event listener/callback function

Returns EventEmitter

Inherited from EventEmitter

By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

Parameters
ParametersTypeDescription
nNumber

new max listener count

Returns EventEmitter

No-op on Titanium. Will always return 0.

Returns Number

The process.uptime() method returns the number of seconds the current Node.js process has been running.

The return value includes fractions of a second. Use Math.floor() to get whole seconds.

Returns Number

Events 4

Inherited from EventEmitter

The 'newListener' event is emitted after the listener is added.

Event properties
Event propertiesTypeDescription
eventNameString

The event name

listenerFunction

The event handler function

Inherited from EventEmitter

The 'removeListener' event is emitted after the listener is removed.

Event properties
Event propertiesTypeDescription
eventNameString

The event name

listenerFunction

The event handler function

The 'uncaughtException' event is emitted when an uncaught JavaScript exception bubbles all the way back to the event loop.

Event properties
Event propertiesTypeDescription
errError

The uncaught exception.

The 'warning' event is emitted whenever Node.js emits a process warning.

Event properties
Event propertiesTypeDescription
warningError

The warning thrown.