Transered js code to AMD