{"id":17991395,"url":"https://github.com/jareware/jsoncache","last_synced_at":"2025-06-12T02:39:28.810Z","repository":{"id":66707954,"uuid":"2106281","full_name":"jareware/JSONCache","owner":"jareware","description":"HTML5's localStorage caching layer for fetching JSON data with jQuery.","archived":false,"fork":false,"pushed_at":"2011-08-04T05:13:11.000Z","size":303,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-07T23:56:25.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/jareware.png","metadata":{"files":{"readme":"README.rst","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":"2011-07-26T10:33:28.000Z","updated_at":"2021-09-26T08:29:36.000Z","dependencies_parsed_at":"2023-02-20T09:35:19.829Z","dependency_job_id":null,"html_url":"https://github.com/jareware/JSONCache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jareware/JSONCache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2FJSONCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2FJSONCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2FJSONCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2FJSONCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jareware","download_url":"https://codeload.github.com/jareware/JSONCache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2FJSONCache/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259384177,"owners_count":22849209,"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-29T19:21:41.492Z","updated_at":"2025-06-12T02:39:28.767Z","avatar_url":"https://github.com/jareware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========\nJSONCache\n=========\n\nJSONCache is a caching layer for fetching JSON data with jQuery. It\nuses HTML5's window.localStorage to cache fetched JSON data to avoid\nunnecessary network requests.\n\nThe primary goal of the library is to minimize network requests for\nmobile devices.\n\nRequirements\n------------\n\n- jQuery (versions ?)\n\n- JSON.parse and JSON.stringify (available in the latest browsers or\n  e.g. with json2.js available at\n  https://github.com/douglascrockford/JSON-js)\n\n- window.localStorage (available in the latest browsers)\n\nUsage\n-----\n\n1. Make sure you have all the requirements.\n\n2. Download the minified jsoncache-{version}.min.js file and include\n   it on your page:\n\n3. Use the JSONCache.getCachedJSON function instead of jQuery.getJSON\n   to fetch your data:\n\nJSONCache.getCachedJSON attempts to provide the same API as the\njQuery.ajax function.\n\nBasic example:\n\n::\n\n    JSONCache.getCachedJSON('http://example.com/data.json', {\n        success: function (data) {\n            // handle data\n        }\n    });\n\nExample with error hooks to display status info to user:\n\n::\n\n    // Message container to show info to user.\n    var message = $('#message');\n\n    JSONCache.getCachedJSON(\n        onerror: function (jqXHR, textStatus, errorThrown, tryNumber) {\n            message.text('Failed fetch number ' + tryNumber + '. Trying again...');\n        },\n        ongiveup: function (status) {\n            message.text('Network failure, cannot fetch data.');\n        },\n        success: function (data) {\n            message.text('Data fetched successfully!');\n        }\n    );\n\nTesting\n-------\n\nJSONCache test suite uses Jasmine (\nhttps://github.com/pivotal/jasmine/wiki ) for its test framework. The\ntests can be run by typing:\n\n::\n\n    make test # for dev and production\n    make test_dev # for dev\n    make test_prop # for production\n\nThe command line test runner uses PhantomJS (\nhttp://www.phantomjs.org/ ). The tests can also be run by opening the\n`tests/index.html` in a browser and clicking on the jasmine test\nlinks.\n\nOld QUnit tests are still available in the same index.html.\n\nTODO\n----\n\n- Removing old entries based on cache size.\n\n  - Have to keep track of the cache size.\n\n  - Remove oldest entries based on timestamp.\n\n  - Catch browser quota errors (only supported on some browsers.)\n\n- Add better support for user defined error handling.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjareware%2Fjsoncache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjareware%2Fjsoncache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjareware%2Fjsoncache/lists"}