Skip to content

Instantly share code, notes, and snippets.

@patrick-steele-idem
Created August 17, 2012 23:29
Show Gist options
  • Save patrick-steele-idem/3383452 to your computer and use it in GitHub Desktop.
Save patrick-steele-idem/3383452 to your computer and use it in GitHub Desktop.
RaptorJS syntax
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