Hypothesis: What if Backbone were created today, with ES 6&7, Virtual DOM, etc?
What if Backbone were to be created today? What would the project look like? With ECMAScript 6 & 7, HTML5 pushState, Virtual DOM / Incremental DOM / etc., new ways of data-binding, etc., front-end development has evolved. This project sets out to see what such an evolution would look like from scratch.
See the change log.
- ES6 classes and ES7 class properties.
- No more
.extend()
for extending a View, Model, etc. Instead, ES6class
andextends
are used. super()
is used, and is expected to be used by developers to call parent methods.
- Collections use the base Model by default instead of whining about not having a Model
- No more
.extend()
for mixing. Just useObject.assign
directly.
- No more
.set()
and.get()
; instead, just use the model'sattr
directly, as'Object.observe'
is observing changes. - No more
.has()
; just check for the property existence directly - No more
.unset()
; just delete it directly. .toJSON
actually returns JSON- Currently previous/changed properties/methods are not implemented as they can be found in the changes array. Open to re-implementation.
- Use Incremental DOM for quick patching of DOM changes. This makes a wrapping tag required.
- Templates now managed by Starplates
The router is inspired from Chaplin.
- Objects in router can now be disposed, which has always been a bane for Backbone's router.
The controller is inspired from Chaplin.
- Controllers have been added to provide MVC structure with the router.
The dispatcher is inspired from Chaplin.
- Responsible for instantiating controller & action on matching route.
- Delete/Unset that doesn't use
delete
- LocalStorage
- Pagination
- Schemas
- Undo/Redo
- Validation
- Collection View
- Composition
- Infinite Scroll
- Media Queries
- Regions
- Selector Store (cache reference to selector in view template)
- Transitions
- afterEnter
- beforeEnter
- beforeEnter('someOtherView')
- View States (beforeRender, afterRender, etc..)
- Visibility (would mainly be useful with media query states)
- Redux integration