Skip to content

Commit

Permalink
dom: fix Event.fromNative to short-circuit if already wrapped
Browse files Browse the repository at this point in the history
  • Loading branch information
afrankvt committed Jan 29, 2024
1 parent ae4a2d6 commit de87dec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dom/es/EventPeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class EventPeer extends sys.Obj {

static fromNative(obj)
{
// short-circut if peer already exists
if (obj.peer && obj.peer.event) return obj;
return EventPeer.make(obj);
}

Expand Down
2 changes: 2 additions & 0 deletions src/dom/js/EventPeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ fan.dom.EventPeer.makeMock = function()

fan.dom.EventPeer.fromNative = function(obj)
{
// short-circut if peer already exists
if (obj.peer && obj.peer.event) return obj;
return fan.dom.EventPeer.make(obj);
}

Expand Down

0 comments on commit de87dec

Please sign in to comment.