This is basically the aim of the latest access object which is enacted to personal factors

As an example, we could revision all of our dependence treatment example so that injection into the private areas:

Thus far we now have seen just how metadata will likely be discussed to have adorned thinking, and also for societal thinking its potential observe exactly how this might be taken. Such as, it's possible to establish a habits injection collection hence annotates sphere with thinking to inject, right after which injects him or her when designing the newest for example:

However, this isn't it is possible to to accomplish this due to the fact actually personal facets, due to the fact secret the fresh new metadata is placed with can't be put to get into they externally.

Measures can only just getting understand

Which target gives decorators ways to expose access through metadata, used in certain means.

Because of this if you label rating or place having good personal industry or accessor, it tend to result in the new accessors into the particularly.

Access is generally offered according to whether or not the well worth try a value intended to be realize or composed. Sphere and you can vehicles-accessors is each other understand and you can written so you can. Accessors can either be read in the case of getters, otherwise wriitten regarding setters.

  • Iterate with the open questions inside proposal, to present these to TC39 and you can sharing next throughout the biweekly decorators phone calls, to bring a conclusion so you're able to committee in a future appointment
  • STATUS: Open questions was basically fixed, designers working category are at general consensus with the build.
  • STATUS: Over, available right here.
  • STATUS: An experimental implementation is made which is available for standard play with. Efforts are constant to implement in the Babel as well as have much more views.
  • Independent implentation:
  • Babel plug-in implementation
  • STATUS: Views is built-up by using the fresh implementation. A great deal more opinions would be gathered about Babel plug-in just after they is done.

Regrettably, we're in the classic pitfall off, "The outdated matter try deprecated, while the brand new question is not in a position but really!" For now, far better keep using the old situation.

The new pion class manage strongly recommend continued to make use of Babel "legacy" designers or TypeScript "experimental" decorators. When you are playing with decorators now, you are probably already using one of these systems. Keep in mind that these types of decorators count on "[[Set]] semantics" to possess field declarations (in Babel, shed form). It is recommended that these power tools take care of support having [[Set]] semantics next to legacy decorators, up until it's possible to change to your decorators with the suggestion.

Babel 7 supporting the latest designers proposal made available to TC39 regarding the TC39 conference. It's okay to utilize these types of to have experimental purposes, even so they face significant abilities issues, are not but really generally adopted; we don't plan to remain pushing for it offer into the TC39. Therefore, i encourage against with this type for big functions. Into the follow-into proposals to incorporate a great deal more oriented-for the decorators, develop in order to recover the additional effectiveness one to new designers suggestion offered.

Babel legacy-setting decorators are derived from the state of the new JavaScript . Also the sentence structure alter in the list above, the fresh calling conference away from Babel legacy designers differs from this proposition:

  • Heritage decorators are known as with the "target" (the course or prototype lower than design), while the class lower than structure is not given to decorators within this suggestion.
  • History designers are known as with the full property descriptor, while this offer phone calls designers with only "the object getting ple, it is impossible to change assets qualities, and that getters and you can setters aren't "coalesced" but instead decorated individually.

Even after such variations, it has to fundamentally feel you'll be able to to really have the same type of effectiveness with this specific designers offer just as in Babel history designers. If you see very important missing functionality inside suggestion, delight file a challenge.

No hay comentarios.

Agregar comentario