Make coding style more good

Apply patterns observer and strategy to javascript too . So that
currently anything should be less coupling