THRIFT-4403: Fix incorrect usage of 'this'
Client: js

This closes #1437
diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js
index ab85e9d..1a11871 100644
--- a/lib/js/src/thrift.js
+++ b/lib/js/src/thrift.js
@@ -599,8 +599,8 @@
           //If the user made calls before the connection was fully
           //open, send them now
           this.send_pending.forEach(function(elem) {
-             this.socket.send(elem.buf);
-             this.callbacks.push((function() {
+             self.socket.send(elem.buf);
+             self.callbacks.push((function() {
                var clientCallback = elem.cb;
                return function(msg) {
                   self.setRecvBuffer(msg);