Create observer.js

Main observer code