Interesting this allows mimic other things probably if it's missing. :) 2018-03-15 10:09 GMT+01:00 Harbs <[email protected]>:
> OK. I just pushed an IEEventAdapterBead which adds name getters to the > event prototypes. It’ll just add it in IE. Along the way I added some new > utility functions for creating getters. > > I think this is lighter-weight, and I think it’s an interesting pattern. > > Harbs > > > On Mar 15, 2018, at 11:00 AM, Harbs <[email protected]> wrote: > > > > Adding a different type of bead… ;-) > > > >> On Mar 15, 2018, at 10:49 AM, Yishay Weiss <[email protected]> > wrote: > >> > >> Already merged mine, using a bead. Feel free to make changes if you see > fit. > >> > >> > >> > >> ________________________________ > >> From: Harbs <[email protected]> > >> Sent: Thursday, March 15, 2018 10:40:34 AM > >> To: [email protected] > >> Subject: Re: [royale-asjs] branch EventConverter updated: Export cross > browser support to a bead so core implementation stays efficient and works > on non-IE browsers > >> > >> I have what I think is a simpler (and more versatile) solution for > these kinds of things. > >> > >> I’m going to commit my idea soon. > >> > >>> On Mar 15, 2018, at 10:37 AM, [email protected] wrote: > >>> > >>> This is an automated email from the ASF dual-hosted git repository. > >>> > >>> yishayw pushed a commit to branch EventConverter > >>> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git > >>> > >>> > >>> The following commit(s) were added to refs/heads/EventConverter by > this push: > >>> new 429032f Export cross browser support to a bead so core > implementation stays efficient and works on non-IE browsers > >>> 429032f is described below > >>> > >>> commit 429032f75d4e48988980fda8e171c6c6e6b1e7bb > >>> Author: DESKTOP-RH4S838\Yishay <[email protected]> > >>> AuthorDate: Thu Mar 15 10:36:44 2018 +0200 > >>> > >>> Export cross browser support to a bead so core implementation stays > >>> efficient and works on non-IE browsers > >>> --- > >>> .../Basic/src/main/resources/basic-manifest.xml | 1 + > >>> .../org/apache/royale/core/HTMLElementWrapper.as | 23 +++--- > >>> .../beads/CrossBrowserFireListenerOverrideBead.as | 93 > ++++++++++++++++++++++ > >>> 3 files changed, 106 insertions(+), 11 deletions(-) > >>> > >>> diff --git > >>> a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml > b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml > >>> index a201ea1..dbff20e 100644 > >>> --- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml > >>> +++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml > >>> @@ -87,6 +87,7 @@ > >>> <component id="ListView" class="org.apache.royale.html. > beads.ListView"/> > >>> <component id="AccordionView" class="org.apache.royale.html. > beads.AccordionView"/> > >>> <component id="CenterElement" class="org.apache.royale.html. > beads.CenterElement"/> > >>> + <component id="CrossBrowserFireListenerOverrideBead" > class="org.apache.royale.html.beads.CrossBrowserFireListenerOverrideBead" > /> > >>> <component id="AccessibilityAltBead" > >>> class="org.apache.royale.html.beads.AccessibilityAltBead" > /> > >>> <component id="DataGridColumnChangePropagator" > class="org.apache.royale.html.beads.DataGridColumnChangePropagator" /> > >>> <component id="DataGridColumnForceChangePropagator" > class="org.apache.royale.html.beads.DataGridColumnForceChangePropagator" > /> > >>> diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/ > royale/core/HTMLElementWrapper.as b/frameworks/projects/Basic/ > src/main/royale/org/apache/royale/core/HTMLElementWrapper.as > >>> index 7aa8a0b..7228fbc 100644 > >>> --- a/frameworks/projects/Basic/src/main/royale/org/apache/ > royale/core/HTMLElementWrapper.as > >>> +++ b/frameworks/projects/Basic/src/main/royale/org/apache/ > royale/core/HTMLElementWrapper.as > >>> @@ -71,17 +71,18 @@ package org.apache.royale.core > >>> { > >>> var e:IBrowserEvent; > >>> var nativeEvent:Object = eventObject.getBrowserEvent(); > >>> - var constructorName:String = > nativeEvent.constructor.toString(); > >>> - if (constructorName.indexOf('KeyboardEvent') > > -1) > >>> - { > >>> - e = KeyboardEventConverter. > convert(nativeEvent); > >>> - } else if (constructorName.indexOf('MouseEvent') > > -1) > >>> - { > >>> - e = MouseEventConverter.convert( > nativeEvent); > >>> - } else > >>> - { > >>> - e = new org.apache.royale.events. > BrowserEvent(); > >>> - } > >>> + switch(nativeEvent.constructor.name) > >>> + { > >>> + case "KeyboardEvent": > >>> + e = KeyboardEventConverter.convert(nativeEvent); > >>> + break; > >>> + case "MouseEvent": > >>> + e = MouseEventConverter.convert(nativeEvent); > >>> + break; > >>> + default: > >>> + e = new org.apache.royale.events.BrowserEvent(); > >>> + break; > >>> + } > >>> > >>> e.wrapEvent(eventObject); > >>> return HTMLElementWrapper.googFireListener(listener, > e); > >>> diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/ > royale/html/beads/CrossBrowserFireListenerOverrideBead.as > b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ > CrossBrowserFireListenerOverrideBead.as > >>> new file mode 100644 > >>> index 0000000..06de46f > >>> --- /dev/null > >>> +++ b/frameworks/projects/Basic/src/main/royale/org/apache/ > royale/html/beads/CrossBrowserFireListenerOverrideBead.as > >>> @@ -0,0 +1,93 @@ > >>> +/////////////////////////////////////////////////////////// > ///////////////////// > >>> +// > >>> +// Licensed to the Apache Software Foundation (ASF) under one or more > >>> +// contributor license agreements. See the NOTICE file distributed > with > >>> +// this work for additional information regarding copyright > ownership. > >>> +// The ASF licenses this file to You under the Apache License, > Version 2.0 > >>> +// (the "License"); you may not use this file except in compliance > with > >>> +// the License. You may obtain a copy of the License at > >>> +// > >>> +// http://www.apache.org/licenses/LICENSE-2.0 > >>> +// > >>> +// Unless required by applicable law or agreed to in writing, > software > >>> +// distributed under the License is distributed on an "AS IS" BASIS, > >>> +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or > implied. > >>> +// See the License for the specific language governing permissions > and > >>> +// limitations under the License. > >>> +// > >>> +/////////////////////////////////////////////////////////// > ///////////////////// > >>> +package org.apache.royale.html.beads > >>> +{ > >>> + import org.apache.royale.core.IBead; > >>> + import org.apache.royale.core.IStrand; > >>> + import org.apache.royale.core.HTMLElementWrapper; > >>> + COMPILE::JS > >>> + { > >>> + import goog.events; > >>> + import goog.events.EventTarget; > >>> + import goog.events.BrowserEvent; > >>> + import org.apache.royale.events.IBrowserEvent; > >>> + import org.apache.royale.events.utils.KeyboardEventConverter; > >>> + import org.apache.royale.events.utils.MouseEventConverter; > >>> + } > >>> + /** > >>> + * Overrides default HTMLElementWrapper implementation to make > sure events are converted on all browsers > >>> + * including IE. > >>> + * @langversion 3.0 > >>> + * @playerversion Flash 10.2 > >>> + * @playerversion AIR 2.6 > >>> + * @productversion Royale 0.92 > >>> + */ > >>> + public class CrossBrowserFireListenerOverrideBead implements > IBead > >>> + { > >>> + /** > >>> + * Constructor. > >>> + * > >>> + * @langversion 3.0 > >>> + * @playerversion Flash 10.2 > >>> + * @playerversion AIR 2.6 > >>> + * @productversion Royale 0.92 > >>> + */ > >>> + public function CrossBrowserFireListenerOverrideBead() > >>> + { > >>> + super(); > >>> + } > >>> + > >>> + /** > >>> + * @copy org.apache.royale.core.IBead#strand > >>> + * > >>> + * @langversion 3.0 > >>> + * @playerversion Flash 10.2 > >>> + * @playerversion AIR 2.6 > >>> + * @productversion Royale 0.92 > >>> + */ > >>> + public function set strand(value:IStrand):void > >>> + { > >>> + COMPILE::JS > >>> + { > >>> + goog.events.fireListener = > CrossBrowserFireListenerOverrideBead.fireListenerOverride; > >>> + } > >>> + } > >>> + > >>> + COMPILE::JS > >>> + static protected function > >>> fireListenerOverride(listener:Object, > eventObject:goog.events.BrowserEvent):Boolean > >>> + { > >>> + var e:IBrowserEvent; > >>> + var nativeEvent:Object = eventObject.getBrowserEvent(); > >>> + var constructorName:String = > nativeEvent.constructor.toString(); > >>> + if (constructorName.indexOf('KeyboardEvent') > > -1) > >>> + { > >>> + e = KeyboardEventConverter. > convert(nativeEvent); > >>> + } else if (constructorName.indexOf('MouseEvent') > > -1) > >>> + { > >>> + e = MouseEventConverter.convert( > nativeEvent); > >>> + } else > >>> + { > >>> + e = new org.apache.royale.events. > BrowserEvent(); > >>> + } > >>> + > >>> + e.wrapEvent(eventObject); > >>> + return HTMLElementWrapper.googFireListener(listener, > e); > >>> + } > >>> + } > >>> +} > >>> > >>> -- > >>> To stop receiving notification emails like this one, please contact > >>> [email protected]. > >> > > > > -- Piotr Zarzycki Patreon: *https://www.patreon.com/piotrzarzycki <https://www.patreon.com/piotrzarzycki>*
