spyne 0.16.0 → 0.18.0

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 (81) hide show
  1. package/.travis.yml +2 -2
  2. package/karma.conf.js +18 -69
  3. package/lib/spyne.js +29752 -28672
  4. package/lib/spyne.min.js +1 -1
  5. package/lib/spyne.min.js.LICENSE.txt +9 -9
  6. package/package.json +21 -42
  7. package/src/spyne/channels/channel-fetch-class.js +25 -5
  8. package/src/spyne/channels/channel-payload-class.js +36 -23
  9. package/src/spyne/channels/channel-proxy.js +7 -5
  10. package/src/spyne/channels/channel.js +54 -28
  11. package/src/spyne/channels/channels-config.js +2 -4
  12. package/src/spyne/channels/{channels-delegator.js → channels-map.js} +25 -41
  13. package/src/spyne/channels/spyne-channel-lifecycle.js +1 -2
  14. package/src/spyne/channels/spyne-channel-route.js +21 -62
  15. package/src/spyne/channels/spyne-channel-ui.js +1 -2
  16. package/src/spyne/channels/spyne-channel-window.js +24 -35
  17. package/src/spyne/spyne-app.js +163 -0
  18. package/src/spyne/spyne-plugins.js +43 -40
  19. package/src/spyne/spyne.js +6 -157
  20. package/src/spyne/utils/channel-config-validator.js +0 -1
  21. package/src/spyne/utils/channel-fetch-util.js +1 -2
  22. package/src/spyne/utils/channel-payload-filter.js +9 -76
  23. package/src/spyne/utils/frp-tools.js +21 -1
  24. package/src/spyne/utils/gc.js +1 -1
  25. package/src/spyne/utils/route-channel-updater.js +0 -4
  26. package/src/spyne/utils/spyne-app-properties.js +183 -0
  27. package/src/spyne/utils/spyne-logger.js +18 -0
  28. package/src/spyne/utils/spyne-plugins-methods.js +97 -0
  29. package/src/spyne/utils/spyne-trait.js +2 -5
  30. package/src/spyne/utils/spyne-utils-channel-route-url.js +3 -8
  31. package/src/spyne/utils/spyne-utils-channel-route.js +6 -14
  32. package/src/spyne/utils/spyne-utils-channel-window.js +1 -3
  33. package/src/spyne/utils/viewstream-observables.js +2 -3
  34. package/src/spyne/views/dom-element-template.js +2 -7
  35. package/src/spyne/views/dom-element.js +0 -19
  36. package/src/spyne/views/view-stream-broadcaster.js +5 -10
  37. package/src/spyne/views/view-stream-element.js +1 -18
  38. package/src/spyne/views/view-stream-payload.js +31 -37
  39. package/src/spyne/views/view-stream-selector.js +3 -8
  40. package/src/spyne/views/view-stream.js +281 -297
  41. package/src/tests/channels/channel-fetch.test.js +102 -0
  42. package/src/tests/channels/channel-payload-class.test.js +14 -5
  43. package/src/tests/channels/channel-payload-filter.test.js +3 -28
  44. package/src/tests/channels/channel.test.js +38 -0
  45. package/src/tests/index.js +0 -1
  46. package/src/tests/index.test.js +6 -0
  47. package/src/tests/spyne-app.test.js +27 -0
  48. package/src/tests/spyne-plugin.test.js +13 -9
  49. package/src/tests/utils/plugins-methods.test.js +103 -0
  50. package/src/tests/utils/spyne-app-properties.test.js +11 -0
  51. package/webpack.config.js +19 -34
  52. package/lib/channel-action-filter.test.3516417154.js +0 -20
  53. package/lib/channel-dom.test.104366832.js +0 -20
  54. package/lib/channel-fetch-util.test.3506167575.js +0 -20
  55. package/lib/channel-payload-class.test.1081032524.js +0 -20
  56. package/lib/channel-payload-filter.test.977308429.js +0 -20
  57. package/lib/channel-route.test.3513636042.js +0 -20
  58. package/lib/channel-stream-item.test.119388071.js +0 -20
  59. package/lib/channel-ui.test.3778619579.js +0 -20
  60. package/lib/channel-util-dom.test.908537750.js +0 -20
  61. package/lib/commons.js +0 -49268
  62. package/lib/dom-el-selectors.test.1268485916.js +0 -20
  63. package/lib/dom-el-template.test.842696987.js +0 -20
  64. package/lib/dom-el.test.2045076905.js +0 -20
  65. package/lib/frp-tools.test.2503042868.js +0 -20
  66. package/lib/import.test.2658619365.js +0 -20
  67. package/lib/index.test.2372977745.js +0 -20
  68. package/lib/route-utils.test.273346057.js +0 -20
  69. package/lib/runtime.js +0 -172
  70. package/lib/spyne-plugin.test.301647328.js +0 -20
  71. package/lib/spyne.js.map +0 -1
  72. package/lib/url-utils.test.1931189114.js +0 -20
  73. package/lib/view-stream-broadcaster.test.1306675435.js +0 -20
  74. package/lib/view-stream-enhancer-loader.test.3617829096.js +0 -20
  75. package/lib/view-stream-enhancer.test.1053738169.js +0 -20
  76. package/lib/view-stream.test.573231784.js +0 -20
  77. package/src/spyne/channels/lifestream-payload.js +0 -56
  78. package/src/spyne/utils/channel-data-packet-generator.js +0 -200
  79. package/src/spyne/utils/channel-data-packet.js +0 -59
  80. package/src/spyne/utils/viewstream-dom-utils.js +0 -51
  81. package/src/spyne/views/view-stream-enhancer-loader.js +0 -70
@@ -1,20 +1,24 @@
1
- import {SpyneApp, ViewStream, DomElement} from './spyne';
2
- import {prop, path, is, pathSatisfies} from 'ramda';
1
+ import {SpyneApp, DomElement, SpyneAppProperties} from './spyne';
2
+ import {is, clone, pathSatisfies} from 'ramda';
3
3
  export class SpynePlugin {
4
4
 
5
5
  constructor(props={}) {
6
6
  let {name, config, parentEl} = props;
7
7
  this.props = props;
8
8
 
9
+
10
+ if (config===undefined){
11
+ config = clone(props);
12
+ }
13
+
9
14
  this.name = name || 'empty';
10
15
  this.props.name = name;
11
16
  config = SpynePlugin.mergeDefaultConfig(config, this.defaultConfig());
12
17
  this.props.parentEl = parentEl || SpynePlugin.createParentEl();
13
- this.props.spyneApp = SpynePlugin.getSpyneApp(name, config);
14
- console.log("SPYNE APP ",{name},this.name,this.props.spyneApp);
15
- if (this.props.spyneApp===false){
16
- //console.warn(`Spyne Warning: Spyne Plugin, ${this.name} already exists!`)
17
- return false;
18
+ SpynePlugin.getSpyneApp(name, config);
19
+
20
+ if (this.props.traits!==undefined){
21
+ this.addTraits(this.props.traits);
18
22
  }
19
23
 
20
24
  this.onBeforeRegistered();
@@ -22,49 +26,21 @@ export class SpynePlugin {
22
26
  this.onRender();
23
27
  }
24
28
 
25
- onBeforeRegistered(){
26
- this.props.pluginName = this.props.name;
27
- this.props.config = path(['Spyne', 'config', 'plugins', this.props.name], window);
28
-
29
- }
30
-
31
29
  static mergeDefaultConfig(config={}, defaultConfig=this.defaultConfig()){
32
30
  return Object.assign(defaultConfig, config);
33
31
  }
34
32
 
35
-
36
- defaultConfig(){
37
-
38
- return {
39
-
40
-
41
- }
42
-
43
- }
44
-
45
-
46
-
47
33
  static getSpyneApp(name, config){
48
- const win = window || {};
49
- let spyneApp = prop('Spyne', win) ;
50
- const spyneInitialized = typeof(spyneApp) === 'object';
51
- //console.log('spyne app is ',{spyneApp, spyneInitialized}, typeof(spyneApp));
52
-
53
- spyneApp = spyneInitialized === true ? spyneApp : new spyneApp();
54
-
55
- const updateConfig = SpynePlugin.updateSpyneConfig(spyneApp, name, config);
34
+ if(SpyneAppProperties.initialized===false){
35
+ SpyneApp.init()
36
+ }
56
37
 
57
- if(updateConfig===false){
58
- return false;
59
- }
38
+ SpyneAppProperties.addPluginConfig(name, config);
60
39
 
61
- // spyneApp.config.plugins[name] = config;
62
- return spyneApp;
63
40
  }
64
41
 
65
42
  static updateSpyneConfig(spyneApp, pluginName, pluginConfig){
66
43
  const pathExists = pathSatisfies(is(Object), ['config', 'plugins', pluginName])(spyneApp);
67
- // console.log('path exists ',{pathExists}, spyneApp.config.plugins[pluginName])
68
44
 
69
45
  if (pathExists===true){
70
46
  if (spyneApp.config.debug===true) {
@@ -87,7 +63,7 @@ export class SpynePlugin {
87
63
  });
88
64
  document.body.appendChild(pluginEl.render());
89
65
  const el = document.getElementById('spyne-plugins')
90
- el.style.cssText="position:absolute; top:0;left:0;width:100%;height:100%;min-height:100vh; pointer-events:none";
66
+ el.style.cssText="position:absolute; top:0;left:0;width:100%;height:100%;min-height:100vh;z-index:1000000; pointer-events:none";
91
67
  return el;
92
68
  }
93
69
  return pluginEl || createPluginEl();
@@ -96,6 +72,32 @@ export class SpynePlugin {
96
72
  return el || createPluginParentEl();
97
73
  }
98
74
 
75
+ addTraits(traits){
76
+ if (traits.constructor.name!=='Array'){
77
+ traits = [traits];
78
+ }
79
+ const addTrait=(TraitClass)=>{
80
+ return new TraitClass(this);
81
+ };
82
+
83
+ traits.forEach(addTrait);
84
+
85
+ }
86
+
87
+ onBeforeRegistered(){
88
+ this.props.pluginName = this.props.name;
89
+ this.props.config = SpyneAppProperties.getPluginConfigByPluginName(this.props.pluginName);
90
+ }
91
+
92
+ defaultConfig(){
93
+
94
+ return {
95
+
96
+
97
+ }
98
+
99
+ }
100
+
99
101
  onRegistered(){
100
102
 
101
103
 
@@ -109,3 +111,4 @@ export class SpynePlugin {
109
111
 
110
112
 
111
113
  }
114
+
@@ -1,6 +1,5 @@
1
- import { ChannelsDelegator } from './channels/channels-delegator';
2
- import { ChannelDataPacketGenerator } from './utils/channel-data-packet-generator';
3
- import { DomElement, DomEl } from './views/dom-element';
1
+ import { ChannelsMap } from './channels/channels-map';
2
+ import { DomElement } from './views/dom-element';
4
3
  import {DomElementTemplate} from './views/dom-element-template';
5
4
  import { ViewStreamElement } from './views/view-stream-element';
6
5
  import { ViewStreamSelector} from './views/view-stream-selector';
@@ -13,178 +12,28 @@ import { ChannelFetch } from './channels/channel-fetch-class';
13
12
  import {ChannelFetchUtil} from './utils/channel-fetch-util';
14
13
  import { ChannelPayload } from './channels/channel-payload-class';
15
14
  import {ChannelPayloadFilter} from './utils/channel-payload-filter';
16
- import {SpyneUtilsChannelRoute} from './utils/spyne-utils-channel-route';
17
15
  import {SpynePlugin} from './spyne-plugins';
18
16
  import { deepMerge } from './utils/deep-merge';
17
+ import {SpyneAppProperties} from './utils/spyne-app-properties';
18
+ import {SpyneApp} from './spyne-app';
19
19
 
20
- class SpyneApp {
21
- /**
22
- *
23
- * SpyneApp creates the global Spyne object, and creates the following items
24
- * <ul>
25
- *
26
- * <li>LINK['ChannelsDelegator', 'channels-controller'] that directs the flow of data to all Channels</li>
27
- * <li>LINK['SpyneChannelUI', 'spyne-channel-u-i'], that broadcast all user interaction events</li>
28
- * <li>LINK['SpyneChannelRoute', 'spyne-channel-route'], that broadcast window location changes and is the only other channel that can be bound to user events</li>
29
- * <li>LINK['SpyneChannelWindow', 'spyne-channel-window'], that broadcast all requested window and document events, such as scrolling, resizing and media queries</li>
30
- * <li>LINK['SpyneChannelLifecycle', 'spyne-channel-lifecycle'], that broadcasts rendering and removing of ViewStream elements that have been directed to broadcast their lifecycle events</li>
31
- * </ul>
32
- *
33
- *
34
- * @module SpyneApp
35
- * @type core
36
- *
37
- * @constructor
38
- * @param {Object} config
39
- * @property {Object} config - = {}; This global config object is mainly used to provide configuration details for two SpyneChannels, CHANNEL_ROUTE and CHANNEL_WINDOW.
40
- */
41
- constructor(config = {}) {
42
- this.channels = new ChannelsDelegator();
43
- this.VERSION = '0.16.0';
44
- /*!
45
- * Spyne 0.16.0
46
- * https://spynejs.org
47
- *
48
- * @license Copyright 2017-2020, Frank Batista, Relevant Context, LLC. All rights reserved.
49
- * Spyne is licensed under the GNU Lesser General Public License v3.0
50
- *
51
- * @author: Frank Batista,
52
- * @email: frbatista.nyc@gmail.com
53
- */
54
- /* eslint-disable */
55
- this.ViewStream = ViewStream;
56
- this.BasicView = ViewStreamElement;
57
- this.DomEl = DomElement;
58
- this.ViewStreamBroadcaster = ViewStreamBroadcaster;
59
- this.ChannelsPayload = ViewStreamPayload;
60
- this.ChannelsController = ChannelsDelegator;
61
- this.ChannelsBase = Channel;
62
- this.ChannelPayloadItem = ChannelPayload;
63
- this._channelDataPacketGenerator = new ChannelDataPacketGenerator();
64
- window.Spyne = this;
65
- let defaultConfig = {
66
- scrollLock: false,
67
- scrollLockX: 31,
68
- scrollLockY: 0,
69
- debug: false,
70
- utils: {
71
- tableRE: /^([^>]*?)(<){1}(\b)(thead|col|colgroup|tbody|td|tfoot|tr|th)(\b)([^\0]*)$/
72
- },
73
- tmp:{
74
-
75
- },
76
- plugins:{
77
-
78
- },
79
- channels: {
80
- WINDOW: {
81
- mediqQueries: {
82
-
83
- },
84
- events: [],
85
- listenForResize: true,
86
- listenForOrientation: true,
87
- listenForScroll: false,
88
- listenForMouseWheel: false,
89
- debounceMSTimeForResize: 200,
90
- debounceMSTimeForScroll: 150
91
- },
92
-
93
- ROUTE: {
94
- type: 'slash',
95
- isHash: false,
96
- isHidden: false,
97
- add404s: false,
98
- routes: {
99
- 'routePath' : {
100
- 'routeName' : 'change'
101
- }
102
- }
103
-
104
- },
105
-
106
- CHANNEL_ROUTE: {},
107
- CHANNEL_UI: {},
108
- }
109
- };
110
- if (config !== undefined) {
111
- config = SpyneUtilsChannelRoute.conformRouteObject(config);
112
- window.Spyne['config'] = deepMerge(defaultConfig, config)
113
- }
114
-
115
-
116
-
117
- this.getChannelActions = (str) => window.Spyne.channels.getChannelActions(str);
118
- this.registerChannel = (val) => this.channels.registerStream(val);
119
- this.registerDataChannel = (obs$) => this.channels.registerStream(obs$);
120
- this.listChannels = () => Array.from(window.Spyne.channels.map.keys());
121
- let nullHolder = new ViewStream({ id:'spyne-null-views' });
122
- nullHolder.appendToDom(document.body);
123
- nullHolder.props.el.style.cssText = 'display:none; opacity:0; pointer-events:none;';
124
- this.channels.init();
125
- }
126
-
127
-
128
- get createDataPacket(){
129
- return this._channelDataPacketGenerator.createDataPacket;
130
- }
131
-
132
- /**
133
- * This is mostly used for debugging purposes
134
- *
135
- * @example
136
- * TITLE['<h4>Listing the registereed Channels in the browser console</h4>']
137
- * SpyneApp.listChannels();
138
- *
139
- * @returns A list of all registered channels
140
- */
141
- static listChannels() {
142
- return Array.from(window.Spyne.channels.map.keys());
143
- }
144
-
145
- /**
146
- * This method is useful to check in the console or in the code what actions are available to be listened to.
147
- * @param {String} str
148
- * @returns {Array} An array of Actions that can be listened to
149
- */
150
- static getChannelActions(str) {
151
- return window.Spyne.channels.getChannelActions(str);
152
- }
153
-
154
- /**
155
- *
156
- * This method will add the channel to the registered list so that it can subscribed by all ViewStream and Channel instances.
157
- * @param {Channel} c
158
- *
159
- *
160
- */
161
- static registerChannel(c) {
162
- if (window.Spyne === undefined) {
163
- console.warn('Spyne has not been initialized');
164
- } else {
165
- return window.Spyne.channels.registerStream(c);
166
- }
167
- }
168
- }
169
-
170
- window['Spyne'] = SpyneApp;
171
20
  export {
172
21
  ViewStreamElement,
173
22
  Channel,
174
23
  ChannelFetch,
175
24
  ChannelFetchUtil,
176
- ChannelsDelegator,
25
+ ChannelsMap,
177
26
  ViewStreamPayload,
178
27
  ChannelPayload,
179
28
  ChannelPayloadFilter,
180
29
  DomElement,
181
- DomEl,
182
30
  DomElementTemplate,
183
31
  ViewStream,
184
32
  ViewStreamSelector,
185
33
  ViewStreamBroadcaster,
186
34
  SpyneTrait,
187
35
  SpyneApp,
36
+ SpyneAppProperties,
188
37
  SpynePlugin,
189
38
  deepMerge
190
39
  };
@@ -1,6 +1,5 @@
1
1
  import Validation from 'data.validation';
2
2
  import {curry, curryN, length, always, reduce} from 'ramda';
3
- // import { curry, curryN, reduce, length, always } from 'ramda';
4
3
  const success = Validation.Success;
5
4
  const failure = Validation.Failure;
6
5
  let validate = () => {};
@@ -2,7 +2,6 @@ import { from } from 'rxjs';
2
2
  import { flatMap, map, publish, tap } from 'rxjs/operators';
3
3
  import {compose, prop, defaultTo, over, lensProp, has, propEq, when, propIs, allPass, assoc, pick, mergeDeepRight} from 'ramda';
4
4
  export class ChannelFetchUtil {
5
- // METHOD GET POST PUT PATCH DELETE
6
5
  /**
7
6
  * @module ChannelFetchUtil
8
7
  * @type util
@@ -49,7 +48,7 @@ export class ChannelFetchUtil {
49
48
 
50
49
 
51
50
  constructor(options, subscriber, testMode) {
52
- // console.log('url ',url,options);
51
+
53
52
  const testSubscriber = (p) => console.log('FETCH RETURNED ', p);
54
53
 
55
54
  this._mapFn = ChannelFetchUtil.setMapFn(options);
@@ -1,14 +1,9 @@
1
1
  import {
2
2
  is,
3
3
  reject,
4
- ifElse,
5
- invoker,
6
- identity,
7
- assoc,
8
4
  isNil,
9
- find,
5
+ find,
10
6
  allPass,
11
- tap,
12
7
  forEachObjIndexed,
13
8
  not,
14
9
  isEmpty,
@@ -19,17 +14,15 @@ import {
19
14
  where,
20
15
  defaultTo,
21
16
  mergeAll,
22
- __,
23
17
  omit,
24
- path,
25
- call,
26
- clone,
27
18
  flatten,
28
19
  any,
29
- type,
30
20
  curry,
31
- mergeRight, lte,
21
+ lte
32
22
  } from 'ramda';
23
+
24
+ import {SpyneAppProperties} from './spyne-app-properties';
25
+
33
26
  const rMap = require('ramda').map;
34
27
 
35
28
  const isNotArr = compose(not, is(Array));
@@ -122,8 +115,6 @@ export class ChannelPayloadFilter {
122
115
 
123
116
  const debugLabelArr = [debugLabel, prop('debugLabel', filters)]
124
117
 
125
- const makeBool = b => Boolean(b);
126
-
127
118
  debugLabel = compose(find(is(String)))(debugLabelArr);
128
119
 
129
120
  let props = omit(['debugLabel', 'label', 'selector', 'props', 'testMode', 'propFilters'], filters)
@@ -137,22 +128,13 @@ export class ChannelPayloadFilter {
137
128
  filters['propFilters'] = props;
138
129
 
139
130
  let {propFilters} = filters;
140
- //console.log("selector filters ", {selector, filters})
141
131
 
142
- // let {selector,propFilters,debugLabel} = filters;
143
132
 
144
133
  const addStringSelectorFilter = isNonEmptyStr(selector) ? ChannelPayloadFilter.filterSelector([selector], debugLabel) : undefined;
145
134
  const addArraySelectorFilter = isNonEmptyArr(selector) ? ChannelPayloadFilter.filterSelector(selector, debugLabel) : undefined;
146
-
147
-
148
135
  const addDataFilter = isNonEmptyObjectFn(propFilters) ? ChannelPayloadFilter.filterData(propFilters, debugLabel) : undefined;
149
136
 
150
- //console.log("IS STRING ",{selector, addStringSelectorFilter, addArraySelectorFilter, addDataFilter},isNonEmptyStr(selector))
151
-
152
-
153
-
154
137
  let filtersArr = reject(isNil, [addStringSelectorFilter, addArraySelectorFilter, addDataFilter]);
155
- // console.log('filtersArr is ',{selector})
156
138
 
157
139
  // IF ARRAY IS EMPTY ALWAYS RETURN FALSE;
158
140
 
@@ -160,15 +142,12 @@ export class ChannelPayloadFilter {
160
142
 
161
143
  if (filtersAreEmpty){
162
144
  filtersArr = [always(false)];
163
- if (path(['Spyne', 'config', 'debug'], window) === true && testMode!==true){
145
+ if (SpyneAppProperties.debug === true && testMode!==true){
164
146
  console.warn(`Spyne Warning: The Channel Filter, with selector: ${selector}, and propFilters:${propFilters} appears to be empty!`);
165
147
  }
166
148
 
167
149
  }
168
-
169
-
170
- //console.log(" VALUES OF FILTERS ",{selector,propFilters,filters,debugLabel,testMode, filtersAreEmpty});
171
- if (testMode === true){
150
+ if (testMode === true){
172
151
  return {selector, propFilters, debugLabel, filters, testMode, filtersAreEmpty};
173
152
  }
174
153
 
@@ -178,40 +157,21 @@ export class ChannelPayloadFilter {
178
157
  static filterData(filterJson, filterdebugLabel) {
179
158
  const debugLabel = filterdebugLabel;
180
159
 
181
- //console.log('filter data is ',{filterJson, debugLabel})
182
160
  let compareData = () => {
183
161
  // DO NOT ALLOW AN EMPTY OBJECT TO RETURN TRUEs
184
162
  if (isEmpty(filterJson)) {
185
163
  return always(false);
186
164
  }
187
165
 
188
- //console.log("FILTER JSON ",filterJson);
189
166
  // CHECKS ALL VALUES IN JSON TO DETERMINE IF THERE ARE FILTERING METHODS
190
167
 
191
- //let typeArrFn = compose(values, rMap(type));
192
-
193
- /*let sendMalFormedWarningBool = uniq(filterValsArr).length > 1;
194
- if (sendMalFormedWarningBool === true) {
195
- console.warn('Spyne Warningd: The data values in ChannelActionFilters needs to be either all methods or all static values. DATA: ', filterJson);
196
- }*/
197
-
198
168
  const createCurryComparator = compareStr => (str)=>{
199
169
  return str===compareStr;
200
170
  };
201
171
  const checkToConvertToFn = (val, key, obj)=>val = is(String, val)===true ? createCurryComparator(val) : val;
202
172
  filterJson = rMap(checkToConvertToFn, filterJson);
203
173
 
204
- // console.log("FILTER JSON: ",{filterJson, newJson});
205
- //const isAllMethods = all(equals('Function'), filterValsArr);
206
-
207
- // PULL OUT THE CHANNEL PAYLOAD OBJECT IN THE MAIN PAYLOAD
208
- // let payload = prop('channelPayload', eventData)
209
-
210
- // IF THERE ARE METHODS IN THE FILTERING JSON, THEN USE where or whereEq if Basic JSON
211
- // let fMethod = isAllMethods === true ? where(filterJson) : whereEq(filterJson);
212
-
213
174
  // TAP LOGGER
214
-
215
175
  const tapLogger = (comparedObj)=>{
216
176
  if (debugLabel===undefined){
217
177
  return comparedObj;
@@ -225,13 +185,11 @@ export class ChannelPayloadFilter {
225
185
  };
226
186
 
227
187
  // END TAP LOGGER
228
-
229
188
  let fMethod = where(filterJson);
230
189
 
231
190
  let getFilteringObj = (v)=>{
232
191
  const {payload, srcElement, event} = v || {};
233
- const o = Object.assign({}, v, event,srcElement, payload);
234
-
192
+ const o = Object.assign({}, v, event, payload);
235
193
  //console.log('o is ',o);
236
194
  return o;
237
195
  }
@@ -240,29 +198,20 @@ export class ChannelPayloadFilter {
240
198
  return compose( fMethod, tapLogger, defaultTo({}), getFilteringObj);
241
199
 
242
200
  };
243
- // const filterLabel = `filtering-${Math.floor(Math.random()*999999)}`;
244
- //console.time(filterLabel);
245
- // const val = compareData();
246
201
 
247
- //console.timeEnd(filterLabel);
248
- //return val;
249
202
  return compareData();
250
203
  }
251
204
 
252
205
 
253
206
  static checkPayloadSelector(arr, debugLabel, srcPayload) {
254
- // ELEMENT FROM PAYLOADs
255
-
256
207
 
208
+ // ELEMENT FROM PAYLOADs
257
209
  const {payload, srcElement, event} = srcPayload || {};
258
- //console.log('payload before ',{srcPayload, payload, srcElement, event})
259
210
 
260
211
  const reduceFindEl = (acc, src) => {
261
212
  const el = prop('el', src);
262
- //console.log("EL IS ",{el, src, acc})
263
213
  if (ChannelPayloadFilter.elIsDomElement(el) && acc===undefined){
264
214
  acc = el;
265
- // return acc;
266
215
  }
267
216
  return acc;
268
217
  }
@@ -270,19 +219,6 @@ export class ChannelPayloadFilter {
270
219
  const el = [srcElement, payload, prop('srcElement', event), srcPayload].reduce(reduceFindEl, undefined);
271
220
 
272
221
 
273
- //console.log('el check ',{debugLabel, srcElement, payload, event, el})
274
-
275
- //const o = Object.assign({}, srcPayload, event,srcElement, payload);
276
-
277
- //console.log('o is ',o);
278
-
279
-
280
- //let payloadIsNotProps = compose(equals('Function'),type, prop('props') )(payload);
281
- //payload = payloadIsNotProps === true ? payload.payload : payload;
282
- // console.log('payload after ',{o})
283
-
284
- // let el = path(['el'], o);
285
-
286
222
  // RETURN BOOLEAN MATCH WITH PAYLOAD EL
287
223
  const compareEls = (elCompare) => elCompare.isEqualNode((el));
288
224
 
@@ -297,10 +233,7 @@ export class ChannelPayloadFilter {
297
233
  if (debugLabel!==undefined){
298
234
  let nodeArrResultsDebugger = compose(flatten, rMap(mapNodeArrWithEl))(arr);
299
235
  const selectorsArr = arr;
300
-
301
236
  console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${debugLabel}"] - selectors: `, "color:orange;",{el, selectorsArr, nodeArrResultsDebugger});
302
-
303
-
304
237
  }
305
238
 
306
239
  // CHECK IF PAYLOAD EL EXISTS
@@ -6,6 +6,26 @@ const isIOS = () => {
6
6
  return ios === true;
7
7
  };
8
8
 
9
+
10
+ const delayCall = async(fn, time)=>{
11
+
12
+ function sleep (ms) {
13
+ return new Promise(resolve => setTimeout(resolve, ms))
14
+ }
15
+
16
+ const timeoutHandler = async() => {
17
+ await sleep(1);
18
+ window.requestAnimationFrame(fn);
19
+ }
20
+
21
+ window.setTimeout(timeoutHandler, time)
22
+
23
+
24
+ }
25
+
26
+
27
+
28
+
9
29
  const getConstructorName = (obj) => {
10
30
  if (obj.constructor.name !== undefined) {
11
31
  return obj.constructor.name;
@@ -142,4 +162,4 @@ const pullParams = (str) => str.replace(routeRE, '$4');
142
162
  const pullTranslateX = str => str.replace(/^(matrix)(.*\d*,)(.*\d*,)(.*\d*,)(.*\d*,)(.*\d*)(,.*)/, '$6');
143
163
  const pullTranslateY = str => str.replace(/^(matrix)(.*\d*,)(.*\d*,)(.*\d*,)(.*\d*,)(.*\d*,)(.*\d)(.*)/, '$7');
144
164
  const pullTranslateYFromHeader = str => str.replace(/^(transform: matrix)(.*\d*,)(.*\d*,)(.*\d*,)(.*\d*,)(.*\d*)(\).*;)/, '$6');
145
- export { getConstructorName, arrFromMapKeys, getAllMethodNames, findStrOrRegexMatchStr, findStrFromRegexArr, checkIfObjIsNotEmptyOrNil, isIOS, pullRouteInfo, pullTranslateYFromHeader, pullSlashFromPath, pullHashAndSlashFromPath, closest, pullTranslateY, pullTranslateX, pullMainRoute, pullParams, right, left, fromNullable, findInObj, ifNilThenUpdate, removeSlashes, subscribeFn, convertDomStringMapToObj };
165
+ export { getConstructorName, arrFromMapKeys, getAllMethodNames, findStrOrRegexMatchStr, findStrFromRegexArr, checkIfObjIsNotEmptyOrNil, isIOS, pullRouteInfo, pullTranslateYFromHeader, pullSlashFromPath, pullHashAndSlashFromPath, closest, pullTranslateY, pullTranslateX, pullMainRoute, pullParams, right, left, fromNullable, findInObj, ifNilThenUpdate, removeSlashes, subscribeFn, convertDomStringMapToObj, delayCall };
@@ -1,7 +1,7 @@
1
1
  import {forEach} from 'ramda';
2
2
  export function gc() {
3
3
  let cleanup = () => {
4
- let loopM = m => void 0;
4
+ let loopM = m => undefined;
5
5
  forEach(loopM, this);
6
6
  };
7
7
  setTimeout(cleanup, 1);
@@ -7,10 +7,7 @@ export class RouteChannelUpdater{
7
7
  let id = `${name}_ROUTE_UPDATER`;
8
8
 
9
9
  const sendRouteChannelUpdate = curry(RouteChannelUpdater.createTemporaryViewStreamObj);
10
-
11
10
  return sendRouteChannelUpdate({id,name});
12
-
13
- //RouteChannelUpdater.createTemporaryViewStreamObj({name,id});
14
11
  }
15
12
 
16
13
 
@@ -30,7 +27,6 @@ export class RouteChannelUpdater{
30
27
  };
31
28
 
32
29
  vs.appendToNull();
33
- //console.log("VIEWSTREAM IS ",{vs, name,id,payload});
34
30
 
35
31
  }
36
32