It is my common.js
import Noty from "noty/lib/noty.min";
import mojs from "mo-js/build/mo.min";
export default {
init() {
// JavaScript to be fired on all pages
// Alert function
function themeAlert($type = 'success', $text = 'Sample Text') {// eslint-disable-line no-unused-vars
new Noty();
new mojs();
}
},
finalize() {
// JavaScript to be fired on all pages, after page specific JS is fired
// Menu toggle
$('.hamburger').click(function () {
$(this).toggleClass('is-active');
});
},
};
And it is single.js
export default {
init() {
// JavaScript to be fired on the about us page
// Alert function
themeAlert();
},
finalize() {
// scripts here fire after init() runs
},
};
But i got console error. Can’t use themeAlaer() function in global.