Created
August 17, 2012 23:29
-
-
Save patrick-steele-idem/3383452 to your computer and use it in GitHub Desktop.
RaptorJS syntax
This file contains 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
raptor.define( | |
'my.module', | |
{ | |
hello: "World" | |
}); | |
raptor.define( | |
'my.module', | |
function() { | |
return { | |
hello: "World" | |
} | |
}); | |
raptor.define( | |
'my.MyClass', | |
function() { | |
var MyClass = function() { | |
}; | |
MyClass.myStatic = "Test"; | |
MyClass.prototype = { | |
hello: world; | |
} | |
return MyClass; | |
}); | |
raptor.define( | |
'my.MyClass', | |
'my.MySuperClass' | |
function() { | |
var MyClass = function() { | |
MyClass.superclass.constructor.call(this, "Hello!"); | |
}; | |
MyClass.myStatic = "Test"; | |
MyClass.prototype = { | |
greet: function(name) { | |
MyClass.superclass.greet.call(this, name); | |
} | |
} | |
return MyClass; | |
}); | |
raptor.extend( | |
'my.module', | |
function() { | |
return { //Mixins to apply to the module object | |
} | |
}); | |
raptor.extend( | |
'my.MyClass', | |
function() { | |
return { //Mixins to apply to the *prototype* of the target class | |
} | |
}); | |
var module = raptor.reuqire('my.module'); | |
var MyClass = raptor.require('my.MyClass'); | |
var myObj = new MyClass(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment