fixed for IE11 (Promise not defined). wrapped client-script into function