# @types/milkcocoa

> TypeScript definitions for milkcocoa

Latest version **0.2.32** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/milkcocoa
pnpm add @types/milkcocoa
yarn add @types/milkcocoa
bun add @types/milkcocoa
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.32 |
| Published | 2023-11-07 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51411 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/milkcocoa
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/milkcocoa
- npm.io page: https://npm.io/package/@types/milkcocoa

## Recent versions

- 0.2.32 (latest) — 2023-11-07
- 0.2.29 (ts3.8) — 2021-12-24
- 0.2.28 (ts2.0) — 2016-09-19
- 0.2.31 — 2023-10-18
- 0.2.30 — 2023-09-27
- 0.2.27 — 2016-07-14
- 0.2.26-alpha — 2016-07-08
- 0.2.25-alpha — 2016-07-04
- 0.2.24-alpha — 2016-07-02
- 0.2.23-alpha — 2016-07-01
- 0.2.22-alpha — 2016-07-01
- 0.2.21-alpha — 2016-05-25
- 0.2.20-alpha — 2016-05-20
- 0.2.15-alpha — 2016-05-19
- 0.2.14-alpha — 2016-05-17

## README

# Installation
> `npm install --save @types/milkcocoa`

# Summary
This package contains type definitions for milkcocoa (https://mlkcca.com/).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/milkcocoa.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/milkcocoa/index.d.ts)
````ts
declare namespace milkcocoa {
    class MilkCocoa {
        constructor(host: string, callback?: Function);
        dataStore(path: string): DataStore;
        addAccount(
            email: string,
            password: string,
            options?: {},
            callback?: (err: MilkCocoa.Error.AddAccount, user: User) => void,
        ): void;
        login(email: string, password: string, callback: (err: MilkCocoa.Error.Login, user: User) => void): void;
        logout(callback?: (err: string) => void): void;
        getCurrentUser(callback: (err: MilkCocoa.Error.GetCurrentUser, user: { id: string }) => void): void;
    }

    namespace MilkCocoa {
        namespace Error {
            enum AddAccount {
                // FormatError = 1, AlreadyExist = 2
                FormatError,
                AlreadyExist,
            }
            enum Login {
                // FormatError = 1, LoginError = 2, EmailNotVerificated = 3
                FormatError,
                LoginError,
                EmailNotVerificated,
            }
            enum GetCurrentUser {
                // NotLoggedIn = 1
                NotLoggedIn,
            }
        }
    }

    interface DataStore {
        push(object: {}, callback?: (data: DataStoreCallbackData) => void): void;
        set(id: string, data: {}): void;
        remove(id: string): void;
        send(object: {}): void;
        // event push, remove, set, send
        on(event: string, callback: (data: DataStoreCallbackData) => void): void;
        off(event: string): void;
        get(id: string, callback: (data: {}) => void): void;
        query(condition?: {}): Query;
        child(path: string): DataStore;
        parent(): DataStore;
        root(): DataStore;
    }

    interface DataStoreCallbackData {
        err: string;
        path: string;
        id: string;
        value: any;
    }

    interface Query {
        done(callback: (data: any) => void): void;
        limit(number: number): Query;
        skip(index: number): Query;
        // mode  asc, desc
        sort(mode: string): Query;
    }

    interface User {
        id: string;
        email: string;
        option: {};
    }
}

import MilkCocoa = milkcocoa.MilkCocoa;
import User = milkcocoa.User;
import Query = milkcocoa.Query;
import DataStore = milkcocoa.DataStore;
import DataStoreCallbackData = milkcocoa.DataStoreCallbackData;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: none

# Credits
These definitions were written by .

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