Update beagle-term/js/beagle.js

handle serial functions at background js