Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #34374
| From | Jan Bruns <ebay@abnuto.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Object.create(canvas.getContext()) |
| Date | 2017-11-20 14:47 +0000 |
| Organization | MB-NET.NET for Open-News-Network e.V. |
| Message-ID | <ouuptf$59b$1@gwaiyur.mb-net.net> (permalink) |
| References | (3 earlier) <1754058.usQuhbGJ8B@PointedEars.de> <oungju$hmt$1@gwaiyur.mb-net.net> <10957516.O9o76ZdvQC@PointedEars.de> <oustnb$gbb$1@gwaiyur.mb-net.net> <4026723.LvFx2qVVIh@PointedEars.de> |
Thomas 'PointedEars' Lahn:
> Jan Bruns wrote:
>
>>> For example, there is a reason why I enclosed the host object property
>>> access in a “try” block.
>> What is that reason? Does "typeof" throw on any enumerated property
>> anywhere?
> If you would have tried, you would have seen that
>
> typeof Object.getPrototypeOf(webGLcontext)[name] == "function"
>
> throws “TypeError: Illegal invocation” for the _enumerable_ properties
> where
Interesting. Saved me from thinking about how to create an object that
throws on typeof(enumerated property). Maybe the "getters" can do so.
But we're talking about a very popular API, meaning there are thousands
or maybe even a million programmers out there that tried out or will try
out working with it.
The prototype object of such an API of course might have very browser
specific behaviour that isn't spcificly user friendly (and even doesn't
necessarily have to meet programing language specific functionality), as
long as the API's specification doesn't explicitly define such behaviour.
But if
for (var i in API) { typeof API[i] };
would throw, why did they implement and enumerate that fail?
Well, probably for the same reasons, as
Object.create(API);
might not work as expected: work in progress.
But then, the only clean way to deal with it would be to copy&paste the
API specification (like C headers) to any project that needs to inherit
the API instead of just referencing it. I'll probably do that in case I
see a problem that could be solved that way, but work in progress...
Gruss
Jan Bruns
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Object.create(canvas.getContext()) Jan Bruns <ebay@abnuto.de> - 2017-11-12 10:09 +0000
Re: Object.create(canvas.getContext()) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-12 17:42 +0100
Re: Object.create(canvas.getContext()) Jan Bruns <ebay@abnuto.de> - 2017-11-14 11:48 +0000
Re: Object.create(canvas.getContext()) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-15 02:32 +0100
Re: Object.create(canvas.getContext()) Jan Bruns <ebay@abnuto.de> - 2017-11-17 20:25 +0000
Re: Object.create(canvas.getContext()) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-19 05:48 +0100
Re: Object.create(canvas.getContext()) Jan Bruns <ebay@abnuto.de> - 2017-11-19 21:39 +0000
Re: Object.create(canvas.getContext()) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-19 23:34 +0100
Re: Object.create(canvas.getContext()) Jan Bruns <ebay@abnuto.de> - 2017-11-20 14:47 +0000
Re: Object.create(canvas.getContext()) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-21 04:07 +0100
Re: Object.create(canvas.getContext()) Jan Bruns <ebay@abnuto.de> - 2017-11-21 16:23 +0000
Re: Object.create(canvas.getContext()) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-22 04:12 +0100
Re: Object.create(canvas.getContext()) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-12 18:45 +0100
csiph-web