0.2.32 • Published 6 months ago

@types/milkcocoa v0.2.32

Weekly downloads
22
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for Milkcocoa 0.2.8
// Project: https://mlkcca.com/
// Definitions by: DefinitelyTyped <https://github.com/DefinitelyTyped>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Api Reference : https://mlkcca.com/document/api-js.html

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: Thu, 23 Dec 2021 23:35:06 GMT
  • Dependencies: none
  • Global values: milkcocoa

Credits

These definitions were written by DefinitelyTyped.

0.2.30

8 months ago

0.2.32

6 months ago

0.2.31

7 months ago

0.2.29

2 years ago

0.2.28

8 years ago

0.2.27

8 years ago

0.2.26-alpha

8 years ago

0.2.25-alpha

8 years ago

0.2.24-alpha

8 years ago

0.2.23-alpha

8 years ago

0.2.22-alpha

8 years ago

0.2.21-alpha

8 years ago

0.2.20-alpha

8 years ago

0.2.15-alpha

8 years ago

0.2.14-alpha

8 years ago