zjquery: Allow $.Event as a constructor.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-12-10 19:17:28 -08:00
parent 5a87c34705
commit f84fd0839d
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,9 @@ const noop = function () {};
class Event {
constructor(type, props) {
if (!(this instanceof Event)) {
return new Event(type, props);
}
this.type = type;
Object.assign(this, props);
}
@ -518,7 +521,7 @@ exports.make_zjquery = function (opts) {
return res;
};
zjquery.Event = (type, props) => new Event(type, props);
zjquery.Event = Event;
fn.after = function (s) {
return s;