Skip to content

Commit

Permalink
Lint onNotification so standard stops screaming (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
Regalijan authored May 22, 2024
1 parent aa07a95 commit abdb429
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions lib/client/onNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports.func = function (args) {
args.jar = { session: args.jar }
}
const session = getSession({ jar: args.jar })
let userNotificationConnection = null;
let userNotificationConnection = null

userNotificationConnection = new signalR.HubConnectionBuilder()
.withUrl('https://realtime-signalr.roblox.com/userhub', {
Expand All @@ -46,40 +46,40 @@ exports.func = function (args) {
Cookie: '.ROBLOSECURITY=' + session + ';'
}
})
.build();
.build()

userNotificationConnection.on('notification', function(name, message) {
notifications.emit('data', name, JSON.parse(message))
})
userNotificationConnection.on('notification', function (name, message) {
notifications.emit('data', name, JSON.parse(message))
})

notifications.on('close', userNotificationConnection.stop)
notifications.on('close', userNotificationConnection.stop)

userNotificationConnection.disconnected = function (err) {
notifications.emit('error', new Error('Connection failed: ' + err.message))
if (retries !== -1) {
if (retries > max) {
notifications.emit('close', new Error('Max retries reached'))
} else {
setTimeout(connect, 5000, retries + 1)
}
userNotificationConnection.disconnected = function (err) {
notifications.emit('error', new Error('Connection failed: ' + err.message))
if (retries !== -1) {
if (retries > max) {
notifications.emit('close', new Error('Max retries reached'))
} else {
setTimeout(connect, 5000, retries + 1)
}
}
}

userNotificationConnection.error = function (err) {
notifications.emit('error', err)
}
userNotificationConnection.error = function (err) {
notifications.emit('error', err)
}

userNotificationConnection.connected = function(connection) {
notifications.emit('connect', connection)
}
userNotificationConnection.connected = function (connection) {
notifications.emit('connect', connection)
}

userNotificationConnection.reconnecting = function () {
setTimeout(connect, 5000, 0)
userNotificationConnection.reconnecting = function () {
setTimeout(connect, 5000, 0)
notifications.emit('error', new Error('Lost connection, reconnecting'))
return true // Abort reconnection
}
}

userNotificationConnection.start()
userNotificationConnection.start()
}
connect(-1)
return notifications
Expand Down

0 comments on commit abdb429

Please sign in to comment.