Widget based JavaScript framework