@rxap/ngx-pub-sub 18.0.2 → 18.0.3-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +13 -0
  3. package/compodoc/changelog.html +226 -0
  4. package/compodoc/classes/MessageMetaData.html +551 -0
  5. package/compodoc/dependencies.html +197 -0
  6. package/compodoc/fonts/ionicons.eot +0 -0
  7. package/compodoc/fonts/ionicons.svg +2090 -0
  8. package/compodoc/fonts/ionicons.ttf +0 -0
  9. package/compodoc/fonts/ionicons.woff +0 -0
  10. package/compodoc/fonts/ionicons.woff2 +0 -0
  11. package/compodoc/fonts/roboto-v15-latin-300.eot +0 -0
  12. package/compodoc/fonts/roboto-v15-latin-300.svg +314 -0
  13. package/compodoc/fonts/roboto-v15-latin-300.ttf +0 -0
  14. package/compodoc/fonts/roboto-v15-latin-300.woff +0 -0
  15. package/compodoc/fonts/roboto-v15-latin-300.woff2 +0 -0
  16. package/compodoc/fonts/roboto-v15-latin-700.eot +0 -0
  17. package/compodoc/fonts/roboto-v15-latin-700.svg +310 -0
  18. package/compodoc/fonts/roboto-v15-latin-700.ttf +0 -0
  19. package/compodoc/fonts/roboto-v15-latin-700.woff +0 -0
  20. package/compodoc/fonts/roboto-v15-latin-700.woff2 +0 -0
  21. package/compodoc/fonts/roboto-v15-latin-italic.eot +0 -0
  22. package/compodoc/fonts/roboto-v15-latin-italic.svg +323 -0
  23. package/compodoc/fonts/roboto-v15-latin-italic.ttf +0 -0
  24. package/compodoc/fonts/roboto-v15-latin-italic.woff +0 -0
  25. package/compodoc/fonts/roboto-v15-latin-italic.woff2 +0 -0
  26. package/compodoc/fonts/roboto-v15-latin-regular.eot +0 -0
  27. package/compodoc/fonts/roboto-v15-latin-regular.svg +308 -0
  28. package/compodoc/fonts/roboto-v15-latin-regular.ttf +0 -0
  29. package/compodoc/fonts/roboto-v15-latin-regular.woff +0 -0
  30. package/compodoc/fonts/roboto-v15-latin-regular.woff2 +0 -0
  31. package/compodoc/graph/dependencies.svg +24 -0
  32. package/compodoc/images/compodoc-vectorise-inverted.png +0 -0
  33. package/compodoc/images/compodoc-vectorise-inverted.svg +201 -0
  34. package/compodoc/images/compodoc-vectorise.png +0 -0
  35. package/compodoc/images/compodoc-vectorise.svg +201 -0
  36. package/compodoc/images/favicon.ico +0 -0
  37. package/compodoc/index.html +197 -0
  38. package/compodoc/injectables/PubSubService.html +1132 -0
  39. package/compodoc/interfaces/CachedPubSubMessage.html +309 -0
  40. package/compodoc/interfaces/PubSubMessage.html +348 -0
  41. package/compodoc/js/compodoc.js +14 -0
  42. package/compodoc/js/lazy-load-graphs.js +44 -0
  43. package/compodoc/js/libs/EventDispatcher.js +5 -0
  44. package/compodoc/js/libs/bootstrap-native.js +2 -0
  45. package/compodoc/js/libs/clipboard.min.js +7 -0
  46. package/compodoc/js/libs/custom-elements-es5-adapter.js +15 -0
  47. package/compodoc/js/libs/custom-elements.min.js +38 -0
  48. package/compodoc/js/libs/d3.v3.min.js +2 -0
  49. package/compodoc/js/libs/deep-iterator.js +2 -0
  50. package/compodoc/js/libs/es6-shim.min.js +12 -0
  51. package/compodoc/js/libs/htmlparser.js +23 -0
  52. package/compodoc/js/libs/innersvg.js +9 -0
  53. package/compodoc/js/libs/lit-html.js +1 -0
  54. package/compodoc/js/libs/prism.js +46 -0
  55. package/compodoc/js/libs/promise.min.js +6 -0
  56. package/compodoc/js/libs/svg-pan-zoom.min.js +3 -0
  57. package/compodoc/js/libs/tablesort.min.js +6 -0
  58. package/compodoc/js/libs/tablesort.number.min.js +6 -0
  59. package/compodoc/js/libs/vis.min.js +47 -0
  60. package/compodoc/js/libs/zepto.min.js +2 -0
  61. package/compodoc/js/menu-wc.js +127 -0
  62. package/compodoc/js/menu-wc_es5.js +40 -0
  63. package/compodoc/js/menu.js +270 -0
  64. package/compodoc/js/routes.js +301 -0
  65. package/compodoc/js/search/lunr.min.js +6 -0
  66. package/compodoc/js/search/search-lunr.js +67 -0
  67. package/compodoc/js/search/search.js +283 -0
  68. package/compodoc/js/search/search_index.js +4 -0
  69. package/compodoc/js/sourceCode.js +58 -0
  70. package/compodoc/js/svg-pan-zoom.controls.js +53 -0
  71. package/compodoc/js/tabs.js +21 -0
  72. package/compodoc/js/tree.js +147 -0
  73. package/compodoc/license.html +731 -0
  74. package/compodoc/miscellaneous/functions.html +524 -0
  75. package/compodoc/miscellaneous/variables.html +304 -0
  76. package/compodoc/modules.html +183 -0
  77. package/compodoc/overview.html +209 -0
  78. package/compodoc/properties.html +195 -0
  79. package/compodoc/styles/bootstrap-card.css +219 -0
  80. package/compodoc/styles/bootstrap.min.css +6 -0
  81. package/compodoc/styles/compodoc.css +1124 -0
  82. package/compodoc/styles/dark.css +121 -0
  83. package/compodoc/styles/ionicons.min.css +11 -0
  84. package/compodoc/styles/laravel.css +113 -0
  85. package/compodoc/styles/material.css +131 -0
  86. package/compodoc/styles/original.css +51 -0
  87. package/compodoc/styles/postmark.css +238 -0
  88. package/compodoc/styles/prism.css +301 -0
  89. package/compodoc/styles/readthedocs.css +117 -0
  90. package/compodoc/styles/reset.css +129 -0
  91. package/compodoc/styles/stripe.css +106 -0
  92. package/compodoc/styles/style.css +7 -0
  93. package/compodoc/styles/tablesort.css +33 -0
  94. package/compodoc/styles/vagrant.css +130 -0
  95. package/docs/.nojekyll +1 -0
  96. package/docs/assets/highlight.css +43 -0
  97. package/docs/assets/icons.js +15 -0
  98. package/docs/assets/icons.svg +1 -0
  99. package/docs/assets/main.js +59 -0
  100. package/docs/assets/navigation.js +1 -0
  101. package/docs/assets/search.js +1 -0
  102. package/docs/assets/style.css +1412 -0
  103. package/docs/classes/MessageMetaData.html +25 -0
  104. package/docs/classes/PubSubService.html +36 -0
  105. package/docs/documentation.json +2697 -0
  106. package/docs/functions/ProvidePubSub.html +1 -0
  107. package/docs/functions/withDisableCache.html +1 -0
  108. package/docs/functions/withDisableGarbageCollector.html +1 -0
  109. package/docs/functions/withGarbageCollectorInterval.html +1 -0
  110. package/docs/functions/withMaxCacheSize.html +1 -0
  111. package/docs/hierarchy.html +1 -0
  112. package/docs/index.html +25 -0
  113. package/docs/interfaces/CachedPubSubMessage.html +6 -0
  114. package/docs/interfaces/PubSubMessage.html +5 -0
  115. package/docs/modules.html +14 -0
  116. package/docs/variables/RXAP_PUB_SUB_CACHE_SIZE.html +1 -0
  117. package/docs/variables/RXAP_PUB_SUB_DISABLE_CACHE.html +1 -0
  118. package/docs/variables/RXAP_PUB_SUB_DISABLE_GARBAGE_COLLECTOR.html +1 -0
  119. package/docs/variables/RXAP_PUB_SUB_GARBAGE_COLLECTOR_INTERVAL.html +1 -0
  120. package/package.json +4 -2
  121. package/theme.css +1 -1
@@ -0,0 +1,1132 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <title>angular-pub-sub</title>
7
+ <meta name="description" content="">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
11
+ <link rel="stylesheet" href="../styles/style.css">
12
+ <link rel="stylesheet" href="../styles/dark.css">
13
+ </head>
14
+ <body>
15
+ <script>
16
+ // Blocking script to avoid flickering dark mode
17
+ // Dark mode toggle button
18
+ var useDark = window.matchMedia('(prefers-color-scheme: dark)');
19
+ var darkModeState = useDark.matches;
20
+ var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
21
+ var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
22
+ var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
23
+
24
+ function checkToggle(check) {
25
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
26
+ $darkModeToggleSwitchers[i].checked = check;
27
+ }
28
+ }
29
+
30
+ function toggleDarkMode(state) {
31
+ if (window.localStorage) {
32
+ localStorage.setItem('compodoc_darkmode-state', state);
33
+ }
34
+
35
+ checkToggle(state);
36
+
37
+ const hasClass = document.body.classList.contains('dark');
38
+
39
+ if (state) {
40
+ for (var i = 0; i < $darkModeToggles.length; i++) {
41
+ $darkModeToggles[i].classList.add('dark');
42
+ }
43
+ if (!hasClass) {
44
+ document.body.classList.add('dark');
45
+ }
46
+ } else {
47
+ for (var i = 0; i < $darkModeToggles.length; i++) {
48
+ $darkModeToggles[i].classList.remove('dark');
49
+ }
50
+ if (hasClass) {
51
+ document.body.classList.remove('dark');
52
+ }
53
+ }
54
+ }
55
+
56
+ useDark.addEventListener('change', function (evt) {
57
+ toggleDarkMode(evt.matches);
58
+ });
59
+ if (darkModeStateLocal) {
60
+ darkModeState = darkModeStateLocal === 'true';
61
+ }
62
+ toggleDarkMode(darkModeState);
63
+ </script>
64
+
65
+ <div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
66
+ <div class="d-flex">
67
+ <a href="../" class="navbar-brand">angular-pub-sub</a>
68
+ <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="xs-menu menu" id="mobile-menu">
73
+ <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
74
+ </div>
75
+
76
+ <div class="container-fluid main">
77
+ <div class="row main">
78
+ <div class="d-none d-md-block menu">
79
+ <compodoc-menu mode="normal"></compodoc-menu>
80
+ </div>
81
+ <!-- START CONTENT -->
82
+ <div class="content injectable">
83
+ <div class="content-data">
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+ <ol class="breadcrumb">
93
+ <li class="breadcrumb-item">Injectables</li>
94
+ <li class="breadcrumb-item" >PubSubService</li>
95
+ </ol>
96
+
97
+ <ul class="nav nav-tabs" role="tablist">
98
+ <li class="nav-item">
99
+ <a href="#info"
100
+ class="nav-link"
101
+ class="nav-link active"
102
+ role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
103
+ </li>
104
+ <li class="nav-item">
105
+ <a href="#source"
106
+ class="nav-link"
107
+
108
+ role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a>
109
+ </li>
110
+ </ul>
111
+
112
+ <div class="tab-content">
113
+ <div class="tab-pane fade active in" id="info">
114
+ <p class="comment">
115
+ <h3>File</h3>
116
+ </p>
117
+ <p class="comment">
118
+ <code>src/lib/pub-sub.service.ts</code>
119
+ </p>
120
+
121
+
122
+
123
+
124
+
125
+ <section data-compodoc="block-index">
126
+ <h3 id="index">Index</h3>
127
+ <table class="table table-sm table-bordered index-table">
128
+ <tbody>
129
+
130
+ <tr>
131
+ <td class="col-md-4">
132
+ <h6><b>Methods</b></h6>
133
+ </td>
134
+ </tr>
135
+ <tr>
136
+ <td class="col-md-4">
137
+ <ul class="index-list">
138
+ <li>
139
+ <span class="modifier">Public</span>
140
+ <a href="#getFromCache" >getFromCache</a>
141
+ </li>
142
+ <li>
143
+ <span class="modifier">Public</span>
144
+ <a href="#publish" >publish</a>
145
+ </li>
146
+ <li>
147
+ <span class="modifier">Public</span>
148
+ <a href="#runGarbageCollector" >runGarbageCollector</a>
149
+ </li>
150
+ <li>
151
+ <span class="modifier">Public</span>
152
+ <a href="#setMaxCacheSize" >setMaxCacheSize</a>
153
+ </li>
154
+ <li>
155
+ <span class="modifier">Public</span>
156
+ <a href="#startGarbageCollector" >startGarbageCollector</a>
157
+ </li>
158
+ <li>
159
+ <span class="modifier">Public</span>
160
+ <a href="#stopGarbageCollector" >stopGarbageCollector</a>
161
+ </li>
162
+ <li>
163
+ <span class="modifier">Public</span>
164
+ <a href="#subscribe" >subscribe</a>
165
+ </li>
166
+ <li>
167
+ <span class="modifier">Public</span>
168
+ <a href="#topicMatch" >topicMatch</a>
169
+ </li>
170
+ </ul>
171
+ </td>
172
+ </tr>
173
+
174
+
175
+
176
+
177
+
178
+ <tr>
179
+ <td class="col-md-4">
180
+ <h6><b>Accessors</b></h6>
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <td class="col-md-4">
185
+ <ul class="index-list">
186
+ <li>
187
+ <a href="#cacheSize" >cacheSize</a>
188
+ </li>
189
+ </ul>
190
+ </td>
191
+ </tr>
192
+ </tbody>
193
+ </table>
194
+ </section>
195
+
196
+
197
+ <section data-compodoc="block-methods">
198
+
199
+ <h3 id="methods">
200
+ Methods
201
+ </h3>
202
+ <table class="table table-sm table-bordered">
203
+ <tbody>
204
+ <tr>
205
+ <td class="col-md-4">
206
+ <a name="getFromCache"></a>
207
+ <span class="name">
208
+ <span class="modifier">Public</span>
209
+ <span ><b>getFromCache</b></span>
210
+ <a href="#getFromCache"><span class="icon ion-ios-link"></span></a>
211
+ </span>
212
+ </td>
213
+ </tr>
214
+ <tr>
215
+ <td class="col-md-4">
216
+ <span class="modifier-icon icon ion-ios-reset"></span>
217
+ <code>getFromCache(topic: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, limit: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
218
+ </td>
219
+ </tr>
220
+
221
+
222
+ <tr>
223
+ <td class="col-md-4">
224
+ <div class="io-line">Defined in <a href="" data-line="193"
225
+ class="link-to-prism">src/lib/pub-sub.service.ts:193</a></div>
226
+ </td>
227
+ </tr>
228
+
229
+ <tr>
230
+ <td class="col-md-4">
231
+ <b>Type parameters :</b>
232
+ <ul class="type-parameters">
233
+ <li>T</li>
234
+ </ul>
235
+ </td>
236
+ </tr>
237
+
238
+ <tr>
239
+ <td class="col-md-4">
240
+
241
+ <div class="io-description">
242
+ <b>Parameters :</b>
243
+
244
+ <table class="params">
245
+ <thead>
246
+ <tr>
247
+ <td>Name</td>
248
+ <td>Type</td>
249
+ <td>Optional</td>
250
+ <td>Default value</td>
251
+ <td>Description</td>
252
+ </tr>
253
+ </thead>
254
+ <tbody>
255
+ <tr>
256
+ <td>topic</td>
257
+ <td>
258
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
259
+ </td>
260
+
261
+ <td>
262
+ No
263
+ </td>
264
+
265
+ <td>
266
+ </td>
267
+
268
+ <td>
269
+ <p>Topic to identify the message.</p>
270
+
271
+ </td>
272
+ </tr>
273
+ <tr>
274
+ <td>limit</td>
275
+ <td>
276
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
277
+ </td>
278
+
279
+ <td>
280
+ No
281
+ </td>
282
+
283
+ <td>
284
+ <code>0</code>
285
+ </td>
286
+
287
+ <td>
288
+ <p>Maximum number of messages to return.</p>
289
+
290
+ </td>
291
+ </tr>
292
+ </tbody>
293
+ </table>
294
+ </div>
295
+ <div class="io-description">
296
+ <b>Returns : </b> <code><a href="../classes/MessageMetaData.html" target="_self" >Array&lt;MessageMetaData&lt;T&gt;&gt;</a></code>
297
+
298
+ </div>
299
+ <div class="io-description">
300
+
301
+ </div>
302
+ </td>
303
+ </tr>
304
+ </tbody>
305
+ </table>
306
+ <table class="table table-sm table-bordered">
307
+ <tbody>
308
+ <tr>
309
+ <td class="col-md-4">
310
+ <a name="publish"></a>
311
+ <span class="name">
312
+ <span class="modifier">Public</span>
313
+ <span ><b>publish</b></span>
314
+ <a href="#publish"><span class="icon ion-ios-link"></span></a>
315
+ </span>
316
+ </td>
317
+ </tr>
318
+ <tr>
319
+ <td class="col-md-4">
320
+ <span class="modifier-icon icon ion-ios-reset"></span>
321
+ <code>publish(topic: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, data?: T, retention?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
322
+ </td>
323
+ </tr>
324
+
325
+
326
+ <tr>
327
+ <td class="col-md-4">
328
+ <div class="io-line">Defined in <a href="" data-line="139"
329
+ class="link-to-prism">src/lib/pub-sub.service.ts:139</a></div>
330
+ </td>
331
+ </tr>
332
+
333
+ <tr>
334
+ <td class="col-md-4">
335
+ <b>Type parameters :</b>
336
+ <ul class="type-parameters">
337
+ <li>T</li>
338
+ </ul>
339
+ </td>
340
+ </tr>
341
+
342
+ <tr>
343
+ <td class="col-md-4">
344
+
345
+ <div class="io-description">
346
+ <b>Parameters :</b>
347
+
348
+ <table class="params">
349
+ <thead>
350
+ <tr>
351
+ <td>Name</td>
352
+ <td>Type</td>
353
+ <td>Optional</td>
354
+ <td>Description</td>
355
+ </tr>
356
+ </thead>
357
+ <tbody>
358
+ <tr>
359
+ <td>topic</td>
360
+ <td>
361
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
362
+ </td>
363
+
364
+ <td>
365
+ No
366
+ </td>
367
+
368
+
369
+ <td>
370
+ <p>Topic to identify the message.</p>
371
+
372
+ </td>
373
+ </tr>
374
+ <tr>
375
+ <td>data</td>
376
+ <td>
377
+ <code>T</code>
378
+ </td>
379
+
380
+ <td>
381
+ Yes
382
+ </td>
383
+
384
+
385
+ <td>
386
+ <p>Optional: Additional data sent with the message.</p>
387
+
388
+ </td>
389
+ </tr>
390
+ <tr>
391
+ <td>retention</td>
392
+ <td>
393
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
394
+ </td>
395
+
396
+ <td>
397
+ Yes
398
+ </td>
399
+
400
+
401
+ <td>
402
+ <p>Optional: Retention time in milliseconds.</p>
403
+
404
+ </td>
405
+ </tr>
406
+ </tbody>
407
+ </table>
408
+ </div>
409
+ <div class="io-description">
410
+ <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
411
+
412
+ </div>
413
+ <div class="io-description">
414
+
415
+ </div>
416
+ </td>
417
+ </tr>
418
+ </tbody>
419
+ </table>
420
+ <table class="table table-sm table-bordered">
421
+ <tbody>
422
+ <tr>
423
+ <td class="col-md-4">
424
+ <a name="runGarbageCollector"></a>
425
+ <span class="name">
426
+ <span class="modifier">Public</span>
427
+ <span ><b>runGarbageCollector</b></span>
428
+ <a href="#runGarbageCollector"><span class="icon ion-ios-link"></span></a>
429
+ </span>
430
+ </td>
431
+ </tr>
432
+ <tr>
433
+ <td class="col-md-4">
434
+ <span class="modifier-icon icon ion-ios-reset"></span>
435
+ <code>runGarbageCollector()</code>
436
+ </td>
437
+ </tr>
438
+
439
+
440
+ <tr>
441
+ <td class="col-md-4">
442
+ <div class="io-line">Defined in <a href="" data-line="73"
443
+ class="link-to-prism">src/lib/pub-sub.service.ts:73</a></div>
444
+ </td>
445
+ </tr>
446
+
447
+
448
+ <tr>
449
+ <td class="col-md-4">
450
+
451
+ <div class="io-description">
452
+ <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
453
+
454
+ </div>
455
+ </td>
456
+ </tr>
457
+ </tbody>
458
+ </table>
459
+ <table class="table table-sm table-bordered">
460
+ <tbody>
461
+ <tr>
462
+ <td class="col-md-4">
463
+ <a name="setMaxCacheSize"></a>
464
+ <span class="name">
465
+ <span class="modifier">Public</span>
466
+ <span ><b>setMaxCacheSize</b></span>
467
+ <a href="#setMaxCacheSize"><span class="icon ion-ios-link"></span></a>
468
+ </span>
469
+ </td>
470
+ </tr>
471
+ <tr>
472
+ <td class="col-md-4">
473
+ <span class="modifier-icon icon ion-ios-reset"></span>
474
+ <code>setMaxCacheSize(size: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
475
+ </td>
476
+ </tr>
477
+
478
+
479
+ <tr>
480
+ <td class="col-md-4">
481
+ <div class="io-line">Defined in <a href="" data-line="54"
482
+ class="link-to-prism">src/lib/pub-sub.service.ts:54</a></div>
483
+ </td>
484
+ </tr>
485
+
486
+
487
+ <tr>
488
+ <td class="col-md-4">
489
+
490
+ <div class="io-description">
491
+ <b>Parameters :</b>
492
+
493
+ <table class="params">
494
+ <thead>
495
+ <tr>
496
+ <td>Name</td>
497
+ <td>Type</td>
498
+ <td>Optional</td>
499
+ </tr>
500
+ </thead>
501
+ <tbody>
502
+ <tr>
503
+ <td>size</td>
504
+ <td>
505
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
506
+ </td>
507
+
508
+ <td>
509
+ No
510
+ </td>
511
+
512
+
513
+ </tr>
514
+ </tbody>
515
+ </table>
516
+ </div>
517
+ <div class="io-description">
518
+ <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
519
+
520
+ </div>
521
+ <div class="io-description">
522
+
523
+ </div>
524
+ </td>
525
+ </tr>
526
+ </tbody>
527
+ </table>
528
+ <table class="table table-sm table-bordered">
529
+ <tbody>
530
+ <tr>
531
+ <td class="col-md-4">
532
+ <a name="startGarbageCollector"></a>
533
+ <span class="name">
534
+ <span class="modifier">Public</span>
535
+ <span ><b>startGarbageCollector</b></span>
536
+ <a href="#startGarbageCollector"><span class="icon ion-ios-link"></span></a>
537
+ </span>
538
+ </td>
539
+ </tr>
540
+ <tr>
541
+ <td class="col-md-4">
542
+ <span class="modifier-icon icon ion-ios-reset"></span>
543
+ <code>startGarbageCollector()</code>
544
+ </td>
545
+ </tr>
546
+
547
+
548
+ <tr>
549
+ <td class="col-md-4">
550
+ <div class="io-line">Defined in <a href="" data-line="58"
551
+ class="link-to-prism">src/lib/pub-sub.service.ts:58</a></div>
552
+ </td>
553
+ </tr>
554
+
555
+
556
+ <tr>
557
+ <td class="col-md-4">
558
+
559
+ <div class="io-description">
560
+ <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
561
+
562
+ </div>
563
+ </td>
564
+ </tr>
565
+ </tbody>
566
+ </table>
567
+ <table class="table table-sm table-bordered">
568
+ <tbody>
569
+ <tr>
570
+ <td class="col-md-4">
571
+ <a name="stopGarbageCollector"></a>
572
+ <span class="name">
573
+ <span class="modifier">Public</span>
574
+ <span ><b>stopGarbageCollector</b></span>
575
+ <a href="#stopGarbageCollector"><span class="icon ion-ios-link"></span></a>
576
+ </span>
577
+ </td>
578
+ </tr>
579
+ <tr>
580
+ <td class="col-md-4">
581
+ <span class="modifier-icon icon ion-ios-reset"></span>
582
+ <code>stopGarbageCollector()</code>
583
+ </td>
584
+ </tr>
585
+
586
+
587
+ <tr>
588
+ <td class="col-md-4">
589
+ <div class="io-line">Defined in <a href="" data-line="85"
590
+ class="link-to-prism">src/lib/pub-sub.service.ts:85</a></div>
591
+ </td>
592
+ </tr>
593
+
594
+
595
+ <tr>
596
+ <td class="col-md-4">
597
+
598
+ <div class="io-description">
599
+ <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
600
+
601
+ </div>
602
+ </td>
603
+ </tr>
604
+ </tbody>
605
+ </table>
606
+ <table class="table table-sm table-bordered">
607
+ <tbody>
608
+ <tr>
609
+ <td class="col-md-4">
610
+ <a name="subscribe"></a>
611
+ <span class="name">
612
+ <span class="modifier">Public</span>
613
+ <span ><b>subscribe</b></span>
614
+ <a href="#subscribe"><span class="icon ion-ios-link"></span></a>
615
+ </span>
616
+ </td>
617
+ </tr>
618
+ <tr>
619
+ <td class="col-md-4">
620
+ <span class="modifier-icon icon ion-ios-reset"></span>
621
+ <code>subscribe(topic: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, replayCount?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
622
+ </td>
623
+ </tr>
624
+
625
+
626
+ <tr>
627
+ <td class="col-md-4">
628
+ <div class="io-line">Defined in <a href="" data-line="168"
629
+ class="link-to-prism">src/lib/pub-sub.service.ts:168</a></div>
630
+ </td>
631
+ </tr>
632
+
633
+ <tr>
634
+ <td class="col-md-4">
635
+ <b>Type parameters :</b>
636
+ <ul class="type-parameters">
637
+ <li>T</li>
638
+ </ul>
639
+ </td>
640
+ </tr>
641
+
642
+ <tr>
643
+ <td class="col-md-4">
644
+
645
+ <div class="io-description">
646
+ <b>Parameters :</b>
647
+
648
+ <table class="params">
649
+ <thead>
650
+ <tr>
651
+ <td>Name</td>
652
+ <td>Type</td>
653
+ <td>Optional</td>
654
+ <td>Description</td>
655
+ </tr>
656
+ </thead>
657
+ <tbody>
658
+ <tr>
659
+ <td>topic</td>
660
+ <td>
661
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
662
+ </td>
663
+
664
+ <td>
665
+ No
666
+ </td>
667
+
668
+
669
+ <td>
670
+ <p>Topic to identify the message.</p>
671
+
672
+ </td>
673
+ </tr>
674
+ <tr>
675
+ <td>replayCount</td>
676
+ <td>
677
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
678
+ </td>
679
+
680
+ <td>
681
+ Yes
682
+ </td>
683
+
684
+
685
+ <td>
686
+ <p>Number of messages to replay.</p>
687
+
688
+ </td>
689
+ </tr>
690
+ </tbody>
691
+ </table>
692
+ </div>
693
+ <div class="io-description">
694
+ <b>Returns : </b> <code><a href="../classes/MessageMetaData.html" target="_self" >Observable&lt;MessageMetaData&lt;T&gt;&gt;</a></code>
695
+
696
+ </div>
697
+ <div class="io-description">
698
+ <p>Observable you can subscribe to listen messages.</p>
699
+
700
+ </div>
701
+ </td>
702
+ </tr>
703
+ </tbody>
704
+ </table>
705
+ <table class="table table-sm table-bordered">
706
+ <tbody>
707
+ <tr>
708
+ <td class="col-md-4">
709
+ <a name="topicMatch"></a>
710
+ <span class="name">
711
+ <span class="modifier">Public</span>
712
+ <span ><b>topicMatch</b></span>
713
+ <a href="#topicMatch"><span class="icon ion-ios-link"></span></a>
714
+ </span>
715
+ </td>
716
+ </tr>
717
+ <tr>
718
+ <td class="col-md-4">
719
+ <span class="modifier-icon icon ion-ios-reset"></span>
720
+ <code>topicMatch(topic: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, wildcard: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
721
+ </td>
722
+ </tr>
723
+
724
+
725
+ <tr>
726
+ <td class="col-md-4">
727
+ <div class="io-line">Defined in <a href="" data-line="101"
728
+ class="link-to-prism">src/lib/pub-sub.service.ts:101</a></div>
729
+ </td>
730
+ </tr>
731
+
732
+
733
+ <tr>
734
+ <td class="col-md-4">
735
+ <div class="io-description"><p>Validates topic matching.</p>
736
+ </div>
737
+
738
+ <div class="io-description">
739
+ <b>Parameters :</b>
740
+
741
+ <table class="params">
742
+ <thead>
743
+ <tr>
744
+ <td>Name</td>
745
+ <td>Type</td>
746
+ <td>Optional</td>
747
+ <td>Description</td>
748
+ </tr>
749
+ </thead>
750
+ <tbody>
751
+ <tr>
752
+ <td>topic</td>
753
+ <td>
754
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
755
+ </td>
756
+
757
+ <td>
758
+ No
759
+ </td>
760
+
761
+
762
+ <td>
763
+ <p>Topic to identify the message/event.</p>
764
+
765
+ </td>
766
+ </tr>
767
+ <tr>
768
+ <td>wildcard</td>
769
+ <td>
770
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
771
+ </td>
772
+
773
+ <td>
774
+ No
775
+ </td>
776
+
777
+
778
+ <td>
779
+ <p>Wildcard received from on method.</p>
780
+
781
+ </td>
782
+ </tr>
783
+ </tbody>
784
+ </table>
785
+ </div>
786
+ <div class="io-description">
787
+ <b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
788
+
789
+ </div>
790
+ <div class="io-description">
791
+ <p>true if topic matches, false otherwise.</p>
792
+
793
+ </div>
794
+ </td>
795
+ </tr>
796
+ </tbody>
797
+ </table>
798
+ </section>
799
+
800
+ <section data-compodoc="block-accessors">
801
+ <h3 id="accessors">
802
+ Accessors
803
+ </h3>
804
+ <table class="table table-sm table-bordered">
805
+ <tbody>
806
+ <tr>
807
+ <td class="col-md-4">
808
+ <a name="cacheSize"></a>
809
+ <span class="name"><b>cacheSize</b><a href="#cacheSize"><span class="icon ion-ios-link"></span></a></span>
810
+ </td>
811
+ </tr>
812
+
813
+ <tr>
814
+ <td class="col-md-4">
815
+ <span class="accessor"><b>get</b><code>cacheSize()</code></span>
816
+ </td>
817
+ </tr>
818
+ <tr>
819
+ <td class="col-md-4">
820
+ <div class="io-line">Defined in <a href="" data-line="50" class="link-to-prism">src/lib/pub-sub.service.ts:50</a></div>
821
+ </td>
822
+ </tr>
823
+
824
+ </tbody>
825
+ </table>
826
+ </section>
827
+ </div>
828
+
829
+
830
+ <div class="tab-pane fade tab-source-code" id="source">
831
+ <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
832
+ inject,
833
+ Injectable,
834
+ OnDestroy,
835
+ } from &#x27;@angular/core&#x27;;
836
+ import {
837
+ concat,
838
+ filter,
839
+ from,
840
+ interval,
841
+ map,
842
+ Observable,
843
+ Subject,
844
+ Subscription,
845
+ tap,
846
+ } from &#x27;rxjs&#x27;;
847
+ import { MessageMetaData } from &#x27;./message-meta-data&#x27;;
848
+ import {
849
+ CachedPubSubMessage,
850
+ PubSubMessage,
851
+ } from &#x27;./pub-sub-message&#x27;;
852
+ import {
853
+ RXAP_PUB_SUB_CACHE_SIZE,
854
+ RXAP_PUB_SUB_DISABLE_CACHE,
855
+ RXAP_PUB_SUB_DISABLE_GARBAGE_COLLECTOR,
856
+ RXAP_PUB_SUB_GARBAGE_COLLECTOR_INTERVAL,
857
+ } from &#x27;./tokens&#x27;;
858
+
859
+ @Injectable({
860
+ providedIn: &#x27;root&#x27;,
861
+ })
862
+ export class PubSubService implements OnDestroy {
863
+
864
+ /**
865
+ * Main observable to multicast to all observers.
866
+ */
867
+ private readonly messageBus &#x3D; new Subject&lt;PubSubMessage&gt;();
868
+ private readonly cache: CachedPubSubMessage[] &#x3D; [];
869
+ private maxCacheSize &#x3D; inject(RXAP_PUB_SUB_CACHE_SIZE);
870
+ /**
871
+ * Topic message separator.
872
+ */
873
+ private readonly separator &#x3D; &#x27;.&#x27;;
874
+ private readonly garbageCollectorInterval: number &#x3D; inject(RXAP_PUB_SUB_GARBAGE_COLLECTOR_INTERVAL);
875
+ private readonly disableCache: boolean &#x3D; inject(RXAP_PUB_SUB_DISABLE_CACHE);
876
+ private readonly disableGarbageCollector: boolean &#x3D; inject(RXAP_PUB_SUB_DISABLE_GARBAGE_COLLECTOR);
877
+ private garbageCollectorSubscription: Subscription | null &#x3D; null;
878
+ private garbageCollectorInitialized &#x3D; false;
879
+
880
+ public get cacheSize(): number {
881
+ return this.cache.length;
882
+ }
883
+
884
+ public setMaxCacheSize(size: number) {
885
+ this.maxCacheSize &#x3D; size;
886
+ }
887
+
888
+ public startGarbageCollector() {
889
+ this.garbageCollectorInitialized &#x3D; true;
890
+ if (this.disableGarbageCollector || this.disableCache) {
891
+ console.warn(&#x27;Garbage collector is disabled&#x27;);
892
+ return;
893
+ }
894
+ if (this.garbageCollectorSubscription) {
895
+ this.garbageCollectorSubscription.unsubscribe();
896
+ this.garbageCollectorSubscription &#x3D; null;
897
+ }
898
+ this.garbageCollectorSubscription &#x3D; interval(this.garbageCollectorInterval).pipe(
899
+ tap(() &#x3D;&gt; this.runGarbageCollector()),
900
+ ).subscribe();
901
+ }
902
+
903
+ public runGarbageCollector() {
904
+ const now &#x3D; Date.now();
905
+ this.cache.forEach((message, index) &#x3D;&gt; {
906
+ if (message.retention) {
907
+ const diff &#x3D; now - message.metadata.timestamp;
908
+ if (diff &gt; message.retention) {
909
+ this.cache.splice(index, 1);
910
+ }
911
+ }
912
+ });
913
+ }
914
+
915
+ public stopGarbageCollector() {
916
+ this.garbageCollectorSubscription?.unsubscribe();
917
+ }
918
+
919
+ ngOnDestroy() {
920
+ this.stopGarbageCollector();
921
+ }
922
+
923
+ /**
924
+ * Validates topic matching.
925
+ *
926
+ * @param topic Topic to identify the message/event.
927
+ * @param wildcard Wildcard received from on method.
928
+ *
929
+ * @return true if topic matches, false otherwise.
930
+ */
931
+ public topicMatch(topic: string, wildcard: string): boolean {
932
+ const w &#x3D; &#x27;*&#x27;;
933
+ const ww &#x3D; &#x27;**&#x27;;
934
+
935
+ const partMatch &#x3D; (wl: string, k: string): boolean &#x3D;&gt; {
936
+ return wl &#x3D;&#x3D;&#x3D; w || wl &#x3D;&#x3D;&#x3D; k;
937
+ };
938
+
939
+ const sep &#x3D; this.separator;
940
+ const kArr &#x3D; topic.split(sep);
941
+ const wArr &#x3D; wildcard.split(sep);
942
+
943
+ const kLen &#x3D; kArr.length;
944
+ const wLen &#x3D; wArr.length;
945
+ const max &#x3D; Math.max(kLen, wLen);
946
+
947
+ for (let i &#x3D; 0; i &lt; max; i++) {
948
+ const cK &#x3D; kArr[i];
949
+ const cW &#x3D; wArr[i];
950
+
951
+ if (cW &#x3D;&#x3D;&#x3D; ww &amp;&amp; typeof cK !&#x3D;&#x3D; &#x27;undefined&#x27;) {
952
+ return true;
953
+ }
954
+
955
+ if (!partMatch(cW, cK)) {
956
+ return false;
957
+ }
958
+ }
959
+
960
+ return true;
961
+ }
962
+
963
+ /**
964
+ * @param topic Topic to identify the message.
965
+ * @param [data] Optional: Additional data sent with the message.
966
+ * @param [retention] Optional: Retention time in milliseconds.
967
+ * @throws {Error} topic parameter must be a string and must not be empty.
968
+ */
969
+ public publish&lt;T &#x3D; unknown&gt;(topic: string, data?: T, retention?: number): void {
970
+
971
+ if (!this.garbageCollectorInitialized) {
972
+ throw new Error(
973
+ &#x27;Garbage collector is not initialized. Ensure the ProvidePubSub function is called in the app config object&#x27;);
974
+ }
975
+
976
+ if (!topic.trim().length) {
977
+ throw new Error(&#x27;topic parameter must be a string and must not be empty&#x27;);
978
+ }
979
+
980
+ const metadata: MessageMetaData&lt;T&gt; &#x3D; new MessageMetaData&lt;T&gt;(topic, data);
981
+
982
+ this.messageBus.next({ topic, metadata });
983
+ if (!this.disableCache &amp;&amp; (
984
+ retention &#x3D;&#x3D;&#x3D; undefined || retention &gt; 0
985
+ )) {
986
+ if (this.cache.length &gt;&#x3D; this.maxCacheSize) {
987
+ this.cache.shift();
988
+ }
989
+ this.cache.push({ topic, metadata, retention });
990
+ }
991
+ }
992
+
993
+ /**
994
+ * @param topic Topic to identify the message.
995
+ * @param replayCount Number of messages to replay.
996
+ * @return Observable you can subscribe to listen messages.
997
+ */
998
+ public subscribe&lt;T &#x3D; unknown&gt;(topic: string, replayCount?: number): Observable&lt;MessageMetaData&lt;T&gt;&gt; {
999
+
1000
+ if (!topic.trim().length) {
1001
+ throw new Error(&#x27;topic parameter must be a string and must not be empty&#x27;);
1002
+ }
1003
+
1004
+ if (!this.garbageCollectorInitialized) {
1005
+ throw new Error(
1006
+ &#x27;Garbage collector is not initialized. Ensure the ProvidePubSub function is called in the app config object&#x27;);
1007
+ }
1008
+
1009
+ const fromCache &#x3D; replayCount &amp;&amp; replayCount &gt; 0 ? this.getFromCache&lt;T&gt;(topic, replayCount ?? 0) : [];
1010
+
1011
+ const fromBus &#x3D; this.messageBus.asObservable().pipe(
1012
+ filter((event: PubSubMessage) &#x3D;&gt; this.topicMatch(event.topic, topic)),
1013
+ map((event: PubSubMessage) &#x3D;&gt; event.metadata as MessageMetaData&lt;T&gt;),
1014
+ );
1015
+
1016
+ return fromCache.length ? concat(from(fromCache), fromBus) : fromBus;
1017
+ }
1018
+
1019
+ /**
1020
+ * @param topic Topic to identify the message.
1021
+ * @param limit Maximum number of messages to return.
1022
+ */
1023
+ public getFromCache&lt;T &#x3D; unknown&gt;(topic: string, limit &#x3D; 0): Array&lt;MessageMetaData&lt;T&gt;&gt; {
1024
+
1025
+ if (!this.garbageCollectorInitialized) {
1026
+ throw new Error(
1027
+ &#x27;Garbage collector is not initialized. Ensure the ProvidePubSub function is called in the app config object&#x27;);
1028
+ }
1029
+
1030
+ const messages: Array&lt;MessageMetaData&lt;T&gt;&gt; &#x3D; [];
1031
+ for (let i &#x3D; this.cache.length - 1; i &gt;&#x3D; 0; i--) {
1032
+ const message &#x3D; this.cache[i];
1033
+ if (this.topicMatch(message.topic, topic)) {
1034
+ messages.push(message.metadata as MessageMetaData&lt;T&gt;);
1035
+ if (limit &amp;&amp; messages.length &gt;&#x3D; limit) {
1036
+ break;
1037
+ }
1038
+ }
1039
+ }
1040
+ return messages;
1041
+ }
1042
+
1043
+ }
1044
+ </code></pre>
1045
+ </div>
1046
+
1047
+ </div>
1048
+
1049
+
1050
+
1051
+
1052
+
1053
+
1054
+
1055
+
1056
+
1057
+
1058
+
1059
+
1060
+
1061
+ </div><div class="search-results">
1062
+ <div class="has-results">
1063
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
1064
+ <ul class="search-results-list"></ul>
1065
+ </div>
1066
+ <div class="no-results">
1067
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
1068
+ </div>
1069
+ </div>
1070
+ </div>
1071
+ <!-- END CONTENT -->
1072
+ </div>
1073
+ </div>
1074
+
1075
+ <label class="dark-mode-switch">
1076
+ <input type="checkbox">
1077
+ <span class="slider">
1078
+ <svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
1079
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
1080
+ </svg>
1081
+ </span>
1082
+ </label>
1083
+
1084
+ <script>
1085
+ var COMPODOC_CURRENT_PAGE_DEPTH = 1;
1086
+ var COMPODOC_CURRENT_PAGE_CONTEXT = 'injectable';
1087
+ var COMPODOC_CURRENT_PAGE_URL = 'PubSubService.html';
1088
+ var MAX_SEARCH_RESULTS = 15;
1089
+ </script>
1090
+
1091
+ <script>
1092
+ $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
1093
+ checkToggle(darkModeState);
1094
+ if ($darkModeToggleSwitchers.length > 0) {
1095
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
1096
+ $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
1097
+ darkModeState = !darkModeState;
1098
+ toggleDarkMode(darkModeState);
1099
+ });
1100
+ }
1101
+ }
1102
+ </script>
1103
+
1104
+ <script src="../js/libs/custom-elements.min.js"></script>
1105
+ <script src="../js/libs/lit-html.js"></script>
1106
+
1107
+ <script src="../js/menu-wc.js" defer></script>
1108
+ <script nomodule src="../js/menu-wc_es5.js" defer></script>
1109
+
1110
+ <script src="../js/libs/bootstrap-native.js"></script>
1111
+
1112
+ <script src="../js/libs/es6-shim.min.js"></script>
1113
+ <script src="../js/libs/EventDispatcher.js"></script>
1114
+ <script src="../js/libs/promise.min.js"></script>
1115
+ <script src="../js/libs/zepto.min.js"></script>
1116
+
1117
+ <script src="../js/compodoc.js"></script>
1118
+
1119
+ <script src="../js/tabs.js"></script>
1120
+ <script src="../js/menu.js"></script>
1121
+ <script src="../js/libs/clipboard.min.js"></script>
1122
+ <script src="../js/libs/prism.js"></script>
1123
+ <script src="../js/sourceCode.js"></script>
1124
+ <script src="../js/search/search.js"></script>
1125
+ <script src="../js/search/lunr.min.js"></script>
1126
+ <script src="../js/search/search-lunr.js"></script>
1127
+ <script src="../js/search/search_index.js"></script>
1128
+ <script src="../js/lazy-load-graphs.js"></script>
1129
+
1130
+
1131
+ </body>
1132
+ </html>