Skip to content

Instantly share code, notes, and snippets.

@wycats
Created September 16, 2011 19:09
Show Gist options
  • Save wycats/313496e6ba9160dc6eb5 to your computer and use it in GitHub Desktop.
Save wycats/313496e6ba9160dc6eb5 to your computer and use it in GitHub Desktop.
/**
* Copyright (C) 2011 by Yehuda Katz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
**/
// ligament.js is the smallest, lightest-weight JavaScript MVC framework.
//
// ligament.js requires modern browsers, which provide Object.create.
// Newer browsers are the future, older browsers are the past.
//
// If you really must support older browsers like IE8, you can use the
// hot polyfill for Object.create found at
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/create
// Usage:
// MyModel = Object.create(M);
// instance = Object.create(MyModel);
// instance.firstName = "Brendan";
// instance.lastName = "Eich";
//
// Because ligament.js uses *real* prototype inheritance, like Spine, you can add new
// methods to the MVC layers by simply extending MVC objects:
// M.toString = function() { console.log("All models get this method!"); };
// Person = Object.create(M);
// Person.fullName = function() { return this.firstName + ' ' + this.lastName; }
// jeremy = Object.create(Person);
// jeremy.firstName = "Jeremy";
// jeremy.lastName = "Ashkenas";
// jeremy.fullName() //=> Jeremy Ashkenas
//
// That's it! Why deal with all the bloat of JavaScript frameworks. Use ligament.js!
M = {}, V = {}, C = {};
@wjcrowcroft
Copy link

wjcrowcroft commented Oct 6, 2011 via email

@haochong
Copy link

cool

@g8d3
Copy link

g8d3 commented Aug 14, 2015

Which one should I use? this or ember?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment