Add accessors for common class attribute lookups.

Review Request #13552 — Created Feb. 18, 2024 and submitted — Latest diff uploaded

Information

Spina
master

Reviewers

Backbone's design allows for both static (unchanging, not ES6 static)
and dynamic (function-based) values for many class attributes. To safely
query these, callers are expected to access these attributes using
_.result(obj, 'attrname'), which doesn't feel natural with ES6
classes.

This change introduces accessors for these attributes. You can now fetch
myModel.getURL() or myView.getTagName(), for example, instead of
_.result(myModel, 'url') or _.result(myView, 'tagName').

These are type-safe as well.

Unit tests pass.

Commits

Files