abstract out base javascript