@gudhub/core 1.1.19 → 1.1.21
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.
|
@@ -110,14 +110,15 @@ export class PipeService {
|
|
|
110
110
|
emit(types, destination, value, params) {
|
|
111
111
|
types.split(" ").forEach((type) => {
|
|
112
112
|
const listenerName = type + ":" + createId(destination);
|
|
113
|
+
let toBeRemovedState = false;
|
|
113
114
|
|
|
114
115
|
if (this.subscribers[listenerName]) {
|
|
115
116
|
|
|
116
117
|
// if subscribers list is empty we put message to messageBox
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
if (this.subscribers[listenerName].size == 0){
|
|
119
|
+
this.messageBox[listenerName] = [types, destination, value, params, toBeRemovedState];
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
121
122
|
|
|
122
123
|
// sending messege to subscribers
|
|
123
124
|
this.subscribers[listenerName].forEach(function (fn) {
|
|
@@ -126,7 +127,7 @@ export class PipeService {
|
|
|
126
127
|
|
|
127
128
|
}else {
|
|
128
129
|
// if there no subscribers list we put message to messageBox
|
|
129
|
-
this.messageBox[listenerName] = [types, destination, value, params];
|
|
130
|
+
this.messageBox[listenerName] = [types, destination, value, params, toBeRemovedState];
|
|
130
131
|
}
|
|
131
132
|
});
|
|
132
133
|
return this;
|
|
@@ -182,6 +183,7 @@ export class PipeService {
|
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
|
|
186
|
+
|
|
185
187
|
//============================== MESSAGE BOX ====================================//
|
|
186
188
|
/*---------------------------------------------------------------------------------
|
|
187
189
|
| If emitting event started erlier then subscriber apears then we save it to the MessageBox
|
|
@@ -189,12 +191,34 @@ export class PipeService {
|
|
|
189
191
|
|
|
|
190
192
|
|---------------------------------------------------------------------------------*/
|
|
191
193
|
|
|
192
|
-
|
|
194
|
+
checkMessageBox(listenerName) {
|
|
195
|
+
|
|
196
|
+
//Here we delete all messages those are marked as "to be removed"
|
|
197
|
+
this.cleanMesssageBox();
|
|
198
|
+
|
|
193
199
|
if (this.messageBox[listenerName]) {
|
|
194
|
-
this.emit(...this.messageBox[listenerName]);
|
|
195
200
|
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
//-- Emiting messages from the MessageBox
|
|
202
|
+
//We use timeout to emit message after subscriber is created
|
|
203
|
+
setTimeout(() => {
|
|
204
|
+
this.emit(...this.messageBox[listenerName]);
|
|
205
|
+
|
|
206
|
+
//we mark message after it was readed as "to be removed" to remove it in next itration
|
|
207
|
+
this.messageBox[listenerName][4] = true;
|
|
208
|
+
}, 0);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
/*-------- CLEAN MESSAGE BOX -----------*/
|
|
214
|
+
// This method delete all messages those are marked as "to be deleted"
|
|
215
|
+
// The thing is that we can't remove message in the same iteration that is wy we mark them as "to be removed
|
|
216
|
+
// and then will remove them in the second iteration just before checking the MessageBox
|
|
217
|
+
cleanMesssageBox(){
|
|
218
|
+
for (let listenerName in this.messageBox) {
|
|
219
|
+
if(this.messageBox[listenerName][4]){
|
|
220
|
+
delete this.messageBox[listenerName];
|
|
221
|
+
}
|
|
198
222
|
}
|
|
199
223
|
}
|
|
200
224
|
}
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -102,7 +102,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
|
|
|
102
102
|
},{"axios":"O4Aa","./utils.js":"EgeI","qs":"hIRQ"}],"Lc8J":[function(require,module,exports) {
|
|
103
103
|
"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(e)}function e(o){var e="";for(var t in o)o.hasOwnProperty(t)&&o[t]&&(e+="."+o[t]);return e?e.substring(1):"any"}function t(e,t,n){return null==e||"string"!=typeof e?(console.log("Listener type is \"undefined\" or not have actual 'type' for subscribe"),!1):null==t||"object"!==o(t)?(console.log("Listener destination is \"undefined\" or not have actual 'type' for subscribe"),!1):"function"==typeof n||(console.log("Listener is not a function for subscribe!"),!1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkParams=t,exports.createId=e;
|
|
104
104
|
},{}],"E3xI":[function(require,module,exports) {
|
|
105
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PipeService=void 0;var e=require("./utils.js");function r(e){return
|
|
105
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PipeService=void 0;var e=require("./utils.js");function r(e){return i(e)||s(e)||n(e)||t()}function t(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,r){if(e){if("string"==typeof e)return o(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,r):void 0}}function s(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return o(e)}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,r,t){return r&&u(e.prototype,r),t&&u(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var l=function(){function t(){a(this,t),this.subscribers={},this.messageBox={}}return c(t,[{key:"on",value:function(r,t,n){var s=this;return(0,e.checkParams)(r,t,n)&&r.split(" ").map(function(r){return r+":"+(0,e.createId)(t)}).forEach(function(e){s.subscribers[e]||(s.subscribers[e]=new Set),s.subscribers[e].add(n),s.checkMessageBox(e)}),this}},{key:"emit",value:function(r,t,n,s){var i=this;return r.split(" ").forEach(function(o){var a=o+":"+(0,e.createId)(t);if(i.subscribers[a]){if(0==i.subscribers[a].size)return i.messageBox[a]=[r,t,n,s,!1],i;i.subscribers[a].forEach(function(e){e(null,n,s)})}else i.messageBox[a]=[r,t,n,s,!1]}),this}},{key:"onRoot",value:function(e,r,t){return this.on(e,r,t)}},{key:"destroy",value:function(r,t,n){var s=this;return r.split(" ").forEach(function(r){var i=r+":"+(0,e.createId)(t);s.subscribers[i]&&n&&s.subscribers[i].delete(n),s.subscribers[i]&&!n&&delete s.subscribers[i]}),this}},{key:"checkMessageBox",value:function(e){var t=this;this.cleanMesssageBox(),this.messageBox[e]&&setTimeout(function(){t.emit.apply(t,r(t.messageBox[e])),t.messageBox[e][4]=!0},0)}},{key:"cleanMesssageBox",value:function(){for(var e in this.messageBox)this.messageBox[e][4]&&delete this.messageBox[e]}}]),t}();exports.PipeService=l;
|
|
106
106
|
},{"./utils.js":"Lc8J"}],"FJWL":[function(require,module,exports) {
|
|
107
107
|
"use strict";function a(a,e){return[{name:"text",url:e+"/"+a+"text_data.js",type:"angular"},{name:"text_opt",url:e+"/"+a+"text_options_data.js",type:"angular"},{name:"number",url:e+"/"+a+"number_data.js",type:"angular"},{name:"task_board",url:e+"/"+a+"task_board_data.js",type:"angular"},{name:"visualizer",url:e+"/"+a+"visualizer_data.js",type:"angular"},{name:"enterprice_visualizer",url:e+"/"+a+"enterprice_visualizer_data.js",type:"angular"},{name:"email",url:e+"/"+a+"email_data.js",type:"angular"},{name:"date",url:e+"/"+a+"date_data.js",type:"angular"},{name:"radio_button",url:e+"/"+a+"radio_button_data.js",type:"angular"},{name:"radio_icon",url:e+"/"+a+"radio_icon_data.js",type:"angular"},{name:"twilio_phone",url:e+"/"+a+"twilio_phone_data.js",type:"angular"},{name:"twilio_autodialer",url:e+"/"+a+"twillio_autodialer_data.js",type:"angular"},{name:"color",url:e+"/"+a+"color_data.js",type:"angular"},{name:"charts",url:e+"/"+a+"charts_data.js",type:"angular"},{name:"funnel_chart",url:e+"/"+a+"funnel_chart_data.js",type:"angular"},{name:"add_items_from_template",url:e+"/"+a+"add_items_from_template_data.js",type:"angular"},{name:"item_ref",url:e+"/"+a+"itemRef_data.js",type:"angular"},{name:"calendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"class"},{name:"data_ref",url:e+"/"+a+"data_ref_data.js",type:"angular"},{name:"table",url:e+"/"+a+"table_data.js",type:"angular"},{name:"tile",url:e+"/"+a+"tile_data.js",type:"angular"},{name:"file",url:e+"/"+a+"file_data.js",type:"angular"},{name:"image",url:e+"/"+a+"image_data.js",type:"angular"},{name:"text_editor",url:e+"/"+a+"text_editor_data.js",type:"angular"},{name:"tinymse",url:e+"/"+a+"tinymse_data.js",type:"angular"},{name:"duration",url:e+"/"+a+"duration_data.js",type:"angular"},{name:"user",url:e+"/"+a+"user_data.js",type:"angular"},{name:"app",url:e+"/"+a+"application_data.js",type:"angular"},{name:"field",url:e+"/"+a+"field_data.js",type:"angular"},{name:"available",url:e+"/"+a+"available_data.js",type:"angular"},{name:"view_list",url:e+"/"+a+"view_list_data.js",type:"angular"},{name:"calculator",url:e+"/"+a+"calculator_data.js",type:"angular"},{name:"string_join",url:e+"/"+a+"string_joiner_data.js",type:"angular"},{name:"signature",url:e+"/"+a+"signature_data.js",type:"angular"},{name:"sendEmail",url:e+"/"+a+"send_email_data.js",type:"angular"},{name:"boolean",url:e+"/"+a+"boolean_data.js",type:"angular"},{name:"product_gallery",url:e+"/"+a+"product_gallery_data.js",type:"angular"},{name:"online_inventory",url:e+"/"+a+"online_inventory_data.js",type:"angular"},{name:"3d_edges",url:e+"/"+a+"3d_edges_data.js",type:"angular"},{name:"color_list",url:e+"/"+a+"color_list_data.js",type:"angular"},{name:"go_to_link",url:e+"/"+a+"go_to_link_data.js",type:"angular"},{name:"go_to_view",url:e+"/"+a+"go_to_view_data.js",type:"angular"},{name:"range",url:e+"/"+a+"range_data.js",type:"angular"},{name:"barcode",url:e+"/"+a+"barcode_data.js",type:"angular"},{name:"item_remote_add",url:e+"/"+a+"item_remote_add_data.js",type:"angular"},{name:"item_remote_update",url:e+"/"+a+"item_remote_update_data.js",type:"angular"},{name:"timeline",url:e+"/"+a+"timeline_data.js",type:"angular"},{name:"delete_item",url:e+"/"+a+"delete_action.js",type:"angular"},{name:"print_doc",url:e+"/"+a+"print_doc_action.js",type:"angular"},{name:"open_item",url:e+"/"+a+"open_item_action.js",type:"angular"},{name:"edit_template",url:e+"/"+a+"edit_template_action.js",type:"angular"},{name:"open_app",url:e+"/"+a+"open_app_action.js",type:"angular"},{name:"user_settings",url:e+"/"+a+"user_settings_action.js",type:"angular"},{name:"app_sharing",url:e+"/"+a+"sharing_action.js",type:"angular"},{name:"app_constructor",url:e+"/"+a+"app_constructor_action.js",type:"angular"},{name:"export_csv",url:e+"/"+a+"export_csv.js",type:"angular"},{name:"import_csv",url:e+"/"+a+"import_csv.js",type:"angular"},{name:"add_items",url:e+"/"+a+"add_items_action.js",type:"angular"},{name:"update_items",url:e+"/"+a+"update_items_action.js",type:"angular"},{name:"install_app",url:e+"/"+a+"install_app_action.js",type:"angular"},{name:"search_action",url:e+"/"+a+"search_action.js",type:"angular"},{name:"filter_table",url:e+"/"+a+"filter_table_action.js",type:"angular"},{name:"slider",url:e+"/"+a+"slider_data.js",type:"angular"},{name:"clone_item",url:e+"/"+a+"clone_item_action.js",type:"angular"},{name:"close",url:e+"/"+a+"close_action.js",type:"angular"},{name:"phone",url:e+"/"+a+"phone_data.js",type:"angular"},{name:"link",url:e+"/"+a+"link_data.js",type:"angular"},{name:"sheduling",url:e+"/"+a+"sheduling_data.js",type:"angular"},{name:"qrcode",url:e+"/"+a+"qrcode_data.js",type:"angular"},{name:"graph2d",url:e+"/"+a+"graph2d_data.js",type:"angular"},{name:"quote_tool",url:e+"/"+a+"quote_tool_data.js",type:"angular"},{name:"cards",url:e+"/"+a+"cards_data.js",type:"angular"},{name:"jsonConstructor",url:e+"/"+a+"json_constructor_data.js",type:"angular"},{name:"button",js:"https://gudhub.com/modules/button_action/button_action.js",type:"class"},{name:"editorjs",js:"https://gudhub.com/modules/Editor-Js/dist/main.js",css:"https://gudhub.com/modules/Editor-Js/dist/style.css",type:"class"},{name:"filter_advanced",url:e+"/"+a+"filter_advanced_data.js",type:"angular"},{name:"code_editor",url:e+"/"+a+"code_editor_data.js",type:"angular"},{name:"icon",url:e+"/"+a+"icon_data.js",type:"angular"},{name:"quoteRequest",url:e+"/"+a+"quote_request_data.js",type:"angular"},{name:"view_container",url:e+"/"+a+"view_container_data.js",type:"angular"},{name:"element_ref",url:e+"/"+a+"element_ref_data.js",type:"angular"},{name:"quote_tool_objects_renderer",url:e+"/"+a+"quote_tool_objects_renderer_data.js",type:"angular"},{name:"quote_tool_objects_renderer_generator",url:e+"/"+a+"quote_tool_objects_renderer_generator_data.js",type:"angular"},{name:"trigger",url:e+"/"+a+"trigger_data.js",type:"angular"},{name:"voting",url:e+"/"+a+"voting_data.js",type:"angular"},{name:"view_tabs",url:e+"/"+a+"view_tabs.js",type:"angular"},{name:"filter_tabs",url:e+"/"+a+"filter_tabs.js",type:"angular"},{name:"gps_coords",url:e+"/"+a+"gps_coords.js",type:"angular"},{name:"google_map",url:e+"/"+a+"google_map_data.js",type:"angular"},{name:"data_migrations",url:e+"/"+a+"data_migrations.js",type:"angular"},{name:"additional_settings",url:e+"/"+a+"gh_additional_settings_data.js",type:"angular"},{name:"send_request",url:e+"/"+a+"send_request_data.js",type:"angular"},{name:"webcam",url:e+"/"+a+"webcam_data.js",type:"angular"},{name:"json_viewer",url:e+"/"+a+"json_viewer_data.js",type:"angular"},{name:"notifications",url:e+"/"+a+"notifications_data.js",type:"angular"},{name:"api",url:e+"/"+a+"api_data.js",type:"angular"},{name:"smart_input",url:e+"/"+a+"smart_input_data.js",type:"angular"},{name:"json_editor",url:e+"/"+a+"json_editor_data.js",type:"angular"},{name:"grapes_html_editor",url:e+"/"+a+"grapes_html_editor_data.js",type:"angular"},{name:"quiz",url:e+"/"+a+"quiz_data.js",type:"angular"},{name:"markdown_viewer",url:e+"/"+a+"markdown_viewer_data.js",type:"angular"},{name:"password_input",url:e+"/"+a+"password_input_data.js",type:"angular"},{name:"vs_code",url:e+"/"+a+"vs_code_data.js",type:"angular"},{name:"nested_list",js:"https://gudhub.com/modules/Nested-List/dist/main.js",css:"https://gudhub.com/modules/Nested-List/dist/style.css",type:"class"},{name:"fullcalendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"class"},{name:"countertop_smart_quote",url:e+"/"+a+"countertop_smart_quote_data.js",type:"angular"},{name:"markdown_viewer_web_component",js:"https://gudhub.com/modules/markdown-it-gh-element/dist/main.js",css:"https://gudhub.com/modules/markdown-it-gh-element/dist/style.css",type:"class"}]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=a;
|
|
108
108
|
},{}],"CSHe":[function(require,module,exports) {
|