UNPKG

1.69 kBJavaScriptView Raw
1
2function $parcel$export(e, n, v, s) {
3 Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4}
5
6$parcel$export(module.exports, "createEventHandler", () => $951fbcbbca8db6ce$export$48d1ea6320830260);
7/*
8 * Copyright 2020 Adobe. All rights reserved.
9 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License. You may obtain a copy
11 * of the License at http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software distributed under
14 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15 * OF ANY KIND, either express or implied. See the License for the specific language
16 * governing permissions and limitations under the License.
17 */ function $951fbcbbca8db6ce$export$48d1ea6320830260(handler) {
18 if (!handler) return undefined;
19 let shouldStopPropagation = true;
20 return (e)=>{
21 let event = {
22 ...e,
23 preventDefault () {
24 e.preventDefault();
25 },
26 isDefaultPrevented () {
27 return e.isDefaultPrevented();
28 },
29 stopPropagation () {
30 console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
31 },
32 continuePropagation () {
33 shouldStopPropagation = false;
34 }
35 };
36 handler(event);
37 if (shouldStopPropagation) e.stopPropagation();
38 };
39}
40
41
42//# sourceMappingURL=createEventHandler.main.js.map