[{"data":1,"prerenderedAt":254},["ShallowReactive",2],{"project-9133067":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":44,"post_text":45,"what":46,"said":73,"maker_in_thread":150,"shape":157,"grid":161,"attempts":215,"same_week":216,"maker_shows":41,"maker_hidden":246,"reader_version":247,"card":248},"9133067","Xr","A modern ES6 Promise-based XMLHttpRequest wrapper","title","Show HN: Xr – A modern ES6 Promise-based XMLHttpRequest wrapper","https:\u002F\u002Fgithub.com\u002Fradiosilence\u002Fxr","github.com","antihero",1425317349,2015,32,22,870,2565,34,"shown","languages","javascript library","library",[24,25,26,27],"xmlhttprequest wrapper","promise ajax","javascript http","es6 promises","roasted",-0.429,{"positive":31,"neutral":32,"mixed":31,"critical":33},0,4,7,11,{"design":36,"idea":38,"execution":40,"docs":42,"performance":43},{"positive":31,"critical":37},2,{"positive":31,"critical":39},1,{"positive":31,"critical":41},3,{"positive":31,"critical":39},{"positive":31,"critical":31},[31,31,39,31,31,39,31,39,31,41,31,39,31,39,41,39,41,31,39,31,41,31],null,{"problem":47,"audience":45,"pricing":45,"motivation":54,"time_to_build":45,"stack":58,"openness":71,"stage":72,"team_size":72},{"value":48,"source":49,"evidence":50},"Making AJAX requests with XMLHttpRequest is verbose; no tiny promise-based library with sane defaults existed","maker",[51],{"id":52,"by":11,"text":53},"9133101","Hello, author here. I thought I'd make this because I couldn't find a library that was tiny, and opinionated about using promises and sane defaults (JSON headers, for instance),…",{"value":55,"source":49,"evidence":56},"Couldn't find a tiny, opinionated promise-based XHR library with sane defaults like JSON headers",[57],{"id":52,"by":11,"text":53},[59,63,67],{"value":60,"source":49,"evidence":61},"JavaScript (ES6)",[62],{"id":52,"by":11,"text":53},{"value":64,"source":49,"evidence":65},"XMLHttpRequest",[66],{"id":52,"by":11,"text":53},{"value":68,"source":49,"evidence":69},"Promises",[70],{"id":52,"by":11,"text":53},"open_source","unknown",{"praise":74,"objections":89,"requests":111,"questions":123,"alternatives":138},[75,81],{"value":76,"source":49,"evidence":77},"Nice tiny dependency that makes AJAX requests nicer",[78],{"id":79,"by":11,"text":80},"9133198","Yep, had a play around with fetch but it didn't seem ready and acted kind of weird. Can't remember exactly what was wrong as it was a while ago. I imagine once fetch is decent,…",{"value":82,"source":83,"evidence":84},"Looks awesome","commenter",[85],{"id":86,"by":87,"text":88},"9133225","VeejayRampay","Looks awesome, though the name fetch does work better for GET requests than for POST\u002FPUT\u002FPATCH\u002FDELETE.",[90,100,107],{"value":91,"source":83,"evidence":92},"Rejects on any non-200 status, though 2xx codes like 201, 202 and 204 are success",[93,97],{"id":94,"by":95,"text":96},"9133170","pimlottc","> * Rejects if not 200. There are other valid 20x return codes that indicate success, such as 202 Accepted and 204 No Content.",{"id":98,"by":87,"text":99},"9133232","Isn't 201 the code for a successful resource creation as well?",{"value":101,"source":83,"evidence":102},"Giant options object API is hard to compose",[103],{"id":104,"by":105,"text":106},"9134002","Touche","Really sad they choose \"giant options object\" for the api. Makes it pretty difficult to compose.",{"value":108,"source":83,"evidence":109},"Name fetch fits GET better than other methods",[110],{"id":86,"by":87,"text":88},[112,116],{"value":113,"source":83,"evidence":114},"Accept all 2xx status codes instead of only 200",[115],{"id":94,"by":95,"text":96},{"value":117,"source":83,"evidence":118},"Reject when the loader throws, such as on malformed JSON",[119],{"id":120,"by":121,"text":122},"9135867","breuleux","Pretty cool, but I have a nitpick: reject() should be called when the loader throws an exception (e.g. if the response is malformed JSON).",[124,131],{"value":125,"source":83,"evidence":126},"Should the library use fetch instead",[127],{"id":128,"by":129,"text":130},"9133181","vjeux","You should look at `fetch` which is the new specification for a promise based XHR wrapper. Polyfill: https:\u002F\u002Fgithub.com\u002Fgithub\u002Ffetch To use Fetch in Firefox (38), you'll…",{"value":132,"source":83,"evidence":133},"Does the XHR get garbage collected after .then",[134],{"id":135,"by":136,"text":137},"9134589","rayshan","What happens after .then? Does xhr get GC'd? Would the inner xhr be considered out of scope?",[139,143],{"value":140,"source":83,"evidence":141},"fetch API with github polyfill",[142],{"id":128,"by":129,"text":130},{"value":144,"source":83,"evidence":145},"axios",[146],{"id":147,"by":148,"text":149},"9133141","pseudobry","Have you seen https:\u002F\u002Fgithub.com\u002Fmzabriskie\u002Faxios?",{"comments":33,"answered":37,"key":151},[152,153,154],{"id":79,"text":80},{"id":52,"text":53},{"id":155,"text":156},"9133156","Haven't seen it, no. Looks neat, but a bit more complex than what I was going for. This is basically a nicer interface to XHR, intended for people who are happy to read up on the…",{"commenters":158,"max_depth":41,"maker_replies":33,"first_comment_mins":159,"lifespan_hours":160},15,5,128,[162,164,166,168,172,175,176,179,183,185,186,188,190,193,194,198,202,205,208,209,211,213],[128,31,31,163,129,31],"commenter\u002Fneutral\u002Fidea",[79,31,31,165,11,39],"project\u002Fpositive\u002Fidea",[86,31,39,167,87,31],"project\u002Fcritical\u002Fdesign",[169,31,31,170,171,31],"9133269","commenter\u002Fneutral\u002Fdesign","itsbits",[173,31,31,170,174,31],"9133414","gobengo",[104,31,39,167,105,31],[177,31,31,170,178,31],"9134081","frio",[180,31,39,181,182,31],"9164091","project\u002Fcritical\u002Fidea","sonnyp",[52,39,31,184,11,39],"project\u002Fneutral\u002Fidea",[147,39,41,184,148,31],[155,39,31,187,11,39],"maker\u002Fneutral\u002Fidea",[94,37,39,189,95,31],"project\u002Fcritical\u002Fexecution",[191,37,31,192,11,39],"9133215","maker\u002Fneutral\u002Fexecution",[98,37,39,189,87,31],[195,37,41,196,197,31],"9133385","project\u002Fneutral\u002Fexecution","glenjamin",[199,37,39,200,201,31],"9133460","project\u002Fcritical\u002Fdocs","Igglyboo",[203,41,41,184,204,31],"9133804","bsimpson",[206,41,31,207,11,39],"9134178","maker\u002Fneutral\u002Fnone",[120,32,39,189,121,31],[210,32,31,192,11,39],"9136599",[135,159,41,212,136,31],"project\u002Fneutral\u002Fperformance",[214,159,31,207,11,39],"9136601",[],[217,222,226,231,236,241],{"id":218,"name":219,"points":220,"category":221},"9144271","OpenLoopz",373,"productivity",{"id":223,"name":224,"points":225,"category":221},"9145007","Ghostnote",301,{"id":227,"name":228,"points":229,"category":230},"9131706","Circles, Sines & Signals",293,"learning_science",{"id":232,"name":233,"points":234,"category":235},"9112803","GitHub Awards",137,"dev_tools",{"id":237,"name":238,"points":239,"category":240},"9117238","grack.com",134,"creative",{"id":242,"name":243,"points":244,"category":245},"9118491","Paz",90,"infrastructure",false,"v2",{"id":249,"name":5,"line":6,"ai":246,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":250,"top":18,"kw":251,"maker":11,"domain":10,"tier":19,"attempts":31,"strip":252,"url":9,"mix":253,"praise":76,"objection":91,"sub":21},9133067,-0.43,[24,25,26,27],"0010010103010131301030",[31,32,31,33],1793990921038]