-
-
Notifications
You must be signed in to change notification settings - Fork 603
Expand file tree
/
Copy pathEventuallyQueue.d.ts
More file actions
168 lines (168 loc) · 5.49 KB
/
EventuallyQueue.d.ts
File metadata and controls
168 lines (168 loc) · 5.49 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import ParseObject from './ParseObject';
import type { Queue, QueueObject } from './CoreManager';
import type { SaveOptions } from './ParseObject';
import type { RequestOptions } from './RESTController';
/**
* Provides utility functions to queue objects that will be
* saved to the server at a later date.
*
* @class Parse.EventuallyQueue
* @static
*/
declare const EventuallyQueue: {
/**
* Add object to queue with save operation.
*
* @function save
* @name Parse.EventuallyQueue.save
* @param {ParseObject} object Parse.Object to be saved eventually
* @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#save Parse.Object.save} options.
* @returns {Promise} A promise that is fulfilled if object is added to queue.
* @static
* @see Parse.Object#saveEventually
*/
save(object: ParseObject, serverOptions?: SaveOptions): Promise<void>;
/**
* Add object to queue with save operation.
*
* @function destroy
* @name Parse.EventuallyQueue.destroy
* @param {ParseObject} object Parse.Object to be destroyed eventually
* @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#destroy Parse.Object.destroy} options
* @returns {Promise} A promise that is fulfilled if object is added to queue.
* @static
* @see Parse.Object#destroyEventually
*/
destroy(object: ParseObject, serverOptions?: RequestOptions): Promise<void>;
/**
* Generate unique identifier to avoid duplicates and maintain previous state.
*
* @param {string} action save / destroy
* @param {object} object Parse.Object to be queued
* @returns {string}
* @static
* @ignore
*/
generateQueueId(action: string, object: ParseObject): string;
/**
* Build queue object and add to queue.
*
* @param {string} action save / destroy
* @param {object} object Parse.Object to be queued
* @param {object} [serverOptions]
* @returns {Promise} A promise that is fulfilled if object is added to queue.
* @static
* @ignore
*/
enqueue(action: string, object: ParseObject, serverOptions?: SaveOptions | RequestOptions): Promise<void>;
store(data: Queue): Promise<void>;
load(): Promise<string | null>;
/**
* Sets the in-memory queue from local storage and returns.
*
* @function getQueue
* @name Parse.EventuallyQueue.getQueue
* @returns {Promise<Queue>}
* @static
*/
getQueue(): Promise<Queue>;
/**
* Saves the queue to local storage
*
* @param {Queue} queue Queue containing Parse.Object data.
* @returns {Promise} A promise that is fulfilled when queue is stored.
* @static
* @ignore
*/
setQueue(queue: Queue): Promise<void>;
/**
* Removes Parse.Object data from queue.
*
* @param {string} queueId Unique identifier for Parse.Object data.
* @returns {Promise} A promise that is fulfilled when queue is stored.
* @static
* @ignore
*/
remove(queueId: string): Promise<void>;
/**
* Removes all objects from queue.
*
* @function clear
* @name Parse.EventuallyQueue.clear
* @returns {Promise} A promise that is fulfilled when queue is cleared.
* @static
*/
clear(): Promise<void>;
/**
* Return the index of a queueId in the queue. Returns -1 if not found.
*
* @param {Queue} queue Queue containing Parse.Object data.
* @param {string} queueId Unique identifier for Parse.Object data.
* @returns {number}
* @static
* @ignore
*/
queueItemExists(queue: Queue, queueId: string): number;
/**
* Return the number of objects in the queue.
*
* @function length
* @name Parse.EventuallyQueue.length
* @returns {Promise<number>}
* @static
*/
length(): Promise<number>;
/**
* Sends the queue to the server.
*
* @function sendQueue
* @name Parse.EventuallyQueue.sendQueue
* @returns {Promise<boolean>} Returns true if queue was sent successfully.
* @static
*/
sendQueue(): Promise<boolean>;
/**
* Build queue object and add to queue.
*
* @param {ParseObject} object Parse.Object to be processed
* @param {QueueObject} queueObject Parse.Object data from the queue
* @returns {Promise} A promise that is fulfilled when operation is performed.
* @static
* @ignore
*/
sendQueueCallback(object: ParseObject, queueObject: QueueObject): Promise<void>;
/**
* Start polling server for network connection.
* Will send queue if connection is established.
*
* @function poll
* @name Parse.EventuallyQueue.poll
* @param [ms] Milliseconds to ping the server. Default 2000ms
* @static
*/
poll(ms?: number): void;
/**
* Turns off polling.
*
* @function stopPoll
* @name Parse.EventuallyQueue.stopPoll
* @static
*/
stopPoll(): void;
/**
* Return true if pinging the server.
*
* @function isPolling
* @name Parse.EventuallyQueue.isPolling
* @returns {boolean}
* @static
*/
isPolling(): boolean;
_setPolling(flag: boolean): void;
process: {
create(ObjectType: any, queueObject: any): Promise<void>;
byId(ObjectType: any, queueObject: any): Promise<void>;
byHash(ObjectType: any, queueObject: any): Promise<void>;
};
};
export default EventuallyQueue;