Last active
October 6, 2015 22:27
-
-
Save rheaton/3062378 to your computer and use it in GitHub Desktop.
emerson up and running in rails >= 3.2
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
// .... require all the things you need | |
// Vendored requires | |
//= require jquery | |
//= require underscore | |
//= require emerson | |
// Application requires | |
//= require base | |
//= require_tree ./lib/traits | |
//= require_tree ./lib/views |
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
(function($, window) { | |
$(window).load(function() { | |
Emerson.init(); | |
}); | |
})(jQuery, this); |
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
gem 'emerson' |
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
(function($, define) { | |
var trait = define('alerter', { | |
initialize : function initialize() { | |
console.log("initializing trait!"); | |
}, | |
subscribe : { | |
'mouseout' : function handler(e) { | |
this.alertMethod(); | |
} | |
} | |
}); | |
trait.extend({ | |
alertMethod : function alertMethod() { | |
alert("you moused out"); | |
} | |
}); | |
})(Emerson.base, Emerson.trait); |
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
<p> | |
Here is some text. | |
<span data-traits='alerter'>I should alert when you mouse out!</span> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment