I am about to check in a change that removes DeclareEvent and DeclareEvents. These were private functions, so no API change review is needed. I am removing these to support my fix for LPP-4997, but also because these functions were dynamically adding attributes to a class at run time, which impacts performance in JS2. If you are working in the LFC or writing a class in <script> you will no longer say:

class ... {
  ...
  DeclareEvent(prototype, 'onSomething');
  ...
}

Instead you should simply declare the event property like any other instance variable, but give it a proper initial value:

class ... {
  ...
  var onSomething = LzDeclaredEvent;
  ...
}

Eventually, we will want to give these proper type declarations (as soon as Don gives us the go-ahead). Events are a non-nullable type. Perhaps we should change the way you specify a null event though? Something like:

class ... {
  ...
  var onSomething:LzEvent = LzEvent.nullEvent;
  ...
}

Thoughts?

---

Note: There are no changes to the usage of LZX <event> tag. The compiler will automatically translate the <event> tag to the new JS format.

Reply via email to