提交 922dd9af 编写于 作者: J Joao Moreno

browser event: stop

上级 c05bf435
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import _Event, { Emitter } from 'vs/base/common/event';
import _Event, { Emitter, mapEvent } from 'vs/base/common/event';
export type EventHandler = HTMLElement | HTMLDocument | Window;
......@@ -127,3 +127,11 @@ export const domEvent: IDomEvent = (element: EventHandler, type: string, useCapt
return emitter.event;
};
export function stop<T extends Event>(event: _Event<T>): _Event<T> {
return mapEvent(event, e => {
e.preventDefault();
e.stopPropagation();
return e;
});
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册