Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are some great solutions here, but I'll like to take it one step further regarding the local file.</p> <p>In a scenario when Google does fail, it should load a local source but maybe a physical file on the server isn't necessarily the best option. I bring this up because I'm currently implementing the same solution, only I want to fall back to a local file that gets generated by a data source.</p> <p>My reasons for this is that I want to have some piece of mind when it comes to keeping track of what I load from Google vs. what I have on the local server. If I want to change versions, I'll want to keep my local copy synced with what I'm trying to load from Google. In an environment where there are many developers, I think the best approach would be to automate this process so that all one would have to do is change a version number in a configuration file.</p> <p>Here's my proposed solution that should work in theory:</p> <ul> <li>In an application configuration file, I'll store 3 things: absolute URL for the library, the URL for the JavaScript API, and the version number</li> <li>Write a class which gets the file contents of the library itself (gets the URL from app config), stores it in my datasource with the name and version number</li> <li>Write a handler which pulls my local file out of the db and caches the file until the version number changes.</li> <li>If it does change (in my app config), my class will pull the file contents based on the version number, save it as a new record in my datasource, then the handler will kick in and serve up the new version.</li> </ul> <p>In theory, if my code is written properly, all I would need to do is change the version number in my app config then viola! You have a fallback solution which is automated, and you don't have to maintain physical files on your server.</p> <p>What does everyone think? Maybe this is overkill, but it could be an elegant method of maintaining your AJAX libraries.</p> <p>Acorn</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload