xmppjs / xmpp.js

XMPP for JavaScript
ISC License
2.18k stars 372 forks source link

Syntax error #907

Closed abelshare closed 2 years ago

abelshare commented 2 years ago

Syntax error

Environment

62.0.3202.84 Chromium from android

contect

file: node_modules\@xmpp\connection\index.js row: 193

// Report Error

try {
      el = await this.close();
    } catch {}
// That's right.

try {
      el = await this.close();
    } catch (e) {}

look this https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/try...catch

sonnyp commented 2 years ago

The JavaScript syntax is valid, it's called optional catch binding https://2ality.com/2017/08/optional-catch-binding.html

Use babel or

<script
  src="https://unpkg.com/@xmpp/client@VERSION/dist/xmpp.min.js"
  crossorigin
></script>