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

  • Home
  • SEARCH
  • 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 7092825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:21:46+00:00 2026-05-28T08:21:46+00:00

I need to have a value returned by and event handler into the function

  • 0

I need to have a value returned by and event handler into the function that initiates the event in the first place, just to return the value that will be received only in the event handler. I believe there should be an easy way to accomplish this or to attack the problem from a different angle.

What I actually need to do is:

  1. Create a new img DOM object to feed dataURL into (the dataURL is coming from canvas.toDataURL())
  2. img.onload will let me return the dataURL

I’m using jQuery if that helps somehow but don’t have to of course.

In my understanding I can’t rely on the img to have the data immediately, and it feels stupid to use timeouts to wait for the event to fire and use some global variable, especially since a few might be processed in parallel.

For even more background, this is all for resizing images before (multi-)uploading them with HTML5 engine.

Thanks even for reading, and for any tips of course 🙂

Thanks,
Igor

  • 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-05-28T08:21:47+00:00Added an answer on May 28, 2026 at 8:21 am

    It doesn’t make sense to return values from an event handler. Events happen when they happen, and the handler is called by the browser at that time. Thus, there’s no code expecting any return value; there’s nowhere for it to go.

    Instead, simply do whatever it is you need to do inside the event handler.

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

Sidebar

Related Questions

I have a bool value that I need to display as Yes or No
I need to have the value for the option in the following: I have
I need to have following attribute value in my XML node: CommandLine=copy $(TargetPath) ..\..\
echo
I have an app where I need a BOOL value to persist across launches.
I have a couple of scenarios: Need to read the value of a column
I have a situation where I need to find the value with the key
I have a SQL Statement where i need to display the value from another
I have an application where I need to INSERT an auto_increment value from a
I have a string which holds a decimal value in it and I need
If you have a situation where you need to know where a boolean value

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.