{"id":13697569,"url":"https://github.com/kabirbaidhya/get-js","last_synced_at":"2025-09-05T12:49:07.635Z","repository":{"id":8185570,"uuid":"57142180","full_name":"kabirbaidhya/get-js","owner":"kabirbaidhya","description":"A lightweight library to asynchronously load scripts on the fly","archived":false,"fork":false,"pushed_at":"2023-01-04T21:49:48.000Z","size":683,"stargazers_count":3,"open_issues_count":13,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T19:21:23.080Z","etag":null,"topics":["angular","async","get","javascript","js","loader","loading","promise","script"],"latest_commit_sha":null,"homepage":"https://yarn.pm/get-js","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kabirbaidhya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-26T15:59:38.000Z","updated_at":"2023-07-12T20:54:36.000Z","dependencies_parsed_at":"2023-01-13T14:40:20.278Z","dependency_job_id":null,"html_url":"https://github.com/kabirbaidhya/get-js","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fget-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fget-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fget-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fget-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kabirbaidhya","download_url":"https://codeload.github.com/kabirbaidhya/get-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717391,"owners_count":20498283,"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":["angular","async","get","javascript","js","loader","loading","promise","script"],"created_at":"2024-08-02T18:01:00.264Z","updated_at":"2025-03-21T00:31:45.250Z","avatar_url":"https://github.com/kabirbaidhya.png","language":"JavaScript","readme":"# get-js\n\n[![NPM Version](https://img.shields.io/npm/v/get-js.svg?style=flat-square)](https://www.npmjs.com/package/get-js)\n[![NPM Downloads](https://img.shields.io/npm/dt/get-js.svg?style=flat-square)](https://www.npmjs.com/package/get-js)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](LICENSE)\n[![Build Status](https://img.shields.io/travis/kabirbaidhya/get-js?style=flat-square)](https://travis-ci.org/kabirbaidhya/get-js)\n\nA lightweight library to asynchronously load scripts on the fly.\n\n## Installation\n\n```bash\n# Using npm\n$ npm install get-js --save\n\n# Using Yarn\n$ yarn add get-js\n\n# Using Bower\n$ bower install get-js --save\n```\n\nFor [older browsers](http://caniuse.com/#feat=promises) you may also need a [promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise) polyfill.\n\n```bash\n# Install promise polyfill.\n$ npm install es6-promise\n```\n\n## Usage\n\nUse it in your project with `require` or `import` as an ES module.\n\n```javascript\nconst get = require('get-js');\n\n// ES2015+\nimport get from 'get-js';\n```\n\nOr, using `\u003cscript\u003e` tags:\n\n```html\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/get-js@0.0.7/dist/get.min.js\"\u003e\u003c/script\u003e\n```\n\nHere you go:\n\n```javascript\n// Load a single script\nget('https://code.jquery.com/jquery-3.4.1.min.js').then(function() {\n  console.log('do something');\n});\n\n// Load multiple scripts, without changing the order\nget(['/js/abc.js', '/js/xyz.js'])\n  .then(function() {\n    console.log('do something now');\n  })\n  .catch(function() {\n    console.log('error');\n  });\n```\n\nIf you're using ES2015+ / TypeScript codebase, you can also use `async` / `await` syntax with `get`:\n\n```js\nimport get from 'get-js';\n\n(async () =\u003e {\n  await get('https://code.jquery.com/jquery-3.4.1.min.js'); // Gets jQuery.\n\n  $(document).on('ready', () =\u003e {\n    console.log('Ready!');\n  });\n})();\n```\n\n## Using with Angular\n\n**Note: This refers to [angular 1.x](https://angularjs.org/) projects.**\n\nYou can inject this in your angular code as a service.\n\nRequire the angular module using\n\n```javascript\nconst angularGetJs = require('get-js/angular');\n```\n\nOr\n\n```html\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/get-js@0.0.7/dist/angular-get.min.js\"\u003e\u003c/script\u003e\n```\n\nThen you should be able to use it like this:\n\n```javascript\n// Add the module as a dependency in your app.\nangular.module('app', ['angularGetJs']);\n\n// Inject the service\nangular.module('app').controller('MyController', [\n  'get',\n  function(get) {\n    get('/some/script.js')\n      .then(function() {\n        console.log('do something now');\n      })\n      .catch(function() {\n        console.log('error');\n      });\n  }\n]);\n```\n\n## Development\n\nTo start developing or contributing to `get-js`, you'll need to clone the project first.\n\n1. Clone it locally.\n   ```\n   $ git clone git@github.com:kabirbaidhya/get-js.git\n   ```\n2. Install dependencies.\n\n   ```\n   $ yarn\n   ```\n\n3. Linting\n\n   ```\n   $ yarn lint\n   ```\n\n4. Generating a build.\n\n   ```\n   $ yarn build\n   ```\n\n## License\n\nThis package is licensed under the [MIT License](LICENSE).\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabirbaidhya%2Fget-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkabirbaidhya%2Fget-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabirbaidhya%2Fget-js/lists"}