mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
zjquery: Allow $.Event as a constructor.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -6,6 +6,9 @@ const noop = function () {};
|
|||||||
|
|
||||||
class Event {
|
class Event {
|
||||||
constructor(type, props) {
|
constructor(type, props) {
|
||||||
|
if (!(this instanceof Event)) {
|
||||||
|
return new Event(type, props);
|
||||||
|
}
|
||||||
this.type = type;
|
this.type = type;
|
||||||
Object.assign(this, props);
|
Object.assign(this, props);
|
||||||
}
|
}
|
||||||
@@ -518,7 +521,7 @@ exports.make_zjquery = function (opts) {
|
|||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
zjquery.Event = (type, props) => new Event(type, props);
|
zjquery.Event = Event;
|
||||||
|
|
||||||
fn.after = function (s) {
|
fn.after = function (s) {
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
Reference in New Issue
Block a user