> Makes sense. I was just wondering why a MouseButton class is needed at
> all and not just a plain String constant.

Maybe is not, but I added, maybe I shouldn't had, isButton(button) => boolean 
which tests to see which button was pressed during the event, the type of 
button is goog.events.BrowserEvent.MouseButton which is declared as enum in 
goog.events.BrowserEvent:

/**
 * Normalized button constants for the mouse.
 * @enum {number}
 */
goog.events.BrowserEvent.MouseButton = {
  LEFT: 0,
  MIDDLE: 1,
  RIGHT: 2
};

The closer things I know to match the package and look close to enum is the 
code I shown (well, I could have prevented the constructor to be called to be 
closer).

The other solution would have been to let the developer fill the parameter with 
a uint or a constant but given that's a public API which is a wrapper to 
another public one, it seems to me it should be protected against bad values 
and should match as much as possible the google doc found for the wrapped 
class, I could be wrong to do that way though, that what why I asked before to 
continue this way for other classes which is btw more time consuming.

Frédéric THOMAS


----------------------------------------
> From: aha...@adobe.com
> To: dev@flex.apache.org
> Subject: Re: Re : Re: [FlexJS] Framework using externs (was: Setup Error)
> Date: Tue, 11 Aug 2015 12:49:35 +0000
>
>
>
> On 8/11/15, 5:22 AM, "Frédéric THOMAS" <webdoubl...@hotmail.com> wrote:
>
>
>>> What is the advantage of doing it this way?
>>
>>My point in migrating the framework is also to figure out how a framework
>>developer would feel comfortable working with, using and developing new
>>component seeing how the others are developed, for example, even though
>>this class is emitted in JS only, it is now coded in AS, except of the
>>comments I added to this class which is a wrapper to the
>>goog.events.BrowserEvent, if he needs to use it, the developer will
>>probably look at the google doc too and I guess, expect to have as close
>>as possible the same API.
>>
>>Well, at least I did this assumption and was wondering if it wasn't to
>>much.
>
> Makes sense. I was just wondering why a MouseButton class is needed at
> all and not just a plain String constant.
>
> -Alex
>
>
                                          

Reply via email to