如何动态使用require.js?

时间:2017-06-11 21:20:00

标签: javascript jquery html module requirejs

我想动态使用require.js。像这样的东西

$("button").click(function() {
    require(["A", "B"],  function(A, B) {

    });
});

button.click();  // <-- first click should load A and B
button.click();  // <-- should not run while A and B have both not loaded
// A and B now loaded
button.click();  // <-- should not re-download A and B, should just re-use A and B

有谁知道怎么做? require.js中是否已支持此类内容?

由于

0 个答案:

没有答案