I don't know which approach is better with ES6 modules and the revealing module pattern. Is the data / functionality from an ES6 module as private as an IIFE?
Should I just use *only ES6 modules, like so:
// Export file
export const test = () => {
console.log('Hello from test');
}
// Import file
import { test } from "./test.js";
test();
Or should I use both combined:
// Export file
export const revealingPattern = (function() {
function test() {
console.log('Hello from test');
}
return {
test
}
})();
// Import file
import { revealingPattern } from "./test.js";
revealingPattern.test();