JS simple module loading principle and advice

I want to learn the core principle of modular loader. Now it can dynamically load files and prevent overloading, but at present, it is stuck in the callback function to receive parameters. Please give me some advice. Thank you.

for example:

A.js
require([""],function(){
    // 
});

B.js
define(function(){
    // A
})

I understand that the callback function is executed after dynamically loading the module, but I don"t know how this parameter is passed, how the callback function gets the return result of the module, and what is the intermediate key between them? If you can give a simple demo will be very grateful, text description of the principle is also OK, thank you.

Mar.18,2021

define implementation:

// 
const moduleResult = {}

function define(module){
    moduleResult[filepath] = module()
}

require implementation:

function require(dependenceList, callback){
    callback(...dependenceList.map(dependence => moduleResult[dependence]))
}

there is only principle, and nothing else is considered


just call the second parameter normally.

function require(list, callback) {
    // list
    // const result1 = eval('xx1.js')
    // const result2 = eval('xx2.js')
    callback(result1, result2)
}

take a look at my article seajs and requirejs Modular Development

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea6db5-1e07.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea6db5-1e07.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?