Skip navigation.

exploreopera

| Help

Sign up | Help

Web Applications Blog

Posts tagged with "aleto"

avatar

Web Chat Transcript: JavaScript with Christian Krebs (Aleto)

, ,

We had a good technical discussion going last week. Thanks again to all of you who submitted great questions - Christian enjoyed it tremendously. Perhaps we will have him back some time in the future.

Keep following the blog to see what we have lined up this week.

-------------------------------

OperaWebApps: Hi Everyone. We go live with Aleto in two minutes. If you would like to post questions now, we'll start answering at 5:00.

Question from dante_: Same question as last time: how about them libraries? Can you give us quick hints, ETAs, maybe save a little wheel invention?

Aleto: Libraries are still in the works, of course. I wrote the animation library, and I'm working on some more. But right now, my focus is on a couple of other important projects.

Question from GreyWyvern: Is there (or will there be) an easy way to disable input methods for widgets and then whitelist the ones we want to allow (perhaps in config.xml)? The huge number of keyboard shorcuts in Opera are a pain to disable for instance.

Aleto: Could you clarify what you mean by input methods? Do you mean strictly keyboard shortcuts?

Question from GreyWyvern: Mostly keyboard shortcuts, but also other things, like if the user has voice enabled and tells the widget to "speak"

Aleto: With JavaScript you cannot override keyboard shortcuts in Opera. I don't know of any plans to change that.

Aleto: Jsaucepn - Hi
Aleto: I'm impressed with your widgets!

Aleto: We have no technical questions today?

Question from FataL: Question: Whwn creating widgets what is the best way(s) to grab data from the remote site if its source code has ID that points to the part that I need?

Example: I already have full source of desired page that has ID "data1" in variable named FullSource. Unfortunately I can't just do FullSource.getElementById("data1").

Gautam: The ways I know are:
1. put FullSource content in some hidden (display:none) DIV element. Than do document.getElementById("data1")
2. use XPath...

Aleto: Another way is to create a new document with document.implementation.createHTMLDocument("") and parse the source into that document.

Aleto: Then the method getElementById is then available in that document.

Question by dante_: (addon to the previous question) 3. DOM3 Load/Save (versus the AJAX implied above)

Aleto: DOM Load and Save is, in my view, dying. The way to go is XMLHttpRequest.

Question by dante_: Any tips on having pre-cached (online) data bundled with the widget?
1. XML (then new XSLTProcessor().transformToFragment)
2. data as source code (JS arrays/JSON)
3. use another way

More so, how to be less memory- or processor-intensive with the 'Switch to language' feature (i.e. keep lots of strings and change all widget texts on user's choice) ?

Aleto: Personally, it depends a little bit. If possible I would keep as much data as possible on the server side. If pre-caching is needed, I would put that as object or arrays in a .js file.

Aleto: If it's really memory consuming, then I would keep that information or data on the server and load it in the .js file when needed. This is in my experience very quick.

Question from jsaucepn: What do you think of the object-oriented features of Javascript? What method do you use for inheritance, or do you avoid it?

Aleto: There is no proper way for object-oriented programming in JavaScript.

Aleto: The problem with the "clean way" of using inheritance in JavaScript is that it is not possible to use private methods or properties in classes.

Aleto: It depends a lot on how many instantiations from an object are really needed to decide which programming techniques are appropriate.

Aleto: But the normal way for inheritance looks in general like Subclass.prototype=new BaseClass(), in short.

Question from shadow: Could you explain the ow_timer object? why are you using it? what is the basic idea behind it?

Aleto: The basic idea behind that is to single-thread all animations.
Aleto: This helps the animations work on a single timeframe.
Aleto: Back to the oop question, in ECMAScript 4, we will have real classes and inheritances, as I have seen in the drafts.

Question from shadow: And when will ECMAScript4 be released and supported?

Aleto: I have no clue, but I hope very soon. As far as I know, Flash 10 already uses some features from ECMAScript 4.

Aleto: The standardization process always takes longer than we wish it would take.

Question from dante_: would you consider a didactic reviewing of a widget ? strong points, weak, alternate.. pick one from widgets.opera.com and make a tutorial, of to-do's and not to's

Aleto: That is a very interesting suggestion. I have a lot of things on my agenda for now. Do you have a certain widget in mind? We can have a small talk right now.

Question from dante_: the spotlight-ed ones.. i assume the reviewers know the best ones

Question from shadow: Can you tell us anything about the mysterious new js libraries that opera is making?

Aleto: We have already made a lot of libraries, but we still have to clean them up

Aleto: If I had more time, I would experiment with the fact that we can store a large amount of data.

Aleto: That is actually the big difference of a widget from a webpage, where we are bound to use cookies.

Aleto: I would like for example to make a real calendar, where you have all your dates local and you syncronize them with, for example, a JSON library, to a server.

Aleto: So, widgets that use these features which are different from a webpage are the ones that I would like to see.

Question from shadow: What exactly will these js libraries do?Ajax?DOM manipulation ?cookies?

Aleto: I know a lot of libraries which do wrap the xmlHttpRequest object, but myself I dont really see the need for that.

Aleto: The libraries will try to make it easier to handle general tasks

Aleto: I have tested myself, upto 1 megabyte is possible. but I dont know where the limit is.

Aleto: What do you feel are the limitations in widgets, in a general way?

Question from shadow: if i can store upto 1mb in the widget prefs...could i then let's say.....store all my js code in the widget prefs?and maybe all the images too?(using the data:uri version of them)

Aleto: Yes, that should be theoretically possible. Just try it out!

Question from shadow: Limitations?Lack of access to the hdd and lack of access to the system stats

Aleto: Yea, system stats would be nice!

Question from dante_: update system

Aleto: dante_ what do you mean by update system?

Aleto: Oh sorry, I misunderstood. I thought that was a question.

Question from dante_: maybe better interaction: sounds when not focused, alerts...

Question from shadow: ohh and maybe the fact that i can't start opera in hidden mode(ctrl+h) when i start my pc

Question from dante_: i would like to see opera manage the updating of new versions of widgets

Aleto: dante_: Yea, that is something I would like to see as well!

Question from dante_: i remember i needed a hashing library: md5, maybe crc32.. would you be so kind to add to the list ?

Aleto: Yea yea, we will consider that.

Aleto: Any questions left? I have to go back to my work

Question from grafio: It's very easy to "hack" JavaScript. Is it possible to secure a widget from hacking? In a game widget for example? Any tips?

Aleto: In general, I dont think there are ways to obscure javascript. (look for example Google Maps)

Aleto: It's not really obscure, you can still reengineer it - but its very hard.

Question from dante_: it's all in connection with 'logging in to sites' and other sensitive operations.. since there is no https support in XMLhttpreq. do you have any technical recommandation for now ?

Aleto: xmlHttpRequest has to work with https. If you have any test case, please file a bug report

Aleto: Outside of https there is no secure way of communicating

Question from shoust: Are you planning any login libraries so it could be possible to have like a full del.ico.us service in a widget for example?

Aleto: I think you should be able to login with xmlHttpRequest

Aleto: Guys, I have to go back to work. Thank you very much for the nice chat, I will take with me some of the things we have discussed here.

Aleto: And I hope to see you again.