add win logic to js