J
jkdufair
I'm looking for advice. I have been playing with Konfabulator which
embeds SpiderMonkey (apparently using the JavaScript 1.5 api) for
scripting "widgets" - various bits of eye candy that sit on your
desktop.
One widget I would like to build is a display of a person's flickr
photostream. Flickr has a nice API, available via REST, XML/RPC, and
SOAP. I'd like to map the flickr API to javascript, having it do url
fetches and parsing the resultant XML results "behind the scenes", but
I don't want to manually create every function, especially since there
would be a huge amount of redundancy in doing so. The scheme
programmer in me immediately reaches for macros, but it does not appear
that JavaScript has macros. It does appear to have first-order
functions, so my gears are still turning.
So my idea is to build an array of function names (as strings), args
(as an array of objects), and xpath expressions (as strings) and
somehow dynamically generate the necessary functions at load time. I'm
a bit stumped on how to get these functions to be available at the top
scoping level. I'm going to sit down with the ECMAScript ed. 3 spec
tonight, but, again, am interested in general advice.
Does anyone have any suggestions on a) how to do this or even better b)
other, better ideas on making this REST api available seamlessly via
JavaScript?
embeds SpiderMonkey (apparently using the JavaScript 1.5 api) for
scripting "widgets" - various bits of eye candy that sit on your
desktop.
One widget I would like to build is a display of a person's flickr
photostream. Flickr has a nice API, available via REST, XML/RPC, and
SOAP. I'd like to map the flickr API to javascript, having it do url
fetches and parsing the resultant XML results "behind the scenes", but
I don't want to manually create every function, especially since there
would be a huge amount of redundancy in doing so. The scheme
programmer in me immediately reaches for macros, but it does not appear
that JavaScript has macros. It does appear to have first-order
functions, so my gears are still turning.
So my idea is to build an array of function names (as strings), args
(as an array of objects), and xpath expressions (as strings) and
somehow dynamically generate the necessary functions at load time. I'm
a bit stumped on how to get these functions to be available at the top
scoping level. I'm going to sit down with the ECMAScript ed. 3 spec
tonight, but, again, am interested in general advice.
Does anyone have any suggestions on a) how to do this or even better b)
other, better ideas on making this REST api available seamlessly via
JavaScript?