{"id":16954565,"url":"https://github.com/lavoiesl/async-js-loader","last_synced_at":"2026-01-27T11:30:19.156Z","repository":{"id":4276665,"uuid":"5405154","full_name":"lavoiesl/async-js-loader","owner":"lavoiesl","description":"Load Social Media widgets libraries asynchronously and delayed (Facebook, Twitter, etc.)","archived":true,"fork":false,"pushed_at":"2012-08-13T23:54:45.000Z","size":110,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T08:24:42.296Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lavoiesl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-13T21:42:55.000Z","updated_at":"2023-03-31T14:12:55.000Z","dependencies_parsed_at":"2022-08-06T16:00:25.554Z","dependency_job_id":null,"html_url":"https://github.com/lavoiesl/async-js-loader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lavoiesl%2Fasync-js-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lavoiesl%2Fasync-js-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lavoiesl%2Fasync-js-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lavoiesl%2Fasync-js-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lavoiesl","download_url":"https://codeload.github.com/lavoiesl/async-js-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239774305,"owners_count":19694697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T22:09:58.566Z","updated_at":"2026-01-27T11:30:19.104Z","avatar_url":"https://github.com/lavoiesl.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asynchronous Javascript Loader\n\nSome javascript libraries are big and they pose a stress on the browser when they are loaded all at the same time.\n\nMost of these libraries suggest to load them in async.\n\n## Library examples\n\n * Google Analytics\n * Google Maps\n * Google Plus\n * Facebook Like\n * Twitter button\n\n## Problems with existing solution\n\n * A lot of ugly script tag with semi-minified code.\n * Most of the library suggest the same trick so we see code duplication.\n * You have to go copy-paste the code each time you start a new project.\n * If you have multiple libraries, they will all fire at the same time, possibly causing a stress on the browser\n * While the libraries are loading (usually with a lot of dependencies) the browser is sluggish and users probably want to read that article before clicking on 'Like'.\n\n## Solution\n\n * Load each library with a function taking an `id`, a `url` and a `delay`.\n * Allow each library to have a different delay.\n   * You may want Google Maps to load only 200ms after the page, but the Facebook Like can wait a bit more.\n\n## Usage\n\n```bash\ncomposer.phar install # autoloader\nphp build.php twitter facebook \u003e /path/to/you/project/js/async-libs.js\n```\n\nAnd add a `\u003cscript/\u003e` tag just before the closing tag of `\u003c/body\u003e`.\n\nAlternatively, you can copy paste the code in a `document.ready`.\n\n[Working example on jsfiddle](http://jsfiddle.net/7T4e7/)\n\n## TODO\n\n * Add more libraries (only Twitter and Facebook at the moment).\n * Add configuration files\n   * Facebook locale / xfbml\n   * Google Maps sensors / api key\n\n## Author\n\n[Sebastien Lavoie](http://blog.lavoie.sl)\n\n[GitHub](https://github.com/lavoiesl/async-js-loader)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flavoiesl%2Fasync-js-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flavoiesl%2Fasync-js-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flavoiesl%2Fasync-js-loader/lists"}