org.zkoss.zkex.ui.comet.modernEvent
Property:
org.zkoss.zkex.ui.comet.modernEvent
Applicable:
-
globally in
zk.xmlvia<library-property> -
not as
<custom-attribute>
Default: false
since 10.3.0
Specifies whether to enable modern XMLHttpRequest event handling (onload, onerror, ontimeout, and onabort) for Comet server push.
By default, this is disabled (false), and ZK uses the legacy onreadystatechange handler. When enabled, it provides better event classification and allows easier client-side extensibility by introducing a dedicated _createXHR method that can be overridden to customize XHR requests.
Client-Side Customization
When enabled, you can customize XHR creation by overriding the _createXHR method:
zk.afterLoad('zkex.cmsp', function() {
var _xPush = {};
zk.override(zkex.cmsp.SPush.prototype, _xPush, {
_createXHR: function() {
var xhr = _xPush._createXHR.apply(this, arguments);
// Add custom configurations
xhr.withCredentials = true;
return xhr;
}
});
});