Skip to content

Instantly share code, notes, and snippets.

@evanlucas
Created October 27, 2015 01:14
Show Gist options
  • Save evanlucas/33ce260023f9d6e7d2c3 to your computer and use it in GitHub Desktop.
Save evanlucas/33ce260023f9d6e7d2c3 to your computer and use it in GitHub Desktop.
arrows.js
'use strict'
module.exports = Client
function Client() {
this.name = 'client'
}
Client.prototype.run = function run(cb) {
const n = 'server'
setImmediate(() => {
cb(null, this.name, n)
})
}
Client.prototype.runWithSelf = function runWithSelf(cb) {
const self = this
const n = 'server'
setImmediate(function() {
cb(null, self.name, n)
})
}
Client.prototype.runWithBind = function runWithBind(cb) {
const n = 'server'
setImmediate(function() {
cb(null, this.name, n)
}.bind(this))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment