newApnSetting.types.slice().forEach(function(type) { // Clone new settings to make sure the promises do not all // point to the very last one var settingClone = ApnUtils.clone(newApnSetting); settingClone.types = [type]; promises.push( ApnSettingsManager.addApn(this._serviceId, settingClone)); }, this);
newApnSetting.types.forEach(function(type) { var settingClone = ApnUtils.clone(newApnSetting); settingClone.types = [type]; if (type === this._apnItem.apn.types[0]) { promises.push(ApnSettingsManager.updateApn(this._serviceId, this._apnItem.id, settingClone)); } else { promises.push(ApnSettingsManager.addApn(this._serviceId, settingClone)); } }, this);
newApnSetting.types.slice().forEach(function(type) { newApnSetting.types = [type]; promises.push( ApnSettingsManager.addApn(this._serviceId, newApnSetting)); }, this);