Skip to content

Commit

Permalink
use parameter instead
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Mar 27, 2024
1 parent 14f0b97 commit 516b238
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class Saturn {
* @param {number} [config.fallbackLimit]
* @param {boolean} [config.experimental]
* @param {string} [config.format]
* @param {Function} [config.onReportLogs]
* @param {import('./storage/index.js').Storage} [config.storage]
*/
constructor (config = {}) {
Expand All @@ -61,6 +62,7 @@ export class Saturn {
this._monitorPerformanceBuffer()
}
this.storage = this.config.storage || memoryStorage()
this.onReportLogs = this.config.onReportLogs || ((_logs) => {})
this.loadNodesPromise = this.config.experimental ? this._loadNodes(this.config) : null
this.authLimiter = pLimit(1)
}
Expand Down Expand Up @@ -488,7 +490,7 @@ export class Saturn {
body: JSON.stringify({ bandwidthLogs, logSender: this.config.logSender })
}
)
this.onReportLogs(bandwidthLogs)
this.config.onReportLogs(bandwidthLogs)
} catch (e) {
console.log(e)
throw e
Expand All @@ -498,14 +500,6 @@ export class Saturn {
}
}

/**
* Overwrite this function to handle logs yourself in addition to the
* Saturn pipeline.
*
* @param {Array<object>} logs
*/
onReportLogs (logs) {}

/**
*
* @param {Array<object>} logs
Expand Down

0 comments on commit 516b238

Please sign in to comment.