{"id":32248600,"url":"https://github.com/orbitbot/ng-appcache","last_synced_at":"2026-02-21T00:04:47.021Z","repository":{"id":26668092,"uuid":"30124614","full_name":"orbitbot/ng-appcache","owner":"orbitbot","description":"Angular module for working with AppCache","archived":false,"fork":false,"pushed_at":"2015-08-03T17:00:04.000Z","size":256,"stargazers_count":13,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-22T16:28:07.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/orbitbot.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":"2015-01-31T20:09:21.000Z","updated_at":"2023-04-03T10:43:16.000Z","dependencies_parsed_at":"2022-07-25T16:02:14.531Z","dependency_job_id":null,"html_url":"https://github.com/orbitbot/ng-appcache","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/orbitbot/ng-appcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitbot%2Fng-appcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitbot%2Fng-appcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitbot%2Fng-appcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitbot%2Fng-appcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orbitbot","download_url":"https://codeload.github.com/orbitbot/ng-appcache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitbot%2Fng-appcache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29668646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T23:24:07.480Z","status":"ssl_error","status_checked_at":"2026-02-20T23:24:06.202Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-10-22T17:45:03.825Z","updated_at":"2026-02-21T00:04:47.016Z","avatar_url":"https://github.com/orbitbot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ng-appcache\n[![Build Status](https://travis-ci.org/orbitbot/ng-appcache.svg?branch=master)](https://travis-ci.org/orbitbot/ng-appcache)\n\n```ng-appcache``` is an [AngularJS](https://angularjs.org/) module for working with the application cache. The module offers both a service for appcache interaction and utility directives for all states. ```ng-appcache``` fails silently if a browser does not have [appcache support](http://caniuse.com/#feat=offline-apps), so it is safe to use, and the implementation is fully testable by mocking the ```$window``` service.\n\n```ng-appcache``` aims to work wherever the appcache is available, so please file an issue if you run into problems.\n\n\n\u003cbr /\u003e\n## Installation\n\n  1) Look in the ```dist``` subfolder, or if you have [bower](http://bower.io/) installed (if you don't, you probably want to) just run\n```bash\n$ bower install ng-appcache\n```\n  2) Include the downloaded file in your base html file\n``` html\n\u003cscript src=\"path/to/appcache.js\"\u003e\u003c/script\u003e\n\u003c!-- or --\u003e\n\u003cscript src=\"path/to/appcache.min.js\"\u003e\u003c/script\u003e\n```\n  3) And finally include the module as a dependency for your angular app:\n``` js\nangular.module('myApp', ['ng-appcache']);\n```  \n\n\u003cbr /\u003e\n## Service API\n\nInclude ```appcache``` as a dependency for your angular component, eg.\n\n```js\nangular.controller('MyCtrl', function(appcache) {\n\n  appcache.checkUpdate().then(function() {\n    alert('There\\'s an update available!');\n  });\n  // ...\n});\n```  \n\u003cbr /\u003e\nThe service offers the following API:  \n\n##### appcache.abortUpdate()\nAbort an ongoing appcache download. If an appcache update is ongoing and is successfully canceled, the function will return ```true```, in all other cases this function will return ```false``` and have no other effect. \n\n\u003cbr /\u003e\n##### appcache.checkUpdate()\nManually check if a new application cache is available, and automatically download it if so. This function returns a ```$q``` promise, which will be resolved when the update is ready to be applied, or will be rejected if no update is available.\n\n**N.B.** browsers usually automatically check for updates when pages are (re-)loaded, so calling this function immediately on pageload is probably unnecessary.\n\n\u003cbr /\u003e\n##### appcache.swapCache()\nIf an appcache update is already downloaded, after a call to this method any requests for cached content will return new versions instead of the ones available from the cache. This function returns a ```$q``` promise that will be rejected if no cache is available, or resolved otherwise (success).\n\n**N.B.** the internet suggests that it is probably safer to do a full pageload when you have an appcache update downloaded, so that there are no mixed resource versions in use.\n\n\u003cbr /\u003e\n##### appcache.addEventListener(eventName, handler, useCapture)\n##### appcache.on(...)\nRegister a function _handler_ which will be executed when _eventName_ fires. See [this reference](http://www.quirksmode.org/js/events_order.html) for an explanation of the _useCapture_ parameter.\n\n_eventName_ can be one of ```'cached', 'checking', 'downloading', 'error', 'noupdate', 'obsolete', 'progress'``` or ```'updateready'```.\n\n\u003cbr /\u003e\n##### appcache.removeEventListener(eventName, handler, useCapture)\n##### appcache.off(...)\nRemove function _handler_ previously registered to be executed when _eventName_ fires. _handler_ must refer to a named function or a stored variable containing a function, otherwise this call will have no effect.\n\n\u003cbr /\u003e\n##### appcache.textStatus\nA string representation of the current appcache state. ```appcache.textStatus``` will be one of ```'UNCACHED', 'IDLE', 'CHECKING', 'DOWNLOADING', 'UPDATEREADY'``` or ```'OBSOLETE'```.\n\n##### appcache.status\nA numerical representation of the current appcache state which matches the constants provided by ```window.applicationCache.status``` and is expressed textually by ```appcache.textStatus```.\n\n\u003cbr /\u003e\n### Unsupported browsers\nIn the case of a browser that does not support appcache, calls to  \n\n    appcache.abortUpdate()\n\nwill return ```false```\n\n    appcache.checkUpdate()\n    appcache.swapCache()\n\nwill return a rejected promise, \n    \n    appcache.addEventListener()\n    appcache.removeEventListener()\n    appcache.on()\n    appcache.off()\n\nwill have no effect, and\n    \n    appcache.status and\n    appcache.textStatus\n\nwill be ```undefined```.\n\n\u003cbr /\u003e\n## Directives\n\nWith ```ng-appcache``` installed, you can use the following directives:\n\n``` html\n\u003cappcache-cached\u003e\n\u003cappcache-checking\u003e\n\u003cappcache-downloading\u003e\n\u003cappcache-error\u003e\n\u003cappcache-noupdate\u003e\n\u003cappcache-obsolete\u003e\n\u003cappcache-updateready\u003e\n```\n\nAll directives can also be specified as attributes, eg ```\u003cdiv appcache-noupdate\u003e```. Any content inside the directives will initially hidden (using the ```ng-hide``` class), and become visible if the corresponding appcache event fires. \n\nBy adding the ```dismiss-on-click``` or ```dismiss-delay``` (or both) attributes to any directive, the directive content can be hidden again. ```dismiss-on-click``` will hide content on a mouseclick, and ```dismiss-delay``` takes a millisecond parameter which specifies the delay before the content will be hidden again.\n\n**Example:**  \n``` html\n\u003cappcache-error dismiss-on-click dismiss-delay=\"2500\"\u003e\u003c/appcache-error\u003e\n```\nThe example directive will initially be hidden, and become visible if an appcache error event occurs. 2,5 seconds later the content will be hidden, or before that if a user clicks the directive.\n\n\u003cbr /\u003e\n## Application cache resources\n\nThe appcache can be [a douchebag](http://alistapart.com/article/application-cache-is-a-douchebag), so have a look at some of the following helpful articles if you're not already familiar with the details:\n \n  - http://www.html5rocks.com/en/tutorials/appcache/beginner/\n  - https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache\n  - http://diveintohtml5.info/offline.html\n  - http://alistapart.com/article/application-cache-is-a-douchebag\n  - http://caniuse.com/#feat=offline-apps\n\n\u003cbr /\u003e\n## Developing\n\n```ng-appcache``` has been developed using [Gulp](http://gulpjs.com/), with a minimal CI setup. To get started, run\n\n```bash\n$ npm install\n```\n\n... which will set up a development environment with PhantomJS for automated testing and a server for manual testing on other browsers. After this, the following gulp tasks are available:\n\n  - ```gulp build```: copy and minify source file into the ```dist``` folder\n  - ```gulp test```: run all tests once against the ```dist``` folder contents\n  - ```gulp develop```: automatically run ```build``` task and jshint reporting when source file is saved, run tests when test files are saved or the ```dist``` folder content changes\n\n\u003cbr /\u003e\nBecause of how the appcache works, you will need to clear the browser cache whenever changing filenames or including new files in the ```index-with-appcache.html``` file.\n\n  - to clear the cache, temporarily move or rename the ```test/test.appcache``` file and run ```gulp test``` once. When PhantomJS requests the manifest file, it will get a 404 response and delete the cache.\n  - alternatively, see the guide [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache#Storage_location_and_clearing_the_offline_cache) for instructions on how to clear the cache on desktop browsers.\n\nPhantomJS does not currently offer any alternatives to the first approach (moving the manifest file), so changes are a bit cumbersome.\n\n\u003cbr /\u003e\n## License\n\nEverything is covered by the MIT license, so wear it, share it, tear it and throw it away.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbitbot%2Fng-appcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forbitbot%2Fng-appcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbitbot%2Fng-appcache/lists"}