microsoft/Bing-Maps-V8-TypeScript-Definitions

Events as constants

perfahlen opened this issue · 2 comments

I was thinking if is a good idea adding events as constants under for example in namespace Microsoft.Maps.Events. Some graphical elements like the map it is quite natural to use DOM events. But for example with DirectionsModule?

I don't know if it makes sense to add something like:

export class Microsoft.Maps.Events.DirectionsEvent{
 public static readonly DIRECTIONS_UPDATE = 'directionsUpdated';
 public static readonly DIRECTIONS_ERROR = 'directionsError';
}

Allthough it is not part of Bing Maps, it supports the developer. Is it a good idea adding event names as constants?

These are TypeScript definitions, which are not compiled and do not end up in the users code. As such, creating constants will only work for intellisense, but will break when you run your code.

yeah, mine constants are compiled into my .js file. That is why it works. So it would rather be a request for v8 control.