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:
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;
}