API Reference (2.0) - Zodiase/meteor-infinite-load GitHub Wiki
- InfiniLoadBase
-
Common interface shared by both client and server code. For inheritance only, should not be instantiated directly.
-
InfiniLoadClient ⇐
InfiniLoadBase
-
Client side interface for loading collection data incrementally.
-
InfiniLoadServer ⇐
InfiniLoadBase
-
Server side interface for loading collection data incrementally.
Common interface shared by both client and server code. For inheritance only, should not be instantiated directly.
Kind: global class
-
InfiniLoadBase
- new InfiniLoadBase(collection, [options])
-
instance
-
.originalCollection ⇒
Mongo.Collection
-
.id ⇒
String
-
.collectionName ⇒
String
-
.originalCollection ⇒
- static
-
inner
-
~CommonOptions :
Object
-
~CommonOptions :
Common constructor shared by both client and server code.
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
The collection this InfiniLoad instance belongs to. |
[options] | CommonOptions |
Optional configurations. |
Returns the collection this InfiniLoad instance belongs to.
Kind: instance property of InfiniLoadBase
Returns the ID of this InfiniLoad instance. IDs are unique for each collection they belong to.
Kind: instance property of InfiniLoadBase
Returns the name of the dedicated collection for this InfiniLoad instance.
Kind: instance property of InfiniLoadBase
Returns the name of the dedicated collection for the specified InfiniLoad instance.
Kind: static method of InfiniLoadBase
Param | Type | Description |
---|---|---|
collectionName | String |
Name of the collection this InfiniLoad instance belongs to. |
instanceId | String |
ID of this InfiniLoad instance. |
Add the instance to the tracking list. Throws if it already exists.
Kind: static method of InfiniLoadBase
Param | Type |
---|---|
instance | InfiniLoadBase |
Configurable options existing on both client side and server side.
Kind: inner typedef of InfiniLoadBase
Properties
Name | Type | Default | Description |
---|---|---|---|
id | String |
"default" |
The ID of this instance unique within this collection. Case in-sensitive. |
verbose | Boolean |
false |
Set to true to turn on the verbose mode. More logs will be spit out. |
InfiniLoadClient ⇐ InfiniLoadBase
Client side interface for loading collection data incrementally.
Kind: global class
Extends: InfiniLoadBase
-
InfiniLoadClient ⇐
InfiniLoadBase
- new InfiniLoadClient(collection, [options])
-
instance
-
.rawCollection ⇒
Mongo.Collection
-
.stats ⇒
StatsDocument
-
.limit ⇒
Number
-
.started ⇒
Boolean
-
.ready ⇒
Boolean
-
.busy ⇒
Boolean
-
.originalCollection ⇒
Mongo.Collection
-
.id ⇒
String
-
.collectionName ⇒
String
- .find()
- .findOne()
-
.count() ⇒
Number
-
.countMore() ⇒
Number
-
.countNew() ⇒
Number
-
.countTotal() ⇒
Number
-
.hasMore() ⇒
Boolean
-
.hasNew() ⇒
Boolean
-
.loadMore([amount]) ⇒
Promise
-
.loadNew() ⇒
Promise
-
.setServerParameters(data) ⇒
Promise
-
.getServerParameters() ⇒
Object
-
.on(events, handler) ⇒
InfiniLoadClient
-
.off(events, handler) ⇒
InfiniLoadClient
-
.start([template]) ⇒
Promise
-
.sync() ⇒
Promise
-
.stop() ⇒
Promise
-
.rawCollection ⇒
-
inner
-
~ClientOptions :
Object
-
~ClientOptions :
Creates a new client side InfiniLoad instance for a Mongo.Collection.
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
The collection this InfiniLoad instance belongs to. |
[options] | ClientOptions |
Optional configurations. |
Get the dedicated collection for this instance for this collection.
Kind: instance property of InfiniLoadClient
infiniLoadClient.stats ⇒ StatsDocument
Get the stats document. A reactive data source.
Kind: instance property of InfiniLoadClient
Get the current load limit. A reactive data source.
Kind: instance property of InfiniLoadClient
Returns true if running and not stopping. A reactive data source.
Kind: instance property of InfiniLoadClient
Returns true if data is ready. A reactive data source.
Kind: instance property of InfiniLoadClient
Returns true if there are unresolved requests. A reactive data source.
Kind: instance property of InfiniLoadClient
Returns the collection this InfiniLoad instance belongs to.
Kind: instance property of InfiniLoadClient
Returns the ID of this InfiniLoad instance. IDs are unique for each collection they belong to.
Kind: instance property of InfiniLoadClient
Returns the name of the dedicated collection for this InfiniLoad instance.
Kind: instance property of InfiniLoadClient
Same as Mongo.Collection.prototype.find
.
A reactive data source.
Kind: instance method of InfiniLoadClient
Same as Mongo.Collection.prototype.findOne
.
A reactive data source.
Kind: instance method of InfiniLoadClient
Return the number of documents that have been loaded. A reactive data source.
Kind: instance method of InfiniLoadClient
Return the number of old documents that have not been loaded yet. A reactive data source.
Kind: instance method of InfiniLoadClient
Return the number of new documents that have not been loaded yet. A reactive data source.
Kind: instance method of InfiniLoadClient
Return the number of all documents in the collection. A reactive data source.
Kind: instance method of InfiniLoadClient
Returns true
if there are more old documents to load.
A reactive data source.
Kind: instance method of InfiniLoadClient
Returns true
if there are more new documents to load.
A reactive data source.
Kind: instance method of InfiniLoadClient
Load more old documents from server. If this called before starting, an error will be thrown.
Kind: instance method of InfiniLoadClient
Param | Type | Default | Description |
---|---|---|---|
[amount] | Number |
0 |
The amount to load. If omitted, the default amount would be used. |
Load all new documents from server. If this called before starting, an error will be thrown.
Kind: instance method of InfiniLoadClient
Set the parameters sent to the server side. If used before starting, registering any ready callbacks will not take effect.
Kind: instance method of InfiniLoadClient
Param | Type |
---|---|
data | Object |
Get the last parameters received by the server. The data returned is not necessarily the same as the value just set since the value may not have been received by the server yet. A reactive data source.
Kind: instance method of InfiniLoadClient
infiniLoadClient.on(events, handler) ⇒ InfiniLoadClient
Attach an event handler function for one or more events.
Kind: instance method of InfiniLoadClient
Returns: InfiniLoadClient
- For chaining.
Param | Type | Description |
---|---|---|
events | String |
A list of space separated event names. |
handler | function |
The callback function. |
infiniLoadClient.off(events, handler) ⇒ InfiniLoadClient
Remove an event handler.
Kind: instance method of InfiniLoadClient
Returns: InfiniLoadClient
- For chaining.
Param | Type | Description |
---|---|---|
events | String |
A list of space separated event names. |
handler | function |
The matching callback function. |
Start all the automations. If a template instance is provided, all the automations will be attached to it so they will be terminated automatically.
Kind: instance method of InfiniLoadClient
Param | Type |
---|---|
[template] | Blaze.TemplateInstance |
Force a new subscription with the current settings. This is useful for waiting previous server updates to propagate to client. If this called before starting, an error will be thrown.
Kind: instance method of InfiniLoadClient
Stop all the automations.
Kind: instance method of InfiniLoadClient
Configurable options for client side.
Kind: inner typedef of InfiniLoadClient
Extends: CommonOptions
Properties
Name | Type | Default | Description |
---|---|---|---|
initialLimit | Number |
10 |
The max number of documents to load on start. |
limitIncrement | Number |
initialLimit |
The number of additional documents to load on .loadMore() by default. |
InfiniLoadServer ⇐ InfiniLoadBase
Server side interface for loading collection data incrementally.
Kind: global class
Extends: InfiniLoadBase
-
InfiniLoadServer ⇐
InfiniLoadBase
- new InfiniLoadServer(collection, [options])
-
instance
-
.originalCollection ⇒
Mongo.Collection
-
.id ⇒
String
-
.collectionName ⇒
String
-
.originalCollection ⇒
-
inner
-
~SubscribeOptions :
Object
-
~SelectorFactory ⇒
Object
-
~SortFactory ⇒
Object
-
~FieldsFactory ⇒
Object
-
~Affiliation :
function
-
~ServerOptions :
Object
-
~SubscribeOptions :
Object
-
~StatsDocument :
Object
-
~SubscribeOptions :
Creates a new server side InfiniLoad instance for a Mongo.Collection.
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
The collection this InfiniLoad instance belongs to. |
[options] | ServerOptions |
Optional configurations. |
Returns the collection this InfiniLoad instance belongs to.
Kind: instance property of InfiniLoadServer
Returns the ID of this InfiniLoad instance. IDs are unique for each collection they belong to.
Kind: instance property of InfiniLoadServer
Returns the name of the dedicated collection for this InfiniLoad instance.
Kind: instance property of InfiniLoadServer
Kind: inner typedef of InfiniLoadServer
Properties
Name | Type | Description |
---|---|---|
requestId | String |
A unique identifier for each subscription request. |
args | Object |
Arguments passed to find option factories. |
limit | Number |
How many documents to return. |
lastLoadTime | Number |
Cut-off time between new and old documents. This is tracked by the client so other parameters can be changed without moving the cut-off line. |
quit | Boolean |
Set to true to ask server to clean up subscription. |
Return dynamic selector object based on user info and client parameters.
Kind: inner typedef of InfiniLoadServer
Param | Type | Description |
---|---|---|
userId | String |
The ID of the current user. |
params | Object |
Parameters set by client. |
Return dynamic sort object based on user info and client parameters.
Kind: inner typedef of InfiniLoadServer
Param | Type | Description |
---|---|---|
userId | String |
The ID of the current user. |
params | Object |
Parameters set by client. |
Return dynamic fields object based on user info and client parameters.
Kind: inner typedef of InfiniLoadServer
Param | Type | Description |
---|---|---|
userId | String |
The ID of the current user. |
params | Object |
Parameters set by client. |
Use the add callback to add affiliated documents.
Kind: inner typedef of InfiniLoadServer
Param | Type | Description |
---|---|---|
doc | Object |
|
add | function |
Same as this.added in Meteor.publish ; pass the collection name as the first parameter, document ID as the second, and the document as the third. |
Configurable options for server side.
Kind: inner typedef of InfiniLoadServer
Extends: CommonOptions
Properties
Name | Type | Default | Description |
---|---|---|---|
selector |
Object | SelectorFactory
|
{} |
The selector object or a factory function for generating the selector object. |
sort |
Object | SortFactory
|
{} |
The sort object or a factory function for generating the sort object. |
fields |
Object | FieldsFactory
|
{} |
The fields object or a factory function for generating the fields object. |
timeField |
String | Object
|
{name: "createTime", type: "number"} |
The name and type of the field used for temporal sorting. If a string is provided, it is considered the name of the field and type is the default value "number" . |
affiliation | Affiliation |
|
Use this function to add more documents to be published alongside. |
slowdown | Number |
0 |
How much time in milliseconds to wait before publishing data. |
Kind: inner typedef of InfiniLoadServer
Properties
Name | Type | Description |
---|---|---|
requestId | String |
A unique identifier for each subscription request. |
args | Object |
Arguments passed to find option factories. |
limit | Number |
How many documents to return. |
lastLoadTime | Number |
Cut-off time between new and old documents. This is tracked by the client so other parameters can be changed without moving the cut-off line. |
Kind: inner typedef of InfiniLoadServer
Properties
Name | Type | Description |
---|---|---|
subscriptionId | String |
The ID of the subscription. |
requestId | String |
The unique identifier for the subscription request. |
lastLoadTime | Number |
Cut-off time between new and old documents. |
latestDocTime | Number |
The time field value of the latest document. |
totalDocCount | Number |
How many documents in the collection that match the find options. |
newDocCount | Number |
How many documents are above than the cut-off line. |
oldDocCount | Number |
How many documents are below than the cut-off line. |
loadedDocCount | Number |
How many documents are sent to the client. This value is never larger than the find limit. |
selector | Object |
The final selector object used in find. |
sort | Object |
The final sort object used in find. |
fields | Object |
The final fields object used in find. |
limit | Number |
The find limit. |
serverArgs | Object |
A copy of the server parameters received from client. |