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:
Streamserves as abstractui.Widgetclass for all streams and provides the basic stream logic as initialization of a stream and accessing other components of the stream.StreamStatecontains the current state of the stream as for examplelastContentId,lastEntryLoaded,loadingStreamEntryserves as base class for all stream entries and implements basic logic for accessing the underlying content (edit/delete/etc.) of a single stream entry.StreamRequestis responsible for requesting and reloading stream entrieswall.WallStreamextends the abstractStreamand is used for example for the space, profile and dashboard streamswall.WallStreamFilteris 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
StreamStateinstance asStream.state - Call of
Stream.initWidgetwhich 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 aStreamRequestcall - Call of
Stream.handleResponsein case there was no error- In case the response contains the last entry call
Stream.handleLastEntryLoaded() - In case the request options
insertAfteris 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