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 = {};
Copy link

ghost commented Oct 6, 2011

haha, awesome. I love the way you tought me a little of grammar and worldview...

So I am dumb, big deal. But I did build a app based on this M V C thing, and it worked! hahahahaha

@mdesantis
Copy link

@RassaR if you wrote an app based on ligament.js, please share it; ligament.js misses an example app.

@n1k0
Copy link

n1k0 commented Oct 6, 2011

UNSUBSCRIBE

@kurko
Copy link

kurko commented Oct 6, 2011

UNSUBSCRIBE +1

@likethesky
Copy link

@lmcd right on! That @MattiSG is a total troll. I'm so glad I have Ligament.js on my resume. Everyone, please tell ALL recruiters to add Ligament to their keyword searches, if they want to get the hottest JS coders. @RassaR please see http://theotherpages.org/quote-14.html for more examples of DWS ( http://acronyms.thefreedictionary.com/Dripping+with+Sarcasm ). @n1k0 @kurko please see https://github.com/account/notifications ("Comments after me on gists") @everyone else: Yeah, the long and the short of it is: we're all bored to tears, couldn't care less, we all know there's one born every minute, so I'm going to put my foot down, take one for the team, you know who you are: you can run but you can't hide, so ideally my post here is the kiss of death for this thread! (@RassaR see http://suspense.net/whitefish/cliche.htm ) :-D

@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