# Module: data

Contains the singleton data structure definition that allows the entire application, to share data between various components of the framework and greater application platform.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - structures/data.js, line 1

### Requires

- module:ruleBroker
- @haystacks/constants

### Methods

#### (inner) getData() → {object}

returns the contents of the data structure. Can be used to stash data, before it is reassigned, for the purpose of setting up a unit test scenario with mocked data.

Author:
  - Seth Hollingsead
Source:
  - structures/data.js, line 21

##### Returns:

A JSON object that contains all of the data that is currently stored in the data structure.

Type
  object

#### (inner) setData(newData) → {boolean}

Clears the data and sets it to some new specified data. Can be used to setup mock data, or create a clone of Haystacks for the purposes of executing a callback on Haystacks such as loading more data for a plugin.

##### Parameters:

Name | Type | Description
--- | --- | ---
`newData` | object | The new data that should replace any data already stored on the data structure.

Author:
  - Seth Hollingsead
Source:
  - structures/data.js, line 40

##### Returns:

True or false to indicate success or failure if the data was set.

Type
  boolean