Stream
This section describes the new (since v1.3) Javascript Stream API.
Please refer to the main Stream Section for more information about Streams.
Since HumHub v1.3 the Javascript Stream API was split into the following main components within the humhub.modules.stream
namespace:
Stream
serves as abstractui.Widget
class for all streams and provides the basic stream logic as initialization of a stream and accessing other components of the stream.StreamState
contains the current state of the stream as for examplelastContentId
,lastEntryLoaded
,loading
StreamEntry
serves as base class for all stream entries and implements basic logic for accessing the underlying content (edit/delete/etc.) of a single stream entry.StreamRequest
is responsible for requesting and reloading stream entrieswall.WallStream
extends the abstractStream
and is used for example for the space, profile and dashboard streamswall.WallStreamFilter
is used as extensible filter component for the wall stream
Stream Initialization
The initialization of a stream is handled as follows:
- Constructor call (subclasses should call
Stream.call(this, container, options);
in case of an overwritten constructor); - Call of widgets
Stream.init()
- Initialize a new
StreamState
instance asStream.state
- Call of
Stream.initWidget
which is only called once for a stream- Call of abstract function
Stream.initEvents()
which can be overwritten to define widget event listeners ashumhub:stream:beforeLoadEntries
- Call of
Stream.initFilter()
sets an optional stream filter defined inoptions.filter
- Call of abstract function
Stream.initScroll()
can be used to define auto scroll loading
- Call of abstract function
- Call of
Stream.clear()
to reset the stream- Hides the stream
- Removes all stream entries
- Removes the stream loader
- Triggers
humhub:stream:clear
- Call of abstract function
Stream.onClear()
which can be used for further cleanups
- Call of
Stream.loadInit()
which requests the initial entries of the stream by means of aStreamRequest
call - Call of
Stream.handleResponse
in case there was no error- In case the response contains the last entry call
Stream.handleLastEntryLoaded()
- In case the request options
insertAfter
is set callStream.handleInsertAfterResponse()
which appends the resulted entries after a certain StreamEntry - Else call the default
Stream.handleLoadMoreResponse()
- In case the response contains the last entry call
- Initialize a new