Skip to content

Instantly share code, notes, and snippets.

@yyx990803
Last active December 25, 2015 00:19
Show Gist options
  • Save yyx990803/6886536 to your computer and use it in GitHub Desktop.
Save yyx990803/6886536 to your computer and use it in GitHub Desktop.

Origin

Seed started out as a practice to create a data binding library that mimics Angular. While implementing it I also shaped the API to get rid of several things I don't like about Angular:

  • auto magic compile and no familar instantiating objects
  • have to be aware of how $digest loop works
  • doesn't play well with module build tools, e.g. component & browserify
  • bundles too much stuff (I just want data binding, something lightweight)

Personal preferences

  • I like CommonJS modules.
  • I like data binding with plain objects.
  • I like automatic dependency tracking, not digest cycles.
  • I like small libraries that do only one thing and do it well.
  • I like libraries that play nice with others.
  • I like simple and non-obtrusive APIs.
  • I want as few dependencies as possible.
  • I don't care about IE8 or below.

Modular

  • Works well with modular build systems
  • Encapsulate your ViewModel logic as components
  • encapsulate your directives, filters, etc
  • declarative
  • inspiration from Polymer/Web Components

Lightweight

  • 10kb gzipped
  • no dependency

Binding data

  • Ember: wrapper objects (verbose syntax, limited)
  • Angular: dirty checking (performance issue, but most accurate)
  • Seed: replace properties with setter/getters (modifies original objects but doesn't affect usage)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment