mermace-js 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
+
};
|