I have the filepicker.io dialog coming up fine but on the success call back I seem to lose my 'this' context.
So my code is like this
var fileProcess ={
saveFileInfo: function () {
.....process info here
},
selectFile: function () {
filepicker.pick({ mimetype: 'image/*' }, function (Blob) {
this.saveFileInfo();
});
}
}
So is there something like "context: this" like I can do in an ajax call?
Try creating a new variable named
selformeset to the current value ofthisOUTSIDE your callback. Then, you use closures, so you can accessthisfrom your callback throughmeorself.Like:
later after a context switch...
EDIT: Oh nuts... Just realized that won't work... Try:
Later...
Function.prototype.bind()takes an object, and returns a function. Whenever the returned function is called, the object passed tobind()is used asthis.