You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ConnectionPlugin.js 796B

1234567891011121314151617181920212223242526272829303132
  1. import Listenable from '../util/Listenable';
  2. /**
  3. * Creates ConnectionPlugin class that extends the passed class.
  4. * @param {Class} base the definition of the class that will be extended by
  5. * ConnectionPlugin
  6. */
  7. function getConnectionPluginDefinition(base = class{}) {
  8. /**
  9. * Base class for strophe connection plugins.
  10. */
  11. return class extends base {
  12. constructor(...args) {
  13. super(...args);
  14. this.connection = null;
  15. }
  16. init(connection) {
  17. this.connection = connection;
  18. }
  19. };
  20. }
  21. /**
  22. * ConnectionPlugin class.
  23. */
  24. export default getConnectionPluginDefinition();
  25. /**
  26. * ConnectionPlugin class that extends Listenable.
  27. */
  28. export const ConnectionPluginListenable
  29. = getConnectionPluginDefinition(Listenable);