wowojs-cdn 1.0.0 → 1.2.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/wowo.min.js +1 -7
- package/package.json +1 -1
- package/wowo.js +3 -3
package/dist/wowo.min.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Wowojs v1.2.1
|
|
3
|
-
* @license MIT
|
|
4
|
-
* @author Devied Rahmadsyah
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
!function(){"use strict";function t(t,e){a({modul:"State: $antek2",detail:{nama:t,value:e}});const n=sessionStorage.getItem(t);let o=null;try{if(null!==n&&(o=JSON.parse(n)),"function"==typeof e){const a=e(o);return sessionStorage.setItem(t,JSON.stringify(a)),a}return 1===arguments.length?o:(sessionStorage.setItem(t,JSON.stringify(e)),e)}catch(r){if(console.error(`Gagal memproses JSON untuk "${t}", mereset data...`,r),arguments.length>1){const a="function"==typeof e?e(null):e;return sessionStorage.setItem(t,JSON.stringify(a)),a}return null}}function e(t){const e=document.querySelector(t);e&&"function"==typeof e.render?e.render():document.addEventListener("DOMContentLoaded",()=>{e&&e.render()},{once:!0})}function a({modul:t,detail:e,aktif:a=!1}){history.push({waktu:(new Date).toLocaleTimeString(),modul:t,detail:e}),a&&console.dir(history)}window.$BuatWilayah=function({namaWilayah:t,isiWilayah:e,style:n="",methods:o={},deskripsi:r}){a({modul:"Component: $BuatWilayah",detail:{namaWilayah:t,isiWilayah:e,style:n||"tidak ada",methods:o||"tidak ada",deskripsi:r||"tidak ada"}});const i=`wowo-${t.toLowerCase()}`;customElements.get(i)||customElements.define(i,class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}getProps(){const t={};for(let e of this.attributes)t[e.name]=e.value;return t}render(){const t=this.getProps(),a="function"==typeof e?e(t):e;let r=n?`<style>${n}</style>`:"";this.shadowRoot.innerHTML=a+r;this.shadowRoot.querySelectorAll("*").forEach(e=>{[...e.attributes].forEach(a=>{if(a.name.startsWith("@")){const n=a.name.slice(1),r=a.value.replace("()","");o[r]&&(e.addEventListener(n,e=>{o[r](e,t),this.render()}),e.removeAttribute(a.name))}})})}})},window.$antek2=t,window.$PecatAntek2=function(t){a({modul:"State: $PecatAntek2",detail:{nama:t}}),"string"==typeof t&&t.trim()||console.warn(`Nama tidak valid: ${t}`),null===sessionStorage.getItem(t)&&console.info(`Key "${t}" tidak ditemukan, tidak ada yang dihapus.`);try{sessionStorage.removeItem(t)}catch(e){console.error(`Gagal menghapus ${t}:`,e)}},window.$BangunEkonomi=function(t){a({modul:"Render: $BangunEkonomi",detail:t}),Array.isArray(t)?t.forEach(t=>{e(t)}):e(t)},window.$UrusKeuangan=function(t,e){a({modul:"Reducer: $UrusKeuangan",detail:[{reducer:t,action:e}]});try{return t(e)}catch(n){console.error(`terjadi error ${t} \n ${n}`)}},window.$CuriData=async function({data:e,state:n,request:o,reload:r=!1}){try{const i=await fetch(e,o);if(!i.ok)throw new Error(`Status: ${i.status}`);const s=await i.json();if(!s||"object"!=typeof s&&!Array.isArray(s))throw new Error(`Data ${e} bukan JSON kocak`);t(n,s),a({modul:"API: $CuriData",detail:{data:e,state:n}}),r&&location.reload()}catch(i){console.error(`Gagal curi data ${e}\n ${i}`)}},window.$Sejarah=a}();
|
|
1
|
+
!function(){"use strict";function t(t,e){n({modul:"State: $antek2",detail:{nama:t,value:e}});const a=sessionStorage.getItem(t);let o=null;try{if(null!==a&&(o=JSON.parse(a)),"function"==typeof e){const a=e(o);return sessionStorage.setItem(t,JSON.stringify(a)),a}return 1===arguments.length?o:(sessionStorage.setItem(t,JSON.stringify(e)),e)}catch(r){if(console.error(`Gagal memproses JSON untuk "${t}", mereset data...`,r),arguments.length>1){const a="function"==typeof e?e(null):e;return sessionStorage.setItem(t,JSON.stringify(a)),a}return null}}function e(t){const e=document.querySelector(t);e&&"function"==typeof e.render?e.render():document.addEventListener("DOMContentLoaded",()=>{e&&e.render()},{once:!0})}let a=[];function n({modul:t,detail:e,aktif:n=!1}){a.push({waktu:(new Date).toLocaleTimeString(),modul:t,detail:e}),n&&console.dir(a)}window.$BuatWilayah=function({namaWilayah:t,isiWilayah:e,style:a="",methods:o={},deskripsi:r}){n({modul:"Component: $BuatWilayah",detail:{namaWilayah:t,isiWilayah:e,style:a||"tidak ada",methods:o||"tidak ada",deskripsi:r||"tidak ada"}});const i=`wowo-${t.toLowerCase()}`;customElements.get(i)||customElements.define(i,class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}getProps(){const t={};for(let e of this.attributes)t[e.name]=e.value;return t}render(){const t=this.getProps(),n="function"==typeof e?e(t):e;let r=a?`<style>${a}</style>`:"";this.shadowRoot.innerHTML=n+r;this.shadowRoot.querySelectorAll("*").forEach(e=>{[...e.attributes].forEach(a=>{if(a.name.startsWith("@")){const n=a.name.slice(1),r=a.value.replace("()","");o[r]&&(e.addEventListener(n,e=>{o[r](e,t),this.render()}),e.removeAttribute(a.name))}})})}})},window.$antek2=t,window.$PecatAntek2=function(t){n({modul:"State: $PecatAntek2",detail:{nama:t}}),"string"==typeof t&&t.trim()||console.warn(`Nama tidak valid: ${t}`),null===sessionStorage.getItem(t)&&console.info(`Key "${t}" tidak ditemukan, tidak ada yang dihapus.`);try{sessionStorage.removeItem(t)}catch(e){console.error(`Gagal menghapus ${t}:`,e)}},window.$BangunEkonomi=function(t){n({modul:"Render: $BangunEkonomi",detail:t}),Array.isArray(t)?t.forEach(t=>{e(t)}):e(t)},window.$UrusKeuangan=function(t,e){n({modul:"Reducer: $UrusKeuangan",detail:[{reducer:t,action:e}]});try{return t(e)}catch(a){console.error(`terjadi error ${t} \n ${a}`)}},window.$CuriData=async function({data:e,state:a,request:o,reload:r=!1}){try{const i=await fetch(e,o);if(!i.ok)throw new Error(`Status: ${i.status}`);const s=await i.json();if(!s||"object"!=typeof s&&!Array.isArray(s))throw new Error(`Data ${e} bukan JSON kocak`);t(a,s),n({modul:"API: $CuriData",detail:{data:e,state:a}}),r&&location.reload()}catch(i){console.error(`Gagal curi data ${e}\n ${i}`)}},window.$Sejarah=n}();
|
package/package.json
CHANGED
package/wowo.js
CHANGED
|
@@ -206,15 +206,15 @@ async function $CuriData({ data, state, request, reload = false }) {
|
|
|
206
206
|
${e}`);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
let _catatan = [];
|
|
210
210
|
function $Sejarah({ modul, detail, aktif = false }) {
|
|
211
|
-
|
|
211
|
+
_catatan.push({
|
|
212
212
|
waktu: new Date().toLocaleTimeString(),
|
|
213
213
|
modul,
|
|
214
214
|
detail,
|
|
215
215
|
});
|
|
216
216
|
if (aktif) {
|
|
217
|
-
console.dir(
|
|
217
|
+
console.dir(_catatan);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
|