Search

Search

Source:

Returned by Chat#search. This is our Search class which allows one to search the backlog of messages. Powered by PubNub History.

Parameters:
Name Type Description
chatEngine ChatEngine

This instance of the ChatEngine object.

chat Chat

The Chat object to search.

config Object

The configuration object. See Chat#search for a list of parameters.

Extends

Members

chat :Chat

Source:

The Chat used for searching.

Type:

config :Object

Source:

An object containing configuration parameters supplied by Chat#search. See Chat#search for possible parameters.

Type:
  • Object

hasMore :boolean

Source:

Flag which represent whether there is potentially more data available in Chat history. This flag can be used for conditional call of Chat#search.

Type:
  • boolean

Methods

next()

Source:
See:
  • $.search.pause

Continue searching the next batch of pages.

off(event)

Source:
Overrides:

Stop a callback from listening to an event.

Example
let callback = function(payload;) {
   console.log('something happend!');
};
object.on('event', callback);
// ...
object.off('event', callback);
Parameters:
Name Type Description
event String

The event name

on(event, cb)

Source:
Overrides:

Listen for a specific event and fire a callback when it's emitted. Supports wildcard matching.

Example
// Get notified whenever someone joins the room
object.on('event', (payload) => {
    console.log('event was fired').
})

// Get notified of event.a and event.b
object.on('event.*', (payload) => {
    console.log('event.a or event.b was fired').;
})
Parameters:
Name Type Description
event String

The event name

cb function

The function to run when the event is emitted

onAny(callback)

Source:
Overrides:

Listen for any event on this object and fire a callback when it's emitted

Example
object.onAny((event, payload) => {
    console.log('All events trigger this.');
});
Parameters:
Name Type Description
callback function

The function to run when any event is emitted. First parameter is the event name and second is the payload.

once(event, callback)

Source:
Overrides:

Listen for an event and only fire the callback a single time

Example
object.once('message', => (event, payload) {
    console.log('This is only fired once!');
});
Parameters:
Name Type Description
event String

The event name

callback function

The function to run once

plugin(module)

Source:
Inherited From:
Tutorials:
  • Tutorial: using

Binds a plugin to this object

Parameters:
Name Type Description
module Object

The plugin module

Events

$.page.response

Source:

PubNub History returned a response.

$.search.finish

Source:

Search has returned all results or reached the end of history.

$.search.pause

Source:
See:

PubNub History has reached the maximum allocated pages and requires user input to continue.

$.search.start

Source:

Search has started.