Welcome Guest, Not a member yet? Register   Sign In
Google AJAX library API and The Future CI JavaScript Functionalities
#1

[eluser]WoOzY KinG[/eluser]
I read the introduction of Google AJAX library API and feel excited about their idea - what I sense is a (much) better performance of juicy javascript powered pages (namely ajax).

And I believe you've all read the news about EE 2.0 is now fully CodeIgnited. The shiny part was:
Quote:There are also exciting things in the works for CodeIgniter that aren’t yet in the public repository (because they aren’t done yet, not because we won’t share). The most exciting of which is probably the brand new javascript and jQuery libraries, which will provide simple, programatic ways to write complex javascript code. It means you’ll have a simple, CodeIgniter way of creating rich javascript functions. You don’t need to be a javascript guru, but you can be.

Amazing (because I hate js so much, this could further relieve a lot of development pressure)! Now what I think is that whether we can have an option of loading the lib file(s) by using Google's API and still have the CI ways of using them, like mentioned in the news:
Code:
// Effect: fade a div into view
$this->javascript->fade_in(“div”);

// Event: set up a click to show a submenu
$this->javascript->click(“#button”,
    $this->javascript->hide(“.submenu”);
);

// Plugin: using a jQuery plugin
$this->jquery->tablesorter();

I know where to load the lib file is a small thing compare to how they're greatly merged into CI, but since we all care about performance, why don't we take all possible effort to boost it?
#2

[eluser]GSV Sleeper Service[/eluser]
hmmm, js helpers could be a step backward for javascript, it should be unobtrusive, I don't want my pages littered with script tags, or even worse seeing the dreaded
Code:
&lt;a href="#" onclick="foo();"&gt;...</a>
#3

[eluser]WoOzY KinG[/eluser]
I don't know, it's still under development I guess? Not revealed yet.
#4

[eluser]WoOzY KinG[/eluser]
I'm really looking forward to take a mouthful bite on this new CI feature; and even more, to take advantage of the "Google Cloud".
#5

[eluser]xwero[/eluser]
I think it's a bit misnamed because the libraries do more than just take care of ajax.

AFAIK the main benefit would be that you load the library of a regional server if they have the library stored. i think that is a big if. What if the library isn't available on a regional server and you have to load it for a far away location. I prefer certainty.
#6

[eluser]WoOzY KinG[/eluser]
Quote:I think it’s a bit misnamed because the libraries do more than just take care of ajax.

TOTALLY AGREED!!! What I can come up with is that the Google people just want to make it consistant with other Google AJAX APIs. But the good thing is that they didn't strip any other functionalities other than Ajax of these libs (and it would consume huge amount of time and man power to do that, I suppose).

Quote:What if the library isn’t available on a regional server

What I really suggest is that if we could have an OPTION to load the script using the API. Because What I'm not sure is whether the integration of jQuery and CI has resulted some changes in jQuery's core to suit the structure of CI. In that case, my suggestion would be pointless anyways. It would be nice to have somebody from the dev team answer this question.
#7

[eluser]Michael Wales[/eluser]
The benefit of the Google API isn't the speeding up of your site's loading time - it's the speeding up of every site's loading time for you, as a user.

Whether the site is in Turkey, the US, or the moon - if they all referenced Google's copy of jQuery (or whatever) - then the end user would use their own cached copy, rather than reloading the same library on every single domain they visit.
#8

[eluser]xwero[/eluser]
[quote author="Michael Wales" date="1212428581"]The benefit of the Google API isn't the speeding up of your site's loading time - it's the speeding up of every site's loading time for you, as a user.

Whether the site is in Turkey, the US, or the moon - if they all referenced Google's copy of jQuery (or whatever) - then the end user would use their own cached copy, rather than reloading the same library on every single domain they visit.[/quote]
Nice you made the subtleties more clear but my question still remains what if the library has to be fetched from a far away server if you don't have already loaded the library from some other site. If it's a first visit your site performance will look bad in the eyes of the surfer.

I can see the benefit of caching the library on the users machine but for which duration? The time the browser stays open? The time the user is logged on?

I didn't get into the api yet but i think as a developer there are a lot of uncertainties and i guess for the benchmark nuts among us it would be a nightmare.
#9

[eluser]Sarre[/eluser]
Quote:I can see the benefit of caching the library on the users machine but for which duration? The time the browser stays open? The time the user is logged on?
Ad infinitum...

That is to say, people will have them in their cache for a very long time (like until a new version of the library comes out, and webmasters switch to that new version by changing the version number in their code).

This could work out very well, but it really depends on how many sites use google's api...
#10

[eluser]WoOzY KinG[/eluser]
Quote:If it’s a first visit your site performance will look bad in the eyes of the surfer.

This could be a problem. But I always believe that Google's servers are faster than any of ours unless compare to localhost Wink




Theme © iAndrew 2016 - Forum software by © MyBB