ziko 0.49.2 → 0.49.3
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/ziko.cjs +141 -145
- package/dist/ziko.js +141 -145
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +141 -145
- package/package.json +1 -1
- package/src/__ziko__/__state__.js +16 -7
- package/src/hooks/use-state.js +7 -15
- package/src/use/use-storage.js +4 -4
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date : Tue Nov 25 2025 11:
|
|
5
|
+
Date : Tue Nov 25 2025 19:11:53 GMT+0100 (UTC+01:00)
|
|
6
6
|
Git-Repo : https://github.com/zakarialaoui10/ziko.js
|
|
7
7
|
Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
|
|
8
8
|
Released under MIT License
|
|
@@ -1179,17 +1179,143 @@ const __CACHE__ = {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
};
|
|
1181
1181
|
|
|
1182
|
+
class ZikoUseChannel{
|
|
1183
|
+
constructor(name = ""){
|
|
1184
|
+
this.channel = new BroadcastChannel(name);
|
|
1185
|
+
this.EVENTS_DATAS_PAIRS = new Map();
|
|
1186
|
+
this.EVENTS_HANDLERS_PAIRS = new Map();
|
|
1187
|
+
this.LAST_RECEIVED_EVENT = "";
|
|
1188
|
+
this.UUID="ziko-channel"+Random.string(10);
|
|
1189
|
+
this.SUBSCRIBERS = new Set([this.UUID]);
|
|
1190
|
+
}
|
|
1191
|
+
get broadcast(){
|
|
1192
|
+
// update receiver
|
|
1193
|
+
return this;
|
|
1194
|
+
}
|
|
1195
|
+
emit(event, data){
|
|
1196
|
+
this.EVENTS_DATAS_PAIRS.set(event,data);
|
|
1197
|
+
this.#maintainEmit(event);
|
|
1198
|
+
return this;
|
|
1199
|
+
}
|
|
1200
|
+
on(event,handler=console.log){
|
|
1201
|
+
this.EVENTS_HANDLERS_PAIRS.set(event,handler);
|
|
1202
|
+
this.#maintainOn();
|
|
1203
|
+
return this;
|
|
1204
|
+
}
|
|
1205
|
+
#maintainOn(){
|
|
1206
|
+
this.channel.onmessage = (e) => {
|
|
1207
|
+
this.LAST_RECEIVED_EVENT=e.data.last_sended_event;
|
|
1208
|
+
const USER_ID=e.data.userId;
|
|
1209
|
+
this.SUBSCRIBERS.add(USER_ID);
|
|
1210
|
+
const Data=e.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
1211
|
+
const Handler=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
1212
|
+
if(Data && Handler)Handler(Data);
|
|
1213
|
+
};
|
|
1214
|
+
return this;
|
|
1215
|
+
}
|
|
1216
|
+
#maintainEmit(event){
|
|
1217
|
+
this.channel.postMessage({
|
|
1218
|
+
EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,
|
|
1219
|
+
last_sended_event:event,
|
|
1220
|
+
userId:this.UUID
|
|
1221
|
+
});
|
|
1222
|
+
return this;
|
|
1223
|
+
}
|
|
1224
|
+
close(){
|
|
1225
|
+
this.channel.close();
|
|
1226
|
+
return this;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
const useChannel = name => new ZikoUseChannel(name);
|
|
1230
|
+
|
|
1231
|
+
// To do : remove old items
|
|
1232
|
+
class ZikoUseStorage{
|
|
1233
|
+
constructor(storage, globalKey, initialValue){
|
|
1234
|
+
this.cache={
|
|
1235
|
+
storage,
|
|
1236
|
+
globalKey,
|
|
1237
|
+
channel:useChannel(`Ziko:useStorage-${globalKey}`),
|
|
1238
|
+
oldItemKeys:new Set()
|
|
1239
|
+
};
|
|
1240
|
+
this.#init(initialValue);
|
|
1241
|
+
this.#maintain();
|
|
1242
|
+
}
|
|
1243
|
+
get items(){
|
|
1244
|
+
return JSON.parse(this.cache.storage[this.cache.globalKey]??null);
|
|
1245
|
+
}
|
|
1246
|
+
#maintain() {
|
|
1247
|
+
for(let i in this.items)Object.assign(this, { [[i]]: this.items[i] });
|
|
1248
|
+
}
|
|
1249
|
+
#init(initialValue){
|
|
1250
|
+
this.cache.channel=useChannel(`Ziko:useStorage-${this.cache.globalKey}`);
|
|
1251
|
+
this.cache.channel.on("Ziko-Storage-Updated",()=>this.#maintain());
|
|
1252
|
+
if(!initialValue)return;
|
|
1253
|
+
if(this.cache.storage[this.cache.globalKey]){
|
|
1254
|
+
Object.keys(this.items).forEach(key=>this.cache.oldItemKeys.add(key));
|
|
1255
|
+
// console.group("Ziko:useStorage")
|
|
1256
|
+
// console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`);
|
|
1257
|
+
// console.info(`%cWe'll keep the existing data.`,"background-color:#2222dd; color:gold;");
|
|
1258
|
+
// console.group("")
|
|
1259
|
+
}
|
|
1260
|
+
else this.set(initialValue);
|
|
1261
|
+
}
|
|
1262
|
+
set(data){
|
|
1263
|
+
this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(data));
|
|
1264
|
+
this.cache.channel.emit("Ziko-Storage-Updated",{});
|
|
1265
|
+
Object.keys(data).forEach(key=>this.cache.oldItemKeys.add(key));
|
|
1266
|
+
this.#maintain();
|
|
1267
|
+
return this
|
|
1268
|
+
}
|
|
1269
|
+
add(data){
|
|
1270
|
+
const db={
|
|
1271
|
+
...this.items,
|
|
1272
|
+
...data
|
|
1273
|
+
};
|
|
1274
|
+
this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(db));
|
|
1275
|
+
this.#maintain();
|
|
1276
|
+
return this;
|
|
1277
|
+
}
|
|
1278
|
+
remove(...keys){
|
|
1279
|
+
const db={...this.items};
|
|
1280
|
+
for(let i=0;i<keys.length;i++){
|
|
1281
|
+
delete db[keys[i]];
|
|
1282
|
+
delete this[keys[i]];
|
|
1283
|
+
}
|
|
1284
|
+
this.set(db);
|
|
1285
|
+
return this;
|
|
1286
|
+
}
|
|
1287
|
+
get(key){
|
|
1288
|
+
return this.items[key];
|
|
1289
|
+
}
|
|
1290
|
+
clear(){
|
|
1291
|
+
this.cache.storage.removeItem(this.cache.globalKey);
|
|
1292
|
+
this.#maintain();
|
|
1293
|
+
return this;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
}
|
|
1297
|
+
const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
|
|
1298
|
+
const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
|
|
1299
|
+
|
|
1182
1300
|
const __State__ = {
|
|
1183
1301
|
store : new Map(),
|
|
1184
|
-
index :
|
|
1302
|
+
index : 0,
|
|
1303
|
+
session_storage : null,
|
|
1185
1304
|
register: function(state){
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1305
|
+
if(!import.meta.env.SSR && import.meta.env.DEV){
|
|
1306
|
+
if(!this.session) this.session_storage = useSessionStorage('ziko-state', {});
|
|
1307
|
+
const savedValue = this.session_storage.get(this.index);
|
|
1308
|
+
if(!savedValue) this.session_storage.add({[this.index] : state.value});
|
|
1309
|
+
else state.value = savedValue;
|
|
1310
|
+
}
|
|
1190
1311
|
this.store.set(this.index++, state);
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1312
|
+
},
|
|
1313
|
+
update: function(index, value){
|
|
1314
|
+
if(!import.meta.env.SSR && import.meta.env.DEV){
|
|
1315
|
+
this.session_storage.add({[index] : value});
|
|
1316
|
+
}
|
|
1317
|
+
},
|
|
1318
|
+
|
|
1193
1319
|
};
|
|
1194
1320
|
|
|
1195
1321
|
function __init__global__(){
|
|
@@ -1447,20 +1573,8 @@ function _register_to_class_(target, mixin) {
|
|
|
1447
1573
|
|
|
1448
1574
|
if(!globalThis.__Ziko__) __init__global__();
|
|
1449
1575
|
|
|
1450
|
-
// HMR persistence
|
|
1451
|
-
if (import.meta.hot?.data) {
|
|
1452
|
-
import.meta.hot.data.__Ziko__ = import.meta.hot.data?.__Ziko__ || globalThis?.__Ziko__;
|
|
1453
|
-
globalThis.__Ziko__ = import.meta.hot.data.__Ziko__;
|
|
1454
|
-
// import.meta.hot.accept(n=>console.log(n));
|
|
1455
|
-
// console.log(import.meta.hot.data.__Ziko__.__State__.store)
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
1576
|
function useState(initialValue) {
|
|
1461
|
-
|
|
1462
|
-
// console.log(import.meta.hot.data.__Ziko__.__State__.store.get(0))
|
|
1463
|
-
|
|
1577
|
+
|
|
1464
1578
|
const {store, index} = __Ziko__.__State__;
|
|
1465
1579
|
__Ziko__.__State__.register({
|
|
1466
1580
|
value : initialValue,
|
|
@@ -1468,7 +1582,7 @@ function useState(initialValue) {
|
|
|
1468
1582
|
paused : false
|
|
1469
1583
|
});
|
|
1470
1584
|
|
|
1471
|
-
|
|
1585
|
+
let current = store.get(index);
|
|
1472
1586
|
|
|
1473
1587
|
function getValue() {
|
|
1474
1588
|
return {
|
|
@@ -1480,10 +1594,13 @@ function useState(initialValue) {
|
|
|
1480
1594
|
|
|
1481
1595
|
function setValue(newValue) {
|
|
1482
1596
|
if (current.paused) return;
|
|
1483
|
-
if (typeof newValue === "function")
|
|
1597
|
+
if (typeof newValue === "function") {
|
|
1598
|
+
newValue = newValue(current.value);
|
|
1599
|
+
}
|
|
1484
1600
|
if (newValue !== current.value) {
|
|
1485
1601
|
current.value = newValue;
|
|
1486
1602
|
current.subscribers.forEach(fn => fn(current.value));
|
|
1603
|
+
__Ziko__.__State__.update(index, newValue);
|
|
1487
1604
|
}
|
|
1488
1605
|
}
|
|
1489
1606
|
|
|
@@ -4465,6 +4582,7 @@ const throttle=(fn,delay)=>{
|
|
|
4465
4582
|
}
|
|
4466
4583
|
};
|
|
4467
4584
|
|
|
4585
|
+
const sleep= ms => new Promise(res => setTimeout(res, ms));
|
|
4468
4586
|
function timeout(ms, fn) {
|
|
4469
4587
|
let id;
|
|
4470
4588
|
const promise = new Promise((resolve) => {
|
|
@@ -4481,10 +4599,6 @@ function timeout(ms, fn) {
|
|
|
4481
4599
|
};
|
|
4482
4600
|
}
|
|
4483
4601
|
|
|
4484
|
-
const sleep= ms => new Promise(res => setTimeout(res, ms));
|
|
4485
|
-
|
|
4486
|
-
// use it with await
|
|
4487
|
-
|
|
4488
4602
|
class TimeLoop {
|
|
4489
4603
|
constructor(callback, { step = 1000, t0 = 0, t1 = Infinity, autoplay = true } = {}) {
|
|
4490
4604
|
this.callback = callback;
|
|
@@ -5094,55 +5208,6 @@ const useReactive = (nested_value) => mapfun$1(
|
|
|
5094
5208
|
nested_value
|
|
5095
5209
|
);
|
|
5096
5210
|
|
|
5097
|
-
class ZikoUseChannel{
|
|
5098
|
-
constructor(name = ""){
|
|
5099
|
-
this.channel = new BroadcastChannel(name);
|
|
5100
|
-
this.EVENTS_DATAS_PAIRS = new Map();
|
|
5101
|
-
this.EVENTS_HANDLERS_PAIRS = new Map();
|
|
5102
|
-
this.LAST_RECEIVED_EVENT = "";
|
|
5103
|
-
this.UUID="ziko-channel"+Random.string(10);
|
|
5104
|
-
this.SUBSCRIBERS = new Set([this.UUID]);
|
|
5105
|
-
}
|
|
5106
|
-
get broadcast(){
|
|
5107
|
-
// update receiver
|
|
5108
|
-
return this;
|
|
5109
|
-
}
|
|
5110
|
-
emit(event, data){
|
|
5111
|
-
this.EVENTS_DATAS_PAIRS.set(event,data);
|
|
5112
|
-
this.#maintainEmit(event);
|
|
5113
|
-
return this;
|
|
5114
|
-
}
|
|
5115
|
-
on(event,handler=console.log){
|
|
5116
|
-
this.EVENTS_HANDLERS_PAIRS.set(event,handler);
|
|
5117
|
-
this.#maintainOn();
|
|
5118
|
-
return this;
|
|
5119
|
-
}
|
|
5120
|
-
#maintainOn(){
|
|
5121
|
-
this.channel.onmessage = (e) => {
|
|
5122
|
-
this.LAST_RECEIVED_EVENT=e.data.last_sended_event;
|
|
5123
|
-
const USER_ID=e.data.userId;
|
|
5124
|
-
this.SUBSCRIBERS.add(USER_ID);
|
|
5125
|
-
const Data=e.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
5126
|
-
const Handler=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
5127
|
-
if(Data && Handler)Handler(Data);
|
|
5128
|
-
};
|
|
5129
|
-
return this;
|
|
5130
|
-
}
|
|
5131
|
-
#maintainEmit(event){
|
|
5132
|
-
this.channel.postMessage({
|
|
5133
|
-
EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,
|
|
5134
|
-
last_sended_event:event,
|
|
5135
|
-
userId:this.UUID
|
|
5136
|
-
});
|
|
5137
|
-
return this;
|
|
5138
|
-
}
|
|
5139
|
-
close(){
|
|
5140
|
-
this.channel.close();
|
|
5141
|
-
return this;
|
|
5142
|
-
}
|
|
5143
|
-
}
|
|
5144
|
-
const useChannel = name => new ZikoUseChannel(name);
|
|
5145
|
-
|
|
5146
5211
|
class ZikoUseThreed {
|
|
5147
5212
|
#workerContent;
|
|
5148
5213
|
constructor() {
|
|
@@ -5259,75 +5324,6 @@ tags.p("Test useRoot ").style({
|
|
|
5259
5324
|
|
|
5260
5325
|
*/
|
|
5261
5326
|
|
|
5262
|
-
// To do : remove old items
|
|
5263
|
-
class ZikoUseStorage{
|
|
5264
|
-
constructor(storage, globalKey, initialValue){
|
|
5265
|
-
this.cache={
|
|
5266
|
-
storage,
|
|
5267
|
-
globalKey,
|
|
5268
|
-
channel:useChannel(`Ziko:useStorage-${globalKey}`),
|
|
5269
|
-
oldItemKeys:new Set()
|
|
5270
|
-
};
|
|
5271
|
-
this.#init(initialValue);
|
|
5272
|
-
this.#maintain();
|
|
5273
|
-
}
|
|
5274
|
-
get items(){
|
|
5275
|
-
return JSON.parse(this.cache.storage[this.cache.globalKey]??null);
|
|
5276
|
-
}
|
|
5277
|
-
#maintain() {
|
|
5278
|
-
for(let i in this.items)Object.assign(this, { [[i]]: this.items[i] });
|
|
5279
|
-
}
|
|
5280
|
-
#init(initialValue){
|
|
5281
|
-
this.cache.channel=useChannel(`Ziko:useStorage-${this.cache.globalKey}`);
|
|
5282
|
-
this.cache.channel.on("Ziko-Storage-Updated",()=>this.#maintain());
|
|
5283
|
-
if(!initialValue)return;
|
|
5284
|
-
if(this.cache.storage[this.cache.globalKey]){
|
|
5285
|
-
Object.keys(this.items).forEach(key=>this.cache.oldItemKeys.add(key));
|
|
5286
|
-
console.group("Ziko:useStorage");
|
|
5287
|
-
console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`);
|
|
5288
|
-
console.info(`%cWe'll keep the existing data.`,"background-color:#2222dd; color:gold;");
|
|
5289
|
-
console.group("");
|
|
5290
|
-
}
|
|
5291
|
-
else this.set(initialValue);
|
|
5292
|
-
}
|
|
5293
|
-
set(data){
|
|
5294
|
-
this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(data));
|
|
5295
|
-
this.cache.channel.emit("Ziko-Storage-Updated",{});
|
|
5296
|
-
Object.keys(data).forEach(key=>this.cache.oldItemKeys.add(key));
|
|
5297
|
-
this.#maintain();
|
|
5298
|
-
return this
|
|
5299
|
-
}
|
|
5300
|
-
add(data){
|
|
5301
|
-
const db={
|
|
5302
|
-
...this.items,
|
|
5303
|
-
...data
|
|
5304
|
-
};
|
|
5305
|
-
this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(db));
|
|
5306
|
-
this.#maintain();
|
|
5307
|
-
return this;
|
|
5308
|
-
}
|
|
5309
|
-
remove(...keys){
|
|
5310
|
-
const db={...this.items};
|
|
5311
|
-
for(let i=0;i<keys.length;i++){
|
|
5312
|
-
delete db[keys[i]];
|
|
5313
|
-
delete this[keys[i]];
|
|
5314
|
-
}
|
|
5315
|
-
this.set(db);
|
|
5316
|
-
return this;
|
|
5317
|
-
}
|
|
5318
|
-
get(key){
|
|
5319
|
-
return this.items[key];
|
|
5320
|
-
}
|
|
5321
|
-
clear(){
|
|
5322
|
-
this.cache.storage.removeItem(this.cache.globalKey);
|
|
5323
|
-
this.#maintain();
|
|
5324
|
-
return this;
|
|
5325
|
-
}
|
|
5326
|
-
|
|
5327
|
-
}
|
|
5328
|
-
const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
|
|
5329
|
-
const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
|
|
5330
|
-
|
|
5331
5327
|
let {sqrt, cos, sin, exp, log, cosh, sinh} = Math;
|
|
5332
5328
|
// Math.abs = new Proxy(Math.abs, {
|
|
5333
5329
|
// apply(target, thisArg, args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.3",
|
|
4
4
|
"description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import { useSessionStorage } from '../use/use-storage'
|
|
1
2
|
export const __State__ = {
|
|
2
3
|
store : new Map(),
|
|
3
|
-
index :
|
|
4
|
+
index : 0,
|
|
5
|
+
session_storage : null,
|
|
4
6
|
register: function(state){
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
if(!import.meta.env.SSR && import.meta.env.DEV){
|
|
8
|
+
if(!this.session) this.session_storage = useSessionStorage('ziko-state', {})
|
|
9
|
+
const savedValue = this.session_storage.get(this.index)
|
|
10
|
+
if(!savedValue) this.session_storage.add({[this.index] : state.value});
|
|
11
|
+
else state.value = savedValue
|
|
12
|
+
}
|
|
9
13
|
this.store.set(this.index++, state)
|
|
10
|
-
}
|
|
11
|
-
|
|
14
|
+
},
|
|
15
|
+
update: function(index, value){
|
|
16
|
+
if(!import.meta.env.SSR && import.meta.env.DEV){
|
|
17
|
+
this.session_storage.add({[index] : value})
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
12
21
|
}
|
package/src/hooks/use-state.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import { __init__global__ } from "../__ziko__/index.js";
|
|
2
|
-
if(!globalThis.__Ziko__) __init__global__()
|
|
3
|
-
|
|
4
|
-
// HMR persistence
|
|
5
|
-
if (import.meta.hot?.data) {
|
|
6
|
-
import.meta.hot.data.__Ziko__ = import.meta.hot.data?.__Ziko__ || globalThis?.__Ziko__;
|
|
7
|
-
globalThis.__Ziko__ = import.meta.hot.data.__Ziko__;
|
|
8
|
-
// import.meta.hot.accept(n=>console.log(n));
|
|
9
|
-
// console.log(import.meta.hot.data.__Ziko__.__State__.store)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
2
|
|
|
3
|
+
if(!globalThis.__Ziko__) __init__global__()
|
|
13
4
|
|
|
14
5
|
export function useState(initialValue) {
|
|
15
|
-
|
|
16
|
-
// console.log(import.meta.hot.data.__Ziko__.__State__.store.get(0))
|
|
17
|
-
|
|
6
|
+
|
|
18
7
|
const {store, index} = __Ziko__.__State__
|
|
19
8
|
__Ziko__.__State__.register({
|
|
20
9
|
value : initialValue,
|
|
@@ -22,7 +11,7 @@ export function useState(initialValue) {
|
|
|
22
11
|
paused : false
|
|
23
12
|
})
|
|
24
13
|
|
|
25
|
-
|
|
14
|
+
let current = store.get(index);
|
|
26
15
|
|
|
27
16
|
function getValue() {
|
|
28
17
|
return {
|
|
@@ -34,10 +23,13 @@ export function useState(initialValue) {
|
|
|
34
23
|
|
|
35
24
|
function setValue(newValue) {
|
|
36
25
|
if (current.paused) return;
|
|
37
|
-
if (typeof newValue === "function")
|
|
26
|
+
if (typeof newValue === "function") {
|
|
27
|
+
newValue = newValue(current.value);
|
|
28
|
+
}
|
|
38
29
|
if (newValue !== current.value) {
|
|
39
30
|
current.value = newValue;
|
|
40
31
|
current.subscribers.forEach(fn => fn(current.value));
|
|
32
|
+
__Ziko__.__State__.update(index, newValue)
|
|
41
33
|
}
|
|
42
34
|
}
|
|
43
35
|
|
package/src/use/use-storage.js
CHANGED
|
@@ -23,10 +23,10 @@ class ZikoUseStorage{
|
|
|
23
23
|
if(!initialValue)return;
|
|
24
24
|
if(this.cache.storage[this.cache.globalKey]){
|
|
25
25
|
Object.keys(this.items).forEach(key=>this.cache.oldItemKeys.add(key));
|
|
26
|
-
console.group("Ziko:useStorage")
|
|
27
|
-
console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`);
|
|
28
|
-
console.info(`%cWe'll keep the existing data.`,"background-color:#2222dd; color:gold;");
|
|
29
|
-
console.group("")
|
|
26
|
+
// console.group("Ziko:useStorage")
|
|
27
|
+
// console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`);
|
|
28
|
+
// console.info(`%cWe'll keep the existing data.`,"background-color:#2222dd; color:gold;");
|
|
29
|
+
// console.group("")
|
|
30
30
|
}
|
|
31
31
|
else this.set(initialValue);
|
|
32
32
|
}
|