Update magLite.js

added factory method to core