Guest User

Untitled

a guest
Oct 15th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. ObjectA.prototype = new MVCObject();
  2. var object_a = new ObjectA();
  3.  
  4. ObjectA.prototype.foo_changed = function()
  5. {
  6. console.log('ObjectA foo changed, it is now: ' + this.get('foo'));
  7. };
  8.  
  9. // Not working Hook
  10. object_a.changed('foo', () => {
  11. console.log('===> index.js ===> Need to be Fired');
  12. })
  13.  
  14. $(function(){
  15.  
  16. $('#btn-panel').click(function(){
  17.  
  18. object_a.set('foo', 'I am cool');
  19. });
  20. });
  21.  
  22. object_a.on('foo_changed', function() {
  23. console.log('===> index.js ===> First Listener');
  24. })
  25.  
  26. object_a.on('foo_changed', function() {
  27. console.log('===> index.js ===> Second Listener');
  28. })
Add Comment
Please, Sign In to add comment