Update yuan.js

Add custom events support.