{"id":18285444,"url":"https://github.com/fancymax/xmlhttprequest","last_synced_at":"2025-04-09T06:16:45.824Z","repository":{"id":215163024,"uuid":"117981225","full_name":"fancymax/XMLHTTPRequest","owner":"fancymax","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-18T12:51:50.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T00:32:47.954Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/fancymax.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-01-18T12:41:04.000Z","updated_at":"2020-08-07T09:05:53.000Z","dependencies_parsed_at":"2024-01-02T21:59:02.736Z","dependency_job_id":"3772c346-062d-4a39-b99a-b70c4a33797d","html_url":"https://github.com/fancymax/XMLHTTPRequest","commit_stats":null,"previous_names":["fancymax/xmlhttprequest"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancymax%2FXMLHTTPRequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancymax%2FXMLHTTPRequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancymax%2FXMLHTTPRequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancymax%2FXMLHTTPRequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fancymax","download_url":"https://codeload.github.com/fancymax/XMLHTTPRequest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"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-11-05T13:16:42.816Z","updated_at":"2025-04-09T06:16:45.803Z","avatar_url":"https://github.com/fancymax.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XMLHTTPRequest\n\nIn iOS 7, Apple introduced the possibility to [execute JavaScript via the JavaScriptCore JavaScript \nengine] (http://nshipster.com/javascriptcore/). Unfortunately, JavaScriptCore is missing some \nobjects and functions a JavaScript environment of a browser would have. Especially the\n`XMLHttpRequest` (see the [Mozilla documentation]\n(https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object needed for AJAX requests\nis not provided by JavaScriptCore. This library implements this missing object, so it is possible to \nuse JavaScript libraries which were originally developed for in-browser use in your Objective-C \n(or Swift) application without the need to use a hidden WebView.\n \n \n## Provided functions\nThis library tries to implement the full XMLHttpRequest specification. Currently not all\nfunctionality is implemented yet. The current limitations are:\n\n* Synchronous calls are not supported.\n* The `onload` and `onerror` callbacks are currently not supported.\n* The `upload` callback is currently not supported.\n* The `timeout` property is currently not supported.\n\nIt is planned to support all functionality of the HTML5 specification at some point.\n\n## How to use it\nCreate a new instance of the `XMLHTTPRequest` class. Then call the `extend:` method and pass either\na `JSContext` instance or a `JSValue` instance. The given object will be extend with the \n`XMLHTTPRequest` object.\n \n```objc\n#import \u003cXMLHTTPRequest/XMLHTTPRequest.h\u003e\n\n...\n\nJSContext *jsContext = [JSContext new];\nXMLHttpRequest *xmlHttpRequest = [XMLHttpRequest new];\n[xmlHttpRequest extend:jsContext];\n```\n\nThe JavaScript context now has a XMLHTTPRequest object you can use like the object found in\nbrowsers. Example (JavaScript):\n\n```JavaScript\nrequest.open('GET', 'http://example.com');\nrequest.setRequestHeader('Accept', 'text/html');\nrequest.setRequestHeader('X-Foo', 'bar');\nrequest.send();\n```\n\n### More Stuff\n\nIf you are interested in more polyfills for missing browser functionality in JavaScriptCore, there is\na window timers implementation (`setTimeout`, `setInterval`, ...) called [WindowTimers]\n(https://github.com/Lukas-Stuehrk/WindowTimers).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancymax%2Fxmlhttprequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffancymax%2Fxmlhttprequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancymax%2Fxmlhttprequest/lists"}