Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ConnectionPlugin.js 897B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. /**
  13. *
  14. */
  15. constructor(...args) {
  16. super(...args);
  17. this.connection = null;
  18. }
  19. /**
  20. *
  21. * @param connection
  22. */
  23. init(connection) {
  24. this.connection = connection;
  25. }
  26. };
  27. }
  28. /**
  29. * ConnectionPlugin class.
  30. */
  31. export default getConnectionPluginDefinition();
  32. /**
  33. * ConnectionPlugin class that extends Listenable.
  34. */
  35. export const ConnectionPluginListenable
  36. = getConnectionPluginDefinition(Listenable);