Release 3.3.0-beta
Pre-release
Pre-release
[3.3.0-beta] - August 21st, 2019
New Features
- Added support for event batching via the event processor.
- Events generated by methods like
activate
,track
, andisFeatureEnabled
will be held in a queue until the configured batch size is reached, or the configured flush interval has elapsed. Then, they will be combined into a request and sent to the event dispatcher. - To configure event batching, include the
eventBatchSize
andeventFlushInterval
number properties in the object you pass tocreateInstance
. - Event batching is enabled by default.
eventBatchSize
defaults to10
.eventFlushInterval
defaults to30000
in Node and1000
in browsers.
- Events generated by methods like
- Added
localStorage
mitigation against lost events in the browser- When event requests are dispatched, they are written to
localStorage
, and when a response is received, they are removed fromlocalStorage
. - When the SDK is initialized for the first time in the browser, if any requests remain in
localStorage
, they will be sent, and removed fromlocalStorage
when a response is received.
- When event requests are dispatched, they are written to
- Updated the
close
method to return aPromise
representing the process of closing the instance. Whenclose
is called, any events waiting to be sent as part of a batched event request will be immediately batched and sent to the event dispatcher.- If any such requests were sent to the event dispatcher,
close
returns aPromise
that fulfills after the event dispatcher calls the response callback for each request. Otherwise,close
returns an immediately-fulfilledPromise
. - The
Promise
returned fromclose
is fulfilled with a result object containingsuccess
(boolean) andreason
(string, only when success isfalse
) properties. In the result object,success
istrue
if all events in the queue at the time close was called were combined into requests, sent to the event dispatcher, and the event dispatcher called the callbacks for each request.success
is false if an unexpected error was encountered during the close process.
- If any such requests were sent to the event dispatcher,
- Added non-typed
getFeatureVariable
method (#298) as a more idiomatic approach to getting values of feature variables.- Typed
getFeatureVariable
methods will still be available for use.
- Typed