API Reference (2.0) - Zodiase/meteor-infinite-load GitHub Wiki

Classes

InfiniLoadBase

Common interface shared by both client and server code. For inheritance only, should not be instantiated directly.

InfiniLoadClientInfiniLoadBase

Client side interface for loading collection data incrementally.

InfiniLoadServerInfiniLoadBase

Server side interface for loading collection data incrementally.

InfiniLoadBase

Common interface shared by both client and server code. For inheritance only, should not be instantiated directly.

Kind: global class

new InfiniLoadBase(collection, [options])

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.

infiniLoadBase.originalCollection ⇒ Mongo.Collection

Returns the collection this InfiniLoad instance belongs to.

Kind: instance property of InfiniLoadBase

infiniLoadBase.id ⇒ String

Returns the ID of this InfiniLoad instance. IDs are unique for each collection they belong to.

Kind: instance property of InfiniLoadBase

infiniLoadBase.collectionName ⇒ String

Returns the name of the dedicated collection for this InfiniLoad instance.

Kind: instance property of InfiniLoadBase

InfiniLoadBase.getInstanceCollectionName(collectionName, instanceId) ⇒ String

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.

InfiniLoadBase._registerInstance(instance)

Add the instance to the tracking list. Throws if it already exists.

Kind: static method of InfiniLoadBase

Param Type
instance InfiniLoadBase

InfiniLoadBase~CommonOptions : Object

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

new InfiniLoadClient(collection, [options])

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.

infiniLoadClient.rawCollection ⇒ Mongo.Collection

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

infiniLoadClient.limit ⇒ Number

Get the current load limit. A reactive data source.

Kind: instance property of InfiniLoadClient

infiniLoadClient.started ⇒ Boolean

Returns true if running and not stopping. A reactive data source.

Kind: instance property of InfiniLoadClient

infiniLoadClient.ready ⇒ Boolean

Returns true if data is ready. A reactive data source.

Kind: instance property of InfiniLoadClient

infiniLoadClient.busy ⇒ Boolean

Returns true if there are unresolved requests. A reactive data source.

Kind: instance property of InfiniLoadClient

infiniLoadClient.originalCollection ⇒ Mongo.Collection

Returns the collection this InfiniLoad instance belongs to.

Kind: instance property of InfiniLoadClient

infiniLoadClient.id ⇒ String

Returns the ID of this InfiniLoad instance. IDs are unique for each collection they belong to.

Kind: instance property of InfiniLoadClient

infiniLoadClient.collectionName ⇒ String

Returns the name of the dedicated collection for this InfiniLoad instance.

Kind: instance property of InfiniLoadClient

infiniLoadClient.find()

Same as Mongo.Collection.prototype.find. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.findOne()

Same as Mongo.Collection.prototype.findOne. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.count() ⇒ Number

Return the number of documents that have been loaded. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.countMore() ⇒ Number

Return the number of old documents that have not been loaded yet. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.countNew() ⇒ Number

Return the number of new documents that have not been loaded yet. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.countTotal() ⇒ Number

Return the number of all documents in the collection. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.hasMore() ⇒ Boolean

Returns true if there are more old documents to load. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.hasNew() ⇒ Boolean

Returns true if there are more new documents to load. A reactive data source.

Kind: instance method of InfiniLoadClient

infiniLoadClient.loadMore([amount]) ⇒ Promise

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.

infiniLoadClient.loadNew() ⇒ Promise

Load all new documents from server. If this called before starting, an error will be thrown.

Kind: instance method of InfiniLoadClient

infiniLoadClient.setServerParameters(data) ⇒ Promise

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

infiniLoadClient.getServerParameters() ⇒ 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.

infiniLoadClient.start([template]) ⇒ Promise

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

infiniLoadClient.sync() ⇒ Promise

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

infiniLoadClient.stop() ⇒ Promise

Stop all the automations.

Kind: instance method of InfiniLoadClient

InfiniLoadClient~ClientOptions : Object

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

new InfiniLoadServer(collection, [options])

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.

infiniLoadServer.originalCollection ⇒ Mongo.Collection

Returns the collection this InfiniLoad instance belongs to.

Kind: instance property of InfiniLoadServer

infiniLoadServer.id ⇒ String

Returns the ID of this InfiniLoad instance. IDs are unique for each collection they belong to.

Kind: instance property of InfiniLoadServer

infiniLoadServer.collectionName ⇒ String

Returns the name of the dedicated collection for this InfiniLoad instance.

Kind: instance property of InfiniLoadServer

InfiniLoadServer~SubscribeOptions : Object

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.

InfiniLoadServer~SelectorFactory ⇒ Object

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.

InfiniLoadServer~SortFactory ⇒ Object

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.

InfiniLoadServer~FieldsFactory ⇒ Object

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.

InfiniLoadServer~Affiliation : function

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.

InfiniLoadServer~ServerOptions : Object

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.

InfiniLoadServer~SubscribeOptions : Object

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.

InfiniLoadServer~StatsDocument : Object

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.
⚠️ **GitHub.com Fallback** ⚠️