Giter VIP home page Giter VIP logo

dragon's Introduction

Dragon

Hypothesis: What if Backbone were created today, with ES 6&7, Virtual DOM, etc?

Hypothesis of project

What if Backbone were to be created today? What would the project look like? With ECMAScript 6 & 7, HTML5 pushState, Virtual DOM, 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.

Changes from Backbone to Dragon

General Changes

  • ES6 classes and ES7 class properties.
  • No more .extend() for extending a View, Model, etc. Instead, ES6 class and extends are used.
  • super() is used, and is expected to be used by developers to call parent methods.

Collections

  • Collections use the base Model by default instead of whining about not having a Model

Mixins

  • No more .extend() for mixing. Just use Object.assign directly.

Models

  • No more .set() and .get(); instead, just use the model's attr 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.

Views

  • No more wrapping tags; views' DOM is 100% from template or attaching to existing DOM element(s)

Router

The router is inspired from Chapin.

  • Objects in router can now be disposed, which has always been a bane for Backbone's router.

Controllers

The controller is inspired from Chapin.

  • Controllers have been added to provide MVC structure with the router.

Dispatcher

The dispatcher is inspired from Chapin.

  • Responsible for instantiating controller & action on matching route.

TODO

Mixin Ideas

Models

  • Delete/Unset that doesn't use delete
  • LocalStorage
  • Pagination
  • Schemas
  • Undo/Redo
  • Validation
  • WebSQL

Views

  • 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.