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 9205555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:58:37+00:00 2026-06-17T23:58:37+00:00

I want to dispatch events to announce the progress of an asynchronous process. The

  • 0

I want to dispatch events to announce the progress of an asynchronous process. The event should contain 2 properties: work done and work total.

As the name suggests 😉 i could use ProgressEvent; it has bytesLoaded and bytesTotal properties that i can use. However, my async process isn’t loading bytes, its processing pixels, so the property names are a bit misleading for my use case – although the class name is perfect.

The alternative is to create a custom event with two properties that i can name how i like. But this means another class added to the code base.

So my question is; Is it better to reuse an existing class where the properties are suitable but maybe the naming isn’t ideal; Or to create a custom class that perfectly fits the requirement? Obviously, one extra class is no big deal, but OOP is all about reusing stuff so adding an unnecessary class does make me uneasy.

I await your thoughts…

PS: This is my first question on stack so be gentle

  • 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-17T23:58:39+00:00Added an answer on June 17, 2026 at 11:58 pm

    For clarity, I’d create a new class. Adding a new class is not much overhead at all, especially for something simple like an event. I find that code is more readable when I don’t have to make mental translations (like bytesLoaded really means pixelsLoaded). To me this is akin to choosing poor names for variables.

    In addition, by going the other route and re-using the ProgressEvent class, I would feel compelled to document the code to indicate that we’re dealing with pixels rather than bytes. That starts to get messy if you have a lot of classes that uses the event.

    Re-use is great, but I’d opt for clarity as long as it doesn’t impact your productivity or the app’s performance.

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

Sidebar

Related Questions

I have several different 'types' of incoming events, and I want to dispatch them
I'm using the combobox component and I want to manually dispatch the change event.
I want to have a single event listener for multiple events and depending on
I want to dispatch an Event 2 times: I have a MainClass, a SecondClass
I want to override flash.display.Loader and to dispatch my own Event with a my
In Grand Central Dispatch I want to start a spinner - UIActivityIndicatorView - spinning
I want to setup a Method dispatch table and I am wondering if it
I want to use unity for a polymorphic event aggregation/handling where handlers are registered
i have a tlf text input in stage,i want dispatch ahndler for this object
In JavaScript, how can I create my own event that I can dispatch to

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.