Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property Bag in javascript

I'm investigating some code outside my scope that's written in a style I've never seen before. I'm trying to understand the inner workings of the following property bag:

Setter:

props.Property(name) = val;

Getter:

val = props.Property(name);

What would you need to instantiate for the setter to function as above?

EDIT: Less simplification, this code IS successfully running on a BrowserWindow within a frame (similar to a phone environment).

var UI =
        {
            ready: function(oProps)
            {
                try
                {
                    if (oProps)
                    {
                        window.external.Property(UI.FrameWidth) = '1000';
                        window.external.Property(UI.FrameHeight) = '900';
                    }

                    window.external.Ready();
                }
                catch (e) { }
            }
    };

Thanks in advance,

like image 614
Valchris Avatar asked Nov 05 '25 15:11

Valchris


1 Answers

I think it might be just some weird old JScript syntax. Steering away from the "internal function returns a reference" idea from the comments, I found a question about differences between JavaScript and JScript and the only syntax difference listed is this one:

The idiom f(x) = y, which is roughly equivalent to f[x] = y.

There isn't much too find about this idiom though. However, this book about Jscript.Net briefly mentions that

you can access any expando properties using square brackets or parenthesis.

"expando" seems to be a modifier for classes which allows you to add dynamic properties.

like image 120
kapex Avatar answered Nov 08 '25 05:11

kapex