import optimizations for site.js
transfered pageIdOn and pageClassOn to clientUtils
This commit is contained in:
parent
5d94812220
commit
4e11e3ba66
9 changed files with 86 additions and 93 deletions
|
@ -158,6 +158,26 @@ export function confirm(message, title, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
export const pageClassOn = function(eventName, className, fn) {
|
||||
document.addEventListener(eventName, function (event) {
|
||||
const target = event.target;
|
||||
|
||||
if (target.classList.contains(className)) {
|
||||
fn.call(target, event);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const pageIdOn = function(eventName, id, fn) {
|
||||
document.addEventListener(eventName, function (event) {
|
||||
const target = event.target;
|
||||
|
||||
if (target.id === id) {
|
||||
fn.call(target, event);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const Dashboard = {
|
||||
alert,
|
||||
capabilities,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue