This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Person = Class.subclass(function(def, Protected, Generic, Parent){ | |
| // Private | |
| // Available to all methods in this definition | |
| var private_variable; | |
| // Protected | |
| // Available to this Class, its instances, all subclasses and all their instances | |
| // Protected methods are bound to each instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Current MooTools 1.2 Class subclass syntax | |
| // all methods are wrapped | |
| // to provide protected support | |
| // and `this.parent` | |
| var Dude = new Class({ | |
| Extends: Person, | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create a new class by subclassing Class | |
| var MyClass = Class.subclass(function(Public, Private){ | |
| Public.implement([Events, Options]); | |
| Public.method = function(arg){ | |
| console.log('grand pappy Method!'); | |
| }; | |
| Public.methodWithAName = methodWithAName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function evalWith(namespaces, code){ | |
| if ({}.toString.call(namespaces) != '[object Array]') | |
| namespaces = [namespaces]; | |
| var imports = { | |
| require: function(){}, | |
| exports: {}, | |
| module: {} | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| --- | |
| provides : BuildSugar | |
| version : 0.1alpha1 | |
| description : Provides a bizarrely clean & simple syntax sugar for building HTML/XML strings | |
| source : http://gist.github.com/278016 | |
| git : git://gist.github.com/278016.git | |
| demo : http://jsfiddle.net/SubtleGradient/4W3RR/ | |
| author : Thomas Aylott |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('MooTools').apply(global); // extends natives; extends global | |
| require('Class').setup.apply(global); // extends global |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*= | |
| name: Class | |
| description: Code with Class | |
| requires: Accessor | |
| =*/ | |
| MooTools.define(function(){ | |
| var Class = this.Class = new Type('Class', function(params){ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Wrap all of MooTools code in a function | |
| /*<b support="CommonJS Modules namespace">*/var MooTools = function(exports){/*</b>*/ | |
| // fallback exports to `this` so that it can be used as both: | |
| // `MooTools.apply(context)` | |
| // this is the only style that'll work in CommonJS since exports can't be a function | |
| // `MooTools(context)` | |
| // `MooTools()` | |
| if (typeof exports == 'undefined') exports = this; | |
| var context = exports; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Workaround for .NET breaking on `clientID.startsWith` | |
| // Name: MicrosoftAjaxWebForms.debug.js | |
| // Assembly: System.Web.Extensions | |
| // Line: 722 | |
| // Error: Object doesn't support this property or method | |
| /* | |
| function Sys$WebForms$PageRequestManager$_matchesParentIDInList |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Moo = function(){ | |
| var context = this; | |
| var Class = this.Class = function(){}; | |
| this.String.prototype.foo = function(){ return "foo'd"; }; | |
| context.String.prototype.bar = function(){ return "bar'd"; }; | |
| }; |