flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [FlexJS] Stuck due to "Dictionary"
Date Sun, 12 Feb 2017 23:21:22 GMT
I did not know there are polyfills, but it looks like I did a (simplified) solution similar
to what I see here:
https://github.com/Benvie/harmony-collections/blob/master/harmony-collections.js <https://github.com/Benvie/harmony-collections/blob/master/harmony-collections.js>

I already uploaded what I did. Feel free to improve it… :-)

Harbs

> On Feb 13, 2017, at 1:14 AM, Carlos Rovira <carlos.rovira@codeoscopic.com> wrote:
> 
> Hi Harbs,
> 
> When I read about Josh lines about Map and WeakMap y saw that there are
> some polyfills out there to support older browsers. You implemented this
> using some polyfill or you found some other way to do it?
> 
> If you plan to upload this in the following days I'll wait for it.
> 
> Thanks
> 
> Carlos
> 
> 
> 
> 2017-02-13 0:04 GMT+01:00 Harbs <harbs.lists@gmail.com>:
> 
>> I had a need for Dictionary for my purposes as well (i.e. using Objects as
>> keys).
>> 
>> I just implemented ObjectMap which wraps Map, WeakMap and Dictionary. It
>> falls back to plain objects for browsers which do not support Map and
>> inserts uids into the objects.
>> 
>> It’s not tested yet, but it compiles. I expect to test it in the next few
>> days.
>> 
>>> On Feb 10, 2017, at 1:33 AM, Alex Harui <aharui@adobe.com> wrote:
>>> 
>>> Also consider whether you truly need Dictionary or not.  A Weak Reference
>>> Dictionary of Classes, for example, is completely unnecessary if you have
>>> a single ApplicationDomain application.  The classes are never going to
>> be
>>> unloaded, so you don't need weak references to them.
>>> 
>>> I was able to get Spark HelloWorld to run on FlexJS without using a
>>> Dictionary because I took some shortcuts since HelloWorld is a single SWF
>>> application.
>>> 
>>> Also note that, in the browsers I tested, if you put an Object as a key
>>> for an Object, the JS runtime seems to call toString() on it to get a
>> key.
>>> And also remember that Classes and Instances are all mutable in JS so you
>>> can hang a UID on each instance/object to use as a key if you want.
>>> 
>>> HTH,
>>> -Alex
>>> 
>>> PS:  The next thing you should look for in the code is use of weak
>>> reference listeners.  I don't have a good answer for that.
>>> 
>>> 
>>> On 2/9/17, 2:23 PM, "Josh Tynjala" <joshtynjala@gmail.com> wrote:
>>> 
>>>> If you only need strings as keys, then Object is the right choice.
>>>> 
>>>> JavaScript has Map and WeakMap for non-string keys, which is similar to
>>>> Flash Player's Dictionary:
>>>> 
>>>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/
>> Reference/Global_O
>>>> bjects/Map
>>>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/
>> Reference/Global_O
>>>> bjects/WeakMap
>>>> 
>>>> Be aware that Map and WeakMap are relatively new in JavaScript. For
>>>> instance, it looks like IE11 has partial support (with full support in
>>>> Edge), but older versions of IE can't use it.
>>>> 
>>>> - Josh
>>>> 
>>>> On Thu, Feb 9, 2017 at 2:13 PM, Carlos Rovira <carlosrovira@apache.org>
>>>> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> we have some flash Dictionary replacement?
>>>>> If not what we could use instead? or what is the recommended approach?
>>>>> 
>>>>> thanks!
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Carlos Rovira
>>>>> http://about.me/carlosrovira
>>>>> 
>>> 
>> 
>> 
> 
> 
> -- 
> 
> Carlos Rovira
> Director General
> M: +34 607 22 60 05
> http://www.codeoscopic.com
> http://www.avant2.es
> 
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si ha recibido este mensaje por
> error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> proceda a su destrucción.
> 
> De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> servicio o información solicitados, teniendo usted derecho de acceso,
> rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> necesaria.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message