You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Maria Jose Esteve <mj...@iest.com> on 2020/01/08 18:32:37 UTC

Jewel: PopUpView.as exception

Hi,
In the PopUpView.as class, we use popUpVisible property to change his visibility.
To display his content, we use the "setTimeout" function, which executes the prepareForPopUp function after 300 milliseconds:

setTimeout(prepareForPopUp,  300);

If you show and hide in a short time frame, the prepareForPopUp event fires after the value of the _popUp variable has been set to NULL causing exception:

TypeError: Cannot read property 'addClass' of null

Would it be correct to verify the _PopUp value before calling it? ... Something like

        private function prepareForPopUp():void
        {
+            if (_popUp)
+                _popUp.addClass("open");

            COMPILE::JS
            {
                //avoid scroll in html
                document.body.classList.add("viewport");
                //cancelAnimationFrame(rq);
            }
        }


Thank you,
Hiedra.

RE: Jewel: PopUpView.as exception

Posted by Maria Jose Esteve <mj...@iest.com>.
Hi Carlos,
Everything works fine now.

Tranks you for all.
Hiedra.

Mª José Esteve García 
Dpto. Sistemas 
mjesteve@iest.com

Informática del Este S.L.
C/ Camino Peñarrocha, 3 – Esc. D – Planta 1ª 
46023 - Valencia (ESPAÑA) 
Tel: +34 963 485 874 | Fax: +34 963 483 706
www.iest.com 

-----Mensaje original-----
De: Carlos Rovira <ca...@apache.org> 
Enviado el: jueves, 9 de enero de 2020 13:20
Para: dev@royale.apache.org
Asunto: Re: Jewel: PopUpView.as exception

Hi Maria Jose,

just applied a fix. Thanks for notifying about it!

I'll be changing setTimeOut calls for something like requestAnimationFrame at some time. When I develop this code, I had issues for different browsers. Now that we have more browser control, we can do smarter management and maybe left setTimeOut as a fallback for browsers that does not work with better methods.

Thanks! :)



El mié., 8 ene. 2020 a las 19:32, Maria Jose Esteve (<mj...@iest.com>)
escribió:

> Hi,
> In the PopUpView.as class, we use popUpVisible property to change his 
> visibility.
> To display his content, we use the "setTimeout" function, which 
> executes the prepareForPopUp function after 300 milliseconds:
>
> setTimeout(prepareForPopUp,  300);
>
> If you show and hide in a short time frame, the prepareForPopUp event 
> fires after the value of the _popUp variable has been set to NULL 
> causing
> exception:
>
> TypeError: Cannot read property 'addClass' of null
>
> Would it be correct to verify the _PopUp value before calling it? ...
> Something like
>
>         private function prepareForPopUp():void
>         {
> +            if (_popUp)
> +                _popUp.addClass("open");
>
>             COMPILE::JS
>             {
>                 //avoid scroll in html
>                 document.body.classList.add("viewport");
>                 //cancelAnimationFrame(rq);
>             }
>         }
>
>
> Thank you,
> Hiedra.
>


--
Carlos Rovira
http://about.me/carlosrovira

Re: Jewel: PopUpView.as exception

Posted by Carlos Rovira <ca...@apache.org>.
Hi Maria Jose,

just applied a fix. Thanks for notifying about it!

I'll be changing setTimeOut calls for something like requestAnimationFrame
at some time. When I develop this code, I had issues for different
browsers. Now that we have more browser control, we can do smarter
management and maybe left setTimeOut as a fallback for browsers that does
not work with better methods.

Thanks! :)



El mié., 8 ene. 2020 a las 19:32, Maria Jose Esteve (<mj...@iest.com>)
escribió:

> Hi,
> In the PopUpView.as class, we use popUpVisible property to change his
> visibility.
> To display his content, we use the "setTimeout" function, which executes
> the prepareForPopUp function after 300 milliseconds:
>
> setTimeout(prepareForPopUp,  300);
>
> If you show and hide in a short time frame, the prepareForPopUp event
> fires after the value of the _popUp variable has been set to NULL causing
> exception:
>
> TypeError: Cannot read property 'addClass' of null
>
> Would it be correct to verify the _PopUp value before calling it? ...
> Something like
>
>         private function prepareForPopUp():void
>         {
> +            if (_popUp)
> +                _popUp.addClass("open");
>
>             COMPILE::JS
>             {
>                 //avoid scroll in html
>                 document.body.classList.add("viewport");
>                 //cancelAnimationFrame(rq);
>             }
>         }
>
>
> Thank you,
> Hiedra.
>


-- 
Carlos Rovira
http://about.me/carlosrovira