|
|
|
@ -2,27 +2,28 @@ import { make_reactive } from './utils.js';
|
|
|
|
|
|
|
|
|
|
|
|
export const ReactiveURLSearchParams = make_reactive(URLSearchParams, {
|
|
|
|
export const ReactiveURLSearchParams = make_reactive(URLSearchParams, {
|
|
|
|
write_properties: ['append', 'delete', 'set', 'sort'],
|
|
|
|
write_properties: ['append', 'delete', 'set', 'sort'],
|
|
|
|
read_properties: ['get', 'has'],
|
|
|
|
read_properties: ['get', 'has', 'getAll'],
|
|
|
|
interceptors: {
|
|
|
|
interceptors: {
|
|
|
|
set: (notify_read_properties, value, property, ...params) => {
|
|
|
|
set: (notify_read_properties, value, property, ...params) => {
|
|
|
|
if (typeof params[0] == 'string' && value.get(params[0]) === params[1]) {
|
|
|
|
if (typeof params[0] == 'string' && value.get(params[0]) === params[1]) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
notify_read_properties(['get', 'has'], params[0]);
|
|
|
|
notify_read_properties(['get', 'has', 'getAll'], params[0]);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
append: (notify_read_properties, value, property, ...params) => {
|
|
|
|
append: (notify_read_properties, value, property, ...params) => {
|
|
|
|
if (typeof params[0] == 'string' && value.get(params[0]) === params[1]) {
|
|
|
|
notify_read_properties(['getAll'], params[0]);
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (typeof params[0] == 'string' && !value.has(params[0])) {
|
|
|
|
notify_read_properties(['get', 'has'], params[0]);
|
|
|
|
notify_read_properties(['get', 'has'], params[0]);
|
|
|
|
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
delete: (notify_read_properties, value, property, ...params) => {
|
|
|
|
delete: (notify_read_properties, value, property, ...params) => {
|
|
|
|
if (typeof params[0] == 'string' && !value.has(params[0])) {
|
|
|
|
if (typeof params[0] == 'string' && !value.has(params[0])) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
notify_read_properties(['get', 'has'], params[0]);
|
|
|
|
notify_read_properties(['get', 'has', 'getAll'], params[0]);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|