forked from NativeScript/firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
152 lines (94 loc) · 4.11 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import { Firebase, FirebaseApp } from '@nativescript/firebase-core';
import { IDataSnapshot, IDatabase, IOnDisconnect, EventType, IQuery, IReference, IThenableReference, TransactionResult } from './common';
export { EventType };
export declare class OnDisconnect implements IOnDisconnect {
readonly native: any;
readonly android: any;
readonly ios: any;
cancel(onComplete?: (error: FirebaseError) => void): Promise<void>;
remove(onComplete?: (error: FirebaseError) => void): Promise<void>;
set(value: any, onComplete?: (error: FirebaseError) => void): Promise<void>;
setWithPriority(value: any, priority: string | number, onComplete?: (error: FirebaseError) => void): Promise<void>;
update(values: { [key: string]: any }, onComplete?: (error: FirebaseError) => void): Promise<void>;
}
export declare class Query implements IQuery {
readonly native: any;
readonly android: any;
readonly ios: any;
get ref(): Reference;
endAt(value: string | number | boolean, key?: string): Query;
equalTo(value: string | number | boolean, key?: string): Query;
keepSynced(bool: boolean);
limitToFirst(limit: number): Query;
limitToLast(limit: number): Query;
off(eventType?: EventType, callback?: (a: DataSnapshot, b: string) => void, context?: Record<string, any>): void;
on(eventType: EventType, callback: (data: DataSnapshot, previousChildKey: string) => void, cancelCallbackOrContext?: (a: FirebaseError) => void | Record<string, any>, context?: Record<string, any>): (a: DataSnapshot, b: string) => void;
once(eventType: EventType, successCallback?: (a: DataSnapshot, b: string) => any, failureCallbackContext?: (a: FirebaseError) => void | Record<string, any>): Promise<DataSnapshot>;
orderByChild(path: string): Query;
orderByKey(): Query;
orderByPriority(): Query;
orderByValue(): Query;
startAt(value: string | number | boolean, key?: string): Query;
}
export declare class ServerValue {
readonly native: any;
readonly android: any;
readonly ios: any;
static timeStamp(): ServerValue;
static increment(count: number): ServerValue;
}
export declare class Reference extends Query implements IReference {
readonly native: any;
readonly android: any;
readonly ios: any;
readonly key: string;
readonly parent: Reference;
readonly ref: Reference;
readonly root: Reference;
child(path: string): Reference;
onDisconnect(): OnDisconnect;
push(value?: any, onComplete?: () => void): IThenableReference;
remove(onComplete?: (error: FirebaseError) => void): Promise<void>;
set(value: any, onComplete?: (error: FirebaseError) => void): Promise<void>;
setPriority(priority: string | number, onComplete?: (error: FirebaseError) => void): Promise<void>;
setWithPriority(newVal: any, newPriority: string | number, onComplete?: (error: FirebaseError) => void): Promise<void>;
transaction(transactionUpdate: (currentData: object) => object, onComplete?: (error: FirebaseError, committed: boolean, finalResult: any) => void, applyLocally: boolean = true): Promise<TransactionResult>;
update(values: { [key: string]: any }, onComplete?: (error: FirebaseError) => void): Promise<void>;
}
export declare class DataSnapshot implements IDataSnapshot {
readonly native: any;
readonly android: any;
readonly ios: any;
readonly key: string;
readonly ref: Reference;
child(path: string): DataSnapshot;
exists(): boolean;
exportVal();
forEach(action: (child: DataSnapshot) => true): boolean;
getPriority(): string | number;
hasChild(path: string): boolean;
hasChildren(): boolean;
numChildren(): number;
val();
}
export declare class Database implements IDatabase {
readonly native: any;
readonly android: any;
readonly ios: any;
readonly app: FirebaseApp;
constructor(app?: FirebaseApp);
persistenceCacheSizeBytes: number;
persistenceEnabled: boolean;
useEmulator(host: string, port: number);
refFromURL(url: string): Reference;
setLoggingEnabled(enabled: boolean);
ref(path?: string): Reference;
goOffline();
goOnline();
}
declare module '@nativescript/firebase-core' {
export interface Firebase extends FirebaseDatabase {}
}
export interface FirebaseDatabase {
static database(app?: FirebaseApp): Database;
}