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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:01:50+00:00 2026-06-14T09:01:50+00:00

Is there a way I can make it easier to call my alert in

  • 0

Is there a way I can make it easier to call my alert in the typescript code below. Here’s where my alert is coded:

module Admin.Shared.Alerts {
    export class alerts {
        static mvcOnFailure(message: string) {
            dialog.alertWin("Internal Application Error", message);
        }
    }

}

Here is a small snippet example of where I call it:

module Admin.MyAccount.Access {
    export function ajaxDone(data: string, textStatus: string, jqXHR: JQueryXHR) {       
        Admin.Shared.Alerts.alerts.mvcOnFailure("x");
    }

}

The problem is that there is such a long string to call the alert. Is there some way that I can do something like a “using” in C# where I don’t have to specify “Admin.Shared.Alerts” ?

  • 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-14T09:01:56+00:00Added an answer on June 14, 2026 at 9:01 am

    I have two recommendations for you in this respect. The first is that you reconsider your module structure. As soon as you see namespaces such as “Common”, “Shared” or “Core” it tells you there is a problem, because these are not words that describe what the code inside is likely to do. Good names are “Messaging”, “Alerts”, “Payments” – you can tell straight away what kind of stuff you will find there.

    So recommendation number 1 is to remove the “Shared” namespace.

    module Admin.Alerts {
    

    If you are building a large TypeScript program, you may want to follow the module patterns that are commonly used in CommonJS application. You use simple module names but nest them in folders:

    .\Admin\Alerts.ts

    module Alerts {
    

    You would import the module using

    import alerts = module('.\Admin\Alerts.ts');
    

    And then use it in your code under the alerts name.

    In a web app, you would use a module loader, such as requires.js to handle all the loading for you so it wouldn’t be much additional work, and you would tell the compiler to create the code for you using a flag…

    tsc --module commonjs Alerts.ts
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way I can make Firefox call a JavaScript function in my
Since there is no way that you can make the flash object transparent, there
Is there any way (utilizing Reflection I hope) that I can make an instantiated
Is there a way to make this method generic so I can return a
Is there any way to make find-name-dired to only show filenames that I can
Is there any way can declare a bean in just like JSP UseBean in
Is there way that I can read the file from remote server using fopen
Is there any way I can set a formatter on models that will convert
Is there any way we can fetch X509 Public Cetrificates using c# from AD
Is there a way I can use one category to stylize all of my

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.