Skip to content

Instantly share code, notes, and snippets.

@andersonqi
Last active January 3, 2016 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersonqi/8486483 to your computer and use it in GitHub Desktop.
Save andersonqi/8486483 to your computer and use it in GitHub Desktop.
Learning events in backbone
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Backbone.js</title>
<script src="jquery-1.10.2.js"></script>
<script src="underscore.js"></script>
<script src="backbone.js"></script>
<script>
'use strict';
var person = {
name: 'Names'
};
_.extend(person,Backbone.Events);
person.on('starting',function(){
console.log(this.name);
});
person.trigger('starting');
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment