creating javascript framework and listeners