Skip to content

Instantly share code, notes, and snippets.

MooTools Dependency Syntax

:<space>, : and / are interchangeable.

Which makes all these options equivilent:

  1. Package: tag: Component
  2. Package: tag:Component
  3. Package: tag/Component
  4. Package:tag: Component
@subtleGradient
subtleGradient / Aylott.md
Created December 9, 2009 17:24
Aylott Classic Anim

@subtleGradient
subtleGradient / MooTools Dependency System.markdown
Created December 9, 2009 04:53
MooTools Dependency System

MooTools Dependency System

  • Package
    • tag
      • group (filename)
        • Provide

Package has many tags
Package/tag has many groups
Package/tag/group has many provides

var MyClass = new Class({
initialize: function(){
this.foo = /*<b compat=1.2>*/'123' && /*</b>*/'345';
/*<b compat=1.2>*/this.foo = '123';/*</b>*/
this.foo = '345';
},
//<b fix=ie6>
method: function(/*<b compat=1.2>*/arg12, /*</b>*/arg20){
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Benchmark prototype Method vs Object Property Fn</title>
<script type="text/javascript" src="JSLitmus.js"></script>
<script type="text/javascript">
// Basic closure, assumes window === this
(function(){
// require stuff here
})();
// Custom closure, this === anything you want
(function(){
// require stuff here
@subtleGradient
subtleGradient / delayunless.js
Created October 30, 2009 13:55
delayUnless — fire an event after a delay unless it's cancelled by another event; DEMO: http://mooshell.net/JvwnU/
// -*- Mode: MooTools Javascript; tab-width: 4; -*-
/*
---
provides: delayUnless
author: Thomas Aylott <subtlegradient.com>
copyright: 2009 Thomas Aylott
license: MIT Style
requires: [MooTools, Element, Events]
...
*/
@subtleGradient
subtleGradient / lateBind.js
Created October 8, 2009 19:45
String.bind lets you bind to a method that doesn't exist yet, and then swap out methods without re-wiring all your codez
// -*- Mode: Javascript; tab-width: 4; -*-
/*
---
privides: [String.bound, String.prototype.bind]
description: Lets you bind to a method that doesn't exist yet, and then swap out methods without re-wiring all your codez
author: Thomas Aylott <subtlegradient.com>
copyright: 2009 Thomas Aylott
license: MIT Style
...
*/
@subtleGradient
subtleGradient / MooTools_Logo.svg
Created October 7, 2009 22:20
MooTools Logo in SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Function.safeTry = (function(){
var currentHandler;
var dispatchFakeEvent;
var currentHandlerResult;
if (document.addEventListener){
document.addEventListener("fakeEvents", function(){
currentHandler(); // execute the callback
}, false);