Skip to content
Merged
13 changes: 7 additions & 6 deletions src/amplitude-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ var _convertProxyObjectToRealObject = function _convertProxyObjectToRealObject(i
* var identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');
* amplitude.identify(identify);
*/
AmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_error_callback) {
AmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_error_callback, outOfSession) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be good to add unit test for out of session funcitonality

if (this._shouldDeferCall()) {
return this._q.push(['identify'].concat(Array.prototype.slice.call(arguments, 0)));
}
Expand Down Expand Up @@ -1142,6 +1142,7 @@ AmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_e
null,
opt_callback,
opt_error_callback,
outOfSession,
);
} else {
_logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {
Expand All @@ -1162,6 +1163,7 @@ AmplitudeClient.prototype.groupIdentify = function (
identify_obj,
opt_callback,
opt_error_callback,
outOfSession,
) {
if (this._shouldDeferCall()) {
return this._q.push(['groupIdentify'].concat(Array.prototype.slice.call(arguments, 0)));
Expand Down Expand Up @@ -1205,6 +1207,7 @@ AmplitudeClient.prototype.groupIdentify = function (
null,
opt_callback,
opt_error_callback,
outOfSession,
);
} else {
_logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {
Expand Down Expand Up @@ -1908,11 +1911,9 @@ AmplitudeClient.prototype.__VERSION__ = function getVersion() {
* @param {string} name - Custom library name
* @param {string} version - Custom library version
*/
AmplitudeClient.prototype.setLibrary = function setLibrary(
name = this.options.libraryName,
version = this.options.libraryVersion,
) {
this.options.library = { name: name, version: version };
AmplitudeClient.prototype.setLibrary = function setLibrary(name, version) {
if (name) this.options.library.name = name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe wrap other than put them in the same line

if (version) this.options.library.version = version;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do an explicit check for null or undefined. Edge case conditions for falsey values may lead to unexpected outcomes (ike 0 or '' )

};

/**
Expand Down