# @wazapp/core

> Core functionality

Latest version **0.11.2** (published 2020-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wazapp/core
pnpm add @wazapp/core
yarn add @wazapp/core
bun add @wazapp/core
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.11.2 |
| Published | 2020-08-15 |
| First published | 2020-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Maciej Kwaśniak |
| Maintainers | exelord |

## Links

- npm: https://www.npmjs.com/package/@wazapp/core
- Repository: https://github.com/wazappjs/wazapp
- Homepage: https://github.com/wazappjs/wazapp#readme
- Issues: https://github.com/wazappjs/wazapp/issues
- npm.io page: https://npm.io/package/@wazapp/core

## Dependencies (1)

- [@wazapp/utils](https://npm.io/package/@wazapp/utils.md) ^0.11.2

## Recent versions

- 0.11.2 (latest) — 2020-08-15
- 0.11.0 — 2020-06-20
- 0.9.0 — 2020-06-20
- 0.8.0 — 2020-06-20
- 0.7.0 — 2020-06-07
- 0.6.0 — 2020-06-07
- 0.5.0 — 2020-06-03
- 0.4.0 — 2020-05-31
- 0.3.2 — 2020-05-25
- 0.3.1 — 2020-05-24
- 0.3.0 — 2020-05-24
- 0.2.0 — 2020-05-23
- 0.1.0 — 2020-05-17

## README

# @wazapp/core

The core is the main element of Wazapp application. It delivers `<App />` component which creates app's `Owner`. It use used to keep all your singleton instances, eg. `Services`.

## API

### App

The App component will integrate your app with Wazapp. Make sure to wrap your top level component with it.

Optionally, you can pass your own `Owner` instance to it, using `owner` property.

#### Example

```typescript
import { App as Wazapp } from '@wazapp/core'

const MyApp = () => (
  <Wazapp>
    <IndexPage />
  </Wazapp>
)

export default MyApp;
```

### Owner

The owner serves as a global registry for your application.
It exposes two methods: `lookup` and `register`. Usually, you dont need to worry about them but may become hand if you would like to pre initialize your own service.

Owner is used by `@wazapp/component` to access and lazy instantiate services.

#### Methods

- `register(key: any, value: any)` - register "memorize" any valye you want under whatever key you want
- `lookup(key: any)` - withdraw the "memorized" value for specific key

#### Example

```typescript
class MySingleton {
  constructor(options) {
    this.options = options;
  }
}

owner.register(MySingleton, new MySingleton({ hey: 'wazapp' }));

const mySingletonInstance = owner.lookup(MySingleton);
```

---
_Source: https://npm.io/package/@wazapp/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
