{"action":"created","issue":{"url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2299","labels_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2299/labels{/name}","comments_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2299/comments","events_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2299/events","html_url":"https://github.com/greasemonkey/greasemonkey/issues/2299","id":111050241,"number":2299,"title":"Refactor GM_API","user":{"login":"KOLANICH","id":240344,"avatar_url":"https://avatars.githubusercontent.com/u/240344?v=3","gravatar_id":"","url":"https://api.github.com/users/KOLANICH","html_url":"https://github.com/KOLANICH","followers_url":"https://api.github.com/users/KOLANICH/followers","following_url":"https://api.github.com/users/KOLANICH/following{/other_user}","gists_url":"https://api.github.com/users/KOLANICH/gists{/gist_id}","starred_url":"https://api.github.com/users/KOLANICH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KOLANICH/subscriptions","organizations_url":"https://api.github.com/users/KOLANICH/orgs","repos_url":"https://api.github.com/users/KOLANICH/repos","events_url":"https://api.github.com/users/KOLANICH/events{/privacy}","received_events_url":"https://api.github.com/users/KOLANICH/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-12T20:32:27Z","updated_at":"2015-10-13T13:16:30Z","closed_at":null,"body":"Hello. I think the GM_API is obsolete and needs refactoring.\r\n* Instead of implementing own API the HTML5 one should be sanitized and reused.\r\n * [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) should be allowed xdomain requests\r\n * [WebNotifications API](https://developer.mozilla.org/en-US/docs/Web/API/notification) should be adopted\r\n * for a storage we should use WebStorage and IndexedDB, like is done in WebExtensions\r\n* I suggest to drop prefix and create a GM namespace for the rest of API\r\n* metadata block should be accessible as `GM.metadata`\r\n* [resources should be accessible through `GM.resources[resourceName]`, and the type of resource should be taken in account](https://github.com/scriptish/scriptish/issues/227)\r\n *  for js files their text should be available, and if it is a module, the result of `import` should be available as ```GM.modules[moduleName]```\r\n * for JSON files they should be parsed and the resulting object should be available\r\n * for audio, video and graphics it should give their objects (Video, Audio and Image)\r\n * for stylesheets it should give [their object](https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet), also they should have a method to easily inject them\r\n * for another mime types we need to have a way to add a custom preprocessor\r\n * all the resources should be loaded and processed lazily"},"comment":{"url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/comments/147710936","html_url":"https://github.com/greasemonkey/greasemonkey/issues/2299#issuecomment-147710936","issue_url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/2299","id":147710936,"user":{"login":"arantius","id":84729,"avatar_url":"https://avatars.githubusercontent.com/u/84729?v=3","gravatar_id":"","url":"https://api.github.com/users/arantius","html_url":"https://github.com/arantius","followers_url":"https://api.github.com/users/arantius/followers","following_url":"https://api.github.com/users/arantius/following{/other_user}","gists_url":"https://api.github.com/users/arantius/gists{/gist_id}","starred_url":"https://api.github.com/users/arantius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arantius/subscriptions","organizations_url":"https://api.github.com/users/arantius/orgs","repos_url":"https://api.github.com/users/arantius/repos","events_url":"https://api.github.com/users/arantius/events{/privacy}","received_events_url":"https://api.github.com/users/arantius/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T13:16:29Z","updated_at":"2015-10-13T13:16:29Z","body":"The benefit is quite small, and the cost (every script breaks) is high.  Not likely.  If you want to use web APIs, just `@grant none` and they work."}}