我正在尝试在 roundcube 中添加登录警报,但我似乎没有得到我期望的客户端事件。我想听听这个beforelogin事件。
我的 javascript 代码如下所示:
if (window.rcmail) {
rcmail.addEventListener('beforelogin', function() {
console.log("Got beforelogin");
window.alert("Alert");
});
rcmail.addEventListener('init', function() {
console.log("Got init");
});
}
它确实记录了
Got init
到控制台日志,但令我惊讶的是它没有记录
Got beforelogin
它也不显示警报。
服务器端,javascript是由
class myalert extends rcube_plugin
{
function init()
{
$this->add_hook('template_object_loginform', array($this,'myalert'));
}
function myalert($args)
{
$this->include_script('myalert.js');
return $args;
}
}
我是否误解了圆形立方体客户端事件的命名约定?我是否以错误的方式添加它?还有什么我可以错过的吗?