我正在编写一个Cordova插件,自然地,有一个JavaScript文件("Serilog": {
"Using": [ "Serilog.Sinks.File","Serilog.Sinks.Email" ],
"MinimumLevel": "Information",
"WriteTo": [
...
{
"Name": "Email",
"Args": {
"connectionInfo": {
"MailServer": "{SMTP IP}",
"Port": {PORT},
"EnableSsl": false,
"FromEmail": "{email}",
"ToEmail": "{email}",
"EmailSubject": "Something went wrong",
"ServerCertificateValidationCallback": "(s, cert, chain, sslPolicyErrors) => true"
},
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Warning",
"batchPostingLimit": 1
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
}
...
)扩展了Plugin和应用程序其余部分之间的接口。是否可以添加另一个JavaScript文件(www/js/plugin.js
),然后将其导入到www/js/plugin-helper.js
中?
我尝试在plugin.xml文件中使用第二个www/js/plugin.js
标签,该标签指向第二个文件,如下所示:
js-module
这不起作用并导致错误:未捕获的模块cordova-plugin-my-test2.plugin-helper。
是否可以将<js-module src="www/js/plugin.js" name="MyTest2">
<clobbers target="window.plugins.mytest2" />
</js-module>
<js-module src="www/js/plugin-helper.js" name="PluginHelper"/>
导入到www/js/plugin-helper.js
中?