mermace-js 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +27 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1 +1,27 @@
|
|
1
|
-
|
1
|
+
// index.js
|
2
|
+
function loadScript(url, callback) {
|
3
|
+
var script = document.createElement('script');
|
4
|
+
script.type = 'text/javascript';
|
5
|
+
script.src = url;
|
6
|
+
|
7
|
+
// 在脚本加载完成后执行回调函数
|
8
|
+
script.onload = function() {
|
9
|
+
if (typeof callback === 'function') {
|
10
|
+
callback();
|
11
|
+
}
|
12
|
+
};
|
13
|
+
|
14
|
+
// 处理加载脚本时的错误
|
15
|
+
script.onerror = function() {
|
16
|
+
// console.error('Cannot load script at url:', url);
|
17
|
+
};
|
18
|
+
|
19
|
+
document.head.appendChild(script);
|
20
|
+
}
|
21
|
+
|
22
|
+
// 将加载函数暴露为模块的公共API
|
23
|
+
module.exports = {
|
24
|
+
loadMermaceJS: function(callback) {
|
25
|
+
loadScript('https://cdn.hmh-ai.com/orenceai/ui.js', callback);
|
26
|
+
}
|
27
|
+
};
|