Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8801611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:52:46+00:00 2026-06-14T00:52:46+00:00

I have a scope issue that I don’t understand. I have this object with

  • 0

I have a scope issue that I don’t understand.

I have this object with some methods:

FileInfo = (file) ->
   @name = path.basename(file.path);

FileInfo::uploadImage = (filename, callback) ->

FileInfo::handleImage = (version, callback) ->
   # Here I would like to call uploadImage

I am calling handleImage from an async.forEach loop as:

async.forEach options, fileInfo.handleImage,  (err) -

I would like to call uploadImage from within handleImage but I get TypeError: Object # has no method ‘uploadImage’

I have tried, inside of handleImage, the following:

this.uploadImage

as well as:

that = this
that.uploadImage

Neither work.

If I call fileInfo.handleImage outside of the forEach loop it works fine with either this or that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:52:48+00:00Added an answer on June 14, 2026 at 12:52 am

    Change fileInfo.handleImage to fileInfo.handleImage.bind(fileInfo) (assuming fileInfo is an instance of FileInfo).

    It is losing the this binding (that is, the value of this when that function is executing, not to be confused with the execution context, see comments) that you expect, because you don’t immediately invoke it, just pass a reference to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The scope of this is that we have three main projects. Some of the
I have an issue that (I think) might have to do with scope, but
I don't understand exactly what's happening here, it seems that's a syntax issue. Just
I have an issue with NSMutableArray and scope I am hoping to get some
I have this scope: scope :user_id, :as => user do resources :boards, :controller =>
I have a named scope set up in my rails application that is used
I have the following scope for finding a product that belongs to a specific
This question is language independent. I have an application that handles requests in a
My issue is that I have a Select statement that has a where clause
I have a php file that is only accessed through ajax. The ajax call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.