_internal.classes.focus._manager.FocusManager - vladzaharia/bitburner GitHub Wiki

Class: FocusManager

_internal/classes/focus/_manager.FocusManager

Manages IFocusable objects, executing based on priority.

implements IFocusable

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new FocusManager(ns)

Creates a new manager capable of handling multiple IFocusables.

Parameters

Name Type Description
ns NS The Netscript object

Defined in

_internal/classes/focus/_manager.ts:32

Properties

_currentFocusable

Private _currentFocusable: undefined | IFocusable

Currently executing focusable.

Defined in

_internal/classes/focus/_manager.ts:21


_ns

Private _ns: NS

The Netscript object.

Defined in

_internal/classes/focus/_manager.ts:15


_registered

Private _registered: IFocusable[] = []

All registered focus actions.

Defined in

_internal/classes/focus/_manager.ts:18


_sleepTime

Private _sleepTime: undefined | number

Sleep time left.

Defined in

_internal/classes/focus/_manager.ts:24


name

name: string = "Manager"

The name of the focusable.

Implementation of

IFocusable.name

Defined in

_internal/classes/focus/_manager.ts:12

Methods

canFocus

canFocus(): boolean

Returns whether any registered focus actions are executable.

Returns

boolean

True if any registered actions are available, false otherwise.

Implementation of

IFocusable.canFocus

Defined in

_internal/classes/focus/_manager.ts:48


clearFocus

clearFocus(): void

Clear current focus.

Returns

void

Defined in

_internal/classes/focus/_manager.ts:99


decrementFocusTime

decrementFocusTime(decrement?): number

Decrement focus time and return the new value.

Parameters

Name Type
decrement number

Returns

number

New focus time after decrementing.

Defined in

_internal/classes/focus/_manager.ts:128


focus

focus(): number

Executes focus() on highest priority item which canFocus().

Returns

number

Whether the focus action was successful.

Implementation of

IFocusable.focus

Defined in

_internal/classes/focus/_manager.ts:57


getCheckInterval

getCheckInterval(): number

Gets the check interval from the focusable, defaults to DEFAULT_CHECK_INTERVAL

Returns

number

Amount of time to wait in between soft-sleep checks.

Implementation of

IFocusable.getCheckInterval

Defined in

_internal/classes/focus/_manager.ts:119


getDetailText

getDetailText(): string

Not applicable to the FocusManager.

Returns

string

Implementation of

IFocusable.getDetailText

Defined in

_internal/classes/focus/_manager.ts:145


getFocusTime

getFocusTime(): number

Gets the focus time left, can be decremented using decrementFocusTime.

Returns

number

Time left to focus.

Implementation of

IFocusable.getFocusTime

Defined in

_internal/classes/focus/_manager.ts:110


getPriority

getPriority(): number

Not applicable to the FocusManager.

Returns

number

Implementation of

IFocusable.getPriority

Defined in

_internal/classes/focus/_manager.ts:152


isWorking

isWorking(): boolean

Check whether the player is focusing on something.

Returns

boolean

Whether the player is focusing on something.

Defined in

_internal/classes/focus/_manager.ts:92


register

register(focusable): void

Registers a new IFocusable with this manager.

Parameters

Name Type
focusable IFocusable

Returns

void

Defined in

_internal/classes/focus/_manager.ts:39


shouldContinueRunning

shouldContinueRunning(): boolean

Check if current focusable needs to continue running.

Returns

boolean

True if it should continue, false otherwise.

Implementation of

IFocusable.shouldContinueRunning

Defined in

_internal/classes/focus/_manager.ts:138


shouldRunInBackground

shouldRunInBackground(): boolean

Not applicable to the FocusManager.

Returns

boolean

Implementation of

IFocusable.shouldRunInBackground

Defined in

_internal/classes/focus/_manager.ts:159

⚠️ **GitHub.com Fallback** ⚠️