nx-lecom-helper 1.0.0 → 1.0.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.
- package/dist/nxLecom-helper.umd.js +8 -34
- package/package.json +1 -1
|
@@ -1,42 +1,16 @@
|
|
|
1
1
|
(function (global) {
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// Evita sobrescrever se já existir
|
|
5
|
+
if (global.LecomAlert) return;
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function init(options) {
|
|
9
|
-
options = options || {};
|
|
10
|
-
if (typeof options.debug === "boolean") _state.debug = options.debug;
|
|
11
|
-
log("init ok", { version: _state.version });
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function log(...args) {
|
|
15
|
-
if (_state.debug && global.console) console.log("[LecomHelper]", ...args);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function get(obj, path, defaultValue) {
|
|
19
|
-
if (!obj || !path) return defaultValue;
|
|
20
|
-
const parts = String(path).split(".");
|
|
21
|
-
let cur = obj;
|
|
22
|
-
for (const p of parts) {
|
|
23
|
-
if (cur && Object.prototype.hasOwnProperty.call(cur, p)) cur = cur[p];
|
|
24
|
-
else return defaultValue;
|
|
25
|
-
}
|
|
26
|
-
return cur ?? defaultValue;
|
|
7
|
+
function show(message) {
|
|
8
|
+
alert(message || "LecomAlert funcionando!");
|
|
27
9
|
}
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const api = Object.freeze({ init, get, gridContains, version: _state.version });
|
|
35
|
-
|
|
36
|
-
Object.defineProperty(global, "LecomHelper", {
|
|
37
|
-
value: api,
|
|
38
|
-
writable: false,
|
|
39
|
-
configurable: false
|
|
11
|
+
// API global mínima
|
|
12
|
+
global.LecomAlert = Object.freeze({
|
|
13
|
+
show
|
|
40
14
|
});
|
|
41
|
-
})(typeof window !== "undefined" ? window : this);
|
|
42
15
|
|
|
16
|
+
})(typeof window !== "undefined" ? window : this);
|