Quantcast
Channel: Alert.js - CRM 2013-2016 Custom Alerts and Popup Dialogs JavaScript Lightbox
Viewing all articles
Browse latest Browse all 170

New Post: Have you considered TypeScript?

$
0
0
I'm using and enjoying TypeScript in CRM. I've created an alert.d.ts file, but it doesn't work very well for the icon parameter in show, since it is a string. Would you consider making this in TypeScript? I could create it for you if you'd like. The resultant js would be 100% compatible still.

Here is my alert.d.ts file if you'd like to include it:
declare module Alert {
    export interface Button {
        label: string;
        callback?: () => void;
    }
}

declare class Alert {


    // purpose: display an alert style dialog for the user using the CRM lightbox (web) or modal dialog (outlook)
    // Allows for custom buttons and callbacks
    // title = 
    // message = 
    // buttons = 
    // icon = 
    // width = 
    // height = 
    // baseUrl = 
    /**
     * Display an alert style dialog for the user using the CRM lightbox (web) or modal dialog (outlook) 
     * Allows for custom buttons and callbacks
     * @param title Main big message
     * @param message (optional) Sub-heading shown below the title
     * @param buttons (otional, defaults to 'Ok') Array of buttons and callback functions for each button. Callbacks optional. E.g. [{label: "OK", callback: function(){}},{label: "Cancel"}]
     * @param icon (optional, defaults to none) Displays a custom icon on the alert: INFO, WARNING, ERROR, SUCCESS, QUESTION
     * @param width (optional, defaults to _dialogWidth) Custom width of the dialog
     * @param height (optional, defaults to _dialogHeight) Custom height of the dialog
     * @param baseUrl (optional, defaults to getClientUrl) Base url of CRM (only required if no access to Xrm.Page)
     */
    static show(title: string, message?: string, buttons?: Alert.Button[], icon?: string, width?: number, height?: number, baseUrl?: string) : void;
}

Viewing all articles
Browse latest Browse all 170

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>