[{"data":1,"prerenderedAt":75526},["ShallowReactive",2],{"article_list_js_":3},[4,3520,11177,11659,12434,13045,15894,16593,20335,21711,25031,31097,31459,31621,33712,34845,36532,42374,45018,46569,51398,54071,56907,59331,60125,70229,73626],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"excerpt":10,"tags":11,"image":15,"publishDate":16,"body":17,"_type":3511,"_id":3512,"_source":3513,"_file":3514,"_stem":3515,"_extension":3516,"author":3517},"/ckeefer/2024-7/vpubsub","2024-7",false,"","Vue 3 Pub / Sub: All aboard the (event) bus","We like Vue at A+L. We think it's one of the best frontend frameworks, and a great choice pretty much anywhere you might otherwise be tempted to use React.",[12,13,14],"js","vue","pub/sub","/ckeefer/2024-7/img/event_bus.png","2024-08-15",{"type":18,"children":19,"toc":3495},"root",[20,45,50,57,79,84,99,104,134,139,144,149,163,169,192,199,583,589,610,928,934,954,1072,1078,1091,1466,1485,1491,1496,1502,1515,1600,1613,1753,1758,1897,1902,1938,1965,1970,2823,2872,2877,2890,3407,3413,3456,3462,3467,3489],{"type":21,"tag":22,"props":23,"children":24},"element","p",{},[25,28,35,37,43],{"type":26,"value":27},"text","We ",{"type":21,"tag":29,"props":30,"children":32},"a",{"href":31},"/search/user:ckeefer/why/vue",[33],{"type":26,"value":34},"like Vue at A+L",{"type":26,"value":36},". We think it's ",{"type":21,"tag":29,"props":38,"children":40},{"href":39},"/search/user:phendry/frontend/frameworks/in/2024",[41],{"type":26,"value":42},"one of the best frontend frameworks",{"type":26,"value":44},", and a great choice pretty much anywhere you might otherwise be tempted to use React.",{"type":21,"tag":22,"props":46,"children":47},{},[48],{"type":26,"value":49},"That said, it's not going to solve every need out of the box. Its robust ecosystem is actually one of its strongest points; chances are that a decent option (or more than one) exists to satisfy a variety of common needs. Let's talk today about our own contribution to this flourishing ecosystem, and why you'd want to use it.",{"type":21,"tag":51,"props":52,"children":54},"h3",{"id":53},"hit-that-subscribe-button",[55],{"type":26,"value":56},"Hit That Subscribe Button",{"type":21,"tag":22,"props":58,"children":59},{},[60,62,69,71,77],{"type":26,"value":61},"In Vue, you've probably run into cases where you need one component to know about some event, or gain access to some bit of data, that's sequestered off in another component. If they were in relationship with one another - parent -> child, or grandparent -> parent -> child, etc., you could ",{"type":21,"tag":63,"props":64,"children":66},"code",{"className":65},[],[67],{"type":26,"value":68},"$emit",{"type":26,"value":70}," an event; and you can send data back down the other way through ",{"type":21,"tag":63,"props":72,"children":74},{"className":73},[],[75],{"type":26,"value":76},"props",{"type":26,"value":78}," (although this can sometimes be a little awkward). Crossing from one unrelated component to another, though, is a problem Vue isn't going to directly help you with.",{"type":21,"tag":22,"props":80,"children":81},{},[82],{"type":26,"value":83},"We don't want to couple our disparate components though, by directly sharing data or having one call the other - that's nasty design that limits their flexibility and reusability.",{"type":21,"tag":22,"props":85,"children":86},{},[87,89,97],{"type":26,"value":88},"One way we can solve this conundrum is with data stores, like vuex or ",{"type":21,"tag":29,"props":90,"children":94},{"href":91,"rel":92},"https://pinia.vuejs.org/",[93],"nofollow",[95],{"type":26,"value":96},"pinia",{"type":26,"value":98}," - we've been using the latter to good effect. There's an upcoming article there - but this isn't that one.",{"type":21,"tag":22,"props":100,"children":101},{},[102],{"type":26,"value":103},"In this one, let's talk about another way we can communicate between disparate components: the event bus, or rather it's older cousin, the Publish / Subscribe pattern.",{"type":21,"tag":22,"props":105,"children":106},{},[107,109,116,118,124,126,132],{"type":26,"value":108},"The ",{"type":21,"tag":29,"props":110,"children":113},{"href":111,"rel":112},"https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern",[93],[114],{"type":26,"value":115},"Publish/Subscribe pattern",{"type":26,"value":117}," allows you to ",{"type":21,"tag":63,"props":119,"children":121},{"className":120},[],[122],{"type":26,"value":123},"subscribe",{"type":26,"value":125}," to messages of interest, and ",{"type":21,"tag":63,"props":127,"children":129},{"className":128},[],[130],{"type":26,"value":131},"publish",{"type":26,"value":133}," those same messages from elsewhere within your application - your subscribers then receive these messages (via callback functions).",{"type":21,"tag":22,"props":135,"children":136},{},[137],{"type":26,"value":138},"If you're not familiar with this pattern, it's a very flexible form of event handling. It allows communications between different components or services while keeping them decoupled - the publisher of an event never needs to know the identity of any potential subscribers, and vice-versa.",{"type":21,"tag":22,"props":140,"children":141},{},[142],{"type":26,"value":143},"Keeping components of your application from being tightly coupled is generally good design, but you'll need to consider whether it's appropriate and helpful in your particular use-case - no tool is always the right tool, not every problem is a nail in want of a hammer. Pub/sub can become a problem in a complex application where events are coming in hot-and-heavy, because it can be difficult to track down just where any given event is coming from.",{"type":21,"tag":22,"props":145,"children":146},{},[147],{"type":26,"value":148},"You should be careful in making events easily referenceable (e.g. don't use a bare string as your key, have a central place where all event names are visible and importable from), and opt for single-hops as often as possible (e.g. avoid having an event publication trigger a subscriber to publish another event which causes a subscriber to publish another event, etc. - instead, have a single publication trigger subscribers, without allowing the subscribers to publish their own events in turn).",{"type":21,"tag":22,"props":150,"children":151},{},[152,154,161],{"type":26,"value":153},"If you know pub/sub is what you need, or you're considering it, you may want to check out our plugin, ",{"type":21,"tag":29,"props":155,"children":158},{"href":156,"rel":157},"https://www.npmjs.com/package/vpubsub",[93],[159],{"type":26,"value":160},"VPubSub",{"type":26,"value":162},". You can use it with or without Vue; and if you use it with Vue, it does a little extra magic to make your life easier. Let's dive in.",{"type":21,"tag":51,"props":164,"children":166},{"id":165},"how-does-it-work",[167],{"type":26,"value":168},"How Does It Work?",{"type":21,"tag":22,"props":170,"children":171},{},[172,174,181,183,190],{"type":26,"value":173},"Let's look at some common and uncommon use-cases, both in general, and then including Vue - both with the ",{"type":21,"tag":29,"props":175,"children":178},{"href":176,"rel":177},"https://vuejs.org/api/#options-api",[93],[179],{"type":26,"value":180},"Options API",{"type":26,"value":182},", and the ",{"type":21,"tag":29,"props":184,"children":187},{"href":185,"rel":186},"https://vuejs.org/api/#composition-api",[93],[188],{"type":26,"value":189},"Composition API",{"type":26,"value":191},":",{"type":21,"tag":193,"props":194,"children":196},"h4",{"id":195},"subscribe-to-a-single-event",[197],{"type":26,"value":198},"Subscribe to a single event",{"type":21,"tag":200,"props":201,"children":204},"pre",{"className":202,"code":203,"language":12,"meta":8,"style":8},"language-js shiki shiki-themes github-light github-dark","import {vent} from \"vpubsub\";\n\nconst EVENTS = {\n    PLAYER:{\n        START:'start.player',\n        END:'end.player',\n    }\n};\n\nvent.on(EVENTS.PLAYER.START, (arg1, arg2, ...rst) => {\n    // Do something useful with the event and arguments.\n    // The arguments will be whatever was passed during the call to `trigger`.\n});\n\n// ... elsewhere in your application ...\nvent.trigger(EVENTS.PLAYER.START, 'event', 'args', 40, 'or', 'as', 'many as you like',)\n",[205],{"type":21,"tag":63,"props":206,"children":207},{"__ignoreMap":8},[208,242,252,277,286,305,323,332,341,349,442,452,461,470,478,487],{"type":21,"tag":209,"props":210,"children":213},"span",{"class":211,"line":212},"line",1,[214,220,226,231,237],{"type":21,"tag":209,"props":215,"children":217},{"style":216},"--shiki-default:#D73A49;--shiki-dark:#F97583",[218],{"type":26,"value":219},"import",{"type":21,"tag":209,"props":221,"children":223},{"style":222},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[224],{"type":26,"value":225}," {vent} ",{"type":21,"tag":209,"props":227,"children":228},{"style":216},[229],{"type":26,"value":230},"from",{"type":21,"tag":209,"props":232,"children":234},{"style":233},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[235],{"type":26,"value":236}," \"vpubsub\"",{"type":21,"tag":209,"props":238,"children":239},{"style":222},[240],{"type":26,"value":241},";\n",{"type":21,"tag":209,"props":243,"children":245},{"class":211,"line":244},2,[246],{"type":21,"tag":209,"props":247,"children":249},{"emptyLinePlaceholder":248},true,[250],{"type":26,"value":251},"\n",{"type":21,"tag":209,"props":253,"children":255},{"class":211,"line":254},3,[256,261,267,272],{"type":21,"tag":209,"props":257,"children":258},{"style":216},[259],{"type":26,"value":260},"const",{"type":21,"tag":209,"props":262,"children":264},{"style":263},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[265],{"type":26,"value":266}," EVENTS",{"type":21,"tag":209,"props":268,"children":269},{"style":216},[270],{"type":26,"value":271}," =",{"type":21,"tag":209,"props":273,"children":274},{"style":222},[275],{"type":26,"value":276}," {\n",{"type":21,"tag":209,"props":278,"children":280},{"class":211,"line":279},4,[281],{"type":21,"tag":209,"props":282,"children":283},{"style":222},[284],{"type":26,"value":285},"    PLAYER:{\n",{"type":21,"tag":209,"props":287,"children":289},{"class":211,"line":288},5,[290,295,300],{"type":21,"tag":209,"props":291,"children":292},{"style":222},[293],{"type":26,"value":294},"        START:",{"type":21,"tag":209,"props":296,"children":297},{"style":233},[298],{"type":26,"value":299},"'start.player'",{"type":21,"tag":209,"props":301,"children":302},{"style":222},[303],{"type":26,"value":304},",\n",{"type":21,"tag":209,"props":306,"children":308},{"class":211,"line":307},6,[309,314,319],{"type":21,"tag":209,"props":310,"children":311},{"style":222},[312],{"type":26,"value":313},"        END:",{"type":21,"tag":209,"props":315,"children":316},{"style":233},[317],{"type":26,"value":318},"'end.player'",{"type":21,"tag":209,"props":320,"children":321},{"style":222},[322],{"type":26,"value":304},{"type":21,"tag":209,"props":324,"children":326},{"class":211,"line":325},7,[327],{"type":21,"tag":209,"props":328,"children":329},{"style":222},[330],{"type":26,"value":331},"    }\n",{"type":21,"tag":209,"props":333,"children":335},{"class":211,"line":334},8,[336],{"type":21,"tag":209,"props":337,"children":338},{"style":222},[339],{"type":26,"value":340},"};\n",{"type":21,"tag":209,"props":342,"children":344},{"class":211,"line":343},9,[345],{"type":21,"tag":209,"props":346,"children":347},{"emptyLinePlaceholder":248},[348],{"type":26,"value":251},{"type":21,"tag":209,"props":350,"children":352},{"class":211,"line":351},10,[353,358,364,369,374,379,384,388,393,398,404,409,414,418,423,428,433,438],{"type":21,"tag":209,"props":354,"children":355},{"style":222},[356],{"type":26,"value":357},"vent.",{"type":21,"tag":209,"props":359,"children":361},{"style":360},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[362],{"type":26,"value":363},"on",{"type":21,"tag":209,"props":365,"children":366},{"style":222},[367],{"type":26,"value":368},"(",{"type":21,"tag":209,"props":370,"children":371},{"style":263},[372],{"type":26,"value":373},"EVENTS",{"type":21,"tag":209,"props":375,"children":376},{"style":222},[377],{"type":26,"value":378},".",{"type":21,"tag":209,"props":380,"children":381},{"style":263},[382],{"type":26,"value":383},"PLAYER",{"type":21,"tag":209,"props":385,"children":386},{"style":222},[387],{"type":26,"value":378},{"type":21,"tag":209,"props":389,"children":390},{"style":263},[391],{"type":26,"value":392},"START",{"type":21,"tag":209,"props":394,"children":395},{"style":222},[396],{"type":26,"value":397},", (",{"type":21,"tag":209,"props":399,"children":401},{"style":400},"--shiki-default:#E36209;--shiki-dark:#FFAB70",[402],{"type":26,"value":403},"arg1",{"type":21,"tag":209,"props":405,"children":406},{"style":222},[407],{"type":26,"value":408},", ",{"type":21,"tag":209,"props":410,"children":411},{"style":400},[412],{"type":26,"value":413},"arg2",{"type":21,"tag":209,"props":415,"children":416},{"style":222},[417],{"type":26,"value":408},{"type":21,"tag":209,"props":419,"children":420},{"style":216},[421],{"type":26,"value":422},"...",{"type":21,"tag":209,"props":424,"children":425},{"style":400},[426],{"type":26,"value":427},"rst",{"type":21,"tag":209,"props":429,"children":430},{"style":222},[431],{"type":26,"value":432},") ",{"type":21,"tag":209,"props":434,"children":435},{"style":216},[436],{"type":26,"value":437},"=>",{"type":21,"tag":209,"props":439,"children":440},{"style":222},[441],{"type":26,"value":276},{"type":21,"tag":209,"props":443,"children":445},{"class":211,"line":444},11,[446],{"type":21,"tag":209,"props":447,"children":449},{"style":448},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[450],{"type":26,"value":451},"    // Do something useful with the event and arguments.\n",{"type":21,"tag":209,"props":453,"children":455},{"class":211,"line":454},12,[456],{"type":21,"tag":209,"props":457,"children":458},{"style":448},[459],{"type":26,"value":460},"    // The arguments will be whatever was passed during the call to `trigger`.\n",{"type":21,"tag":209,"props":462,"children":464},{"class":211,"line":463},13,[465],{"type":21,"tag":209,"props":466,"children":467},{"style":222},[468],{"type":26,"value":469},"});\n",{"type":21,"tag":209,"props":471,"children":473},{"class":211,"line":472},14,[474],{"type":21,"tag":209,"props":475,"children":476},{"emptyLinePlaceholder":248},[477],{"type":26,"value":251},{"type":21,"tag":209,"props":479,"children":481},{"class":211,"line":480},15,[482],{"type":21,"tag":209,"props":483,"children":484},{"style":448},[485],{"type":26,"value":486},"// ... elsewhere in your application ...\n",{"type":21,"tag":209,"props":488,"children":490},{"class":211,"line":489},16,[491,495,500,504,508,512,516,520,524,528,533,537,542,546,551,555,560,564,569,573,578],{"type":21,"tag":209,"props":492,"children":493},{"style":222},[494],{"type":26,"value":357},{"type":21,"tag":209,"props":496,"children":497},{"style":360},[498],{"type":26,"value":499},"trigger",{"type":21,"tag":209,"props":501,"children":502},{"style":222},[503],{"type":26,"value":368},{"type":21,"tag":209,"props":505,"children":506},{"style":263},[507],{"type":26,"value":373},{"type":21,"tag":209,"props":509,"children":510},{"style":222},[511],{"type":26,"value":378},{"type":21,"tag":209,"props":513,"children":514},{"style":263},[515],{"type":26,"value":383},{"type":21,"tag":209,"props":517,"children":518},{"style":222},[519],{"type":26,"value":378},{"type":21,"tag":209,"props":521,"children":522},{"style":263},[523],{"type":26,"value":392},{"type":21,"tag":209,"props":525,"children":526},{"style":222},[527],{"type":26,"value":408},{"type":21,"tag":209,"props":529,"children":530},{"style":233},[531],{"type":26,"value":532},"'event'",{"type":21,"tag":209,"props":534,"children":535},{"style":222},[536],{"type":26,"value":408},{"type":21,"tag":209,"props":538,"children":539},{"style":233},[540],{"type":26,"value":541},"'args'",{"type":21,"tag":209,"props":543,"children":544},{"style":222},[545],{"type":26,"value":408},{"type":21,"tag":209,"props":547,"children":548},{"style":263},[549],{"type":26,"value":550},"40",{"type":21,"tag":209,"props":552,"children":553},{"style":222},[554],{"type":26,"value":408},{"type":21,"tag":209,"props":556,"children":557},{"style":233},[558],{"type":26,"value":559},"'or'",{"type":21,"tag":209,"props":561,"children":562},{"style":222},[563],{"type":26,"value":408},{"type":21,"tag":209,"props":565,"children":566},{"style":233},[567],{"type":26,"value":568},"'as'",{"type":21,"tag":209,"props":570,"children":571},{"style":222},[572],{"type":26,"value":408},{"type":21,"tag":209,"props":574,"children":575},{"style":233},[576],{"type":26,"value":577},"'many as you like'",{"type":21,"tag":209,"props":579,"children":580},{"style":222},[581],{"type":26,"value":582},",)\n",{"type":21,"tag":193,"props":584,"children":586},{"id":585},"subscribe-to-all-events-on-a-channel",[587],{"type":26,"value":588},"Subscribe to all events on a channel",{"type":21,"tag":22,"props":590,"children":591},{},[592,594,600,602,608],{"type":26,"value":593},"Did you notice the ",{"type":21,"tag":63,"props":595,"children":597},{"className":596},[],[598],{"type":26,"value":599},"event.channel",{"type":26,"value":601}," structure of the event name in our example above? All events within VPubSub belong to a ",{"type":21,"tag":63,"props":603,"children":605},{"className":604},[],[606],{"type":26,"value":607},"channel",{"type":26,"value":609}," - a way of organizing events together. This also allows us to perform operations on a channel-basis, like subscribe to all events for that channel.",{"type":21,"tag":200,"props":611,"children":613},{"className":202,"code":612,"language":12,"meta":8,"style":8},"import {vent} from \"vpubsub\";\n\nconst EVENTS = {\n    PLAYER:{\n        START:'start.player',\n        END:'end.player',\n    }\n};\n\n/**\n * Subscribers to wildcard events will receive the channelEvent as the last argument,\n * allowing for disambiguation within the handler.\n */\nvent.on('*.player', (arg1, arg2, ..., channelEvent) => {\n    switch(channelEvent){\n        case 'start.player':\n            break;\n        case 'end.player':\n            break;\n        default:\n            break;\n    }\n});\n",[614],{"type":21,"tag":63,"props":615,"children":616},{"__ignoreMap":8},[617,640,647,666,673,688,703,710,717,724,732,740,748,756,814,827,845,858,875,887,900,912,920],{"type":21,"tag":209,"props":618,"children":619},{"class":211,"line":212},[620,624,628,632,636],{"type":21,"tag":209,"props":621,"children":622},{"style":216},[623],{"type":26,"value":219},{"type":21,"tag":209,"props":625,"children":626},{"style":222},[627],{"type":26,"value":225},{"type":21,"tag":209,"props":629,"children":630},{"style":216},[631],{"type":26,"value":230},{"type":21,"tag":209,"props":633,"children":634},{"style":233},[635],{"type":26,"value":236},{"type":21,"tag":209,"props":637,"children":638},{"style":222},[639],{"type":26,"value":241},{"type":21,"tag":209,"props":641,"children":642},{"class":211,"line":244},[643],{"type":21,"tag":209,"props":644,"children":645},{"emptyLinePlaceholder":248},[646],{"type":26,"value":251},{"type":21,"tag":209,"props":648,"children":649},{"class":211,"line":254},[650,654,658,662],{"type":21,"tag":209,"props":651,"children":652},{"style":216},[653],{"type":26,"value":260},{"type":21,"tag":209,"props":655,"children":656},{"style":263},[657],{"type":26,"value":266},{"type":21,"tag":209,"props":659,"children":660},{"style":216},[661],{"type":26,"value":271},{"type":21,"tag":209,"props":663,"children":664},{"style":222},[665],{"type":26,"value":276},{"type":21,"tag":209,"props":667,"children":668},{"class":211,"line":279},[669],{"type":21,"tag":209,"props":670,"children":671},{"style":222},[672],{"type":26,"value":285},{"type":21,"tag":209,"props":674,"children":675},{"class":211,"line":288},[676,680,684],{"type":21,"tag":209,"props":677,"children":678},{"style":222},[679],{"type":26,"value":294},{"type":21,"tag":209,"props":681,"children":682},{"style":233},[683],{"type":26,"value":299},{"type":21,"tag":209,"props":685,"children":686},{"style":222},[687],{"type":26,"value":304},{"type":21,"tag":209,"props":689,"children":690},{"class":211,"line":307},[691,695,699],{"type":21,"tag":209,"props":692,"children":693},{"style":222},[694],{"type":26,"value":313},{"type":21,"tag":209,"props":696,"children":697},{"style":233},[698],{"type":26,"value":318},{"type":21,"tag":209,"props":700,"children":701},{"style":222},[702],{"type":26,"value":304},{"type":21,"tag":209,"props":704,"children":705},{"class":211,"line":325},[706],{"type":21,"tag":209,"props":707,"children":708},{"style":222},[709],{"type":26,"value":331},{"type":21,"tag":209,"props":711,"children":712},{"class":211,"line":334},[713],{"type":21,"tag":209,"props":714,"children":715},{"style":222},[716],{"type":26,"value":340},{"type":21,"tag":209,"props":718,"children":719},{"class":211,"line":343},[720],{"type":21,"tag":209,"props":721,"children":722},{"emptyLinePlaceholder":248},[723],{"type":26,"value":251},{"type":21,"tag":209,"props":725,"children":726},{"class":211,"line":351},[727],{"type":21,"tag":209,"props":728,"children":729},{"style":448},[730],{"type":26,"value":731},"/**\n",{"type":21,"tag":209,"props":733,"children":734},{"class":211,"line":444},[735],{"type":21,"tag":209,"props":736,"children":737},{"style":448},[738],{"type":26,"value":739}," * Subscribers to wildcard events will receive the channelEvent as the last argument,\n",{"type":21,"tag":209,"props":741,"children":742},{"class":211,"line":454},[743],{"type":21,"tag":209,"props":744,"children":745},{"style":448},[746],{"type":26,"value":747}," * allowing for disambiguation within the handler.\n",{"type":21,"tag":209,"props":749,"children":750},{"class":211,"line":463},[751],{"type":21,"tag":209,"props":752,"children":753},{"style":448},[754],{"type":26,"value":755}," */\n",{"type":21,"tag":209,"props":757,"children":758},{"class":211,"line":472},[759,763,767,771,776,780,784,788,792,797,802,806,810],{"type":21,"tag":209,"props":760,"children":761},{"style":222},[762],{"type":26,"value":357},{"type":21,"tag":209,"props":764,"children":765},{"style":360},[766],{"type":26,"value":363},{"type":21,"tag":209,"props":768,"children":769},{"style":222},[770],{"type":26,"value":368},{"type":21,"tag":209,"props":772,"children":773},{"style":233},[774],{"type":26,"value":775},"'*.player'",{"type":21,"tag":209,"props":777,"children":778},{"style":222},[779],{"type":26,"value":397},{"type":21,"tag":209,"props":781,"children":782},{"style":400},[783],{"type":26,"value":403},{"type":21,"tag":209,"props":785,"children":786},{"style":222},[787],{"type":26,"value":408},{"type":21,"tag":209,"props":789,"children":790},{"style":400},[791],{"type":26,"value":413},{"type":21,"tag":209,"props":793,"children":794},{"style":222},[795],{"type":26,"value":796},", ..., ",{"type":21,"tag":209,"props":798,"children":799},{"style":400},[800],{"type":26,"value":801},"channelEvent",{"type":21,"tag":209,"props":803,"children":804},{"style":222},[805],{"type":26,"value":432},{"type":21,"tag":209,"props":807,"children":808},{"style":216},[809],{"type":26,"value":437},{"type":21,"tag":209,"props":811,"children":812},{"style":222},[813],{"type":26,"value":276},{"type":21,"tag":209,"props":815,"children":816},{"class":211,"line":480},[817,822],{"type":21,"tag":209,"props":818,"children":819},{"style":216},[820],{"type":26,"value":821},"    switch",{"type":21,"tag":209,"props":823,"children":824},{"style":222},[825],{"type":26,"value":826},"(channelEvent){\n",{"type":21,"tag":209,"props":828,"children":829},{"class":211,"line":489},[830,835,840],{"type":21,"tag":209,"props":831,"children":832},{"style":216},[833],{"type":26,"value":834},"        case",{"type":21,"tag":209,"props":836,"children":837},{"style":233},[838],{"type":26,"value":839}," 'start.player'",{"type":21,"tag":209,"props":841,"children":842},{"style":222},[843],{"type":26,"value":844},":\n",{"type":21,"tag":209,"props":846,"children":848},{"class":211,"line":847},17,[849,854],{"type":21,"tag":209,"props":850,"children":851},{"style":216},[852],{"type":26,"value":853},"            break",{"type":21,"tag":209,"props":855,"children":856},{"style":222},[857],{"type":26,"value":241},{"type":21,"tag":209,"props":859,"children":861},{"class":211,"line":860},18,[862,866,871],{"type":21,"tag":209,"props":863,"children":864},{"style":216},[865],{"type":26,"value":834},{"type":21,"tag":209,"props":867,"children":868},{"style":233},[869],{"type":26,"value":870}," 'end.player'",{"type":21,"tag":209,"props":872,"children":873},{"style":222},[874],{"type":26,"value":844},{"type":21,"tag":209,"props":876,"children":878},{"class":211,"line":877},19,[879,883],{"type":21,"tag":209,"props":880,"children":881},{"style":216},[882],{"type":26,"value":853},{"type":21,"tag":209,"props":884,"children":885},{"style":222},[886],{"type":26,"value":241},{"type":21,"tag":209,"props":888,"children":890},{"class":211,"line":889},20,[891,896],{"type":21,"tag":209,"props":892,"children":893},{"style":216},[894],{"type":26,"value":895},"        default",{"type":21,"tag":209,"props":897,"children":898},{"style":222},[899],{"type":26,"value":844},{"type":21,"tag":209,"props":901,"children":903},{"class":211,"line":902},21,[904,908],{"type":21,"tag":209,"props":905,"children":906},{"style":216},[907],{"type":26,"value":853},{"type":21,"tag":209,"props":909,"children":910},{"style":222},[911],{"type":26,"value":241},{"type":21,"tag":209,"props":913,"children":915},{"class":211,"line":914},22,[916],{"type":21,"tag":209,"props":917,"children":918},{"style":222},[919],{"type":26,"value":331},{"type":21,"tag":209,"props":921,"children":923},{"class":211,"line":922},23,[924],{"type":21,"tag":209,"props":925,"children":926},{"style":222},[927],{"type":26,"value":469},{"type":21,"tag":193,"props":929,"children":931},{"id":930},"subscribe-to-all-events",[932],{"type":26,"value":933},"Subscribe to all events",{"type":21,"tag":22,"props":935,"children":936},{},[937,939,945,947,952],{"type":26,"value":938},"While not recommended, you can add a subscriber to all events by subscribing to the wildcard ",{"type":21,"tag":63,"props":940,"children":942},{"className":941},[],[943],{"type":26,"value":944},"*",{"type":26,"value":946}," event on the wildcard ",{"type":21,"tag":63,"props":948,"children":950},{"className":949},[],[951],{"type":26,"value":944},{"type":26,"value":953}," channel. This could be used for debugging events, as you'll be able to see all traffic across the bus:",{"type":21,"tag":200,"props":955,"children":957},{"className":202,"code":956,"language":12,"meta":8,"style":8},"/**\n * As with wildcard channel events, the channelEvent will always be the last argument\n * when subscribing to all events.\n */\nvent.on('*.*', (arg1, arg2, ..., channelEvent) => {\n    console.log(arg1, channelEvent);\n});\n",[958],{"type":21,"tag":63,"props":959,"children":960},{"__ignoreMap":8},[961,968,976,984,991,1047,1065],{"type":21,"tag":209,"props":962,"children":963},{"class":211,"line":212},[964],{"type":21,"tag":209,"props":965,"children":966},{"style":448},[967],{"type":26,"value":731},{"type":21,"tag":209,"props":969,"children":970},{"class":211,"line":244},[971],{"type":21,"tag":209,"props":972,"children":973},{"style":448},[974],{"type":26,"value":975}," * As with wildcard channel events, the channelEvent will always be the last argument\n",{"type":21,"tag":209,"props":977,"children":978},{"class":211,"line":254},[979],{"type":21,"tag":209,"props":980,"children":981},{"style":448},[982],{"type":26,"value":983}," * when subscribing to all events.\n",{"type":21,"tag":209,"props":985,"children":986},{"class":211,"line":279},[987],{"type":21,"tag":209,"props":988,"children":989},{"style":448},[990],{"type":26,"value":755},{"type":21,"tag":209,"props":992,"children":993},{"class":211,"line":288},[994,998,1002,1006,1011,1015,1019,1023,1027,1031,1035,1039,1043],{"type":21,"tag":209,"props":995,"children":996},{"style":222},[997],{"type":26,"value":357},{"type":21,"tag":209,"props":999,"children":1000},{"style":360},[1001],{"type":26,"value":363},{"type":21,"tag":209,"props":1003,"children":1004},{"style":222},[1005],{"type":26,"value":368},{"type":21,"tag":209,"props":1007,"children":1008},{"style":233},[1009],{"type":26,"value":1010},"'*.*'",{"type":21,"tag":209,"props":1012,"children":1013},{"style":222},[1014],{"type":26,"value":397},{"type":21,"tag":209,"props":1016,"children":1017},{"style":400},[1018],{"type":26,"value":403},{"type":21,"tag":209,"props":1020,"children":1021},{"style":222},[1022],{"type":26,"value":408},{"type":21,"tag":209,"props":1024,"children":1025},{"style":400},[1026],{"type":26,"value":413},{"type":21,"tag":209,"props":1028,"children":1029},{"style":222},[1030],{"type":26,"value":796},{"type":21,"tag":209,"props":1032,"children":1033},{"style":400},[1034],{"type":26,"value":801},{"type":21,"tag":209,"props":1036,"children":1037},{"style":222},[1038],{"type":26,"value":432},{"type":21,"tag":209,"props":1040,"children":1041},{"style":216},[1042],{"type":26,"value":437},{"type":21,"tag":209,"props":1044,"children":1045},{"style":222},[1046],{"type":26,"value":276},{"type":21,"tag":209,"props":1048,"children":1049},{"class":211,"line":307},[1050,1055,1060],{"type":21,"tag":209,"props":1051,"children":1052},{"style":222},[1053],{"type":26,"value":1054},"    console.",{"type":21,"tag":209,"props":1056,"children":1057},{"style":360},[1058],{"type":26,"value":1059},"log",{"type":21,"tag":209,"props":1061,"children":1062},{"style":222},[1063],{"type":26,"value":1064},"(arg1, channelEvent);\n",{"type":21,"tag":209,"props":1066,"children":1067},{"class":211,"line":325},[1068],{"type":21,"tag":209,"props":1069,"children":1070},{"style":222},[1071],{"type":26,"value":469},{"type":21,"tag":193,"props":1073,"children":1075},{"id":1074},"requests",[1076],{"type":26,"value":1077},"Requests",{"type":21,"tag":22,"props":1079,"children":1080},{},[1081,1083,1089],{"type":26,"value":1082},"In addition to one-way event publishing, we can also perform two-way event ",{"type":21,"tag":1084,"props":1085,"children":1086},"em",{},[1087],{"type":26,"value":1088},"messaging",{"type":26,"value":1090}," by making requests. Requests always return a promise that resolves with the responses from all subscribers.",{"type":21,"tag":200,"props":1092,"children":1094},{"className":202,"code":1093,"language":12,"meta":8,"style":8},"import {vent} from \"vpubsub\";\n\nconst EVENTS = {\n    PLAYER:{\n        START:'start.player',\n        END:'end.player',\n    }\n};\n\nvent.on(EVENTS.PLAYER.START, () => {\n    // Perform some work and return a response.\n    const data = {...};\n    return data;\n});\n\n// ... elsewhere in your application ...\n\nvent.request(EVENTS.PLAYER.START, async(res) => {\n    // Do something useful with the response(s) from the subscriber(s).\n    const [resp1] = await res;\n    console.log(resp1);\n});\n",[1095],{"type":21,"tag":63,"props":1096,"children":1097},{"__ignoreMap":8},[1098,1121,1128,1147,1154,1169,1184,1191,1198,1205,1253,1261,1291,1304,1311,1318,1325,1332,1398,1406,1443,1459],{"type":21,"tag":209,"props":1099,"children":1100},{"class":211,"line":212},[1101,1105,1109,1113,1117],{"type":21,"tag":209,"props":1102,"children":1103},{"style":216},[1104],{"type":26,"value":219},{"type":21,"tag":209,"props":1106,"children":1107},{"style":222},[1108],{"type":26,"value":225},{"type":21,"tag":209,"props":1110,"children":1111},{"style":216},[1112],{"type":26,"value":230},{"type":21,"tag":209,"props":1114,"children":1115},{"style":233},[1116],{"type":26,"value":236},{"type":21,"tag":209,"props":1118,"children":1119},{"style":222},[1120],{"type":26,"value":241},{"type":21,"tag":209,"props":1122,"children":1123},{"class":211,"line":244},[1124],{"type":21,"tag":209,"props":1125,"children":1126},{"emptyLinePlaceholder":248},[1127],{"type":26,"value":251},{"type":21,"tag":209,"props":1129,"children":1130},{"class":211,"line":254},[1131,1135,1139,1143],{"type":21,"tag":209,"props":1132,"children":1133},{"style":216},[1134],{"type":26,"value":260},{"type":21,"tag":209,"props":1136,"children":1137},{"style":263},[1138],{"type":26,"value":266},{"type":21,"tag":209,"props":1140,"children":1141},{"style":216},[1142],{"type":26,"value":271},{"type":21,"tag":209,"props":1144,"children":1145},{"style":222},[1146],{"type":26,"value":276},{"type":21,"tag":209,"props":1148,"children":1149},{"class":211,"line":279},[1150],{"type":21,"tag":209,"props":1151,"children":1152},{"style":222},[1153],{"type":26,"value":285},{"type":21,"tag":209,"props":1155,"children":1156},{"class":211,"line":288},[1157,1161,1165],{"type":21,"tag":209,"props":1158,"children":1159},{"style":222},[1160],{"type":26,"value":294},{"type":21,"tag":209,"props":1162,"children":1163},{"style":233},[1164],{"type":26,"value":299},{"type":21,"tag":209,"props":1166,"children":1167},{"style":222},[1168],{"type":26,"value":304},{"type":21,"tag":209,"props":1170,"children":1171},{"class":211,"line":307},[1172,1176,1180],{"type":21,"tag":209,"props":1173,"children":1174},{"style":222},[1175],{"type":26,"value":313},{"type":21,"tag":209,"props":1177,"children":1178},{"style":233},[1179],{"type":26,"value":318},{"type":21,"tag":209,"props":1181,"children":1182},{"style":222},[1183],{"type":26,"value":304},{"type":21,"tag":209,"props":1185,"children":1186},{"class":211,"line":325},[1187],{"type":21,"tag":209,"props":1188,"children":1189},{"style":222},[1190],{"type":26,"value":331},{"type":21,"tag":209,"props":1192,"children":1193},{"class":211,"line":334},[1194],{"type":21,"tag":209,"props":1195,"children":1196},{"style":222},[1197],{"type":26,"value":340},{"type":21,"tag":209,"props":1199,"children":1200},{"class":211,"line":343},[1201],{"type":21,"tag":209,"props":1202,"children":1203},{"emptyLinePlaceholder":248},[1204],{"type":26,"value":251},{"type":21,"tag":209,"props":1206,"children":1207},{"class":211,"line":351},[1208,1212,1216,1220,1224,1228,1232,1236,1240,1245,1249],{"type":21,"tag":209,"props":1209,"children":1210},{"style":222},[1211],{"type":26,"value":357},{"type":21,"tag":209,"props":1213,"children":1214},{"style":360},[1215],{"type":26,"value":363},{"type":21,"tag":209,"props":1217,"children":1218},{"style":222},[1219],{"type":26,"value":368},{"type":21,"tag":209,"props":1221,"children":1222},{"style":263},[1223],{"type":26,"value":373},{"type":21,"tag":209,"props":1225,"children":1226},{"style":222},[1227],{"type":26,"value":378},{"type":21,"tag":209,"props":1229,"children":1230},{"style":263},[1231],{"type":26,"value":383},{"type":21,"tag":209,"props":1233,"children":1234},{"style":222},[1235],{"type":26,"value":378},{"type":21,"tag":209,"props":1237,"children":1238},{"style":263},[1239],{"type":26,"value":392},{"type":21,"tag":209,"props":1241,"children":1242},{"style":222},[1243],{"type":26,"value":1244},", () ",{"type":21,"tag":209,"props":1246,"children":1247},{"style":216},[1248],{"type":26,"value":437},{"type":21,"tag":209,"props":1250,"children":1251},{"style":222},[1252],{"type":26,"value":276},{"type":21,"tag":209,"props":1254,"children":1255},{"class":211,"line":444},[1256],{"type":21,"tag":209,"props":1257,"children":1258},{"style":448},[1259],{"type":26,"value":1260},"    // Perform some work and return a response.\n",{"type":21,"tag":209,"props":1262,"children":1263},{"class":211,"line":454},[1264,1269,1274,1278,1283,1287],{"type":21,"tag":209,"props":1265,"children":1266},{"style":216},[1267],{"type":26,"value":1268},"    const",{"type":21,"tag":209,"props":1270,"children":1271},{"style":263},[1272],{"type":26,"value":1273}," data",{"type":21,"tag":209,"props":1275,"children":1276},{"style":216},[1277],{"type":26,"value":271},{"type":21,"tag":209,"props":1279,"children":1280},{"style":222},[1281],{"type":26,"value":1282}," {",{"type":21,"tag":209,"props":1284,"children":1285},{"style":216},[1286],{"type":26,"value":422},{"type":21,"tag":209,"props":1288,"children":1289},{"style":222},[1290],{"type":26,"value":340},{"type":21,"tag":209,"props":1292,"children":1293},{"class":211,"line":463},[1294,1299],{"type":21,"tag":209,"props":1295,"children":1296},{"style":216},[1297],{"type":26,"value":1298},"    return",{"type":21,"tag":209,"props":1300,"children":1301},{"style":222},[1302],{"type":26,"value":1303}," data;\n",{"type":21,"tag":209,"props":1305,"children":1306},{"class":211,"line":472},[1307],{"type":21,"tag":209,"props":1308,"children":1309},{"style":222},[1310],{"type":26,"value":469},{"type":21,"tag":209,"props":1312,"children":1313},{"class":211,"line":480},[1314],{"type":21,"tag":209,"props":1315,"children":1316},{"emptyLinePlaceholder":248},[1317],{"type":26,"value":251},{"type":21,"tag":209,"props":1319,"children":1320},{"class":211,"line":489},[1321],{"type":21,"tag":209,"props":1322,"children":1323},{"style":448},[1324],{"type":26,"value":486},{"type":21,"tag":209,"props":1326,"children":1327},{"class":211,"line":847},[1328],{"type":21,"tag":209,"props":1329,"children":1330},{"emptyLinePlaceholder":248},[1331],{"type":26,"value":251},{"type":21,"tag":209,"props":1333,"children":1334},{"class":211,"line":860},[1335,1339,1344,1348,1352,1356,1360,1364,1368,1372,1377,1381,1386,1390,1394],{"type":21,"tag":209,"props":1336,"children":1337},{"style":222},[1338],{"type":26,"value":357},{"type":21,"tag":209,"props":1340,"children":1341},{"style":360},[1342],{"type":26,"value":1343},"request",{"type":21,"tag":209,"props":1345,"children":1346},{"style":222},[1347],{"type":26,"value":368},{"type":21,"tag":209,"props":1349,"children":1350},{"style":263},[1351],{"type":26,"value":373},{"type":21,"tag":209,"props":1353,"children":1354},{"style":222},[1355],{"type":26,"value":378},{"type":21,"tag":209,"props":1357,"children":1358},{"style":263},[1359],{"type":26,"value":383},{"type":21,"tag":209,"props":1361,"children":1362},{"style":222},[1363],{"type":26,"value":378},{"type":21,"tag":209,"props":1365,"children":1366},{"style":263},[1367],{"type":26,"value":392},{"type":21,"tag":209,"props":1369,"children":1370},{"style":222},[1371],{"type":26,"value":408},{"type":21,"tag":209,"props":1373,"children":1374},{"style":216},[1375],{"type":26,"value":1376},"async",{"type":21,"tag":209,"props":1378,"children":1379},{"style":222},[1380],{"type":26,"value":368},{"type":21,"tag":209,"props":1382,"children":1383},{"style":400},[1384],{"type":26,"value":1385},"res",{"type":21,"tag":209,"props":1387,"children":1388},{"style":222},[1389],{"type":26,"value":432},{"type":21,"tag":209,"props":1391,"children":1392},{"style":216},[1393],{"type":26,"value":437},{"type":21,"tag":209,"props":1395,"children":1396},{"style":222},[1397],{"type":26,"value":276},{"type":21,"tag":209,"props":1399,"children":1400},{"class":211,"line":877},[1401],{"type":21,"tag":209,"props":1402,"children":1403},{"style":448},[1404],{"type":26,"value":1405},"    // Do something useful with the response(s) from the subscriber(s).\n",{"type":21,"tag":209,"props":1407,"children":1408},{"class":211,"line":889},[1409,1413,1418,1423,1428,1433,1438],{"type":21,"tag":209,"props":1410,"children":1411},{"style":216},[1412],{"type":26,"value":1268},{"type":21,"tag":209,"props":1414,"children":1415},{"style":222},[1416],{"type":26,"value":1417}," [",{"type":21,"tag":209,"props":1419,"children":1420},{"style":263},[1421],{"type":26,"value":1422},"resp1",{"type":21,"tag":209,"props":1424,"children":1425},{"style":222},[1426],{"type":26,"value":1427},"] ",{"type":21,"tag":209,"props":1429,"children":1430},{"style":216},[1431],{"type":26,"value":1432},"=",{"type":21,"tag":209,"props":1434,"children":1435},{"style":216},[1436],{"type":26,"value":1437}," await",{"type":21,"tag":209,"props":1439,"children":1440},{"style":222},[1441],{"type":26,"value":1442}," res;\n",{"type":21,"tag":209,"props":1444,"children":1445},{"class":211,"line":902},[1446,1450,1454],{"type":21,"tag":209,"props":1447,"children":1448},{"style":222},[1449],{"type":26,"value":1054},{"type":21,"tag":209,"props":1451,"children":1452},{"style":360},[1453],{"type":26,"value":1059},{"type":21,"tag":209,"props":1455,"children":1456},{"style":222},[1457],{"type":26,"value":1458},"(resp1);\n",{"type":21,"tag":209,"props":1460,"children":1461},{"class":211,"line":914},[1462],{"type":21,"tag":209,"props":1463,"children":1464},{"style":222},[1465],{"type":26,"value":469},{"type":21,"tag":22,"props":1467,"children":1468},{},[1469,1471,1476,1478,1483],{"type":26,"value":1470},"The same special wildcard channel event and global wildcard that you can use with ",{"type":21,"tag":63,"props":1472,"children":1474},{"className":1473},[],[1475],{"type":26,"value":499},{"type":26,"value":1477}," also apply to ",{"type":21,"tag":63,"props":1479,"children":1481},{"className":1480},[],[1482],{"type":26,"value":1343},{"type":26,"value":1484},", as detailed above.",{"type":21,"tag":51,"props":1486,"children":1488},{"id":1487},"how-does-it-work-with-vue",[1489],{"type":26,"value":1490},"How Does It Work With Vue?",{"type":21,"tag":22,"props":1492,"children":1493},{},[1494],{"type":26,"value":1495},"VPubSub comes with built-in support for using it as a plugin with Vue 3. First, let's install it, and then we'll take a look at using it with the Options or Composition APIs.",{"type":21,"tag":193,"props":1497,"children":1499},{"id":1498},"installation",[1500],{"type":26,"value":1501},"Installation",{"type":21,"tag":22,"props":1503,"children":1504},{},[1505,1507,1513],{"type":26,"value":1506},"Let's create a ",{"type":21,"tag":63,"props":1508,"children":1510},{"className":1509},[],[1511],{"type":26,"value":1512},"plugins/vent.js",{"type":26,"value":1514}," file, that looks like this:",{"type":21,"tag":200,"props":1516,"children":1518},{"className":202,"code":1517,"language":12,"meta":8,"style":8},"/**\n * Return our vent utility as a plugin in Vue for install.\n */\n\nimport {install} from \"vpubsub\";\n\nexport default install;\n",[1519],{"type":21,"tag":63,"props":1520,"children":1521},{"__ignoreMap":8},[1522,1529,1537,1544,1551,1575,1582],{"type":21,"tag":209,"props":1523,"children":1524},{"class":211,"line":212},[1525],{"type":21,"tag":209,"props":1526,"children":1527},{"style":448},[1528],{"type":26,"value":731},{"type":21,"tag":209,"props":1530,"children":1531},{"class":211,"line":244},[1532],{"type":21,"tag":209,"props":1533,"children":1534},{"style":448},[1535],{"type":26,"value":1536}," * Return our vent utility as a plugin in Vue for install.\n",{"type":21,"tag":209,"props":1538,"children":1539},{"class":211,"line":254},[1540],{"type":21,"tag":209,"props":1541,"children":1542},{"style":448},[1543],{"type":26,"value":755},{"type":21,"tag":209,"props":1545,"children":1546},{"class":211,"line":279},[1547],{"type":21,"tag":209,"props":1548,"children":1549},{"emptyLinePlaceholder":248},[1550],{"type":26,"value":251},{"type":21,"tag":209,"props":1552,"children":1553},{"class":211,"line":288},[1554,1558,1563,1567,1571],{"type":21,"tag":209,"props":1555,"children":1556},{"style":216},[1557],{"type":26,"value":219},{"type":21,"tag":209,"props":1559,"children":1560},{"style":222},[1561],{"type":26,"value":1562}," {install} ",{"type":21,"tag":209,"props":1564,"children":1565},{"style":216},[1566],{"type":26,"value":230},{"type":21,"tag":209,"props":1568,"children":1569},{"style":233},[1570],{"type":26,"value":236},{"type":21,"tag":209,"props":1572,"children":1573},{"style":222},[1574],{"type":26,"value":241},{"type":21,"tag":209,"props":1576,"children":1577},{"class":211,"line":307},[1578],{"type":21,"tag":209,"props":1579,"children":1580},{"emptyLinePlaceholder":248},[1581],{"type":26,"value":251},{"type":21,"tag":209,"props":1583,"children":1584},{"class":211,"line":325},[1585,1590,1595],{"type":21,"tag":209,"props":1586,"children":1587},{"style":216},[1588],{"type":26,"value":1589},"export",{"type":21,"tag":209,"props":1591,"children":1592},{"style":216},[1593],{"type":26,"value":1594}," default",{"type":21,"tag":209,"props":1596,"children":1597},{"style":222},[1598],{"type":26,"value":1599}," install;\n",{"type":21,"tag":22,"props":1601,"children":1602},{},[1603,1605,1611],{"type":26,"value":1604},"Then, in ",{"type":21,"tag":63,"props":1606,"children":1608},{"className":1607},[],[1609],{"type":26,"value":1610},"main.js",{"type":26,"value":1612}," (your Vue app's point of entry), we can use it like so:",{"type":21,"tag":200,"props":1614,"children":1616},{"className":202,"code":1615,"language":12,"meta":8,"style":8},"import {createApp} from 'vue';\nimport vent from \"plugins/vent\";\nimport App from \"App.vue\";\n\nconst vue = createApp(App);\n\nvue.use(vent);\n",[1617],{"type":21,"tag":63,"props":1618,"children":1619},{"__ignoreMap":8},[1620,1645,1670,1695,1702,1728,1735],{"type":21,"tag":209,"props":1621,"children":1622},{"class":211,"line":212},[1623,1627,1632,1636,1641],{"type":21,"tag":209,"props":1624,"children":1625},{"style":216},[1626],{"type":26,"value":219},{"type":21,"tag":209,"props":1628,"children":1629},{"style":222},[1630],{"type":26,"value":1631}," {createApp} ",{"type":21,"tag":209,"props":1633,"children":1634},{"style":216},[1635],{"type":26,"value":230},{"type":21,"tag":209,"props":1637,"children":1638},{"style":233},[1639],{"type":26,"value":1640}," 'vue'",{"type":21,"tag":209,"props":1642,"children":1643},{"style":222},[1644],{"type":26,"value":241},{"type":21,"tag":209,"props":1646,"children":1647},{"class":211,"line":244},[1648,1652,1657,1661,1666],{"type":21,"tag":209,"props":1649,"children":1650},{"style":216},[1651],{"type":26,"value":219},{"type":21,"tag":209,"props":1653,"children":1654},{"style":222},[1655],{"type":26,"value":1656}," vent ",{"type":21,"tag":209,"props":1658,"children":1659},{"style":216},[1660],{"type":26,"value":230},{"type":21,"tag":209,"props":1662,"children":1663},{"style":233},[1664],{"type":26,"value":1665}," \"plugins/vent\"",{"type":21,"tag":209,"props":1667,"children":1668},{"style":222},[1669],{"type":26,"value":241},{"type":21,"tag":209,"props":1671,"children":1672},{"class":211,"line":254},[1673,1677,1682,1686,1691],{"type":21,"tag":209,"props":1674,"children":1675},{"style":216},[1676],{"type":26,"value":219},{"type":21,"tag":209,"props":1678,"children":1679},{"style":222},[1680],{"type":26,"value":1681}," App ",{"type":21,"tag":209,"props":1683,"children":1684},{"style":216},[1685],{"type":26,"value":230},{"type":21,"tag":209,"props":1687,"children":1688},{"style":233},[1689],{"type":26,"value":1690}," \"App.vue\"",{"type":21,"tag":209,"props":1692,"children":1693},{"style":222},[1694],{"type":26,"value":241},{"type":21,"tag":209,"props":1696,"children":1697},{"class":211,"line":279},[1698],{"type":21,"tag":209,"props":1699,"children":1700},{"emptyLinePlaceholder":248},[1701],{"type":26,"value":251},{"type":21,"tag":209,"props":1703,"children":1704},{"class":211,"line":288},[1705,1709,1714,1718,1723],{"type":21,"tag":209,"props":1706,"children":1707},{"style":216},[1708],{"type":26,"value":260},{"type":21,"tag":209,"props":1710,"children":1711},{"style":263},[1712],{"type":26,"value":1713}," vue",{"type":21,"tag":209,"props":1715,"children":1716},{"style":216},[1717],{"type":26,"value":271},{"type":21,"tag":209,"props":1719,"children":1720},{"style":360},[1721],{"type":26,"value":1722}," createApp",{"type":21,"tag":209,"props":1724,"children":1725},{"style":222},[1726],{"type":26,"value":1727},"(App);\n",{"type":21,"tag":209,"props":1729,"children":1730},{"class":211,"line":307},[1731],{"type":21,"tag":209,"props":1732,"children":1733},{"emptyLinePlaceholder":248},[1734],{"type":26,"value":251},{"type":21,"tag":209,"props":1736,"children":1737},{"class":211,"line":325},[1738,1743,1748],{"type":21,"tag":209,"props":1739,"children":1740},{"style":222},[1741],{"type":26,"value":1742},"vue.",{"type":21,"tag":209,"props":1744,"children":1745},{"style":360},[1746],{"type":26,"value":1747},"use",{"type":21,"tag":209,"props":1749,"children":1750},{"style":222},[1751],{"type":26,"value":1752},"(vent);\n",{"type":21,"tag":22,"props":1754,"children":1755},{},[1756],{"type":26,"value":1757},"You can also skip creating a plugin wrapper, and use it like so:",{"type":21,"tag":200,"props":1759,"children":1761},{"className":202,"code":1760,"language":12,"meta":8,"style":8},"import {install as vent} from \"vpubsub\";\nimport {createApp} from 'vue';\nimport App from \"App.vue\";\n\nconst vue = createApp(App);\n\nvue.use(vent);\n",[1762],{"type":21,"tag":63,"props":1763,"children":1764},{"__ignoreMap":8},[1765,1799,1822,1845,1852,1875,1882],{"type":21,"tag":209,"props":1766,"children":1767},{"class":211,"line":212},[1768,1772,1777,1782,1787,1791,1795],{"type":21,"tag":209,"props":1769,"children":1770},{"style":216},[1771],{"type":26,"value":219},{"type":21,"tag":209,"props":1773,"children":1774},{"style":222},[1775],{"type":26,"value":1776}," {install ",{"type":21,"tag":209,"props":1778,"children":1779},{"style":216},[1780],{"type":26,"value":1781},"as",{"type":21,"tag":209,"props":1783,"children":1784},{"style":222},[1785],{"type":26,"value":1786}," vent} ",{"type":21,"tag":209,"props":1788,"children":1789},{"style":216},[1790],{"type":26,"value":230},{"type":21,"tag":209,"props":1792,"children":1793},{"style":233},[1794],{"type":26,"value":236},{"type":21,"tag":209,"props":1796,"children":1797},{"style":222},[1798],{"type":26,"value":241},{"type":21,"tag":209,"props":1800,"children":1801},{"class":211,"line":244},[1802,1806,1810,1814,1818],{"type":21,"tag":209,"props":1803,"children":1804},{"style":216},[1805],{"type":26,"value":219},{"type":21,"tag":209,"props":1807,"children":1808},{"style":222},[1809],{"type":26,"value":1631},{"type":21,"tag":209,"props":1811,"children":1812},{"style":216},[1813],{"type":26,"value":230},{"type":21,"tag":209,"props":1815,"children":1816},{"style":233},[1817],{"type":26,"value":1640},{"type":21,"tag":209,"props":1819,"children":1820},{"style":222},[1821],{"type":26,"value":241},{"type":21,"tag":209,"props":1823,"children":1824},{"class":211,"line":254},[1825,1829,1833,1837,1841],{"type":21,"tag":209,"props":1826,"children":1827},{"style":216},[1828],{"type":26,"value":219},{"type":21,"tag":209,"props":1830,"children":1831},{"style":222},[1832],{"type":26,"value":1681},{"type":21,"tag":209,"props":1834,"children":1835},{"style":216},[1836],{"type":26,"value":230},{"type":21,"tag":209,"props":1838,"children":1839},{"style":233},[1840],{"type":26,"value":1690},{"type":21,"tag":209,"props":1842,"children":1843},{"style":222},[1844],{"type":26,"value":241},{"type":21,"tag":209,"props":1846,"children":1847},{"class":211,"line":279},[1848],{"type":21,"tag":209,"props":1849,"children":1850},{"emptyLinePlaceholder":248},[1851],{"type":26,"value":251},{"type":21,"tag":209,"props":1853,"children":1854},{"class":211,"line":288},[1855,1859,1863,1867,1871],{"type":21,"tag":209,"props":1856,"children":1857},{"style":216},[1858],{"type":26,"value":260},{"type":21,"tag":209,"props":1860,"children":1861},{"style":263},[1862],{"type":26,"value":1713},{"type":21,"tag":209,"props":1864,"children":1865},{"style":216},[1866],{"type":26,"value":271},{"type":21,"tag":209,"props":1868,"children":1869},{"style":360},[1870],{"type":26,"value":1722},{"type":21,"tag":209,"props":1872,"children":1873},{"style":222},[1874],{"type":26,"value":1727},{"type":21,"tag":209,"props":1876,"children":1877},{"class":211,"line":307},[1878],{"type":21,"tag":209,"props":1879,"children":1880},{"emptyLinePlaceholder":248},[1881],{"type":26,"value":251},{"type":21,"tag":209,"props":1883,"children":1884},{"class":211,"line":325},[1885,1889,1893],{"type":21,"tag":209,"props":1886,"children":1887},{"style":222},[1888],{"type":26,"value":1742},{"type":21,"tag":209,"props":1890,"children":1891},{"style":360},[1892],{"type":26,"value":1747},{"type":21,"tag":209,"props":1894,"children":1895},{"style":222},[1896],{"type":26,"value":1752},{"type":21,"tag":193,"props":1898,"children":1900},{"id":1899},"options-api",[1901],{"type":26,"value":180},{"type":21,"tag":22,"props":1903,"children":1904},{},[1905,1907,1913,1915,1921,1923,1929,1931,1936],{"type":26,"value":1906},"When installed as a Vue plugin, VPubSub adds a new element to the Options API, the ",{"type":21,"tag":63,"props":1908,"children":1910},{"className":1909},[],[1911],{"type":26,"value":1912},"vent",{"type":26,"value":1914}," option. This should be an object similar to ",{"type":21,"tag":63,"props":1916,"children":1918},{"className":1917},[],[1919],{"type":26,"value":1920},"methods",{"type":26,"value":1922}," or ",{"type":21,"tag":63,"props":1924,"children":1926},{"className":1925},[],[1927],{"type":26,"value":1928},"computed",{"type":26,"value":1930}," in your component, that has the events as the key and ",{"type":21,"tag":1084,"props":1932,"children":1933},{},[1934],{"type":26,"value":1935},"either",{"type":26,"value":1937}," a direct function as the subscriber, or the name of a method in your component as a string.",{"type":21,"tag":22,"props":1939,"children":1940},{},[1941,1943,1948,1950,1956,1958,1964],{"type":26,"value":1942},"You also gain access to the ",{"type":21,"tag":63,"props":1944,"children":1946},{"className":1945},[],[1947],{"type":26,"value":1912},{"type":26,"value":1949}," singleton as a globally available component property, via ",{"type":21,"tag":63,"props":1951,"children":1953},{"className":1952},[],[1954],{"type":26,"value":1955},"$vent",{"type":26,"value":1957},"; you can reference it from within any component via ",{"type":21,"tag":63,"props":1959,"children":1961},{"className":1960},[],[1962],{"type":26,"value":1963},"this.$vent",{"type":26,"value":378},{"type":21,"tag":22,"props":1966,"children":1967},{},[1968],{"type":26,"value":1969},"For example:",{"type":21,"tag":200,"props":1971,"children":1974},{"className":1972,"code":1973,"language":13,"meta":8,"style":8},"language-vue shiki shiki-themes github-light github-dark","\u003Ctemplate>\n    \u003Cdiv>\u003C!-- ...Your template contents... -->\u003C/div>\n\u003C/template>\n\u003Cscript lang=\"js\">\nconst EVENTS = {\n    PLAYER:{\n        START:'start.player',\n        END:'end.player',\n    }\n};\n\nexport default {\n    name: \"VComponent\",\n    props:{\n        vprop:{\n            type:Boolean,\n            default:true,\n        }\n        // ... Your Props ...\n    },\n    vent:{\n        // Indirect binding - the named function within this component will be bound.\n        [EVENTS.PLAYER.START]:'recalcPoints',\n        // Direct binding - this function will be bound.\n        [EVENTS.PLAYER.END](arg1, arg2){\n            // Called whenever the `EVENTS.PLAYER.END` event is triggered or requested.\n        }\n    },\n    methods:{\n        /**\n         * This method will be called whenever the `EVENTS.PLAYER.START` event is\n         * triggered or requested.\n         */\n        recalcPoints(arg1, arg2){\n            // Because the `vent` events are bound to the component, you can use\n            // this to get props, data, computed, etc. of the component.\n            console.log(this.vprop);\n        },\n        /**\n         * Trigger an event as a result of doing something.\n         */\n        doSomething(){\n            this.$vent.trigger(EVENTS.PLAYER.END);\n        },\n        /**\n         * Request replies from subscribers.\n         */\n        getSomething(){\n            this.$vent.request(EVENTS.PLAYER.END).then((res) => {\n                const [resp] = res;\n                console.log(resp);\n            });\n        },\n    },\n};\n\u003C/script>\n",[1975],{"type":21,"tag":63,"props":1976,"children":1977},{"__ignoreMap":8},[1978,1997,2033,2048,2078,2097,2104,2119,2134,2141,2148,2155,2170,2187,2195,2203,2211,2228,2236,2244,2252,2260,2268,2310,2319,2370,2379,2387,2395,2404,2413,2422,2431,2440,2469,2478,2487,2514,2523,2531,2540,2548,2562,2609,2617,2625,2634,2642,2655,2726,2756,2774,2783,2791,2799,2807],{"type":21,"tag":209,"props":1979,"children":1980},{"class":211,"line":212},[1981,1986,1992],{"type":21,"tag":209,"props":1982,"children":1983},{"style":222},[1984],{"type":26,"value":1985},"\u003C",{"type":21,"tag":209,"props":1987,"children":1989},{"style":1988},"--shiki-default:#22863A;--shiki-dark:#85E89D",[1990],{"type":26,"value":1991},"template",{"type":21,"tag":209,"props":1993,"children":1994},{"style":222},[1995],{"type":26,"value":1996},">\n",{"type":21,"tag":209,"props":1998,"children":1999},{"class":211,"line":244},[2000,2005,2010,2015,2020,2025,2029],{"type":21,"tag":209,"props":2001,"children":2002},{"style":222},[2003],{"type":26,"value":2004},"    \u003C",{"type":21,"tag":209,"props":2006,"children":2007},{"style":1988},[2008],{"type":26,"value":2009},"div",{"type":21,"tag":209,"props":2011,"children":2012},{"style":222},[2013],{"type":26,"value":2014},">",{"type":21,"tag":209,"props":2016,"children":2017},{"style":448},[2018],{"type":26,"value":2019},"\u003C!-- ...Your template contents... -->",{"type":21,"tag":209,"props":2021,"children":2022},{"style":222},[2023],{"type":26,"value":2024},"\u003C/",{"type":21,"tag":209,"props":2026,"children":2027},{"style":1988},[2028],{"type":26,"value":2009},{"type":21,"tag":209,"props":2030,"children":2031},{"style":222},[2032],{"type":26,"value":1996},{"type":21,"tag":209,"props":2034,"children":2035},{"class":211,"line":254},[2036,2040,2044],{"type":21,"tag":209,"props":2037,"children":2038},{"style":222},[2039],{"type":26,"value":2024},{"type":21,"tag":209,"props":2041,"children":2042},{"style":1988},[2043],{"type":26,"value":1991},{"type":21,"tag":209,"props":2045,"children":2046},{"style":222},[2047],{"type":26,"value":1996},{"type":21,"tag":209,"props":2049,"children":2050},{"class":211,"line":279},[2051,2055,2060,2065,2069,2074],{"type":21,"tag":209,"props":2052,"children":2053},{"style":222},[2054],{"type":26,"value":1985},{"type":21,"tag":209,"props":2056,"children":2057},{"style":1988},[2058],{"type":26,"value":2059},"script",{"type":21,"tag":209,"props":2061,"children":2062},{"style":360},[2063],{"type":26,"value":2064}," lang",{"type":21,"tag":209,"props":2066,"children":2067},{"style":222},[2068],{"type":26,"value":1432},{"type":21,"tag":209,"props":2070,"children":2071},{"style":233},[2072],{"type":26,"value":2073},"\"js\"",{"type":21,"tag":209,"props":2075,"children":2076},{"style":222},[2077],{"type":26,"value":1996},{"type":21,"tag":209,"props":2079,"children":2080},{"class":211,"line":288},[2081,2085,2089,2093],{"type":21,"tag":209,"props":2082,"children":2083},{"style":216},[2084],{"type":26,"value":260},{"type":21,"tag":209,"props":2086,"children":2087},{"style":263},[2088],{"type":26,"value":266},{"type":21,"tag":209,"props":2090,"children":2091},{"style":216},[2092],{"type":26,"value":271},{"type":21,"tag":209,"props":2094,"children":2095},{"style":222},[2096],{"type":26,"value":276},{"type":21,"tag":209,"props":2098,"children":2099},{"class":211,"line":307},[2100],{"type":21,"tag":209,"props":2101,"children":2102},{"style":222},[2103],{"type":26,"value":285},{"type":21,"tag":209,"props":2105,"children":2106},{"class":211,"line":325},[2107,2111,2115],{"type":21,"tag":209,"props":2108,"children":2109},{"style":222},[2110],{"type":26,"value":294},{"type":21,"tag":209,"props":2112,"children":2113},{"style":233},[2114],{"type":26,"value":299},{"type":21,"tag":209,"props":2116,"children":2117},{"style":222},[2118],{"type":26,"value":304},{"type":21,"tag":209,"props":2120,"children":2121},{"class":211,"line":334},[2122,2126,2130],{"type":21,"tag":209,"props":2123,"children":2124},{"style":222},[2125],{"type":26,"value":313},{"type":21,"tag":209,"props":2127,"children":2128},{"style":233},[2129],{"type":26,"value":318},{"type":21,"tag":209,"props":2131,"children":2132},{"style":222},[2133],{"type":26,"value":304},{"type":21,"tag":209,"props":2135,"children":2136},{"class":211,"line":343},[2137],{"type":21,"tag":209,"props":2138,"children":2139},{"style":222},[2140],{"type":26,"value":331},{"type":21,"tag":209,"props":2142,"children":2143},{"class":211,"line":351},[2144],{"type":21,"tag":209,"props":2145,"children":2146},{"style":222},[2147],{"type":26,"value":340},{"type":21,"tag":209,"props":2149,"children":2150},{"class":211,"line":444},[2151],{"type":21,"tag":209,"props":2152,"children":2153},{"emptyLinePlaceholder":248},[2154],{"type":26,"value":251},{"type":21,"tag":209,"props":2156,"children":2157},{"class":211,"line":454},[2158,2162,2166],{"type":21,"tag":209,"props":2159,"children":2160},{"style":216},[2161],{"type":26,"value":1589},{"type":21,"tag":209,"props":2163,"children":2164},{"style":216},[2165],{"type":26,"value":1594},{"type":21,"tag":209,"props":2167,"children":2168},{"style":222},[2169],{"type":26,"value":276},{"type":21,"tag":209,"props":2171,"children":2172},{"class":211,"line":463},[2173,2178,2183],{"type":21,"tag":209,"props":2174,"children":2175},{"style":222},[2176],{"type":26,"value":2177},"    name: ",{"type":21,"tag":209,"props":2179,"children":2180},{"style":233},[2181],{"type":26,"value":2182},"\"VComponent\"",{"type":21,"tag":209,"props":2184,"children":2185},{"style":222},[2186],{"type":26,"value":304},{"type":21,"tag":209,"props":2188,"children":2189},{"class":211,"line":472},[2190],{"type":21,"tag":209,"props":2191,"children":2192},{"style":222},[2193],{"type":26,"value":2194},"    props:{\n",{"type":21,"tag":209,"props":2196,"children":2197},{"class":211,"line":480},[2198],{"type":21,"tag":209,"props":2199,"children":2200},{"style":222},[2201],{"type":26,"value":2202},"        vprop:{\n",{"type":21,"tag":209,"props":2204,"children":2205},{"class":211,"line":489},[2206],{"type":21,"tag":209,"props":2207,"children":2208},{"style":222},[2209],{"type":26,"value":2210},"            type:Boolean,\n",{"type":21,"tag":209,"props":2212,"children":2213},{"class":211,"line":847},[2214,2219,2224],{"type":21,"tag":209,"props":2215,"children":2216},{"style":222},[2217],{"type":26,"value":2218},"            default:",{"type":21,"tag":209,"props":2220,"children":2221},{"style":263},[2222],{"type":26,"value":2223},"true",{"type":21,"tag":209,"props":2225,"children":2226},{"style":222},[2227],{"type":26,"value":304},{"type":21,"tag":209,"props":2229,"children":2230},{"class":211,"line":860},[2231],{"type":21,"tag":209,"props":2232,"children":2233},{"style":222},[2234],{"type":26,"value":2235},"        }\n",{"type":21,"tag":209,"props":2237,"children":2238},{"class":211,"line":877},[2239],{"type":21,"tag":209,"props":2240,"children":2241},{"style":448},[2242],{"type":26,"value":2243},"        // ... Your Props ...\n",{"type":21,"tag":209,"props":2245,"children":2246},{"class":211,"line":889},[2247],{"type":21,"tag":209,"props":2248,"children":2249},{"style":222},[2250],{"type":26,"value":2251},"    },\n",{"type":21,"tag":209,"props":2253,"children":2254},{"class":211,"line":902},[2255],{"type":21,"tag":209,"props":2256,"children":2257},{"style":222},[2258],{"type":26,"value":2259},"    vent:{\n",{"type":21,"tag":209,"props":2261,"children":2262},{"class":211,"line":914},[2263],{"type":21,"tag":209,"props":2264,"children":2265},{"style":448},[2266],{"type":26,"value":2267},"        // Indirect binding - the named function within this component will be bound.\n",{"type":21,"tag":209,"props":2269,"children":2270},{"class":211,"line":922},[2271,2276,2280,2284,2288,2292,2296,2301,2306],{"type":21,"tag":209,"props":2272,"children":2273},{"style":222},[2274],{"type":26,"value":2275},"        [",{"type":21,"tag":209,"props":2277,"children":2278},{"style":263},[2279],{"type":26,"value":373},{"type":21,"tag":209,"props":2281,"children":2282},{"style":222},[2283],{"type":26,"value":378},{"type":21,"tag":209,"props":2285,"children":2286},{"style":263},[2287],{"type":26,"value":383},{"type":21,"tag":209,"props":2289,"children":2290},{"style":222},[2291],{"type":26,"value":378},{"type":21,"tag":209,"props":2293,"children":2294},{"style":263},[2295],{"type":26,"value":392},{"type":21,"tag":209,"props":2297,"children":2298},{"style":222},[2299],{"type":26,"value":2300},"]:",{"type":21,"tag":209,"props":2302,"children":2303},{"style":233},[2304],{"type":26,"value":2305},"'recalcPoints'",{"type":21,"tag":209,"props":2307,"children":2308},{"style":222},[2309],{"type":26,"value":304},{"type":21,"tag":209,"props":2311,"children":2313},{"class":211,"line":2312},24,[2314],{"type":21,"tag":209,"props":2315,"children":2316},{"style":448},[2317],{"type":26,"value":2318},"        // Direct binding - this function will be bound.\n",{"type":21,"tag":209,"props":2320,"children":2322},{"class":211,"line":2321},25,[2323,2327,2331,2335,2339,2343,2348,2353,2357,2361,2365],{"type":21,"tag":209,"props":2324,"children":2325},{"style":222},[2326],{"type":26,"value":2275},{"type":21,"tag":209,"props":2328,"children":2329},{"style":263},[2330],{"type":26,"value":373},{"type":21,"tag":209,"props":2332,"children":2333},{"style":222},[2334],{"type":26,"value":378},{"type":21,"tag":209,"props":2336,"children":2337},{"style":263},[2338],{"type":26,"value":383},{"type":21,"tag":209,"props":2340,"children":2341},{"style":222},[2342],{"type":26,"value":378},{"type":21,"tag":209,"props":2344,"children":2345},{"style":263},[2346],{"type":26,"value":2347},"END",{"type":21,"tag":209,"props":2349,"children":2350},{"style":222},[2351],{"type":26,"value":2352},"](",{"type":21,"tag":209,"props":2354,"children":2355},{"style":400},[2356],{"type":26,"value":403},{"type":21,"tag":209,"props":2358,"children":2359},{"style":222},[2360],{"type":26,"value":408},{"type":21,"tag":209,"props":2362,"children":2363},{"style":400},[2364],{"type":26,"value":413},{"type":21,"tag":209,"props":2366,"children":2367},{"style":222},[2368],{"type":26,"value":2369},"){\n",{"type":21,"tag":209,"props":2371,"children":2373},{"class":211,"line":2372},26,[2374],{"type":21,"tag":209,"props":2375,"children":2376},{"style":448},[2377],{"type":26,"value":2378},"            // Called whenever the `EVENTS.PLAYER.END` event is triggered or requested.\n",{"type":21,"tag":209,"props":2380,"children":2382},{"class":211,"line":2381},27,[2383],{"type":21,"tag":209,"props":2384,"children":2385},{"style":222},[2386],{"type":26,"value":2235},{"type":21,"tag":209,"props":2388,"children":2390},{"class":211,"line":2389},28,[2391],{"type":21,"tag":209,"props":2392,"children":2393},{"style":222},[2394],{"type":26,"value":2251},{"type":21,"tag":209,"props":2396,"children":2398},{"class":211,"line":2397},29,[2399],{"type":21,"tag":209,"props":2400,"children":2401},{"style":222},[2402],{"type":26,"value":2403},"    methods:{\n",{"type":21,"tag":209,"props":2405,"children":2407},{"class":211,"line":2406},30,[2408],{"type":21,"tag":209,"props":2409,"children":2410},{"style":448},[2411],{"type":26,"value":2412},"        /**\n",{"type":21,"tag":209,"props":2414,"children":2416},{"class":211,"line":2415},31,[2417],{"type":21,"tag":209,"props":2418,"children":2419},{"style":448},[2420],{"type":26,"value":2421},"         * This method will be called whenever the `EVENTS.PLAYER.START` event is\n",{"type":21,"tag":209,"props":2423,"children":2425},{"class":211,"line":2424},32,[2426],{"type":21,"tag":209,"props":2427,"children":2428},{"style":448},[2429],{"type":26,"value":2430},"         * triggered or requested.\n",{"type":21,"tag":209,"props":2432,"children":2434},{"class":211,"line":2433},33,[2435],{"type":21,"tag":209,"props":2436,"children":2437},{"style":448},[2438],{"type":26,"value":2439},"         */\n",{"type":21,"tag":209,"props":2441,"children":2443},{"class":211,"line":2442},34,[2444,2449,2453,2457,2461,2465],{"type":21,"tag":209,"props":2445,"children":2446},{"style":360},[2447],{"type":26,"value":2448},"        recalcPoints",{"type":21,"tag":209,"props":2450,"children":2451},{"style":222},[2452],{"type":26,"value":368},{"type":21,"tag":209,"props":2454,"children":2455},{"style":400},[2456],{"type":26,"value":403},{"type":21,"tag":209,"props":2458,"children":2459},{"style":222},[2460],{"type":26,"value":408},{"type":21,"tag":209,"props":2462,"children":2463},{"style":400},[2464],{"type":26,"value":413},{"type":21,"tag":209,"props":2466,"children":2467},{"style":222},[2468],{"type":26,"value":2369},{"type":21,"tag":209,"props":2470,"children":2472},{"class":211,"line":2471},35,[2473],{"type":21,"tag":209,"props":2474,"children":2475},{"style":448},[2476],{"type":26,"value":2477},"            // Because the `vent` events are bound to the component, you can use\n",{"type":21,"tag":209,"props":2479,"children":2481},{"class":211,"line":2480},36,[2482],{"type":21,"tag":209,"props":2483,"children":2484},{"style":448},[2485],{"type":26,"value":2486},"            // this to get props, data, computed, etc. of the component.\n",{"type":21,"tag":209,"props":2488,"children":2490},{"class":211,"line":2489},37,[2491,2496,2500,2504,2509],{"type":21,"tag":209,"props":2492,"children":2493},{"style":222},[2494],{"type":26,"value":2495},"            console.",{"type":21,"tag":209,"props":2497,"children":2498},{"style":360},[2499],{"type":26,"value":1059},{"type":21,"tag":209,"props":2501,"children":2502},{"style":222},[2503],{"type":26,"value":368},{"type":21,"tag":209,"props":2505,"children":2506},{"style":263},[2507],{"type":26,"value":2508},"this",{"type":21,"tag":209,"props":2510,"children":2511},{"style":222},[2512],{"type":26,"value":2513},".vprop);\n",{"type":21,"tag":209,"props":2515,"children":2517},{"class":211,"line":2516},38,[2518],{"type":21,"tag":209,"props":2519,"children":2520},{"style":222},[2521],{"type":26,"value":2522},"        },\n",{"type":21,"tag":209,"props":2524,"children":2526},{"class":211,"line":2525},39,[2527],{"type":21,"tag":209,"props":2528,"children":2529},{"style":448},[2530],{"type":26,"value":2412},{"type":21,"tag":209,"props":2532,"children":2534},{"class":211,"line":2533},40,[2535],{"type":21,"tag":209,"props":2536,"children":2537},{"style":448},[2538],{"type":26,"value":2539},"         * Trigger an event as a result of doing something.\n",{"type":21,"tag":209,"props":2541,"children":2543},{"class":211,"line":2542},41,[2544],{"type":21,"tag":209,"props":2545,"children":2546},{"style":448},[2547],{"type":26,"value":2439},{"type":21,"tag":209,"props":2549,"children":2551},{"class":211,"line":2550},42,[2552,2557],{"type":21,"tag":209,"props":2553,"children":2554},{"style":360},[2555],{"type":26,"value":2556},"        doSomething",{"type":21,"tag":209,"props":2558,"children":2559},{"style":222},[2560],{"type":26,"value":2561},"(){\n",{"type":21,"tag":209,"props":2563,"children":2565},{"class":211,"line":2564},43,[2566,2571,2576,2580,2584,2588,2592,2596,2600,2604],{"type":21,"tag":209,"props":2567,"children":2568},{"style":263},[2569],{"type":26,"value":2570},"            this",{"type":21,"tag":209,"props":2572,"children":2573},{"style":222},[2574],{"type":26,"value":2575},".$vent.",{"type":21,"tag":209,"props":2577,"children":2578},{"style":360},[2579],{"type":26,"value":499},{"type":21,"tag":209,"props":2581,"children":2582},{"style":222},[2583],{"type":26,"value":368},{"type":21,"tag":209,"props":2585,"children":2586},{"style":263},[2587],{"type":26,"value":373},{"type":21,"tag":209,"props":2589,"children":2590},{"style":222},[2591],{"type":26,"value":378},{"type":21,"tag":209,"props":2593,"children":2594},{"style":263},[2595],{"type":26,"value":383},{"type":21,"tag":209,"props":2597,"children":2598},{"style":222},[2599],{"type":26,"value":378},{"type":21,"tag":209,"props":2601,"children":2602},{"style":263},[2603],{"type":26,"value":2347},{"type":21,"tag":209,"props":2605,"children":2606},{"style":222},[2607],{"type":26,"value":2608},");\n",{"type":21,"tag":209,"props":2610,"children":2612},{"class":211,"line":2611},44,[2613],{"type":21,"tag":209,"props":2614,"children":2615},{"style":222},[2616],{"type":26,"value":2522},{"type":21,"tag":209,"props":2618,"children":2620},{"class":211,"line":2619},45,[2621],{"type":21,"tag":209,"props":2622,"children":2623},{"style":448},[2624],{"type":26,"value":2412},{"type":21,"tag":209,"props":2626,"children":2628},{"class":211,"line":2627},46,[2629],{"type":21,"tag":209,"props":2630,"children":2631},{"style":448},[2632],{"type":26,"value":2633},"         * Request replies from subscribers.\n",{"type":21,"tag":209,"props":2635,"children":2637},{"class":211,"line":2636},47,[2638],{"type":21,"tag":209,"props":2639,"children":2640},{"style":448},[2641],{"type":26,"value":2439},{"type":21,"tag":209,"props":2643,"children":2645},{"class":211,"line":2644},48,[2646,2651],{"type":21,"tag":209,"props":2647,"children":2648},{"style":360},[2649],{"type":26,"value":2650},"        getSomething",{"type":21,"tag":209,"props":2652,"children":2653},{"style":222},[2654],{"type":26,"value":2561},{"type":21,"tag":209,"props":2656,"children":2658},{"class":211,"line":2657},49,[2659,2663,2667,2671,2675,2679,2683,2687,2691,2695,2700,2705,2710,2714,2718,2722],{"type":21,"tag":209,"props":2660,"children":2661},{"style":263},[2662],{"type":26,"value":2570},{"type":21,"tag":209,"props":2664,"children":2665},{"style":222},[2666],{"type":26,"value":2575},{"type":21,"tag":209,"props":2668,"children":2669},{"style":360},[2670],{"type":26,"value":1343},{"type":21,"tag":209,"props":2672,"children":2673},{"style":222},[2674],{"type":26,"value":368},{"type":21,"tag":209,"props":2676,"children":2677},{"style":263},[2678],{"type":26,"value":373},{"type":21,"tag":209,"props":2680,"children":2681},{"style":222},[2682],{"type":26,"value":378},{"type":21,"tag":209,"props":2684,"children":2685},{"style":263},[2686],{"type":26,"value":383},{"type":21,"tag":209,"props":2688,"children":2689},{"style":222},[2690],{"type":26,"value":378},{"type":21,"tag":209,"props":2692,"children":2693},{"style":263},[2694],{"type":26,"value":2347},{"type":21,"tag":209,"props":2696,"children":2697},{"style":222},[2698],{"type":26,"value":2699},").",{"type":21,"tag":209,"props":2701,"children":2702},{"style":360},[2703],{"type":26,"value":2704},"then",{"type":21,"tag":209,"props":2706,"children":2707},{"style":222},[2708],{"type":26,"value":2709},"((",{"type":21,"tag":209,"props":2711,"children":2712},{"style":400},[2713],{"type":26,"value":1385},{"type":21,"tag":209,"props":2715,"children":2716},{"style":222},[2717],{"type":26,"value":432},{"type":21,"tag":209,"props":2719,"children":2720},{"style":216},[2721],{"type":26,"value":437},{"type":21,"tag":209,"props":2723,"children":2724},{"style":222},[2725],{"type":26,"value":276},{"type":21,"tag":209,"props":2727,"children":2729},{"class":211,"line":2728},50,[2730,2735,2739,2744,2748,2752],{"type":21,"tag":209,"props":2731,"children":2732},{"style":216},[2733],{"type":26,"value":2734},"                const",{"type":21,"tag":209,"props":2736,"children":2737},{"style":222},[2738],{"type":26,"value":1417},{"type":21,"tag":209,"props":2740,"children":2741},{"style":263},[2742],{"type":26,"value":2743},"resp",{"type":21,"tag":209,"props":2745,"children":2746},{"style":222},[2747],{"type":26,"value":1427},{"type":21,"tag":209,"props":2749,"children":2750},{"style":216},[2751],{"type":26,"value":1432},{"type":21,"tag":209,"props":2753,"children":2754},{"style":222},[2755],{"type":26,"value":1442},{"type":21,"tag":209,"props":2757,"children":2759},{"class":211,"line":2758},51,[2760,2765,2769],{"type":21,"tag":209,"props":2761,"children":2762},{"style":222},[2763],{"type":26,"value":2764},"                console.",{"type":21,"tag":209,"props":2766,"children":2767},{"style":360},[2768],{"type":26,"value":1059},{"type":21,"tag":209,"props":2770,"children":2771},{"style":222},[2772],{"type":26,"value":2773},"(resp);\n",{"type":21,"tag":209,"props":2775,"children":2777},{"class":211,"line":2776},52,[2778],{"type":21,"tag":209,"props":2779,"children":2780},{"style":222},[2781],{"type":26,"value":2782},"            });\n",{"type":21,"tag":209,"props":2784,"children":2786},{"class":211,"line":2785},53,[2787],{"type":21,"tag":209,"props":2788,"children":2789},{"style":222},[2790],{"type":26,"value":2522},{"type":21,"tag":209,"props":2792,"children":2794},{"class":211,"line":2793},54,[2795],{"type":21,"tag":209,"props":2796,"children":2797},{"style":222},[2798],{"type":26,"value":2251},{"type":21,"tag":209,"props":2800,"children":2802},{"class":211,"line":2801},55,[2803],{"type":21,"tag":209,"props":2804,"children":2805},{"style":222},[2806],{"type":26,"value":340},{"type":21,"tag":209,"props":2808,"children":2810},{"class":211,"line":2809},56,[2811,2815,2819],{"type":21,"tag":209,"props":2812,"children":2813},{"style":222},[2814],{"type":26,"value":2024},{"type":21,"tag":209,"props":2816,"children":2817},{"style":1988},[2818],{"type":26,"value":2059},{"type":21,"tag":209,"props":2820,"children":2821},{"style":222},[2822],{"type":26,"value":1996},{"type":21,"tag":22,"props":2824,"children":2825},{},[2826,2828,2833,2835,2841,2843,2849,2851,2856,2858,2864,2865,2870],{"type":26,"value":2827},"All events specified in the ",{"type":21,"tag":63,"props":2829,"children":2831},{"className":2830},[],[2832],{"type":26,"value":1912},{"type":26,"value":2834}," object are bound to the context of the component on ",{"type":21,"tag":63,"props":2836,"children":2838},{"className":2837},[],[2839],{"type":26,"value":2840},"mounted",{"type":26,"value":2842},", and unbound during ",{"type":21,"tag":63,"props":2844,"children":2846},{"className":2845},[],[2847],{"type":26,"value":2848},"beforeUnmount",{"type":26,"value":2850},". This means that you can use ",{"type":21,"tag":63,"props":2852,"children":2854},{"className":2853},[],[2855],{"type":26,"value":2508},{"type":26,"value":2857}," to refer to the context of the component within these functions and access ",{"type":21,"tag":63,"props":2859,"children":2861},{"className":2860},[],[2862],{"type":26,"value":2863},"data",{"type":26,"value":408},{"type":21,"tag":63,"props":2866,"children":2868},{"className":2867},[],[2869],{"type":26,"value":76},{"type":26,"value":2871},", computed properties, etc.; and that the listeners will be safely bound and unbound automagically for you without any need to manually subscribe or unsubscribe.",{"type":21,"tag":193,"props":2873,"children":2875},{"id":2874},"composition-api",[2876],{"type":26,"value":189},{"type":21,"tag":22,"props":2878,"children":2879},{},[2880,2882,2888],{"type":26,"value":2881},"Using VPubSub with the Composition API is similar to using it outside of Vue, and can be used in a ",{"type":21,"tag":63,"props":2883,"children":2885},{"className":2884},[],[2886],{"type":26,"value":2887},"setup",{"type":26,"value":2889}," script tag in single-file components.",{"type":21,"tag":200,"props":2891,"children":2893},{"className":1972,"code":2892,"language":13,"meta":8,"style":8},"\u003Cscript setup>\n    import {vent} from \"vpubsub\";\n    import EVENTS from \"events\";\n    \n    function onStart(arg1, arg2){\n        // Do something on player start.\n    }\n    function onStartRequest(arg1, arg2){\n        // Return something player start request.\n        return 42;\n    }\n    \n    vent.on(EVENTS.PLAYER.START, onStart);\n    vent.on(EVENTS.PLAYER.START, onStartRequest);\n    \n    vent.trigger(EVENTS.PLAYER.START, 1, 2);\n    vent.request(EVENTS.PLAYER.START, 1, 2).then(async(res) => {\n        const [res1, res2] = await res;\n        console.log(res1, res2);\n    });\n\u003C/script>\n",[2894],{"type":21,"tag":63,"props":2895,"children":2896},{"__ignoreMap":8},[2897,2917,2941,2966,2974,3007,3015,3022,3054,3062,3079,3086,3093,3134,3174,3181,3238,3325,3367,3384,3392],{"type":21,"tag":209,"props":2898,"children":2899},{"class":211,"line":212},[2900,2904,2908,2913],{"type":21,"tag":209,"props":2901,"children":2902},{"style":222},[2903],{"type":26,"value":1985},{"type":21,"tag":209,"props":2905,"children":2906},{"style":1988},[2907],{"type":26,"value":2059},{"type":21,"tag":209,"props":2909,"children":2910},{"style":360},[2911],{"type":26,"value":2912}," setup",{"type":21,"tag":209,"props":2914,"children":2915},{"style":222},[2916],{"type":26,"value":1996},{"type":21,"tag":209,"props":2918,"children":2919},{"class":211,"line":244},[2920,2925,2929,2933,2937],{"type":21,"tag":209,"props":2921,"children":2922},{"style":216},[2923],{"type":26,"value":2924},"    import",{"type":21,"tag":209,"props":2926,"children":2927},{"style":222},[2928],{"type":26,"value":225},{"type":21,"tag":209,"props":2930,"children":2931},{"style":216},[2932],{"type":26,"value":230},{"type":21,"tag":209,"props":2934,"children":2935},{"style":233},[2936],{"type":26,"value":236},{"type":21,"tag":209,"props":2938,"children":2939},{"style":222},[2940],{"type":26,"value":241},{"type":21,"tag":209,"props":2942,"children":2943},{"class":211,"line":254},[2944,2948,2953,2957,2962],{"type":21,"tag":209,"props":2945,"children":2946},{"style":216},[2947],{"type":26,"value":2924},{"type":21,"tag":209,"props":2949,"children":2950},{"style":222},[2951],{"type":26,"value":2952}," EVENTS ",{"type":21,"tag":209,"props":2954,"children":2955},{"style":216},[2956],{"type":26,"value":230},{"type":21,"tag":209,"props":2958,"children":2959},{"style":233},[2960],{"type":26,"value":2961}," \"events\"",{"type":21,"tag":209,"props":2963,"children":2964},{"style":222},[2965],{"type":26,"value":241},{"type":21,"tag":209,"props":2967,"children":2968},{"class":211,"line":279},[2969],{"type":21,"tag":209,"props":2970,"children":2971},{"style":222},[2972],{"type":26,"value":2973},"    \n",{"type":21,"tag":209,"props":2975,"children":2976},{"class":211,"line":288},[2977,2982,2987,2991,2995,2999,3003],{"type":21,"tag":209,"props":2978,"children":2979},{"style":216},[2980],{"type":26,"value":2981},"    function",{"type":21,"tag":209,"props":2983,"children":2984},{"style":360},[2985],{"type":26,"value":2986}," onStart",{"type":21,"tag":209,"props":2988,"children":2989},{"style":222},[2990],{"type":26,"value":368},{"type":21,"tag":209,"props":2992,"children":2993},{"style":400},[2994],{"type":26,"value":403},{"type":21,"tag":209,"props":2996,"children":2997},{"style":222},[2998],{"type":26,"value":408},{"type":21,"tag":209,"props":3000,"children":3001},{"style":400},[3002],{"type":26,"value":413},{"type":21,"tag":209,"props":3004,"children":3005},{"style":222},[3006],{"type":26,"value":2369},{"type":21,"tag":209,"props":3008,"children":3009},{"class":211,"line":307},[3010],{"type":21,"tag":209,"props":3011,"children":3012},{"style":448},[3013],{"type":26,"value":3014},"        // Do something on player start.\n",{"type":21,"tag":209,"props":3016,"children":3017},{"class":211,"line":325},[3018],{"type":21,"tag":209,"props":3019,"children":3020},{"style":222},[3021],{"type":26,"value":331},{"type":21,"tag":209,"props":3023,"children":3024},{"class":211,"line":334},[3025,3029,3034,3038,3042,3046,3050],{"type":21,"tag":209,"props":3026,"children":3027},{"style":216},[3028],{"type":26,"value":2981},{"type":21,"tag":209,"props":3030,"children":3031},{"style":360},[3032],{"type":26,"value":3033}," onStartRequest",{"type":21,"tag":209,"props":3035,"children":3036},{"style":222},[3037],{"type":26,"value":368},{"type":21,"tag":209,"props":3039,"children":3040},{"style":400},[3041],{"type":26,"value":403},{"type":21,"tag":209,"props":3043,"children":3044},{"style":222},[3045],{"type":26,"value":408},{"type":21,"tag":209,"props":3047,"children":3048},{"style":400},[3049],{"type":26,"value":413},{"type":21,"tag":209,"props":3051,"children":3052},{"style":222},[3053],{"type":26,"value":2369},{"type":21,"tag":209,"props":3055,"children":3056},{"class":211,"line":343},[3057],{"type":21,"tag":209,"props":3058,"children":3059},{"style":448},[3060],{"type":26,"value":3061},"        // Return something player start request.\n",{"type":21,"tag":209,"props":3063,"children":3064},{"class":211,"line":351},[3065,3070,3075],{"type":21,"tag":209,"props":3066,"children":3067},{"style":216},[3068],{"type":26,"value":3069},"        return",{"type":21,"tag":209,"props":3071,"children":3072},{"style":263},[3073],{"type":26,"value":3074}," 42",{"type":21,"tag":209,"props":3076,"children":3077},{"style":222},[3078],{"type":26,"value":241},{"type":21,"tag":209,"props":3080,"children":3081},{"class":211,"line":444},[3082],{"type":21,"tag":209,"props":3083,"children":3084},{"style":222},[3085],{"type":26,"value":331},{"type":21,"tag":209,"props":3087,"children":3088},{"class":211,"line":454},[3089],{"type":21,"tag":209,"props":3090,"children":3091},{"style":222},[3092],{"type":26,"value":2973},{"type":21,"tag":209,"props":3094,"children":3095},{"class":211,"line":463},[3096,3101,3105,3109,3113,3117,3121,3125,3129],{"type":21,"tag":209,"props":3097,"children":3098},{"style":222},[3099],{"type":26,"value":3100},"    vent.",{"type":21,"tag":209,"props":3102,"children":3103},{"style":360},[3104],{"type":26,"value":363},{"type":21,"tag":209,"props":3106,"children":3107},{"style":222},[3108],{"type":26,"value":368},{"type":21,"tag":209,"props":3110,"children":3111},{"style":263},[3112],{"type":26,"value":373},{"type":21,"tag":209,"props":3114,"children":3115},{"style":222},[3116],{"type":26,"value":378},{"type":21,"tag":209,"props":3118,"children":3119},{"style":263},[3120],{"type":26,"value":383},{"type":21,"tag":209,"props":3122,"children":3123},{"style":222},[3124],{"type":26,"value":378},{"type":21,"tag":209,"props":3126,"children":3127},{"style":263},[3128],{"type":26,"value":392},{"type":21,"tag":209,"props":3130,"children":3131},{"style":222},[3132],{"type":26,"value":3133},", onStart);\n",{"type":21,"tag":209,"props":3135,"children":3136},{"class":211,"line":472},[3137,3141,3145,3149,3153,3157,3161,3165,3169],{"type":21,"tag":209,"props":3138,"children":3139},{"style":222},[3140],{"type":26,"value":3100},{"type":21,"tag":209,"props":3142,"children":3143},{"style":360},[3144],{"type":26,"value":363},{"type":21,"tag":209,"props":3146,"children":3147},{"style":222},[3148],{"type":26,"value":368},{"type":21,"tag":209,"props":3150,"children":3151},{"style":263},[3152],{"type":26,"value":373},{"type":21,"tag":209,"props":3154,"children":3155},{"style":222},[3156],{"type":26,"value":378},{"type":21,"tag":209,"props":3158,"children":3159},{"style":263},[3160],{"type":26,"value":383},{"type":21,"tag":209,"props":3162,"children":3163},{"style":222},[3164],{"type":26,"value":378},{"type":21,"tag":209,"props":3166,"children":3167},{"style":263},[3168],{"type":26,"value":392},{"type":21,"tag":209,"props":3170,"children":3171},{"style":222},[3172],{"type":26,"value":3173},", onStartRequest);\n",{"type":21,"tag":209,"props":3175,"children":3176},{"class":211,"line":480},[3177],{"type":21,"tag":209,"props":3178,"children":3179},{"style":222},[3180],{"type":26,"value":2973},{"type":21,"tag":209,"props":3182,"children":3183},{"class":211,"line":489},[3184,3188,3192,3196,3200,3204,3208,3212,3216,3220,3225,3229,3234],{"type":21,"tag":209,"props":3185,"children":3186},{"style":222},[3187],{"type":26,"value":3100},{"type":21,"tag":209,"props":3189,"children":3190},{"style":360},[3191],{"type":26,"value":499},{"type":21,"tag":209,"props":3193,"children":3194},{"style":222},[3195],{"type":26,"value":368},{"type":21,"tag":209,"props":3197,"children":3198},{"style":263},[3199],{"type":26,"value":373},{"type":21,"tag":209,"props":3201,"children":3202},{"style":222},[3203],{"type":26,"value":378},{"type":21,"tag":209,"props":3205,"children":3206},{"style":263},[3207],{"type":26,"value":383},{"type":21,"tag":209,"props":3209,"children":3210},{"style":222},[3211],{"type":26,"value":378},{"type":21,"tag":209,"props":3213,"children":3214},{"style":263},[3215],{"type":26,"value":392},{"type":21,"tag":209,"props":3217,"children":3218},{"style":222},[3219],{"type":26,"value":408},{"type":21,"tag":209,"props":3221,"children":3222},{"style":263},[3223],{"type":26,"value":3224},"1",{"type":21,"tag":209,"props":3226,"children":3227},{"style":222},[3228],{"type":26,"value":408},{"type":21,"tag":209,"props":3230,"children":3231},{"style":263},[3232],{"type":26,"value":3233},"2",{"type":21,"tag":209,"props":3235,"children":3236},{"style":222},[3237],{"type":26,"value":2608},{"type":21,"tag":209,"props":3239,"children":3240},{"class":211,"line":847},[3241,3245,3249,3253,3257,3261,3265,3269,3273,3277,3281,3285,3289,3293,3297,3301,3305,3309,3313,3317,3321],{"type":21,"tag":209,"props":3242,"children":3243},{"style":222},[3244],{"type":26,"value":3100},{"type":21,"tag":209,"props":3246,"children":3247},{"style":360},[3248],{"type":26,"value":1343},{"type":21,"tag":209,"props":3250,"children":3251},{"style":222},[3252],{"type":26,"value":368},{"type":21,"tag":209,"props":3254,"children":3255},{"style":263},[3256],{"type":26,"value":373},{"type":21,"tag":209,"props":3258,"children":3259},{"style":222},[3260],{"type":26,"value":378},{"type":21,"tag":209,"props":3262,"children":3263},{"style":263},[3264],{"type":26,"value":383},{"type":21,"tag":209,"props":3266,"children":3267},{"style":222},[3268],{"type":26,"value":378},{"type":21,"tag":209,"props":3270,"children":3271},{"style":263},[3272],{"type":26,"value":392},{"type":21,"tag":209,"props":3274,"children":3275},{"style":222},[3276],{"type":26,"value":408},{"type":21,"tag":209,"props":3278,"children":3279},{"style":263},[3280],{"type":26,"value":3224},{"type":21,"tag":209,"props":3282,"children":3283},{"style":222},[3284],{"type":26,"value":408},{"type":21,"tag":209,"props":3286,"children":3287},{"style":263},[3288],{"type":26,"value":3233},{"type":21,"tag":209,"props":3290,"children":3291},{"style":222},[3292],{"type":26,"value":2699},{"type":21,"tag":209,"props":3294,"children":3295},{"style":360},[3296],{"type":26,"value":2704},{"type":21,"tag":209,"props":3298,"children":3299},{"style":222},[3300],{"type":26,"value":368},{"type":21,"tag":209,"props":3302,"children":3303},{"style":216},[3304],{"type":26,"value":1376},{"type":21,"tag":209,"props":3306,"children":3307},{"style":222},[3308],{"type":26,"value":368},{"type":21,"tag":209,"props":3310,"children":3311},{"style":400},[3312],{"type":26,"value":1385},{"type":21,"tag":209,"props":3314,"children":3315},{"style":222},[3316],{"type":26,"value":432},{"type":21,"tag":209,"props":3318,"children":3319},{"style":216},[3320],{"type":26,"value":437},{"type":21,"tag":209,"props":3322,"children":3323},{"style":222},[3324],{"type":26,"value":276},{"type":21,"tag":209,"props":3326,"children":3327},{"class":211,"line":860},[3328,3333,3337,3342,3346,3351,3355,3359,3363],{"type":21,"tag":209,"props":3329,"children":3330},{"style":216},[3331],{"type":26,"value":3332},"        const",{"type":21,"tag":209,"props":3334,"children":3335},{"style":222},[3336],{"type":26,"value":1417},{"type":21,"tag":209,"props":3338,"children":3339},{"style":263},[3340],{"type":26,"value":3341},"res1",{"type":21,"tag":209,"props":3343,"children":3344},{"style":222},[3345],{"type":26,"value":408},{"type":21,"tag":209,"props":3347,"children":3348},{"style":263},[3349],{"type":26,"value":3350},"res2",{"type":21,"tag":209,"props":3352,"children":3353},{"style":222},[3354],{"type":26,"value":1427},{"type":21,"tag":209,"props":3356,"children":3357},{"style":216},[3358],{"type":26,"value":1432},{"type":21,"tag":209,"props":3360,"children":3361},{"style":216},[3362],{"type":26,"value":1437},{"type":21,"tag":209,"props":3364,"children":3365},{"style":222},[3366],{"type":26,"value":1442},{"type":21,"tag":209,"props":3368,"children":3369},{"class":211,"line":877},[3370,3375,3379],{"type":21,"tag":209,"props":3371,"children":3372},{"style":222},[3373],{"type":26,"value":3374},"        console.",{"type":21,"tag":209,"props":3376,"children":3377},{"style":360},[3378],{"type":26,"value":1059},{"type":21,"tag":209,"props":3380,"children":3381},{"style":222},[3382],{"type":26,"value":3383},"(res1, res2);\n",{"type":21,"tag":209,"props":3385,"children":3386},{"class":211,"line":889},[3387],{"type":21,"tag":209,"props":3388,"children":3389},{"style":222},[3390],{"type":26,"value":3391},"    });\n",{"type":21,"tag":209,"props":3393,"children":3394},{"class":211,"line":902},[3395,3399,3403],{"type":21,"tag":209,"props":3396,"children":3397},{"style":222},[3398],{"type":26,"value":2024},{"type":21,"tag":209,"props":3400,"children":3401},{"style":1988},[3402],{"type":26,"value":2059},{"type":21,"tag":209,"props":3404,"children":3405},{"style":222},[3406],{"type":26,"value":1996},{"type":21,"tag":193,"props":3408,"children":3410},{"id":3409},"what-are-my-import-options",[3411],{"type":26,"value":3412},"What are my import options?",{"type":21,"tag":22,"props":3414,"children":3415},{},[3416,3418,3424,3426,3432,3434,3440,3442,3447,3449,3454],{"type":26,"value":3417},"As for imports, you can choose between importing from ",{"type":21,"tag":63,"props":3419,"children":3421},{"className":3420},[],[3422],{"type":26,"value":3423},"vpubsub",{"type":26,"value":3425},", which expects ",{"type":21,"tag":63,"props":3427,"children":3429},{"className":3428},[],[3430],{"type":26,"value":3431},"lodash-es",{"type":26,"value":3433}," as a peer dependency but doesn't bake in the parts it needs; or you can import from ",{"type":21,"tag":63,"props":3435,"children":3437},{"className":3436},[],[3438],{"type":26,"value":3439},"vpubsub/dist/vpubsub.full.js",{"type":26,"value":3441}," which bakes in just those bits of ",{"type":21,"tag":63,"props":3443,"children":3445},{"className":3444},[],[3446],{"type":26,"value":3431},{"type":26,"value":3448}," that it relies on, and is suitable if you don't intend to make ",{"type":21,"tag":63,"props":3450,"children":3452},{"className":3451},[],[3453],{"type":26,"value":3431},{"type":26,"value":3455}," part of your project.",{"type":21,"tag":193,"props":3457,"children":3459},{"id":3458},"this-is-pretty-neat-id-like-to-use-it-in-my-project",[3460],{"type":26,"value":3461},"This is pretty neat! I'd like to use it in my project.",{"type":21,"tag":22,"props":3463,"children":3464},{},[3465],{"type":26,"value":3466},"Go for it. 🚀",{"type":21,"tag":22,"props":3468,"children":3469},{},[3470,3472,3479,3481,3488],{"type":26,"value":3471},"You can find it over on ",{"type":21,"tag":29,"props":3473,"children":3476},{"href":3474,"rel":3475},"https://github.com/SaneMethod/vpubsub",[93],[3477],{"type":26,"value":3478},"github",{"type":26,"value":3480}," - license details are ",{"type":21,"tag":29,"props":3482,"children":3485},{"href":3483,"rel":3484},"https://github.com/SaneMethod/vpubsub/blob/master/LICENSE.txt",[93],[3486],{"type":26,"value":3487},"in the repo",{"type":26,"value":378},{"type":21,"tag":3490,"props":3491,"children":3492},"style",{},[3493],{"type":26,"value":3494},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":8,"searchDepth":254,"depth":254,"links":3496},[3497,3498,3504],{"id":53,"depth":254,"text":56},{"id":165,"depth":254,"text":168,"children":3499},[3500,3501,3502,3503],{"id":195,"depth":279,"text":198},{"id":585,"depth":279,"text":588},{"id":930,"depth":279,"text":933},{"id":1074,"depth":279,"text":1077},{"id":1487,"depth":254,"text":1490,"children":3505},[3506,3507,3508,3509,3510],{"id":1498,"depth":279,"text":1501},{"id":1899,"depth":279,"text":180},{"id":2874,"depth":279,"text":189},{"id":3409,"depth":279,"text":3412},{"id":3458,"depth":279,"text":3461},"markdown","content:ckeefer:2024-7:VPubSub.md","content","ckeefer/2024-7/VPubSub.md","ckeefer/2024-7/VPubSub","md",{"user":3518,"name":3519},"ckeefer","Christopher Keefer",{"_path":3521,"_dir":3522,"_draft":7,"_partial":7,"_locale":8,"title":3523,"description":3524,"image":3525,"tags":3526,"publishDate":3528,"excerpt":3524,"body":3529,"_type":3511,"_id":11171,"_source":3513,"_file":11172,"_stem":11173,"_extension":3516,"author":11174},"/phendry/2022-07-28/migratingfromexpresstofastifypart2","2022-07-28","Migrating from Express to Fastify, Part 2","In Part 1, we looked at the features of the Fastify Node.js Web framework compared to Express.js. In Part 2, we'll work through migrating an example Express.js application to Fastify.","/phendry/2022-07-28/img/Migrating from Express to Fastify, Part 2.png",[12,3527],"series","2023-12-31",{"type":18,"children":3530,"toc":11158},[3531,3554,3581,3595,3602,3620,3625,3659,3665,3678,3774,3793,3799,3804,3814,3835,3870,3882,3895,4124,4129,4556,4561,4675,4696,4701,4729,5353,5366,5871,5897,5939,5952,5958,5964,5984,6014,6023,6840,6852,6982,7011,7017,7030,7567,7573,7593,7603,7700,7721,7730,7886,7907,7912,7921,8383,8388,8397,8736,8763,8799,8808,9079,9084,9329,9334,9346,9352,9394,9406,9412,9417,9422,9942,9963,9973,11120,11126,11138,11143,11154],{"type":21,"tag":22,"props":3532,"children":3533},{},[3534,3536,3543,3545,3552],{"type":26,"value":3535},"In Part 1, we looked at the features of the ",{"type":21,"tag":29,"props":3537,"children":3540},{"href":3538,"rel":3539},"https://www.fastify.io/",[93],[3541],{"type":26,"value":3542},"Fastify",{"type":26,"value":3544}," Node.js Web framework compared to ",{"type":21,"tag":29,"props":3546,"children":3549},{"href":3547,"rel":3548},"https://expressjs.com/",[93],[3550],{"type":26,"value":3551},"Express.js",{"type":26,"value":3553},". In Part 2, we'll work through migrating an example Express.js application to Fastify.",{"type":21,"tag":22,"props":3555,"children":3556},{},[3557,3559,3570,3572,3579],{"type":26,"value":3558},"The example application we'll migrate is called ",{"type":21,"tag":29,"props":3560,"children":3563},{"href":3561,"rel":3562},"https://github.com/gothinkster/node-express-realworld-example-app",[93],[3564],{"type":21,"tag":63,"props":3565,"children":3567},{"className":3566},[],[3568],{"type":26,"value":3569},"node-express-realworld-example-app",{"type":26,"value":3571},", which is an Express/MongoDB-based implementation of the ",{"type":21,"tag":29,"props":3573,"children":3576},{"href":3574,"rel":3575},"https://github.com/gothinkster/realworld",[93],[3577],{"type":26,"value":3578},"RealWorld example app",{"type":26,"value":3580}," backend. RealWorld is a specification of a simple blogging website, so the backend component involves managing users, articles, and comments; it's a good demonstration project since it's just large enough to be a decent representation of a production project.",{"type":21,"tag":22,"props":3582,"children":3583},{},[3584,3586,3593],{"type":26,"value":3585},"The code for this example can be found ",{"type":21,"tag":29,"props":3587,"children":3590},{"href":3588,"rel":3589},"https://github.com/artandlogic/node-express-to-fastify-example",[93],[3591],{"type":26,"value":3592},"here",{"type":26,"value":3594},"; at each step in the migration, there'll be a link to follow along with the complete set of changes.",{"type":21,"tag":3596,"props":3597,"children":3599},"h2",{"id":3598},"incremental-migration-using-fastifyexpress",[3600],{"type":26,"value":3601},"Incremental migration using @fastify/express",{"type":21,"tag":22,"props":3603,"children":3604},{},[3605,3607,3618],{"type":26,"value":3606},"Any code refactor is best done incrementally, so that it can be tested every step along the way. Fastify provides a core plugin called ",{"type":21,"tag":29,"props":3608,"children":3611},{"href":3609,"rel":3610},"https://github.com/fastify/fastify-express",[93],[3612],{"type":21,"tag":63,"props":3613,"children":3615},{"className":3614},[],[3616],{"type":26,"value":3617},"@fastify/express",{"type":26,"value":3619}," which makes this possible during an Express-to-Fastify migration. It can be used in a few different ways, but the feature that's useful in this example is its ability to load an entire Express application inside of a Fastify application.",{"type":21,"tag":22,"props":3621,"children":3622},{},[3623],{"type":26,"value":3624},"With this capability, an Express application can be migrated to Fastify in a three-step process:",{"type":21,"tag":3626,"props":3627,"children":3628},"ol",{},[3629,3642,3647],{"type":21,"tag":3630,"props":3631,"children":3632},"li",{},[3633,3635,3640],{"type":26,"value":3634},"Replace the Express server component with Fastify, using ",{"type":21,"tag":63,"props":3636,"children":3638},{"className":3637},[],[3639],{"type":26,"value":3617},{"type":26,"value":3641}," to load the existing Express router",{"type":21,"tag":3630,"props":3643,"children":3644},{},[3645],{"type":26,"value":3646},"Migrate routes from Express to Fastify, one by one",{"type":21,"tag":3630,"props":3648,"children":3649},{},[3650,3652,3657],{"type":26,"value":3651},"Remove Express, associated plugins, and ",{"type":21,"tag":63,"props":3653,"children":3655},{"className":3654},[],[3656],{"type":26,"value":3617},{"type":26,"value":3658}," from the project",{"type":21,"tag":3596,"props":3660,"children":3662},{"id":3661},"an-overview-of-the-example-project",[3663],{"type":26,"value":3664},"An overview of the example project",{"type":21,"tag":22,"props":3666,"children":3667},{},[3668,3670,3676],{"type":26,"value":3669},"The initial state of the project can be browsed ",{"type":21,"tag":29,"props":3671,"children":3674},{"href":3672,"rel":3673},"https://github.com/artandlogic/node-express-to-fastify-example/tree/3614fd4aeeca2c863c79b9127ecf467ce8c80fe2",[93],[3675],{"type":26,"value":3592},{"type":26,"value":3677},". It's structured in a straightforward way:",{"type":21,"tag":3679,"props":3680,"children":3681},"ul",{},[3682,3701,3721,3732,3743,3763],{"type":21,"tag":3630,"props":3683,"children":3684},{},[3685,3691,3693,3699],{"type":21,"tag":63,"props":3686,"children":3688},{"className":3687},[],[3689],{"type":26,"value":3690},"config/",{"type":26,"value":3692},": A few modules for configuring environment variables and the ",{"type":21,"tag":63,"props":3694,"children":3696},{"className":3695},[],[3697],{"type":26,"value":3698},"passport",{"type":26,"value":3700}," library used for authentication",{"type":21,"tag":3630,"props":3702,"children":3703},{},[3704,3710,3712,3719],{"type":21,"tag":63,"props":3705,"children":3707},{"className":3706},[],[3708],{"type":26,"value":3709},"models/",{"type":26,"value":3711},": Contains the ",{"type":21,"tag":29,"props":3713,"children":3716},{"href":3714,"rel":3715},"https://mongoosejs.com/",[93],[3717],{"type":26,"value":3718},"Mongoose",{"type":26,"value":3720}," models used for interfacing with MongoDB",{"type":21,"tag":3630,"props":3722,"children":3723},{},[3724,3730],{"type":21,"tag":63,"props":3725,"children":3727},{"className":3726},[],[3728],{"type":26,"value":3729},"public/",{"type":26,"value":3731},": A directory for static assets",{"type":21,"tag":3630,"props":3733,"children":3734},{},[3735,3741],{"type":21,"tag":63,"props":3736,"children":3738},{"className":3737},[],[3739],{"type":26,"value":3740},"routes/",{"type":26,"value":3742},": Modules defining the API endpoints of the application",{"type":21,"tag":3630,"props":3744,"children":3745},{},[3746,3752,3754,3761],{"type":21,"tag":63,"props":3747,"children":3749},{"className":3748},[],[3750],{"type":26,"value":3751},"tests/",{"type":26,"value":3753},": Contains ",{"type":21,"tag":29,"props":3755,"children":3758},{"href":3756,"rel":3757},"https://learning.postman.com/docs/running-collections/using-newman-cli/command-line-integration-with-newman/",[93],[3759],{"type":26,"value":3760},"Newman",{"type":26,"value":3762},"-based end-to-end automated testing",{"type":21,"tag":3630,"props":3764,"children":3765},{},[3766,3772],{"type":21,"tag":63,"props":3767,"children":3769},{"className":3768},[],[3770],{"type":26,"value":3771},"app.js",{"type":26,"value":3773},": The main entrypoint where the Express server is started",{"type":21,"tag":22,"props":3775,"children":3776},{},[3777,3779,3784,3786,3791],{"type":26,"value":3778},"The first step in the migration will be to change ",{"type":21,"tag":63,"props":3780,"children":3782},{"className":3781},[],[3783],{"type":26,"value":3771},{"type":26,"value":3785}," such that it starts a Fastify server, and using the ",{"type":21,"tag":63,"props":3787,"children":3789},{"className":3788},[],[3790],{"type":26,"value":3617},{"type":26,"value":3792}," plugin in order to load the existing Express application. The end result is an application that works no differently than before, but it'll be ready for Fastify routes to be added which co-exist with the Express ones.",{"type":21,"tag":3596,"props":3794,"children":3796},{"id":3795},"step-1-replacing-the-server-component",[3797],{"type":26,"value":3798},"Step 1: Replacing the server component",{"type":21,"tag":22,"props":3800,"children":3801},{},[3802],{"type":26,"value":3803},"First, a few new packages need to be installed:",{"type":21,"tag":200,"props":3805,"children":3809},{"className":3806,"code":3808,"language":26},[3807],"language-text","npm install --save fastify @fastify/express fastify-plugin @fastify/formbody\n",[3810],{"type":21,"tag":63,"props":3811,"children":3812},{"__ignoreMap":8},[3813],{"type":26,"value":3808},{"type":21,"tag":22,"props":3815,"children":3816},{},[3817,3819,3825,3827,3833],{"type":26,"value":3818},"Note that ",{"type":21,"tag":63,"props":3820,"children":3822},{"className":3821},[],[3823],{"type":26,"value":3824},"fastify-plugin",{"type":26,"value":3826}," is a utility we'll use for defining Fastify plugins, and ",{"type":21,"tag":63,"props":3828,"children":3830},{"className":3829},[],[3831],{"type":26,"value":3832},"@fastify/formbody",{"type":26,"value":3834}," is for an Express-related workaround we'll discuss later.",{"type":21,"tag":22,"props":3836,"children":3837},{},[3838,3840,3845,3847,3853,3855,3861,3863,3868],{"type":26,"value":3839},"Next, we'll want to move the existing Express routes from ",{"type":21,"tag":63,"props":3841,"children":3843},{"className":3842},[],[3844],{"type":26,"value":3740},{"type":26,"value":3846}," into a new ",{"type":21,"tag":63,"props":3848,"children":3850},{"className":3849},[],[3851],{"type":26,"value":3852},"routes/legacy/",{"type":26,"value":3854}," directory, updating ",{"type":21,"tag":63,"props":3856,"children":3858},{"className":3857},[],[3859],{"type":26,"value":3860},"require()",{"type":26,"value":3862}," statements accordingly. This leaves the ",{"type":21,"tag":63,"props":3864,"children":3866},{"className":3865},[],[3867],{"type":26,"value":3740},{"type":26,"value":3869}," directory ready to accept new Fastify routes in step 2.",{"type":21,"tag":22,"props":3871,"children":3872},{},[3873,3875,3880],{"type":26,"value":3874},"With those preparations complete, it's time to replace the Express server in ",{"type":21,"tag":63,"props":3876,"children":3878},{"className":3877},[],[3879],{"type":26,"value":3771},{"type":26,"value":3881}," with a Fastify server. Currently, what that module is doing is:",{"type":21,"tag":22,"props":3883,"children":3884},{},[3885,3887,3893],{"type":26,"value":3886},"Instantiating an ",{"type":21,"tag":63,"props":3888,"children":3890},{"className":3889},[],[3891],{"type":26,"value":3892},"Express",{"type":26,"value":3894}," object...",{"type":21,"tag":200,"props":3896,"children":3898},{"className":202,"code":3897,"language":12,"meta":8,"style":8},"var express = require('express');\nvar bodyParser = require('body-parser');\nvar cors = require('cors');\nvar mongoose = require('mongoose');\n/* ... */\n\nvar isProduction = process.env.NODE_ENV === 'production';\n\nvar app = express();\n",[3899],{"type":21,"tag":63,"props":3900,"children":3901},{"__ignoreMap":8},[3902,3937,3970,4003,4036,4044,4051,4091,4098],{"type":21,"tag":209,"props":3903,"children":3904},{"class":211,"line":212},[3905,3910,3915,3919,3924,3928,3933],{"type":21,"tag":209,"props":3906,"children":3907},{"style":216},[3908],{"type":26,"value":3909},"var",{"type":21,"tag":209,"props":3911,"children":3912},{"style":222},[3913],{"type":26,"value":3914}," express ",{"type":21,"tag":209,"props":3916,"children":3917},{"style":216},[3918],{"type":26,"value":1432},{"type":21,"tag":209,"props":3920,"children":3921},{"style":360},[3922],{"type":26,"value":3923}," require",{"type":21,"tag":209,"props":3925,"children":3926},{"style":222},[3927],{"type":26,"value":368},{"type":21,"tag":209,"props":3929,"children":3930},{"style":233},[3931],{"type":26,"value":3932},"'express'",{"type":21,"tag":209,"props":3934,"children":3935},{"style":222},[3936],{"type":26,"value":2608},{"type":21,"tag":209,"props":3938,"children":3939},{"class":211,"line":244},[3940,3944,3949,3953,3957,3961,3966],{"type":21,"tag":209,"props":3941,"children":3942},{"style":216},[3943],{"type":26,"value":3909},{"type":21,"tag":209,"props":3945,"children":3946},{"style":222},[3947],{"type":26,"value":3948}," bodyParser ",{"type":21,"tag":209,"props":3950,"children":3951},{"style":216},[3952],{"type":26,"value":1432},{"type":21,"tag":209,"props":3954,"children":3955},{"style":360},[3956],{"type":26,"value":3923},{"type":21,"tag":209,"props":3958,"children":3959},{"style":222},[3960],{"type":26,"value":368},{"type":21,"tag":209,"props":3962,"children":3963},{"style":233},[3964],{"type":26,"value":3965},"'body-parser'",{"type":21,"tag":209,"props":3967,"children":3968},{"style":222},[3969],{"type":26,"value":2608},{"type":21,"tag":209,"props":3971,"children":3972},{"class":211,"line":254},[3973,3977,3982,3986,3990,3994,3999],{"type":21,"tag":209,"props":3974,"children":3975},{"style":216},[3976],{"type":26,"value":3909},{"type":21,"tag":209,"props":3978,"children":3979},{"style":222},[3980],{"type":26,"value":3981}," cors ",{"type":21,"tag":209,"props":3983,"children":3984},{"style":216},[3985],{"type":26,"value":1432},{"type":21,"tag":209,"props":3987,"children":3988},{"style":360},[3989],{"type":26,"value":3923},{"type":21,"tag":209,"props":3991,"children":3992},{"style":222},[3993],{"type":26,"value":368},{"type":21,"tag":209,"props":3995,"children":3996},{"style":233},[3997],{"type":26,"value":3998},"'cors'",{"type":21,"tag":209,"props":4000,"children":4001},{"style":222},[4002],{"type":26,"value":2608},{"type":21,"tag":209,"props":4004,"children":4005},{"class":211,"line":279},[4006,4010,4015,4019,4023,4027,4032],{"type":21,"tag":209,"props":4007,"children":4008},{"style":216},[4009],{"type":26,"value":3909},{"type":21,"tag":209,"props":4011,"children":4012},{"style":222},[4013],{"type":26,"value":4014}," mongoose ",{"type":21,"tag":209,"props":4016,"children":4017},{"style":216},[4018],{"type":26,"value":1432},{"type":21,"tag":209,"props":4020,"children":4021},{"style":360},[4022],{"type":26,"value":3923},{"type":21,"tag":209,"props":4024,"children":4025},{"style":222},[4026],{"type":26,"value":368},{"type":21,"tag":209,"props":4028,"children":4029},{"style":233},[4030],{"type":26,"value":4031},"'mongoose'",{"type":21,"tag":209,"props":4033,"children":4034},{"style":222},[4035],{"type":26,"value":2608},{"type":21,"tag":209,"props":4037,"children":4038},{"class":211,"line":288},[4039],{"type":21,"tag":209,"props":4040,"children":4041},{"style":448},[4042],{"type":26,"value":4043},"/* ... */\n",{"type":21,"tag":209,"props":4045,"children":4046},{"class":211,"line":307},[4047],{"type":21,"tag":209,"props":4048,"children":4049},{"emptyLinePlaceholder":248},[4050],{"type":26,"value":251},{"type":21,"tag":209,"props":4052,"children":4053},{"class":211,"line":325},[4054,4058,4063,4067,4072,4077,4082,4087],{"type":21,"tag":209,"props":4055,"children":4056},{"style":216},[4057],{"type":26,"value":3909},{"type":21,"tag":209,"props":4059,"children":4060},{"style":222},[4061],{"type":26,"value":4062}," isProduction ",{"type":21,"tag":209,"props":4064,"children":4065},{"style":216},[4066],{"type":26,"value":1432},{"type":21,"tag":209,"props":4068,"children":4069},{"style":222},[4070],{"type":26,"value":4071}," process.env.",{"type":21,"tag":209,"props":4073,"children":4074},{"style":263},[4075],{"type":26,"value":4076},"NODE_ENV",{"type":21,"tag":209,"props":4078,"children":4079},{"style":216},[4080],{"type":26,"value":4081}," ===",{"type":21,"tag":209,"props":4083,"children":4084},{"style":233},[4085],{"type":26,"value":4086}," 'production'",{"type":21,"tag":209,"props":4088,"children":4089},{"style":222},[4090],{"type":26,"value":241},{"type":21,"tag":209,"props":4092,"children":4093},{"class":211,"line":334},[4094],{"type":21,"tag":209,"props":4095,"children":4096},{"emptyLinePlaceholder":248},[4097],{"type":26,"value":251},{"type":21,"tag":209,"props":4099,"children":4100},{"class":211,"line":343},[4101,4105,4110,4114,4119],{"type":21,"tag":209,"props":4102,"children":4103},{"style":216},[4104],{"type":26,"value":3909},{"type":21,"tag":209,"props":4106,"children":4107},{"style":222},[4108],{"type":26,"value":4109}," app ",{"type":21,"tag":209,"props":4111,"children":4112},{"style":216},[4113],{"type":26,"value":1432},{"type":21,"tag":209,"props":4115,"children":4116},{"style":360},[4117],{"type":26,"value":4118}," express",{"type":21,"tag":209,"props":4120,"children":4121},{"style":222},[4122],{"type":26,"value":4123},"();\n",{"type":21,"tag":22,"props":4125,"children":4126},{},[4127],{"type":26,"value":4128},"...configuring it, applying middleware, and setting up a database connection...",{"type":21,"tag":200,"props":4130,"children":4132},{"className":202,"code":4131,"language":12,"meta":8,"style":8},"app.use(cors());\n\napp.use(require('morgan')('dev'));\napp.use(bodyParser.urlencoded({ extended: false }));\napp.use(bodyParser.json());\n\n/* ... */\n\nif(isProduction){\n  mongoose.connect(process.env.MONGODB_URI);\n} else {\n  mongoose.connect('mongodb://localhost/conduit');\n  mongoose.set('debug', true);\n}\n\nrequire('./models/User');\nrequire('./models/Article');\nrequire('./models/Comment');\nrequire('./config/passport');\n\napp.use(require('./routes'));\n\n/* ... */\n",[4133],{"type":21,"tag":63,"props":4134,"children":4135},{"__ignoreMap":8},[4136,4162,4169,4213,4249,4273,4280,4287,4294,4307,4334,4351,4375,4408,4416,4423,4443,4463,4483,4503,4510,4542,4549],{"type":21,"tag":209,"props":4137,"children":4138},{"class":211,"line":212},[4139,4144,4148,4152,4157],{"type":21,"tag":209,"props":4140,"children":4141},{"style":222},[4142],{"type":26,"value":4143},"app.",{"type":21,"tag":209,"props":4145,"children":4146},{"style":360},[4147],{"type":26,"value":1747},{"type":21,"tag":209,"props":4149,"children":4150},{"style":222},[4151],{"type":26,"value":368},{"type":21,"tag":209,"props":4153,"children":4154},{"style":360},[4155],{"type":26,"value":4156},"cors",{"type":21,"tag":209,"props":4158,"children":4159},{"style":222},[4160],{"type":26,"value":4161},"());\n",{"type":21,"tag":209,"props":4163,"children":4164},{"class":211,"line":244},[4165],{"type":21,"tag":209,"props":4166,"children":4167},{"emptyLinePlaceholder":248},[4168],{"type":26,"value":251},{"type":21,"tag":209,"props":4170,"children":4171},{"class":211,"line":254},[4172,4176,4180,4184,4189,4193,4198,4203,4208],{"type":21,"tag":209,"props":4173,"children":4174},{"style":222},[4175],{"type":26,"value":4143},{"type":21,"tag":209,"props":4177,"children":4178},{"style":360},[4179],{"type":26,"value":1747},{"type":21,"tag":209,"props":4181,"children":4182},{"style":222},[4183],{"type":26,"value":368},{"type":21,"tag":209,"props":4185,"children":4186},{"style":360},[4187],{"type":26,"value":4188},"require",{"type":21,"tag":209,"props":4190,"children":4191},{"style":222},[4192],{"type":26,"value":368},{"type":21,"tag":209,"props":4194,"children":4195},{"style":233},[4196],{"type":26,"value":4197},"'morgan'",{"type":21,"tag":209,"props":4199,"children":4200},{"style":222},[4201],{"type":26,"value":4202},")(",{"type":21,"tag":209,"props":4204,"children":4205},{"style":233},[4206],{"type":26,"value":4207},"'dev'",{"type":21,"tag":209,"props":4209,"children":4210},{"style":222},[4211],{"type":26,"value":4212},"));\n",{"type":21,"tag":209,"props":4214,"children":4215},{"class":211,"line":279},[4216,4220,4224,4229,4234,4239,4244],{"type":21,"tag":209,"props":4217,"children":4218},{"style":222},[4219],{"type":26,"value":4143},{"type":21,"tag":209,"props":4221,"children":4222},{"style":360},[4223],{"type":26,"value":1747},{"type":21,"tag":209,"props":4225,"children":4226},{"style":222},[4227],{"type":26,"value":4228},"(bodyParser.",{"type":21,"tag":209,"props":4230,"children":4231},{"style":360},[4232],{"type":26,"value":4233},"urlencoded",{"type":21,"tag":209,"props":4235,"children":4236},{"style":222},[4237],{"type":26,"value":4238},"({ extended: ",{"type":21,"tag":209,"props":4240,"children":4241},{"style":263},[4242],{"type":26,"value":4243},"false",{"type":21,"tag":209,"props":4245,"children":4246},{"style":222},[4247],{"type":26,"value":4248}," }));\n",{"type":21,"tag":209,"props":4250,"children":4251},{"class":211,"line":288},[4252,4256,4260,4264,4269],{"type":21,"tag":209,"props":4253,"children":4254},{"style":222},[4255],{"type":26,"value":4143},{"type":21,"tag":209,"props":4257,"children":4258},{"style":360},[4259],{"type":26,"value":1747},{"type":21,"tag":209,"props":4261,"children":4262},{"style":222},[4263],{"type":26,"value":4228},{"type":21,"tag":209,"props":4265,"children":4266},{"style":360},[4267],{"type":26,"value":4268},"json",{"type":21,"tag":209,"props":4270,"children":4271},{"style":222},[4272],{"type":26,"value":4161},{"type":21,"tag":209,"props":4274,"children":4275},{"class":211,"line":307},[4276],{"type":21,"tag":209,"props":4277,"children":4278},{"emptyLinePlaceholder":248},[4279],{"type":26,"value":251},{"type":21,"tag":209,"props":4281,"children":4282},{"class":211,"line":325},[4283],{"type":21,"tag":209,"props":4284,"children":4285},{"style":448},[4286],{"type":26,"value":4043},{"type":21,"tag":209,"props":4288,"children":4289},{"class":211,"line":334},[4290],{"type":21,"tag":209,"props":4291,"children":4292},{"emptyLinePlaceholder":248},[4293],{"type":26,"value":251},{"type":21,"tag":209,"props":4295,"children":4296},{"class":211,"line":343},[4297,4302],{"type":21,"tag":209,"props":4298,"children":4299},{"style":216},[4300],{"type":26,"value":4301},"if",{"type":21,"tag":209,"props":4303,"children":4304},{"style":222},[4305],{"type":26,"value":4306},"(isProduction){\n",{"type":21,"tag":209,"props":4308,"children":4309},{"class":211,"line":351},[4310,4315,4320,4325,4330],{"type":21,"tag":209,"props":4311,"children":4312},{"style":222},[4313],{"type":26,"value":4314},"  mongoose.",{"type":21,"tag":209,"props":4316,"children":4317},{"style":360},[4318],{"type":26,"value":4319},"connect",{"type":21,"tag":209,"props":4321,"children":4322},{"style":222},[4323],{"type":26,"value":4324},"(process.env.",{"type":21,"tag":209,"props":4326,"children":4327},{"style":263},[4328],{"type":26,"value":4329},"MONGODB_URI",{"type":21,"tag":209,"props":4331,"children":4332},{"style":222},[4333],{"type":26,"value":2608},{"type":21,"tag":209,"props":4335,"children":4336},{"class":211,"line":444},[4337,4342,4347],{"type":21,"tag":209,"props":4338,"children":4339},{"style":222},[4340],{"type":26,"value":4341},"} ",{"type":21,"tag":209,"props":4343,"children":4344},{"style":216},[4345],{"type":26,"value":4346},"else",{"type":21,"tag":209,"props":4348,"children":4349},{"style":222},[4350],{"type":26,"value":276},{"type":21,"tag":209,"props":4352,"children":4353},{"class":211,"line":454},[4354,4358,4362,4366,4371],{"type":21,"tag":209,"props":4355,"children":4356},{"style":222},[4357],{"type":26,"value":4314},{"type":21,"tag":209,"props":4359,"children":4360},{"style":360},[4361],{"type":26,"value":4319},{"type":21,"tag":209,"props":4363,"children":4364},{"style":222},[4365],{"type":26,"value":368},{"type":21,"tag":209,"props":4367,"children":4368},{"style":233},[4369],{"type":26,"value":4370},"'mongodb://localhost/conduit'",{"type":21,"tag":209,"props":4372,"children":4373},{"style":222},[4374],{"type":26,"value":2608},{"type":21,"tag":209,"props":4376,"children":4377},{"class":211,"line":463},[4378,4382,4387,4391,4396,4400,4404],{"type":21,"tag":209,"props":4379,"children":4380},{"style":222},[4381],{"type":26,"value":4314},{"type":21,"tag":209,"props":4383,"children":4384},{"style":360},[4385],{"type":26,"value":4386},"set",{"type":21,"tag":209,"props":4388,"children":4389},{"style":222},[4390],{"type":26,"value":368},{"type":21,"tag":209,"props":4392,"children":4393},{"style":233},[4394],{"type":26,"value":4395},"'debug'",{"type":21,"tag":209,"props":4397,"children":4398},{"style":222},[4399],{"type":26,"value":408},{"type":21,"tag":209,"props":4401,"children":4402},{"style":263},[4403],{"type":26,"value":2223},{"type":21,"tag":209,"props":4405,"children":4406},{"style":222},[4407],{"type":26,"value":2608},{"type":21,"tag":209,"props":4409,"children":4410},{"class":211,"line":472},[4411],{"type":21,"tag":209,"props":4412,"children":4413},{"style":222},[4414],{"type":26,"value":4415},"}\n",{"type":21,"tag":209,"props":4417,"children":4418},{"class":211,"line":480},[4419],{"type":21,"tag":209,"props":4420,"children":4421},{"emptyLinePlaceholder":248},[4422],{"type":26,"value":251},{"type":21,"tag":209,"props":4424,"children":4425},{"class":211,"line":489},[4426,4430,4434,4439],{"type":21,"tag":209,"props":4427,"children":4428},{"style":360},[4429],{"type":26,"value":4188},{"type":21,"tag":209,"props":4431,"children":4432},{"style":222},[4433],{"type":26,"value":368},{"type":21,"tag":209,"props":4435,"children":4436},{"style":233},[4437],{"type":26,"value":4438},"'./models/User'",{"type":21,"tag":209,"props":4440,"children":4441},{"style":222},[4442],{"type":26,"value":2608},{"type":21,"tag":209,"props":4444,"children":4445},{"class":211,"line":847},[4446,4450,4454,4459],{"type":21,"tag":209,"props":4447,"children":4448},{"style":360},[4449],{"type":26,"value":4188},{"type":21,"tag":209,"props":4451,"children":4452},{"style":222},[4453],{"type":26,"value":368},{"type":21,"tag":209,"props":4455,"children":4456},{"style":233},[4457],{"type":26,"value":4458},"'./models/Article'",{"type":21,"tag":209,"props":4460,"children":4461},{"style":222},[4462],{"type":26,"value":2608},{"type":21,"tag":209,"props":4464,"children":4465},{"class":211,"line":860},[4466,4470,4474,4479],{"type":21,"tag":209,"props":4467,"children":4468},{"style":360},[4469],{"type":26,"value":4188},{"type":21,"tag":209,"props":4471,"children":4472},{"style":222},[4473],{"type":26,"value":368},{"type":21,"tag":209,"props":4475,"children":4476},{"style":233},[4477],{"type":26,"value":4478},"'./models/Comment'",{"type":21,"tag":209,"props":4480,"children":4481},{"style":222},[4482],{"type":26,"value":2608},{"type":21,"tag":209,"props":4484,"children":4485},{"class":211,"line":877},[4486,4490,4494,4499],{"type":21,"tag":209,"props":4487,"children":4488},{"style":360},[4489],{"type":26,"value":4188},{"type":21,"tag":209,"props":4491,"children":4492},{"style":222},[4493],{"type":26,"value":368},{"type":21,"tag":209,"props":4495,"children":4496},{"style":233},[4497],{"type":26,"value":4498},"'./config/passport'",{"type":21,"tag":209,"props":4500,"children":4501},{"style":222},[4502],{"type":26,"value":2608},{"type":21,"tag":209,"props":4504,"children":4505},{"class":211,"line":889},[4506],{"type":21,"tag":209,"props":4507,"children":4508},{"emptyLinePlaceholder":248},[4509],{"type":26,"value":251},{"type":21,"tag":209,"props":4511,"children":4512},{"class":211,"line":902},[4513,4517,4521,4525,4529,4533,4538],{"type":21,"tag":209,"props":4514,"children":4515},{"style":222},[4516],{"type":26,"value":4143},{"type":21,"tag":209,"props":4518,"children":4519},{"style":360},[4520],{"type":26,"value":1747},{"type":21,"tag":209,"props":4522,"children":4523},{"style":222},[4524],{"type":26,"value":368},{"type":21,"tag":209,"props":4526,"children":4527},{"style":360},[4528],{"type":26,"value":4188},{"type":21,"tag":209,"props":4530,"children":4531},{"style":222},[4532],{"type":26,"value":368},{"type":21,"tag":209,"props":4534,"children":4535},{"style":233},[4536],{"type":26,"value":4537},"'./routes'",{"type":21,"tag":209,"props":4539,"children":4540},{"style":222},[4541],{"type":26,"value":4212},{"type":21,"tag":209,"props":4543,"children":4544},{"class":211,"line":914},[4545],{"type":21,"tag":209,"props":4546,"children":4547},{"emptyLinePlaceholder":248},[4548],{"type":26,"value":251},{"type":21,"tag":209,"props":4550,"children":4551},{"class":211,"line":922},[4552],{"type":21,"tag":209,"props":4553,"children":4554},{"style":448},[4555],{"type":26,"value":4043},{"type":21,"tag":22,"props":4557,"children":4558},{},[4559],{"type":26,"value":4560},"...and finally, starting the server:",{"type":21,"tag":200,"props":4562,"children":4564},{"className":202,"code":4563,"language":12,"meta":8,"style":8},"var server = app.listen( process.env.PORT || 3000, function(){\n  console.log('Listening on port ' + server.address().port);\n});\n",[4565],{"type":21,"tag":63,"props":4566,"children":4567},{"__ignoreMap":8},[4568,4627,4668],{"type":21,"tag":209,"props":4569,"children":4570},{"class":211,"line":212},[4571,4575,4580,4584,4589,4594,4599,4604,4609,4614,4618,4623],{"type":21,"tag":209,"props":4572,"children":4573},{"style":216},[4574],{"type":26,"value":3909},{"type":21,"tag":209,"props":4576,"children":4577},{"style":222},[4578],{"type":26,"value":4579}," server ",{"type":21,"tag":209,"props":4581,"children":4582},{"style":216},[4583],{"type":26,"value":1432},{"type":21,"tag":209,"props":4585,"children":4586},{"style":222},[4587],{"type":26,"value":4588}," app.",{"type":21,"tag":209,"props":4590,"children":4591},{"style":360},[4592],{"type":26,"value":4593},"listen",{"type":21,"tag":209,"props":4595,"children":4596},{"style":222},[4597],{"type":26,"value":4598},"( process.env.",{"type":21,"tag":209,"props":4600,"children":4601},{"style":263},[4602],{"type":26,"value":4603},"PORT",{"type":21,"tag":209,"props":4605,"children":4606},{"style":216},[4607],{"type":26,"value":4608}," ||",{"type":21,"tag":209,"props":4610,"children":4611},{"style":263},[4612],{"type":26,"value":4613}," 3000",{"type":21,"tag":209,"props":4615,"children":4616},{"style":222},[4617],{"type":26,"value":408},{"type":21,"tag":209,"props":4619,"children":4620},{"style":216},[4621],{"type":26,"value":4622},"function",{"type":21,"tag":209,"props":4624,"children":4625},{"style":222},[4626],{"type":26,"value":2561},{"type":21,"tag":209,"props":4628,"children":4629},{"class":211,"line":244},[4630,4635,4639,4643,4648,4653,4658,4663],{"type":21,"tag":209,"props":4631,"children":4632},{"style":222},[4633],{"type":26,"value":4634},"  console.",{"type":21,"tag":209,"props":4636,"children":4637},{"style":360},[4638],{"type":26,"value":1059},{"type":21,"tag":209,"props":4640,"children":4641},{"style":222},[4642],{"type":26,"value":368},{"type":21,"tag":209,"props":4644,"children":4645},{"style":233},[4646],{"type":26,"value":4647},"'Listening on port '",{"type":21,"tag":209,"props":4649,"children":4650},{"style":216},[4651],{"type":26,"value":4652}," +",{"type":21,"tag":209,"props":4654,"children":4655},{"style":222},[4656],{"type":26,"value":4657}," server.",{"type":21,"tag":209,"props":4659,"children":4660},{"style":360},[4661],{"type":26,"value":4662},"address",{"type":21,"tag":209,"props":4664,"children":4665},{"style":222},[4666],{"type":26,"value":4667},"().port);\n",{"type":21,"tag":209,"props":4669,"children":4670},{"class":211,"line":254},[4671],{"type":21,"tag":209,"props":4672,"children":4673},{"style":222},[4674],{"type":26,"value":469},{"type":21,"tag":22,"props":4676,"children":4677},{},[4678,4680,4687,4689,4694],{"type":26,"value":4679},"Fastify works similarly, but it has a ",{"type":21,"tag":29,"props":4681,"children":4684},{"href":4682,"rel":4683},"https://www.fastify.io/docs/latest/Reference/Plugins/",[93],[4685],{"type":26,"value":4686},"plugin system",{"type":26,"value":4688}," which provides a flexible way to extend a Fastify server's capabilities. One property that plugins can enforce is ",{"type":21,"tag":1084,"props":4690,"children":4691},{},[4692],{"type":26,"value":4693},"encapsulation",{"type":26,"value":4695},": ensuring that the capabilities added by a plugin can only be used within that plugin.",{"type":21,"tag":22,"props":4697,"children":4698},{},[4699],{"type":26,"value":4700},"In this first step where we intend to temporarily load an Express application within a Fastify application, encapsulation is a great way to ensure that none of the Fastify-based code can inadvertently use functionality added by the Express application, so it makes sense to create a Fastify plugin for it. For now the entirety of the application will exist in there, but we'll change that incrementally later.",{"type":21,"tag":22,"props":4702,"children":4703},{},[4704,4706,4711,4713,4719,4721,4727],{"type":26,"value":4705},"The Fastify version of ",{"type":21,"tag":63,"props":4707,"children":4709},{"className":4708},[],[4710],{"type":26,"value":3771},{"type":26,"value":4712}," is similar in structure, defining a ",{"type":21,"tag":63,"props":4714,"children":4716},{"className":4715},[],[4717],{"type":26,"value":4718},"build()",{"type":26,"value":4720}," function which sets up the database and loads plugins, and then running it and calling a ",{"type":21,"tag":63,"props":4722,"children":4724},{"className":4723},[],[4725],{"type":26,"value":4726},".listen()",{"type":26,"value":4728}," method to start the server:",{"type":21,"tag":200,"props":4730,"children":4732},{"className":202,"code":4731,"language":12,"meta":8,"style":8},"var isProduction = process.env.NODE_ENV === 'production';\n\nasync function build() {\n  const mongoose = require('mongoose');\n\n  if(isProduction){\n    mongoose.connect(process.env.MONGODB_URI);\n  } else {\n    mongoose.connect('mongodb://localhost/conduit');\n    mongoose.set('debug', true);\n  }\n\n  require('./models/User');\n  require('./models/Article');\n  require('./models/Comment');\n  require('./config/passport');\n\n  // Create global app object\n  const app = require('fastify')({\n    logger: true,\n  });\n  await app.register(require('@fastify/formbody'));\n  await app.register(require('./routes/legacy'), {isProduction});\n  return app;\n}\n\nbuild()\n  .then(app => app.listen({port: 3000}))\n  .then((address) => {\n    console.log('Listening on ' + address);\n  }).catch(console.log);\n",[4733],{"type":21,"tag":63,"props":4734,"children":4735},{"__ignoreMap":8},[4736,4771,4778,4800,4833,4840,4852,4876,4892,4915,4946,4954,4961,4981,5000,5019,5038,5045,5053,5087,5103,5111,5149,5186,5199,5206,5213,5226,5275,5306,5335],{"type":21,"tag":209,"props":4737,"children":4738},{"class":211,"line":212},[4739,4743,4747,4751,4755,4759,4763,4767],{"type":21,"tag":209,"props":4740,"children":4741},{"style":216},[4742],{"type":26,"value":3909},{"type":21,"tag":209,"props":4744,"children":4745},{"style":222},[4746],{"type":26,"value":4062},{"type":21,"tag":209,"props":4748,"children":4749},{"style":216},[4750],{"type":26,"value":1432},{"type":21,"tag":209,"props":4752,"children":4753},{"style":222},[4754],{"type":26,"value":4071},{"type":21,"tag":209,"props":4756,"children":4757},{"style":263},[4758],{"type":26,"value":4076},{"type":21,"tag":209,"props":4760,"children":4761},{"style":216},[4762],{"type":26,"value":4081},{"type":21,"tag":209,"props":4764,"children":4765},{"style":233},[4766],{"type":26,"value":4086},{"type":21,"tag":209,"props":4768,"children":4769},{"style":222},[4770],{"type":26,"value":241},{"type":21,"tag":209,"props":4772,"children":4773},{"class":211,"line":244},[4774],{"type":21,"tag":209,"props":4775,"children":4776},{"emptyLinePlaceholder":248},[4777],{"type":26,"value":251},{"type":21,"tag":209,"props":4779,"children":4780},{"class":211,"line":254},[4781,4785,4790,4795],{"type":21,"tag":209,"props":4782,"children":4783},{"style":216},[4784],{"type":26,"value":1376},{"type":21,"tag":209,"props":4786,"children":4787},{"style":216},[4788],{"type":26,"value":4789}," function",{"type":21,"tag":209,"props":4791,"children":4792},{"style":360},[4793],{"type":26,"value":4794}," build",{"type":21,"tag":209,"props":4796,"children":4797},{"style":222},[4798],{"type":26,"value":4799},"() {\n",{"type":21,"tag":209,"props":4801,"children":4802},{"class":211,"line":279},[4803,4808,4813,4817,4821,4825,4829],{"type":21,"tag":209,"props":4804,"children":4805},{"style":216},[4806],{"type":26,"value":4807},"  const",{"type":21,"tag":209,"props":4809,"children":4810},{"style":263},[4811],{"type":26,"value":4812}," mongoose",{"type":21,"tag":209,"props":4814,"children":4815},{"style":216},[4816],{"type":26,"value":271},{"type":21,"tag":209,"props":4818,"children":4819},{"style":360},[4820],{"type":26,"value":3923},{"type":21,"tag":209,"props":4822,"children":4823},{"style":222},[4824],{"type":26,"value":368},{"type":21,"tag":209,"props":4826,"children":4827},{"style":233},[4828],{"type":26,"value":4031},{"type":21,"tag":209,"props":4830,"children":4831},{"style":222},[4832],{"type":26,"value":2608},{"type":21,"tag":209,"props":4834,"children":4835},{"class":211,"line":288},[4836],{"type":21,"tag":209,"props":4837,"children":4838},{"emptyLinePlaceholder":248},[4839],{"type":26,"value":251},{"type":21,"tag":209,"props":4841,"children":4842},{"class":211,"line":307},[4843,4848],{"type":21,"tag":209,"props":4844,"children":4845},{"style":216},[4846],{"type":26,"value":4847},"  if",{"type":21,"tag":209,"props":4849,"children":4850},{"style":222},[4851],{"type":26,"value":4306},{"type":21,"tag":209,"props":4853,"children":4854},{"class":211,"line":325},[4855,4860,4864,4868,4872],{"type":21,"tag":209,"props":4856,"children":4857},{"style":222},[4858],{"type":26,"value":4859},"    mongoose.",{"type":21,"tag":209,"props":4861,"children":4862},{"style":360},[4863],{"type":26,"value":4319},{"type":21,"tag":209,"props":4865,"children":4866},{"style":222},[4867],{"type":26,"value":4324},{"type":21,"tag":209,"props":4869,"children":4870},{"style":263},[4871],{"type":26,"value":4329},{"type":21,"tag":209,"props":4873,"children":4874},{"style":222},[4875],{"type":26,"value":2608},{"type":21,"tag":209,"props":4877,"children":4878},{"class":211,"line":334},[4879,4884,4888],{"type":21,"tag":209,"props":4880,"children":4881},{"style":222},[4882],{"type":26,"value":4883},"  } ",{"type":21,"tag":209,"props":4885,"children":4886},{"style":216},[4887],{"type":26,"value":4346},{"type":21,"tag":209,"props":4889,"children":4890},{"style":222},[4891],{"type":26,"value":276},{"type":21,"tag":209,"props":4893,"children":4894},{"class":211,"line":343},[4895,4899,4903,4907,4911],{"type":21,"tag":209,"props":4896,"children":4897},{"style":222},[4898],{"type":26,"value":4859},{"type":21,"tag":209,"props":4900,"children":4901},{"style":360},[4902],{"type":26,"value":4319},{"type":21,"tag":209,"props":4904,"children":4905},{"style":222},[4906],{"type":26,"value":368},{"type":21,"tag":209,"props":4908,"children":4909},{"style":233},[4910],{"type":26,"value":4370},{"type":21,"tag":209,"props":4912,"children":4913},{"style":222},[4914],{"type":26,"value":2608},{"type":21,"tag":209,"props":4916,"children":4917},{"class":211,"line":351},[4918,4922,4926,4930,4934,4938,4942],{"type":21,"tag":209,"props":4919,"children":4920},{"style":222},[4921],{"type":26,"value":4859},{"type":21,"tag":209,"props":4923,"children":4924},{"style":360},[4925],{"type":26,"value":4386},{"type":21,"tag":209,"props":4927,"children":4928},{"style":222},[4929],{"type":26,"value":368},{"type":21,"tag":209,"props":4931,"children":4932},{"style":233},[4933],{"type":26,"value":4395},{"type":21,"tag":209,"props":4935,"children":4936},{"style":222},[4937],{"type":26,"value":408},{"type":21,"tag":209,"props":4939,"children":4940},{"style":263},[4941],{"type":26,"value":2223},{"type":21,"tag":209,"props":4943,"children":4944},{"style":222},[4945],{"type":26,"value":2608},{"type":21,"tag":209,"props":4947,"children":4948},{"class":211,"line":444},[4949],{"type":21,"tag":209,"props":4950,"children":4951},{"style":222},[4952],{"type":26,"value":4953},"  }\n",{"type":21,"tag":209,"props":4955,"children":4956},{"class":211,"line":454},[4957],{"type":21,"tag":209,"props":4958,"children":4959},{"emptyLinePlaceholder":248},[4960],{"type":26,"value":251},{"type":21,"tag":209,"props":4962,"children":4963},{"class":211,"line":463},[4964,4969,4973,4977],{"type":21,"tag":209,"props":4965,"children":4966},{"style":360},[4967],{"type":26,"value":4968},"  require",{"type":21,"tag":209,"props":4970,"children":4971},{"style":222},[4972],{"type":26,"value":368},{"type":21,"tag":209,"props":4974,"children":4975},{"style":233},[4976],{"type":26,"value":4438},{"type":21,"tag":209,"props":4978,"children":4979},{"style":222},[4980],{"type":26,"value":2608},{"type":21,"tag":209,"props":4982,"children":4983},{"class":211,"line":472},[4984,4988,4992,4996],{"type":21,"tag":209,"props":4985,"children":4986},{"style":360},[4987],{"type":26,"value":4968},{"type":21,"tag":209,"props":4989,"children":4990},{"style":222},[4991],{"type":26,"value":368},{"type":21,"tag":209,"props":4993,"children":4994},{"style":233},[4995],{"type":26,"value":4458},{"type":21,"tag":209,"props":4997,"children":4998},{"style":222},[4999],{"type":26,"value":2608},{"type":21,"tag":209,"props":5001,"children":5002},{"class":211,"line":480},[5003,5007,5011,5015],{"type":21,"tag":209,"props":5004,"children":5005},{"style":360},[5006],{"type":26,"value":4968},{"type":21,"tag":209,"props":5008,"children":5009},{"style":222},[5010],{"type":26,"value":368},{"type":21,"tag":209,"props":5012,"children":5013},{"style":233},[5014],{"type":26,"value":4478},{"type":21,"tag":209,"props":5016,"children":5017},{"style":222},[5018],{"type":26,"value":2608},{"type":21,"tag":209,"props":5020,"children":5021},{"class":211,"line":489},[5022,5026,5030,5034],{"type":21,"tag":209,"props":5023,"children":5024},{"style":360},[5025],{"type":26,"value":4968},{"type":21,"tag":209,"props":5027,"children":5028},{"style":222},[5029],{"type":26,"value":368},{"type":21,"tag":209,"props":5031,"children":5032},{"style":233},[5033],{"type":26,"value":4498},{"type":21,"tag":209,"props":5035,"children":5036},{"style":222},[5037],{"type":26,"value":2608},{"type":21,"tag":209,"props":5039,"children":5040},{"class":211,"line":847},[5041],{"type":21,"tag":209,"props":5042,"children":5043},{"emptyLinePlaceholder":248},[5044],{"type":26,"value":251},{"type":21,"tag":209,"props":5046,"children":5047},{"class":211,"line":860},[5048],{"type":21,"tag":209,"props":5049,"children":5050},{"style":448},[5051],{"type":26,"value":5052},"  // Create global app object\n",{"type":21,"tag":209,"props":5054,"children":5055},{"class":211,"line":877},[5056,5060,5065,5069,5073,5077,5082],{"type":21,"tag":209,"props":5057,"children":5058},{"style":216},[5059],{"type":26,"value":4807},{"type":21,"tag":209,"props":5061,"children":5062},{"style":263},[5063],{"type":26,"value":5064}," app",{"type":21,"tag":209,"props":5066,"children":5067},{"style":216},[5068],{"type":26,"value":271},{"type":21,"tag":209,"props":5070,"children":5071},{"style":360},[5072],{"type":26,"value":3923},{"type":21,"tag":209,"props":5074,"children":5075},{"style":222},[5076],{"type":26,"value":368},{"type":21,"tag":209,"props":5078,"children":5079},{"style":233},[5080],{"type":26,"value":5081},"'fastify'",{"type":21,"tag":209,"props":5083,"children":5084},{"style":222},[5085],{"type":26,"value":5086},")({\n",{"type":21,"tag":209,"props":5088,"children":5089},{"class":211,"line":889},[5090,5095,5099],{"type":21,"tag":209,"props":5091,"children":5092},{"style":222},[5093],{"type":26,"value":5094},"    logger: ",{"type":21,"tag":209,"props":5096,"children":5097},{"style":263},[5098],{"type":26,"value":2223},{"type":21,"tag":209,"props":5100,"children":5101},{"style":222},[5102],{"type":26,"value":304},{"type":21,"tag":209,"props":5104,"children":5105},{"class":211,"line":902},[5106],{"type":21,"tag":209,"props":5107,"children":5108},{"style":222},[5109],{"type":26,"value":5110},"  });\n",{"type":21,"tag":209,"props":5112,"children":5113},{"class":211,"line":914},[5114,5119,5123,5128,5132,5136,5140,5145],{"type":21,"tag":209,"props":5115,"children":5116},{"style":216},[5117],{"type":26,"value":5118},"  await",{"type":21,"tag":209,"props":5120,"children":5121},{"style":222},[5122],{"type":26,"value":4588},{"type":21,"tag":209,"props":5124,"children":5125},{"style":360},[5126],{"type":26,"value":5127},"register",{"type":21,"tag":209,"props":5129,"children":5130},{"style":222},[5131],{"type":26,"value":368},{"type":21,"tag":209,"props":5133,"children":5134},{"style":360},[5135],{"type":26,"value":4188},{"type":21,"tag":209,"props":5137,"children":5138},{"style":222},[5139],{"type":26,"value":368},{"type":21,"tag":209,"props":5141,"children":5142},{"style":233},[5143],{"type":26,"value":5144},"'@fastify/formbody'",{"type":21,"tag":209,"props":5146,"children":5147},{"style":222},[5148],{"type":26,"value":4212},{"type":21,"tag":209,"props":5150,"children":5151},{"class":211,"line":922},[5152,5156,5160,5164,5168,5172,5176,5181],{"type":21,"tag":209,"props":5153,"children":5154},{"style":216},[5155],{"type":26,"value":5118},{"type":21,"tag":209,"props":5157,"children":5158},{"style":222},[5159],{"type":26,"value":4588},{"type":21,"tag":209,"props":5161,"children":5162},{"style":360},[5163],{"type":26,"value":5127},{"type":21,"tag":209,"props":5165,"children":5166},{"style":222},[5167],{"type":26,"value":368},{"type":21,"tag":209,"props":5169,"children":5170},{"style":360},[5171],{"type":26,"value":4188},{"type":21,"tag":209,"props":5173,"children":5174},{"style":222},[5175],{"type":26,"value":368},{"type":21,"tag":209,"props":5177,"children":5178},{"style":233},[5179],{"type":26,"value":5180},"'./routes/legacy'",{"type":21,"tag":209,"props":5182,"children":5183},{"style":222},[5184],{"type":26,"value":5185},"), {isProduction});\n",{"type":21,"tag":209,"props":5187,"children":5188},{"class":211,"line":2312},[5189,5194],{"type":21,"tag":209,"props":5190,"children":5191},{"style":216},[5192],{"type":26,"value":5193},"  return",{"type":21,"tag":209,"props":5195,"children":5196},{"style":222},[5197],{"type":26,"value":5198}," app;\n",{"type":21,"tag":209,"props":5200,"children":5201},{"class":211,"line":2321},[5202],{"type":21,"tag":209,"props":5203,"children":5204},{"style":222},[5205],{"type":26,"value":4415},{"type":21,"tag":209,"props":5207,"children":5208},{"class":211,"line":2372},[5209],{"type":21,"tag":209,"props":5210,"children":5211},{"emptyLinePlaceholder":248},[5212],{"type":26,"value":251},{"type":21,"tag":209,"props":5214,"children":5215},{"class":211,"line":2381},[5216,5221],{"type":21,"tag":209,"props":5217,"children":5218},{"style":360},[5219],{"type":26,"value":5220},"build",{"type":21,"tag":209,"props":5222,"children":5223},{"style":222},[5224],{"type":26,"value":5225},"()\n",{"type":21,"tag":209,"props":5227,"children":5228},{"class":211,"line":2389},[5229,5234,5238,5242,5247,5252,5256,5260,5265,5270],{"type":21,"tag":209,"props":5230,"children":5231},{"style":222},[5232],{"type":26,"value":5233},"  .",{"type":21,"tag":209,"props":5235,"children":5236},{"style":360},[5237],{"type":26,"value":2704},{"type":21,"tag":209,"props":5239,"children":5240},{"style":222},[5241],{"type":26,"value":368},{"type":21,"tag":209,"props":5243,"children":5244},{"style":400},[5245],{"type":26,"value":5246},"app",{"type":21,"tag":209,"props":5248,"children":5249},{"style":216},[5250],{"type":26,"value":5251}," =>",{"type":21,"tag":209,"props":5253,"children":5254},{"style":222},[5255],{"type":26,"value":4588},{"type":21,"tag":209,"props":5257,"children":5258},{"style":360},[5259],{"type":26,"value":4593},{"type":21,"tag":209,"props":5261,"children":5262},{"style":222},[5263],{"type":26,"value":5264},"({port: ",{"type":21,"tag":209,"props":5266,"children":5267},{"style":263},[5268],{"type":26,"value":5269},"3000",{"type":21,"tag":209,"props":5271,"children":5272},{"style":222},[5273],{"type":26,"value":5274},"}))\n",{"type":21,"tag":209,"props":5276,"children":5277},{"class":211,"line":2397},[5278,5282,5286,5290,5294,5298,5302],{"type":21,"tag":209,"props":5279,"children":5280},{"style":222},[5281],{"type":26,"value":5233},{"type":21,"tag":209,"props":5283,"children":5284},{"style":360},[5285],{"type":26,"value":2704},{"type":21,"tag":209,"props":5287,"children":5288},{"style":222},[5289],{"type":26,"value":2709},{"type":21,"tag":209,"props":5291,"children":5292},{"style":400},[5293],{"type":26,"value":4662},{"type":21,"tag":209,"props":5295,"children":5296},{"style":222},[5297],{"type":26,"value":432},{"type":21,"tag":209,"props":5299,"children":5300},{"style":216},[5301],{"type":26,"value":437},{"type":21,"tag":209,"props":5303,"children":5304},{"style":222},[5305],{"type":26,"value":276},{"type":21,"tag":209,"props":5307,"children":5308},{"class":211,"line":2406},[5309,5313,5317,5321,5326,5330],{"type":21,"tag":209,"props":5310,"children":5311},{"style":222},[5312],{"type":26,"value":1054},{"type":21,"tag":209,"props":5314,"children":5315},{"style":360},[5316],{"type":26,"value":1059},{"type":21,"tag":209,"props":5318,"children":5319},{"style":222},[5320],{"type":26,"value":368},{"type":21,"tag":209,"props":5322,"children":5323},{"style":233},[5324],{"type":26,"value":5325},"'Listening on '",{"type":21,"tag":209,"props":5327,"children":5328},{"style":216},[5329],{"type":26,"value":4652},{"type":21,"tag":209,"props":5331,"children":5332},{"style":222},[5333],{"type":26,"value":5334}," address);\n",{"type":21,"tag":209,"props":5336,"children":5337},{"class":211,"line":2415},[5338,5343,5348],{"type":21,"tag":209,"props":5339,"children":5340},{"style":222},[5341],{"type":26,"value":5342},"  }).",{"type":21,"tag":209,"props":5344,"children":5345},{"style":360},[5346],{"type":26,"value":5347},"catch",{"type":21,"tag":209,"props":5349,"children":5350},{"style":222},[5351],{"type":26,"value":5352},"(console.log);\n",{"type":21,"tag":22,"props":5354,"children":5355},{},[5356,5358,5364],{"type":26,"value":5357},"The Express application configuration has been moved to a plugin defined in ",{"type":21,"tag":63,"props":5359,"children":5361},{"className":5360},[],[5362],{"type":26,"value":5363},"routes/legacy/index.js",{"type":26,"value":5365},", which is registered in the Fastify app above. It looks like this:",{"type":21,"tag":200,"props":5367,"children":5369},{"className":202,"code":5368,"language":12,"meta":8,"style":8},"const express = require('express'),\n      session = require('express-session'),\n      fp = require('fastify-plugin'),\n      cors = require('cors'),\n      errorhandler = require('errorhandler');\n\nmodule.exports = fp(async function (fastify, opts) {\n  await fastify.register(require('@fastify/express'), {\n    // run express after `fastify-formbody` logic\n    expressHook: 'preHandler',\n  });\n\n  fastify.use(cors());\n\n  fastify.use(require('morgan')('dev'));\n\n  /* ... (the same .use() calls that used to be in app.js) */\n\n  const router = require('express').Router();\n  router.use('/api', require('./api'));\n\n  fastify.use(router);\n});\n",[5370],{"type":21,"tag":63,"props":5371,"children":5372},{"__ignoreMap":8},[5373,5405,5434,5463,5491,5520,5527,5589,5627,5635,5652,5659,5666,5690,5697,5736,5743,5751,5758,5799,5841,5848,5864],{"type":21,"tag":209,"props":5374,"children":5375},{"class":211,"line":212},[5376,5380,5384,5388,5392,5396,5400],{"type":21,"tag":209,"props":5377,"children":5378},{"style":216},[5379],{"type":26,"value":260},{"type":21,"tag":209,"props":5381,"children":5382},{"style":263},[5383],{"type":26,"value":4118},{"type":21,"tag":209,"props":5385,"children":5386},{"style":216},[5387],{"type":26,"value":271},{"type":21,"tag":209,"props":5389,"children":5390},{"style":360},[5391],{"type":26,"value":3923},{"type":21,"tag":209,"props":5393,"children":5394},{"style":222},[5395],{"type":26,"value":368},{"type":21,"tag":209,"props":5397,"children":5398},{"style":233},[5399],{"type":26,"value":3932},{"type":21,"tag":209,"props":5401,"children":5402},{"style":222},[5403],{"type":26,"value":5404},"),\n",{"type":21,"tag":209,"props":5406,"children":5407},{"class":211,"line":244},[5408,5413,5417,5421,5425,5430],{"type":21,"tag":209,"props":5409,"children":5410},{"style":263},[5411],{"type":26,"value":5412},"      session",{"type":21,"tag":209,"props":5414,"children":5415},{"style":216},[5416],{"type":26,"value":271},{"type":21,"tag":209,"props":5418,"children":5419},{"style":360},[5420],{"type":26,"value":3923},{"type":21,"tag":209,"props":5422,"children":5423},{"style":222},[5424],{"type":26,"value":368},{"type":21,"tag":209,"props":5426,"children":5427},{"style":233},[5428],{"type":26,"value":5429},"'express-session'",{"type":21,"tag":209,"props":5431,"children":5432},{"style":222},[5433],{"type":26,"value":5404},{"type":21,"tag":209,"props":5435,"children":5436},{"class":211,"line":254},[5437,5442,5446,5450,5454,5459],{"type":21,"tag":209,"props":5438,"children":5439},{"style":263},[5440],{"type":26,"value":5441},"      fp",{"type":21,"tag":209,"props":5443,"children":5444},{"style":216},[5445],{"type":26,"value":271},{"type":21,"tag":209,"props":5447,"children":5448},{"style":360},[5449],{"type":26,"value":3923},{"type":21,"tag":209,"props":5451,"children":5452},{"style":222},[5453],{"type":26,"value":368},{"type":21,"tag":209,"props":5455,"children":5456},{"style":233},[5457],{"type":26,"value":5458},"'fastify-plugin'",{"type":21,"tag":209,"props":5460,"children":5461},{"style":222},[5462],{"type":26,"value":5404},{"type":21,"tag":209,"props":5464,"children":5465},{"class":211,"line":279},[5466,5471,5475,5479,5483,5487],{"type":21,"tag":209,"props":5467,"children":5468},{"style":263},[5469],{"type":26,"value":5470},"      cors",{"type":21,"tag":209,"props":5472,"children":5473},{"style":216},[5474],{"type":26,"value":271},{"type":21,"tag":209,"props":5476,"children":5477},{"style":360},[5478],{"type":26,"value":3923},{"type":21,"tag":209,"props":5480,"children":5481},{"style":222},[5482],{"type":26,"value":368},{"type":21,"tag":209,"props":5484,"children":5485},{"style":233},[5486],{"type":26,"value":3998},{"type":21,"tag":209,"props":5488,"children":5489},{"style":222},[5490],{"type":26,"value":5404},{"type":21,"tag":209,"props":5492,"children":5493},{"class":211,"line":288},[5494,5499,5503,5507,5511,5516],{"type":21,"tag":209,"props":5495,"children":5496},{"style":263},[5497],{"type":26,"value":5498},"      errorhandler",{"type":21,"tag":209,"props":5500,"children":5501},{"style":216},[5502],{"type":26,"value":271},{"type":21,"tag":209,"props":5504,"children":5505},{"style":360},[5506],{"type":26,"value":3923},{"type":21,"tag":209,"props":5508,"children":5509},{"style":222},[5510],{"type":26,"value":368},{"type":21,"tag":209,"props":5512,"children":5513},{"style":233},[5514],{"type":26,"value":5515},"'errorhandler'",{"type":21,"tag":209,"props":5517,"children":5518},{"style":222},[5519],{"type":26,"value":2608},{"type":21,"tag":209,"props":5521,"children":5522},{"class":211,"line":307},[5523],{"type":21,"tag":209,"props":5524,"children":5525},{"emptyLinePlaceholder":248},[5526],{"type":26,"value":251},{"type":21,"tag":209,"props":5528,"children":5529},{"class":211,"line":325},[5530,5535,5539,5544,5548,5553,5557,5561,5565,5570,5575,5579,5584],{"type":21,"tag":209,"props":5531,"children":5532},{"style":263},[5533],{"type":26,"value":5534},"module",{"type":21,"tag":209,"props":5536,"children":5537},{"style":222},[5538],{"type":26,"value":378},{"type":21,"tag":209,"props":5540,"children":5541},{"style":263},[5542],{"type":26,"value":5543},"exports",{"type":21,"tag":209,"props":5545,"children":5546},{"style":216},[5547],{"type":26,"value":271},{"type":21,"tag":209,"props":5549,"children":5550},{"style":360},[5551],{"type":26,"value":5552}," fp",{"type":21,"tag":209,"props":5554,"children":5555},{"style":222},[5556],{"type":26,"value":368},{"type":21,"tag":209,"props":5558,"children":5559},{"style":216},[5560],{"type":26,"value":1376},{"type":21,"tag":209,"props":5562,"children":5563},{"style":216},[5564],{"type":26,"value":4789},{"type":21,"tag":209,"props":5566,"children":5567},{"style":222},[5568],{"type":26,"value":5569}," (",{"type":21,"tag":209,"props":5571,"children":5572},{"style":400},[5573],{"type":26,"value":5574},"fastify",{"type":21,"tag":209,"props":5576,"children":5577},{"style":222},[5578],{"type":26,"value":408},{"type":21,"tag":209,"props":5580,"children":5581},{"style":400},[5582],{"type":26,"value":5583},"opts",{"type":21,"tag":209,"props":5585,"children":5586},{"style":222},[5587],{"type":26,"value":5588},") {\n",{"type":21,"tag":209,"props":5590,"children":5591},{"class":211,"line":334},[5592,5596,5601,5605,5609,5613,5617,5622],{"type":21,"tag":209,"props":5593,"children":5594},{"style":216},[5595],{"type":26,"value":5118},{"type":21,"tag":209,"props":5597,"children":5598},{"style":222},[5599],{"type":26,"value":5600}," fastify.",{"type":21,"tag":209,"props":5602,"children":5603},{"style":360},[5604],{"type":26,"value":5127},{"type":21,"tag":209,"props":5606,"children":5607},{"style":222},[5608],{"type":26,"value":368},{"type":21,"tag":209,"props":5610,"children":5611},{"style":360},[5612],{"type":26,"value":4188},{"type":21,"tag":209,"props":5614,"children":5615},{"style":222},[5616],{"type":26,"value":368},{"type":21,"tag":209,"props":5618,"children":5619},{"style":233},[5620],{"type":26,"value":5621},"'@fastify/express'",{"type":21,"tag":209,"props":5623,"children":5624},{"style":222},[5625],{"type":26,"value":5626},"), {\n",{"type":21,"tag":209,"props":5628,"children":5629},{"class":211,"line":343},[5630],{"type":21,"tag":209,"props":5631,"children":5632},{"style":448},[5633],{"type":26,"value":5634},"    // run express after `fastify-formbody` logic\n",{"type":21,"tag":209,"props":5636,"children":5637},{"class":211,"line":351},[5638,5643,5648],{"type":21,"tag":209,"props":5639,"children":5640},{"style":222},[5641],{"type":26,"value":5642},"    expressHook: ",{"type":21,"tag":209,"props":5644,"children":5645},{"style":233},[5646],{"type":26,"value":5647},"'preHandler'",{"type":21,"tag":209,"props":5649,"children":5650},{"style":222},[5651],{"type":26,"value":304},{"type":21,"tag":209,"props":5653,"children":5654},{"class":211,"line":444},[5655],{"type":21,"tag":209,"props":5656,"children":5657},{"style":222},[5658],{"type":26,"value":5110},{"type":21,"tag":209,"props":5660,"children":5661},{"class":211,"line":454},[5662],{"type":21,"tag":209,"props":5663,"children":5664},{"emptyLinePlaceholder":248},[5665],{"type":26,"value":251},{"type":21,"tag":209,"props":5667,"children":5668},{"class":211,"line":463},[5669,5674,5678,5682,5686],{"type":21,"tag":209,"props":5670,"children":5671},{"style":222},[5672],{"type":26,"value":5673},"  fastify.",{"type":21,"tag":209,"props":5675,"children":5676},{"style":360},[5677],{"type":26,"value":1747},{"type":21,"tag":209,"props":5679,"children":5680},{"style":222},[5681],{"type":26,"value":368},{"type":21,"tag":209,"props":5683,"children":5684},{"style":360},[5685],{"type":26,"value":4156},{"type":21,"tag":209,"props":5687,"children":5688},{"style":222},[5689],{"type":26,"value":4161},{"type":21,"tag":209,"props":5691,"children":5692},{"class":211,"line":472},[5693],{"type":21,"tag":209,"props":5694,"children":5695},{"emptyLinePlaceholder":248},[5696],{"type":26,"value":251},{"type":21,"tag":209,"props":5698,"children":5699},{"class":211,"line":480},[5700,5704,5708,5712,5716,5720,5724,5728,5732],{"type":21,"tag":209,"props":5701,"children":5702},{"style":222},[5703],{"type":26,"value":5673},{"type":21,"tag":209,"props":5705,"children":5706},{"style":360},[5707],{"type":26,"value":1747},{"type":21,"tag":209,"props":5709,"children":5710},{"style":222},[5711],{"type":26,"value":368},{"type":21,"tag":209,"props":5713,"children":5714},{"style":360},[5715],{"type":26,"value":4188},{"type":21,"tag":209,"props":5717,"children":5718},{"style":222},[5719],{"type":26,"value":368},{"type":21,"tag":209,"props":5721,"children":5722},{"style":233},[5723],{"type":26,"value":4197},{"type":21,"tag":209,"props":5725,"children":5726},{"style":222},[5727],{"type":26,"value":4202},{"type":21,"tag":209,"props":5729,"children":5730},{"style":233},[5731],{"type":26,"value":4207},{"type":21,"tag":209,"props":5733,"children":5734},{"style":222},[5735],{"type":26,"value":4212},{"type":21,"tag":209,"props":5737,"children":5738},{"class":211,"line":489},[5739],{"type":21,"tag":209,"props":5740,"children":5741},{"emptyLinePlaceholder":248},[5742],{"type":26,"value":251},{"type":21,"tag":209,"props":5744,"children":5745},{"class":211,"line":847},[5746],{"type":21,"tag":209,"props":5747,"children":5748},{"style":448},[5749],{"type":26,"value":5750},"  /* ... (the same .use() calls that used to be in app.js) */\n",{"type":21,"tag":209,"props":5752,"children":5753},{"class":211,"line":860},[5754],{"type":21,"tag":209,"props":5755,"children":5756},{"emptyLinePlaceholder":248},[5757],{"type":26,"value":251},{"type":21,"tag":209,"props":5759,"children":5760},{"class":211,"line":877},[5761,5765,5770,5774,5778,5782,5786,5790,5795],{"type":21,"tag":209,"props":5762,"children":5763},{"style":216},[5764],{"type":26,"value":4807},{"type":21,"tag":209,"props":5766,"children":5767},{"style":263},[5768],{"type":26,"value":5769}," router",{"type":21,"tag":209,"props":5771,"children":5772},{"style":216},[5773],{"type":26,"value":271},{"type":21,"tag":209,"props":5775,"children":5776},{"style":360},[5777],{"type":26,"value":3923},{"type":21,"tag":209,"props":5779,"children":5780},{"style":222},[5781],{"type":26,"value":368},{"type":21,"tag":209,"props":5783,"children":5784},{"style":233},[5785],{"type":26,"value":3932},{"type":21,"tag":209,"props":5787,"children":5788},{"style":222},[5789],{"type":26,"value":2699},{"type":21,"tag":209,"props":5791,"children":5792},{"style":360},[5793],{"type":26,"value":5794},"Router",{"type":21,"tag":209,"props":5796,"children":5797},{"style":222},[5798],{"type":26,"value":4123},{"type":21,"tag":209,"props":5800,"children":5801},{"class":211,"line":889},[5802,5807,5811,5815,5820,5824,5828,5832,5837],{"type":21,"tag":209,"props":5803,"children":5804},{"style":222},[5805],{"type":26,"value":5806},"  router.",{"type":21,"tag":209,"props":5808,"children":5809},{"style":360},[5810],{"type":26,"value":1747},{"type":21,"tag":209,"props":5812,"children":5813},{"style":222},[5814],{"type":26,"value":368},{"type":21,"tag":209,"props":5816,"children":5817},{"style":233},[5818],{"type":26,"value":5819},"'/api'",{"type":21,"tag":209,"props":5821,"children":5822},{"style":222},[5823],{"type":26,"value":408},{"type":21,"tag":209,"props":5825,"children":5826},{"style":360},[5827],{"type":26,"value":4188},{"type":21,"tag":209,"props":5829,"children":5830},{"style":222},[5831],{"type":26,"value":368},{"type":21,"tag":209,"props":5833,"children":5834},{"style":233},[5835],{"type":26,"value":5836},"'./api'",{"type":21,"tag":209,"props":5838,"children":5839},{"style":222},[5840],{"type":26,"value":4212},{"type":21,"tag":209,"props":5842,"children":5843},{"class":211,"line":902},[5844],{"type":21,"tag":209,"props":5845,"children":5846},{"emptyLinePlaceholder":248},[5847],{"type":26,"value":251},{"type":21,"tag":209,"props":5849,"children":5850},{"class":211,"line":914},[5851,5855,5859],{"type":21,"tag":209,"props":5852,"children":5853},{"style":222},[5854],{"type":26,"value":5673},{"type":21,"tag":209,"props":5856,"children":5857},{"style":360},[5858],{"type":26,"value":1747},{"type":21,"tag":209,"props":5860,"children":5861},{"style":222},[5862],{"type":26,"value":5863},"(router);\n",{"type":21,"tag":209,"props":5865,"children":5866},{"class":211,"line":922},[5867],{"type":21,"tag":209,"props":5868,"children":5869},{"style":222},[5870],{"type":26,"value":469},{"type":21,"tag":22,"props":5872,"children":5873},{},[5874,5876,5881,5883,5888,5890,5895],{"type":26,"value":5875},"For the most part it contains the same Express configuration that previously existed in ",{"type":21,"tag":63,"props":5877,"children":5879},{"className":5878},[],[5880],{"type":26,"value":3771},{"type":26,"value":5882},", except that it's contained in a Fastify plugin, and the configuration is applied to the ",{"type":21,"tag":63,"props":5884,"children":5886},{"className":5885},[],[5887],{"type":26,"value":5574},{"type":26,"value":5889}," instance provided to the plugin. The plugin registers ",{"type":21,"tag":63,"props":5891,"children":5893},{"className":5892},[],[5894],{"type":26,"value":3617},{"type":26,"value":5896}," as a sub-plugin, which is what makes all that Express configuration work seamlessly.",{"type":21,"tag":22,"props":5898,"children":5899},{},[5900,5902,5907,5909,5915,5917,5923,5925,5930,5932,5937],{"type":26,"value":5901},"There's one messy bit, which is the business with ",{"type":21,"tag":63,"props":5903,"children":5905},{"className":5904},[],[5906],{"type":26,"value":3832},{"type":26,"value":5908}," and the ",{"type":21,"tag":63,"props":5910,"children":5912},{"className":5911},[],[5913],{"type":26,"value":5914},"expressHook: 'preHandler'",{"type":26,"value":5916}," configuration line. There's a known incompatibility with the Express ",{"type":21,"tag":63,"props":5918,"children":5920},{"className":5919},[],[5921],{"type":26,"value":5922},"body-parser",{"type":26,"value":5924}," library, and the workaround is to immediately remove ",{"type":21,"tag":63,"props":5926,"children":5928},{"className":5927},[],[5929],{"type":26,"value":5922},{"type":26,"value":5931}," and substitute it with the ",{"type":21,"tag":63,"props":5933,"children":5935},{"className":5934},[],[5936],{"type":26,"value":3832},{"type":26,"value":5938}," plugin which works similarly. This was the only hangup like this that I encountered; otherwise the application runs just like before, using Fastify as the server.",{"type":21,"tag":22,"props":5940,"children":5941},{},[5942,5944,5950],{"type":26,"value":5943},"Click ",{"type":21,"tag":29,"props":5945,"children":5948},{"href":5946,"rel":5947},"https://github.com/artandlogic/node-express-to-fastify-example/commit/38504ce47943246eb71aa25894ecae00cc302955",[93],[5949],{"type":26,"value":3592},{"type":26,"value":5951}," to view the full set of changes up to this point.",{"type":21,"tag":3596,"props":5953,"children":5955},{"id":5954},"step-2-migrating-a-route-to-fastify",[5956],{"type":26,"value":5957},"Step 2: Migrating a route to Fastify",{"type":21,"tag":51,"props":5959,"children":5961},{"id":5960},"prerequisite-1-implementing-authentication-decorators-for-fastify-routes",[5962],{"type":26,"value":5963},"Prerequisite #1: Implementing authentication decorators for Fastify routes",{"type":21,"tag":22,"props":5965,"children":5966},{},[5967,5969,5975,5976,5982],{"type":26,"value":5968},"In the Express application, authentication is applied to a route by adding an ",{"type":21,"tag":63,"props":5970,"children":5972},{"className":5971},[],[5973],{"type":26,"value":5974},"auth.optional",{"type":26,"value":1922},{"type":21,"tag":63,"props":5977,"children":5979},{"className":5978},[],[5980],{"type":26,"value":5981},"auth.required",{"type":26,"value":5983}," middleware. Before migrating a route to Fastify, we'll need an equivalent way to add authentication requirements to a route.",{"type":21,"tag":22,"props":5985,"children":5986},{},[5987,5989,5996,5998,6005,6007,6013],{"type":26,"value":5988},"In Fastify, this can be accomplished via ",{"type":21,"tag":29,"props":5990,"children":5993},{"href":5991,"rel":5992},"https://www.fastify.io/docs/latest/Reference/Hooks/",[93],[5994],{"type":26,"value":5995},"Hooks",{"type":26,"value":5997}," and ",{"type":21,"tag":29,"props":5999,"children":6002},{"href":6000,"rel":6001},"https://www.fastify.io/docs/latest/Reference/Decorators/",[93],[6003],{"type":26,"value":6004},"Decorators",{"type":26,"value":6006},". For organizational purposes, this can be set up as a Fastify plugin, ",{"type":21,"tag":63,"props":6008,"children":6010},{"className":6009},[],[6011],{"type":26,"value":6012},"plugins/auth.js",{"type":26,"value":191},{"type":21,"tag":200,"props":6015,"children":6018},{"className":6016,"code":6017,"language":26},[3807],"npm install --save @fastify/jwt\n",[6019],{"type":21,"tag":63,"props":6020,"children":6021},{"__ignoreMap":8},[6022],{"type":26,"value":6017},{"type":21,"tag":200,"props":6024,"children":6026},{"className":202,"code":6025,"language":12,"meta":8,"style":8},"const fp = require(\"fastify-plugin\");\nconst secret = require('../config').secret;\n\nmodule.exports = fp(async function (fastify, opts) {\n  await fastify.register(require(\"@fastify/jwt\"), {\n    // @fastify/jwt puts the token data on request.user by default; use\n    // request.payload to match the existing application\n    decoratorName: 'payload',\n    secret,\n    verify: {\n      // The application uses \"Token\" in the Authorization header rather than\n      // the more standard \"Bearer\", so add custom code to parse that\n      extractToken: (request) => {\n        const parts = request.headers.authorization.split(' ');\n        if (parts.length !== 2) {\n          throw new BadRequestError();\n        }\n\n        const [scheme, token] = parts;\n\n        if (!/^Token$/i.test(scheme)) {\n          throw new BadRequestError()\n        }\n\n        return token;\n      },\n    },\n  });\n  // Add a decorator so that routes can reference this via `fastify.authenticated`\n  await fastify.decorate(\"authenticated\", async function(request, reply) {\n    try {\n      await request.jwtVerify();\n    } catch (err) {\n      reply.send(err);\n    }\n  });\n  // Add a decorator so that routes can reference this via `fastify.authenticatedOptional`\n  await fastify.decorate(\"authenticatedOptional\", async function(request, reply) {\n    try {\n      await request.jwtVerify();\n    } catch {}\n  });\n});\n",[6027],{"type":21,"tag":63,"props":6028,"children":6029},{"__ignoreMap":8},[6030,6062,6096,6103,6158,6194,6202,6210,6227,6235,6243,6251,6259,6288,6327,6359,6381,6388,6395,6433,6440,6500,6519,6526,6533,6545,6553,6560,6567,6575,6633,6645,6667,6684,6702,6709,6716,6724,6780,6791,6810,6826,6833],{"type":21,"tag":209,"props":6031,"children":6032},{"class":211,"line":212},[6033,6037,6041,6045,6049,6053,6058],{"type":21,"tag":209,"props":6034,"children":6035},{"style":216},[6036],{"type":26,"value":260},{"type":21,"tag":209,"props":6038,"children":6039},{"style":263},[6040],{"type":26,"value":5552},{"type":21,"tag":209,"props":6042,"children":6043},{"style":216},[6044],{"type":26,"value":271},{"type":21,"tag":209,"props":6046,"children":6047},{"style":360},[6048],{"type":26,"value":3923},{"type":21,"tag":209,"props":6050,"children":6051},{"style":222},[6052],{"type":26,"value":368},{"type":21,"tag":209,"props":6054,"children":6055},{"style":233},[6056],{"type":26,"value":6057},"\"fastify-plugin\"",{"type":21,"tag":209,"props":6059,"children":6060},{"style":222},[6061],{"type":26,"value":2608},{"type":21,"tag":209,"props":6063,"children":6064},{"class":211,"line":244},[6065,6069,6074,6078,6082,6086,6091],{"type":21,"tag":209,"props":6066,"children":6067},{"style":216},[6068],{"type":26,"value":260},{"type":21,"tag":209,"props":6070,"children":6071},{"style":263},[6072],{"type":26,"value":6073}," secret",{"type":21,"tag":209,"props":6075,"children":6076},{"style":216},[6077],{"type":26,"value":271},{"type":21,"tag":209,"props":6079,"children":6080},{"style":360},[6081],{"type":26,"value":3923},{"type":21,"tag":209,"props":6083,"children":6084},{"style":222},[6085],{"type":26,"value":368},{"type":21,"tag":209,"props":6087,"children":6088},{"style":233},[6089],{"type":26,"value":6090},"'../config'",{"type":21,"tag":209,"props":6092,"children":6093},{"style":222},[6094],{"type":26,"value":6095},").secret;\n",{"type":21,"tag":209,"props":6097,"children":6098},{"class":211,"line":254},[6099],{"type":21,"tag":209,"props":6100,"children":6101},{"emptyLinePlaceholder":248},[6102],{"type":26,"value":251},{"type":21,"tag":209,"props":6104,"children":6105},{"class":211,"line":279},[6106,6110,6114,6118,6122,6126,6130,6134,6138,6142,6146,6150,6154],{"type":21,"tag":209,"props":6107,"children":6108},{"style":263},[6109],{"type":26,"value":5534},{"type":21,"tag":209,"props":6111,"children":6112},{"style":222},[6113],{"type":26,"value":378},{"type":21,"tag":209,"props":6115,"children":6116},{"style":263},[6117],{"type":26,"value":5543},{"type":21,"tag":209,"props":6119,"children":6120},{"style":216},[6121],{"type":26,"value":271},{"type":21,"tag":209,"props":6123,"children":6124},{"style":360},[6125],{"type":26,"value":5552},{"type":21,"tag":209,"props":6127,"children":6128},{"style":222},[6129],{"type":26,"value":368},{"type":21,"tag":209,"props":6131,"children":6132},{"style":216},[6133],{"type":26,"value":1376},{"type":21,"tag":209,"props":6135,"children":6136},{"style":216},[6137],{"type":26,"value":4789},{"type":21,"tag":209,"props":6139,"children":6140},{"style":222},[6141],{"type":26,"value":5569},{"type":21,"tag":209,"props":6143,"children":6144},{"style":400},[6145],{"type":26,"value":5574},{"type":21,"tag":209,"props":6147,"children":6148},{"style":222},[6149],{"type":26,"value":408},{"type":21,"tag":209,"props":6151,"children":6152},{"style":400},[6153],{"type":26,"value":5583},{"type":21,"tag":209,"props":6155,"children":6156},{"style":222},[6157],{"type":26,"value":5588},{"type":21,"tag":209,"props":6159,"children":6160},{"class":211,"line":288},[6161,6165,6169,6173,6177,6181,6185,6190],{"type":21,"tag":209,"props":6162,"children":6163},{"style":216},[6164],{"type":26,"value":5118},{"type":21,"tag":209,"props":6166,"children":6167},{"style":222},[6168],{"type":26,"value":5600},{"type":21,"tag":209,"props":6170,"children":6171},{"style":360},[6172],{"type":26,"value":5127},{"type":21,"tag":209,"props":6174,"children":6175},{"style":222},[6176],{"type":26,"value":368},{"type":21,"tag":209,"props":6178,"children":6179},{"style":360},[6180],{"type":26,"value":4188},{"type":21,"tag":209,"props":6182,"children":6183},{"style":222},[6184],{"type":26,"value":368},{"type":21,"tag":209,"props":6186,"children":6187},{"style":233},[6188],{"type":26,"value":6189},"\"@fastify/jwt\"",{"type":21,"tag":209,"props":6191,"children":6192},{"style":222},[6193],{"type":26,"value":5626},{"type":21,"tag":209,"props":6195,"children":6196},{"class":211,"line":307},[6197],{"type":21,"tag":209,"props":6198,"children":6199},{"style":448},[6200],{"type":26,"value":6201},"    // @fastify/jwt puts the token data on request.user by default; use\n",{"type":21,"tag":209,"props":6203,"children":6204},{"class":211,"line":325},[6205],{"type":21,"tag":209,"props":6206,"children":6207},{"style":448},[6208],{"type":26,"value":6209},"    // request.payload to match the existing application\n",{"type":21,"tag":209,"props":6211,"children":6212},{"class":211,"line":334},[6213,6218,6223],{"type":21,"tag":209,"props":6214,"children":6215},{"style":222},[6216],{"type":26,"value":6217},"    decoratorName: ",{"type":21,"tag":209,"props":6219,"children":6220},{"style":233},[6221],{"type":26,"value":6222},"'payload'",{"type":21,"tag":209,"props":6224,"children":6225},{"style":222},[6226],{"type":26,"value":304},{"type":21,"tag":209,"props":6228,"children":6229},{"class":211,"line":343},[6230],{"type":21,"tag":209,"props":6231,"children":6232},{"style":222},[6233],{"type":26,"value":6234},"    secret,\n",{"type":21,"tag":209,"props":6236,"children":6237},{"class":211,"line":351},[6238],{"type":21,"tag":209,"props":6239,"children":6240},{"style":222},[6241],{"type":26,"value":6242},"    verify: {\n",{"type":21,"tag":209,"props":6244,"children":6245},{"class":211,"line":444},[6246],{"type":21,"tag":209,"props":6247,"children":6248},{"style":448},[6249],{"type":26,"value":6250},"      // The application uses \"Token\" in the Authorization header rather than\n",{"type":21,"tag":209,"props":6252,"children":6253},{"class":211,"line":454},[6254],{"type":21,"tag":209,"props":6255,"children":6256},{"style":448},[6257],{"type":26,"value":6258},"      // the more standard \"Bearer\", so add custom code to parse that\n",{"type":21,"tag":209,"props":6260,"children":6261},{"class":211,"line":463},[6262,6267,6272,6276,6280,6284],{"type":21,"tag":209,"props":6263,"children":6264},{"style":360},[6265],{"type":26,"value":6266},"      extractToken",{"type":21,"tag":209,"props":6268,"children":6269},{"style":222},[6270],{"type":26,"value":6271},": (",{"type":21,"tag":209,"props":6273,"children":6274},{"style":400},[6275],{"type":26,"value":1343},{"type":21,"tag":209,"props":6277,"children":6278},{"style":222},[6279],{"type":26,"value":432},{"type":21,"tag":209,"props":6281,"children":6282},{"style":216},[6283],{"type":26,"value":437},{"type":21,"tag":209,"props":6285,"children":6286},{"style":222},[6287],{"type":26,"value":276},{"type":21,"tag":209,"props":6289,"children":6290},{"class":211,"line":472},[6291,6295,6300,6304,6309,6314,6318,6323],{"type":21,"tag":209,"props":6292,"children":6293},{"style":216},[6294],{"type":26,"value":3332},{"type":21,"tag":209,"props":6296,"children":6297},{"style":263},[6298],{"type":26,"value":6299}," parts",{"type":21,"tag":209,"props":6301,"children":6302},{"style":216},[6303],{"type":26,"value":271},{"type":21,"tag":209,"props":6305,"children":6306},{"style":222},[6307],{"type":26,"value":6308}," request.headers.authorization.",{"type":21,"tag":209,"props":6310,"children":6311},{"style":360},[6312],{"type":26,"value":6313},"split",{"type":21,"tag":209,"props":6315,"children":6316},{"style":222},[6317],{"type":26,"value":368},{"type":21,"tag":209,"props":6319,"children":6320},{"style":233},[6321],{"type":26,"value":6322},"' '",{"type":21,"tag":209,"props":6324,"children":6325},{"style":222},[6326],{"type":26,"value":2608},{"type":21,"tag":209,"props":6328,"children":6329},{"class":211,"line":480},[6330,6335,6340,6345,6350,6355],{"type":21,"tag":209,"props":6331,"children":6332},{"style":216},[6333],{"type":26,"value":6334},"        if",{"type":21,"tag":209,"props":6336,"children":6337},{"style":222},[6338],{"type":26,"value":6339}," (parts.",{"type":21,"tag":209,"props":6341,"children":6342},{"style":263},[6343],{"type":26,"value":6344},"length",{"type":21,"tag":209,"props":6346,"children":6347},{"style":216},[6348],{"type":26,"value":6349}," !==",{"type":21,"tag":209,"props":6351,"children":6352},{"style":263},[6353],{"type":26,"value":6354}," 2",{"type":21,"tag":209,"props":6356,"children":6357},{"style":222},[6358],{"type":26,"value":5588},{"type":21,"tag":209,"props":6360,"children":6361},{"class":211,"line":489},[6362,6367,6372,6377],{"type":21,"tag":209,"props":6363,"children":6364},{"style":216},[6365],{"type":26,"value":6366},"          throw",{"type":21,"tag":209,"props":6368,"children":6369},{"style":216},[6370],{"type":26,"value":6371}," new",{"type":21,"tag":209,"props":6373,"children":6374},{"style":360},[6375],{"type":26,"value":6376}," BadRequestError",{"type":21,"tag":209,"props":6378,"children":6379},{"style":222},[6380],{"type":26,"value":4123},{"type":21,"tag":209,"props":6382,"children":6383},{"class":211,"line":847},[6384],{"type":21,"tag":209,"props":6385,"children":6386},{"style":222},[6387],{"type":26,"value":2235},{"type":21,"tag":209,"props":6389,"children":6390},{"class":211,"line":860},[6391],{"type":21,"tag":209,"props":6392,"children":6393},{"emptyLinePlaceholder":248},[6394],{"type":26,"value":251},{"type":21,"tag":209,"props":6396,"children":6397},{"class":211,"line":877},[6398,6402,6406,6411,6415,6420,6424,6428],{"type":21,"tag":209,"props":6399,"children":6400},{"style":216},[6401],{"type":26,"value":3332},{"type":21,"tag":209,"props":6403,"children":6404},{"style":222},[6405],{"type":26,"value":1417},{"type":21,"tag":209,"props":6407,"children":6408},{"style":263},[6409],{"type":26,"value":6410},"scheme",{"type":21,"tag":209,"props":6412,"children":6413},{"style":222},[6414],{"type":26,"value":408},{"type":21,"tag":209,"props":6416,"children":6417},{"style":263},[6418],{"type":26,"value":6419},"token",{"type":21,"tag":209,"props":6421,"children":6422},{"style":222},[6423],{"type":26,"value":1427},{"type":21,"tag":209,"props":6425,"children":6426},{"style":216},[6427],{"type":26,"value":1432},{"type":21,"tag":209,"props":6429,"children":6430},{"style":222},[6431],{"type":26,"value":6432}," parts;\n",{"type":21,"tag":209,"props":6434,"children":6435},{"class":211,"line":889},[6436],{"type":21,"tag":209,"props":6437,"children":6438},{"emptyLinePlaceholder":248},[6439],{"type":26,"value":251},{"type":21,"tag":209,"props":6441,"children":6442},{"class":211,"line":902},[6443,6447,6451,6456,6461,6466,6472,6477,6481,6486,6490,6495],{"type":21,"tag":209,"props":6444,"children":6445},{"style":216},[6446],{"type":26,"value":6334},{"type":21,"tag":209,"props":6448,"children":6449},{"style":222},[6450],{"type":26,"value":5569},{"type":21,"tag":209,"props":6452,"children":6453},{"style":216},[6454],{"type":26,"value":6455},"!",{"type":21,"tag":209,"props":6457,"children":6458},{"style":233},[6459],{"type":26,"value":6460},"/",{"type":21,"tag":209,"props":6462,"children":6463},{"style":216},[6464],{"type":26,"value":6465},"^",{"type":21,"tag":209,"props":6467,"children":6469},{"style":6468},"--shiki-default:#032F62;--shiki-dark:#DBEDFF",[6470],{"type":26,"value":6471},"Token",{"type":21,"tag":209,"props":6473,"children":6474},{"style":216},[6475],{"type":26,"value":6476},"$",{"type":21,"tag":209,"props":6478,"children":6479},{"style":233},[6480],{"type":26,"value":6460},{"type":21,"tag":209,"props":6482,"children":6483},{"style":216},[6484],{"type":26,"value":6485},"i",{"type":21,"tag":209,"props":6487,"children":6488},{"style":222},[6489],{"type":26,"value":378},{"type":21,"tag":209,"props":6491,"children":6492},{"style":360},[6493],{"type":26,"value":6494},"test",{"type":21,"tag":209,"props":6496,"children":6497},{"style":222},[6498],{"type":26,"value":6499},"(scheme)) {\n",{"type":21,"tag":209,"props":6501,"children":6502},{"class":211,"line":914},[6503,6507,6511,6515],{"type":21,"tag":209,"props":6504,"children":6505},{"style":216},[6506],{"type":26,"value":6366},{"type":21,"tag":209,"props":6508,"children":6509},{"style":216},[6510],{"type":26,"value":6371},{"type":21,"tag":209,"props":6512,"children":6513},{"style":360},[6514],{"type":26,"value":6376},{"type":21,"tag":209,"props":6516,"children":6517},{"style":222},[6518],{"type":26,"value":5225},{"type":21,"tag":209,"props":6520,"children":6521},{"class":211,"line":922},[6522],{"type":21,"tag":209,"props":6523,"children":6524},{"style":222},[6525],{"type":26,"value":2235},{"type":21,"tag":209,"props":6527,"children":6528},{"class":211,"line":2312},[6529],{"type":21,"tag":209,"props":6530,"children":6531},{"emptyLinePlaceholder":248},[6532],{"type":26,"value":251},{"type":21,"tag":209,"props":6534,"children":6535},{"class":211,"line":2321},[6536,6540],{"type":21,"tag":209,"props":6537,"children":6538},{"style":216},[6539],{"type":26,"value":3069},{"type":21,"tag":209,"props":6541,"children":6542},{"style":222},[6543],{"type":26,"value":6544}," token;\n",{"type":21,"tag":209,"props":6546,"children":6547},{"class":211,"line":2372},[6548],{"type":21,"tag":209,"props":6549,"children":6550},{"style":222},[6551],{"type":26,"value":6552},"      },\n",{"type":21,"tag":209,"props":6554,"children":6555},{"class":211,"line":2381},[6556],{"type":21,"tag":209,"props":6557,"children":6558},{"style":222},[6559],{"type":26,"value":2251},{"type":21,"tag":209,"props":6561,"children":6562},{"class":211,"line":2389},[6563],{"type":21,"tag":209,"props":6564,"children":6565},{"style":222},[6566],{"type":26,"value":5110},{"type":21,"tag":209,"props":6568,"children":6569},{"class":211,"line":2397},[6570],{"type":21,"tag":209,"props":6571,"children":6572},{"style":448},[6573],{"type":26,"value":6574},"  // Add a decorator so that routes can reference this via `fastify.authenticated`\n",{"type":21,"tag":209,"props":6576,"children":6577},{"class":211,"line":2406},[6578,6582,6586,6591,6595,6600,6604,6608,6612,6616,6620,6624,6629],{"type":21,"tag":209,"props":6579,"children":6580},{"style":216},[6581],{"type":26,"value":5118},{"type":21,"tag":209,"props":6583,"children":6584},{"style":222},[6585],{"type":26,"value":5600},{"type":21,"tag":209,"props":6587,"children":6588},{"style":360},[6589],{"type":26,"value":6590},"decorate",{"type":21,"tag":209,"props":6592,"children":6593},{"style":222},[6594],{"type":26,"value":368},{"type":21,"tag":209,"props":6596,"children":6597},{"style":233},[6598],{"type":26,"value":6599},"\"authenticated\"",{"type":21,"tag":209,"props":6601,"children":6602},{"style":222},[6603],{"type":26,"value":408},{"type":21,"tag":209,"props":6605,"children":6606},{"style":216},[6607],{"type":26,"value":1376},{"type":21,"tag":209,"props":6609,"children":6610},{"style":216},[6611],{"type":26,"value":4789},{"type":21,"tag":209,"props":6613,"children":6614},{"style":222},[6615],{"type":26,"value":368},{"type":21,"tag":209,"props":6617,"children":6618},{"style":400},[6619],{"type":26,"value":1343},{"type":21,"tag":209,"props":6621,"children":6622},{"style":222},[6623],{"type":26,"value":408},{"type":21,"tag":209,"props":6625,"children":6626},{"style":400},[6627],{"type":26,"value":6628},"reply",{"type":21,"tag":209,"props":6630,"children":6631},{"style":222},[6632],{"type":26,"value":5588},{"type":21,"tag":209,"props":6634,"children":6635},{"class":211,"line":2415},[6636,6641],{"type":21,"tag":209,"props":6637,"children":6638},{"style":216},[6639],{"type":26,"value":6640},"    try",{"type":21,"tag":209,"props":6642,"children":6643},{"style":222},[6644],{"type":26,"value":276},{"type":21,"tag":209,"props":6646,"children":6647},{"class":211,"line":2424},[6648,6653,6658,6663],{"type":21,"tag":209,"props":6649,"children":6650},{"style":216},[6651],{"type":26,"value":6652},"      await",{"type":21,"tag":209,"props":6654,"children":6655},{"style":222},[6656],{"type":26,"value":6657}," request.",{"type":21,"tag":209,"props":6659,"children":6660},{"style":360},[6661],{"type":26,"value":6662},"jwtVerify",{"type":21,"tag":209,"props":6664,"children":6665},{"style":222},[6666],{"type":26,"value":4123},{"type":21,"tag":209,"props":6668,"children":6669},{"class":211,"line":2433},[6670,6675,6679],{"type":21,"tag":209,"props":6671,"children":6672},{"style":222},[6673],{"type":26,"value":6674},"    } ",{"type":21,"tag":209,"props":6676,"children":6677},{"style":216},[6678],{"type":26,"value":5347},{"type":21,"tag":209,"props":6680,"children":6681},{"style":222},[6682],{"type":26,"value":6683}," (err) {\n",{"type":21,"tag":209,"props":6685,"children":6686},{"class":211,"line":2442},[6687,6692,6697],{"type":21,"tag":209,"props":6688,"children":6689},{"style":222},[6690],{"type":26,"value":6691},"      reply.",{"type":21,"tag":209,"props":6693,"children":6694},{"style":360},[6695],{"type":26,"value":6696},"send",{"type":21,"tag":209,"props":6698,"children":6699},{"style":222},[6700],{"type":26,"value":6701},"(err);\n",{"type":21,"tag":209,"props":6703,"children":6704},{"class":211,"line":2471},[6705],{"type":21,"tag":209,"props":6706,"children":6707},{"style":222},[6708],{"type":26,"value":331},{"type":21,"tag":209,"props":6710,"children":6711},{"class":211,"line":2480},[6712],{"type":21,"tag":209,"props":6713,"children":6714},{"style":222},[6715],{"type":26,"value":5110},{"type":21,"tag":209,"props":6717,"children":6718},{"class":211,"line":2489},[6719],{"type":21,"tag":209,"props":6720,"children":6721},{"style":448},[6722],{"type":26,"value":6723},"  // Add a decorator so that routes can reference this via `fastify.authenticatedOptional`\n",{"type":21,"tag":209,"props":6725,"children":6726},{"class":211,"line":2516},[6727,6731,6735,6739,6743,6748,6752,6756,6760,6764,6768,6772,6776],{"type":21,"tag":209,"props":6728,"children":6729},{"style":216},[6730],{"type":26,"value":5118},{"type":21,"tag":209,"props":6732,"children":6733},{"style":222},[6734],{"type":26,"value":5600},{"type":21,"tag":209,"props":6736,"children":6737},{"style":360},[6738],{"type":26,"value":6590},{"type":21,"tag":209,"props":6740,"children":6741},{"style":222},[6742],{"type":26,"value":368},{"type":21,"tag":209,"props":6744,"children":6745},{"style":233},[6746],{"type":26,"value":6747},"\"authenticatedOptional\"",{"type":21,"tag":209,"props":6749,"children":6750},{"style":222},[6751],{"type":26,"value":408},{"type":21,"tag":209,"props":6753,"children":6754},{"style":216},[6755],{"type":26,"value":1376},{"type":21,"tag":209,"props":6757,"children":6758},{"style":216},[6759],{"type":26,"value":4789},{"type":21,"tag":209,"props":6761,"children":6762},{"style":222},[6763],{"type":26,"value":368},{"type":21,"tag":209,"props":6765,"children":6766},{"style":400},[6767],{"type":26,"value":1343},{"type":21,"tag":209,"props":6769,"children":6770},{"style":222},[6771],{"type":26,"value":408},{"type":21,"tag":209,"props":6773,"children":6774},{"style":400},[6775],{"type":26,"value":6628},{"type":21,"tag":209,"props":6777,"children":6778},{"style":222},[6779],{"type":26,"value":5588},{"type":21,"tag":209,"props":6781,"children":6782},{"class":211,"line":2525},[6783,6787],{"type":21,"tag":209,"props":6784,"children":6785},{"style":216},[6786],{"type":26,"value":6640},{"type":21,"tag":209,"props":6788,"children":6789},{"style":222},[6790],{"type":26,"value":276},{"type":21,"tag":209,"props":6792,"children":6793},{"class":211,"line":2533},[6794,6798,6802,6806],{"type":21,"tag":209,"props":6795,"children":6796},{"style":216},[6797],{"type":26,"value":6652},{"type":21,"tag":209,"props":6799,"children":6800},{"style":222},[6801],{"type":26,"value":6657},{"type":21,"tag":209,"props":6803,"children":6804},{"style":360},[6805],{"type":26,"value":6662},{"type":21,"tag":209,"props":6807,"children":6808},{"style":222},[6809],{"type":26,"value":4123},{"type":21,"tag":209,"props":6811,"children":6812},{"class":211,"line":2542},[6813,6817,6821],{"type":21,"tag":209,"props":6814,"children":6815},{"style":222},[6816],{"type":26,"value":6674},{"type":21,"tag":209,"props":6818,"children":6819},{"style":216},[6820],{"type":26,"value":5347},{"type":21,"tag":209,"props":6822,"children":6823},{"style":222},[6824],{"type":26,"value":6825}," {}\n",{"type":21,"tag":209,"props":6827,"children":6828},{"class":211,"line":2550},[6829],{"type":21,"tag":209,"props":6830,"children":6831},{"style":222},[6832],{"type":26,"value":5110},{"type":21,"tag":209,"props":6834,"children":6835},{"class":211,"line":2564},[6836],{"type":21,"tag":209,"props":6837,"children":6838},{"style":222},[6839],{"type":26,"value":469},{"type":21,"tag":22,"props":6841,"children":6842},{},[6843,6845,6850],{"type":26,"value":6844},"To load this plugin, ",{"type":21,"tag":63,"props":6846,"children":6848},{"className":6847},[],[6849],{"type":26,"value":3771},{"type":26,"value":6851}," will need to register it:",{"type":21,"tag":200,"props":6853,"children":6855},{"className":202,"code":6854,"language":12,"meta":8,"style":8},"  await app.register(require('@fastify/formbody'));\n  await app.register(require('./plugins/auth'));  // \u003C-- Register the plugin\n  await app.register(require('./routes/legacy'), {isProduction});\n  return app;\n",[6856],{"type":21,"tag":63,"props":6857,"children":6858},{"__ignoreMap":8},[6859,6894,6936,6971],{"type":21,"tag":209,"props":6860,"children":6861},{"class":211,"line":212},[6862,6866,6870,6874,6878,6882,6886,6890],{"type":21,"tag":209,"props":6863,"children":6864},{"style":216},[6865],{"type":26,"value":5118},{"type":21,"tag":209,"props":6867,"children":6868},{"style":222},[6869],{"type":26,"value":4588},{"type":21,"tag":209,"props":6871,"children":6872},{"style":360},[6873],{"type":26,"value":5127},{"type":21,"tag":209,"props":6875,"children":6876},{"style":222},[6877],{"type":26,"value":368},{"type":21,"tag":209,"props":6879,"children":6880},{"style":360},[6881],{"type":26,"value":4188},{"type":21,"tag":209,"props":6883,"children":6884},{"style":222},[6885],{"type":26,"value":368},{"type":21,"tag":209,"props":6887,"children":6888},{"style":233},[6889],{"type":26,"value":5144},{"type":21,"tag":209,"props":6891,"children":6892},{"style":222},[6893],{"type":26,"value":4212},{"type":21,"tag":209,"props":6895,"children":6896},{"class":211,"line":244},[6897,6901,6905,6909,6913,6917,6921,6926,6931],{"type":21,"tag":209,"props":6898,"children":6899},{"style":216},[6900],{"type":26,"value":5118},{"type":21,"tag":209,"props":6902,"children":6903},{"style":222},[6904],{"type":26,"value":4588},{"type":21,"tag":209,"props":6906,"children":6907},{"style":360},[6908],{"type":26,"value":5127},{"type":21,"tag":209,"props":6910,"children":6911},{"style":222},[6912],{"type":26,"value":368},{"type":21,"tag":209,"props":6914,"children":6915},{"style":360},[6916],{"type":26,"value":4188},{"type":21,"tag":209,"props":6918,"children":6919},{"style":222},[6920],{"type":26,"value":368},{"type":21,"tag":209,"props":6922,"children":6923},{"style":233},[6924],{"type":26,"value":6925},"'./plugins/auth'",{"type":21,"tag":209,"props":6927,"children":6928},{"style":222},[6929],{"type":26,"value":6930},"));  ",{"type":21,"tag":209,"props":6932,"children":6933},{"style":448},[6934],{"type":26,"value":6935},"// \u003C-- Register the plugin\n",{"type":21,"tag":209,"props":6937,"children":6938},{"class":211,"line":254},[6939,6943,6947,6951,6955,6959,6963,6967],{"type":21,"tag":209,"props":6940,"children":6941},{"style":216},[6942],{"type":26,"value":5118},{"type":21,"tag":209,"props":6944,"children":6945},{"style":222},[6946],{"type":26,"value":4588},{"type":21,"tag":209,"props":6948,"children":6949},{"style":360},[6950],{"type":26,"value":5127},{"type":21,"tag":209,"props":6952,"children":6953},{"style":222},[6954],{"type":26,"value":368},{"type":21,"tag":209,"props":6956,"children":6957},{"style":360},[6958],{"type":26,"value":4188},{"type":21,"tag":209,"props":6960,"children":6961},{"style":222},[6962],{"type":26,"value":368},{"type":21,"tag":209,"props":6964,"children":6965},{"style":233},[6966],{"type":26,"value":5180},{"type":21,"tag":209,"props":6968,"children":6969},{"style":222},[6970],{"type":26,"value":5185},{"type":21,"tag":209,"props":6972,"children":6973},{"class":211,"line":279},[6974,6978],{"type":21,"tag":209,"props":6975,"children":6976},{"style":216},[6977],{"type":26,"value":5193},{"type":21,"tag":209,"props":6979,"children":6980},{"style":222},[6981],{"type":26,"value":5198},{"type":21,"tag":22,"props":6983,"children":6984},{},[6985,6987,6993,6995,7001,7003,7009],{"type":26,"value":6986},"With these decorators added, a route can now add a ",{"type":21,"tag":63,"props":6988,"children":6990},{"className":6989},[],[6991],{"type":26,"value":6992},"onRequest: [fastify.authenticated]",{"type":26,"value":6994}," or a ",{"type":21,"tag":63,"props":6996,"children":6998},{"className":6997},[],[6999],{"type":26,"value":7000},"onRequest: [fastify.authenticatedOptional]",{"type":26,"value":7002}," hook to handle authentication and to make user information available in the ",{"type":21,"tag":63,"props":7004,"children":7006},{"className":7005},[],[7007],{"type":26,"value":7008},"request.payload",{"type":26,"value":7010}," field.",{"type":21,"tag":51,"props":7012,"children":7014},{"id":7013},"prerequisite-2-setting-up-route-plugins",[7015],{"type":26,"value":7016},"Prerequisite #2: Setting up route plugins",{"type":21,"tag":22,"props":7018,"children":7019},{},[7020,7022,7028],{"type":26,"value":7021},"Adding a route to a Fastify instance is no different from adding any other piece of functionality to a Fastify instance, which is what plugins are designed to help organize. As such, routes can be defined as a nested tree of plugins. The now-legacy ",{"type":21,"tag":63,"props":7023,"children":7025},{"className":7024},[],[7026],{"type":26,"value":7027},"articles.js",{"type":26,"value":7029}," module is as good a place as any to start converting routes, so to set up an equivalent module for the Fastify routes, we'll:",{"type":21,"tag":3626,"props":7031,"children":7032},{},[7033,7214,7355,7493],{"type":21,"tag":3630,"props":7034,"children":7035},{},[7036,7038,7044,7046,7051,7052],{"type":26,"value":7037},"Import and register a ",{"type":21,"tag":63,"props":7039,"children":7041},{"className":7040},[],[7042],{"type":26,"value":7043},"routes",{"type":26,"value":7045}," plugin in ",{"type":21,"tag":63,"props":7047,"children":7049},{"className":7048},[],[7050],{"type":26,"value":3771},{"type":26,"value":191},{"type":21,"tag":200,"props":7053,"children":7055},{"className":202,"code":7054,"language":12,"meta":8,"style":8},"  await app.register(require('@fastify/formbody'));\n  await app.register(require('./plugins/auth'));\n  await app.register(require('./routes'));  // \u003C-- Register the plugin\n  await app.register(require('./routes/legacy'), {isProduction});\n  return app;\n",[7056],{"type":21,"tag":63,"props":7057,"children":7058},{"__ignoreMap":8},[7059,7094,7129,7168,7203],{"type":21,"tag":209,"props":7060,"children":7061},{"class":211,"line":212},[7062,7066,7070,7074,7078,7082,7086,7090],{"type":21,"tag":209,"props":7063,"children":7064},{"style":216},[7065],{"type":26,"value":5118},{"type":21,"tag":209,"props":7067,"children":7068},{"style":222},[7069],{"type":26,"value":4588},{"type":21,"tag":209,"props":7071,"children":7072},{"style":360},[7073],{"type":26,"value":5127},{"type":21,"tag":209,"props":7075,"children":7076},{"style":222},[7077],{"type":26,"value":368},{"type":21,"tag":209,"props":7079,"children":7080},{"style":360},[7081],{"type":26,"value":4188},{"type":21,"tag":209,"props":7083,"children":7084},{"style":222},[7085],{"type":26,"value":368},{"type":21,"tag":209,"props":7087,"children":7088},{"style":233},[7089],{"type":26,"value":5144},{"type":21,"tag":209,"props":7091,"children":7092},{"style":222},[7093],{"type":26,"value":4212},{"type":21,"tag":209,"props":7095,"children":7096},{"class":211,"line":244},[7097,7101,7105,7109,7113,7117,7121,7125],{"type":21,"tag":209,"props":7098,"children":7099},{"style":216},[7100],{"type":26,"value":5118},{"type":21,"tag":209,"props":7102,"children":7103},{"style":222},[7104],{"type":26,"value":4588},{"type":21,"tag":209,"props":7106,"children":7107},{"style":360},[7108],{"type":26,"value":5127},{"type":21,"tag":209,"props":7110,"children":7111},{"style":222},[7112],{"type":26,"value":368},{"type":21,"tag":209,"props":7114,"children":7115},{"style":360},[7116],{"type":26,"value":4188},{"type":21,"tag":209,"props":7118,"children":7119},{"style":222},[7120],{"type":26,"value":368},{"type":21,"tag":209,"props":7122,"children":7123},{"style":233},[7124],{"type":26,"value":6925},{"type":21,"tag":209,"props":7126,"children":7127},{"style":222},[7128],{"type":26,"value":4212},{"type":21,"tag":209,"props":7130,"children":7131},{"class":211,"line":254},[7132,7136,7140,7144,7148,7152,7156,7160,7164],{"type":21,"tag":209,"props":7133,"children":7134},{"style":216},[7135],{"type":26,"value":5118},{"type":21,"tag":209,"props":7137,"children":7138},{"style":222},[7139],{"type":26,"value":4588},{"type":21,"tag":209,"props":7141,"children":7142},{"style":360},[7143],{"type":26,"value":5127},{"type":21,"tag":209,"props":7145,"children":7146},{"style":222},[7147],{"type":26,"value":368},{"type":21,"tag":209,"props":7149,"children":7150},{"style":360},[7151],{"type":26,"value":4188},{"type":21,"tag":209,"props":7153,"children":7154},{"style":222},[7155],{"type":26,"value":368},{"type":21,"tag":209,"props":7157,"children":7158},{"style":233},[7159],{"type":26,"value":4537},{"type":21,"tag":209,"props":7161,"children":7162},{"style":222},[7163],{"type":26,"value":6930},{"type":21,"tag":209,"props":7165,"children":7166},{"style":448},[7167],{"type":26,"value":6935},{"type":21,"tag":209,"props":7169,"children":7170},{"class":211,"line":279},[7171,7175,7179,7183,7187,7191,7195,7199],{"type":21,"tag":209,"props":7172,"children":7173},{"style":216},[7174],{"type":26,"value":5118},{"type":21,"tag":209,"props":7176,"children":7177},{"style":222},[7178],{"type":26,"value":4588},{"type":21,"tag":209,"props":7180,"children":7181},{"style":360},[7182],{"type":26,"value":5127},{"type":21,"tag":209,"props":7184,"children":7185},{"style":222},[7186],{"type":26,"value":368},{"type":21,"tag":209,"props":7188,"children":7189},{"style":360},[7190],{"type":26,"value":4188},{"type":21,"tag":209,"props":7192,"children":7193},{"style":222},[7194],{"type":26,"value":368},{"type":21,"tag":209,"props":7196,"children":7197},{"style":233},[7198],{"type":26,"value":5180},{"type":21,"tag":209,"props":7200,"children":7201},{"style":222},[7202],{"type":26,"value":5185},{"type":21,"tag":209,"props":7204,"children":7205},{"class":211,"line":288},[7206,7210],{"type":21,"tag":209,"props":7207,"children":7208},{"style":216},[7209],{"type":26,"value":5193},{"type":21,"tag":209,"props":7211,"children":7212},{"style":222},[7213],{"type":26,"value":5198},{"type":21,"tag":3630,"props":7215,"children":7216},{},[7217,7219,7225,7227,7233,7235,7342,7346,7348,7353],{"type":26,"value":7218},"In ",{"type":21,"tag":63,"props":7220,"children":7222},{"className":7221},[],[7223],{"type":26,"value":7224},"routes/index.js",{"type":26,"value":7226},", import and register an ",{"type":21,"tag":63,"props":7228,"children":7230},{"className":7229},[],[7231],{"type":26,"value":7232},"api",{"type":26,"value":7234}," plugin:",{"type":21,"tag":200,"props":7236,"children":7238},{"className":202,"code":7237,"language":12,"meta":8,"style":8},"module.exports = async function (fastify, opts) {\n  await fastify.register(require('./api'), {prefix: \"/api\"});\n};\n",[7239],{"type":21,"tag":63,"props":7240,"children":7241},{"__ignoreMap":8},[7242,7290,7335],{"type":21,"tag":209,"props":7243,"children":7244},{"class":211,"line":212},[7245,7249,7253,7257,7261,7266,7270,7274,7278,7282,7286],{"type":21,"tag":209,"props":7246,"children":7247},{"style":263},[7248],{"type":26,"value":5534},{"type":21,"tag":209,"props":7250,"children":7251},{"style":222},[7252],{"type":26,"value":378},{"type":21,"tag":209,"props":7254,"children":7255},{"style":263},[7256],{"type":26,"value":5543},{"type":21,"tag":209,"props":7258,"children":7259},{"style":216},[7260],{"type":26,"value":271},{"type":21,"tag":209,"props":7262,"children":7263},{"style":216},[7264],{"type":26,"value":7265}," async",{"type":21,"tag":209,"props":7267,"children":7268},{"style":216},[7269],{"type":26,"value":4789},{"type":21,"tag":209,"props":7271,"children":7272},{"style":222},[7273],{"type":26,"value":5569},{"type":21,"tag":209,"props":7275,"children":7276},{"style":400},[7277],{"type":26,"value":5574},{"type":21,"tag":209,"props":7279,"children":7280},{"style":222},[7281],{"type":26,"value":408},{"type":21,"tag":209,"props":7283,"children":7284},{"style":400},[7285],{"type":26,"value":5583},{"type":21,"tag":209,"props":7287,"children":7288},{"style":222},[7289],{"type":26,"value":5588},{"type":21,"tag":209,"props":7291,"children":7292},{"class":211,"line":244},[7293,7297,7301,7305,7309,7313,7317,7321,7326,7331],{"type":21,"tag":209,"props":7294,"children":7295},{"style":216},[7296],{"type":26,"value":5118},{"type":21,"tag":209,"props":7298,"children":7299},{"style":222},[7300],{"type":26,"value":5600},{"type":21,"tag":209,"props":7302,"children":7303},{"style":360},[7304],{"type":26,"value":5127},{"type":21,"tag":209,"props":7306,"children":7307},{"style":222},[7308],{"type":26,"value":368},{"type":21,"tag":209,"props":7310,"children":7311},{"style":360},[7312],{"type":26,"value":4188},{"type":21,"tag":209,"props":7314,"children":7315},{"style":222},[7316],{"type":26,"value":368},{"type":21,"tag":209,"props":7318,"children":7319},{"style":233},[7320],{"type":26,"value":5836},{"type":21,"tag":209,"props":7322,"children":7323},{"style":222},[7324],{"type":26,"value":7325},"), {prefix: ",{"type":21,"tag":209,"props":7327,"children":7328},{"style":233},[7329],{"type":26,"value":7330},"\"/api\"",{"type":21,"tag":209,"props":7332,"children":7333},{"style":222},[7334],{"type":26,"value":469},{"type":21,"tag":209,"props":7336,"children":7337},{"class":211,"line":254},[7338],{"type":21,"tag":209,"props":7339,"children":7340},{"style":222},[7341],{"type":26,"value":340},{"type":21,"tag":7343,"props":7344,"children":7345},"br",{},[],{"type":26,"value":7347},"(Note how this plugin is registered with a ",{"type":21,"tag":63,"props":7349,"children":7351},{"className":7350},[],[7352],{"type":26,"value":7330},{"type":26,"value":7354}," prefix, so that all routes within will automatically have this prefixed to their route path)",{"type":21,"tag":3630,"props":7356,"children":7357},{},[7358,7359,7365,7367,7373,7375,7481,7484,7486,7491],{"type":26,"value":7218},{"type":21,"tag":63,"props":7360,"children":7362},{"className":7361},[],[7363],{"type":26,"value":7364},"routes/api/index.js",{"type":26,"value":7366},", import and register the ",{"type":21,"tag":63,"props":7368,"children":7370},{"className":7369},[],[7371],{"type":26,"value":7372},"articles",{"type":26,"value":7374}," plugin that will contain our migrated routes:",{"type":21,"tag":200,"props":7376,"children":7378},{"className":202,"code":7377,"language":12,"meta":8,"style":8},"module.exports = async function (fastify, opts) {\n  await fastify.register(require('./articles'), {prefix: \"/articles\"});\n}\n",[7379],{"type":21,"tag":63,"props":7380,"children":7381},{"__ignoreMap":8},[7382,7429,7474],{"type":21,"tag":209,"props":7383,"children":7384},{"class":211,"line":212},[7385,7389,7393,7397,7401,7405,7409,7413,7417,7421,7425],{"type":21,"tag":209,"props":7386,"children":7387},{"style":263},[7388],{"type":26,"value":5534},{"type":21,"tag":209,"props":7390,"children":7391},{"style":222},[7392],{"type":26,"value":378},{"type":21,"tag":209,"props":7394,"children":7395},{"style":263},[7396],{"type":26,"value":5543},{"type":21,"tag":209,"props":7398,"children":7399},{"style":216},[7400],{"type":26,"value":271},{"type":21,"tag":209,"props":7402,"children":7403},{"style":216},[7404],{"type":26,"value":7265},{"type":21,"tag":209,"props":7406,"children":7407},{"style":216},[7408],{"type":26,"value":4789},{"type":21,"tag":209,"props":7410,"children":7411},{"style":222},[7412],{"type":26,"value":5569},{"type":21,"tag":209,"props":7414,"children":7415},{"style":400},[7416],{"type":26,"value":5574},{"type":21,"tag":209,"props":7418,"children":7419},{"style":222},[7420],{"type":26,"value":408},{"type":21,"tag":209,"props":7422,"children":7423},{"style":400},[7424],{"type":26,"value":5583},{"type":21,"tag":209,"props":7426,"children":7427},{"style":222},[7428],{"type":26,"value":5588},{"type":21,"tag":209,"props":7430,"children":7431},{"class":211,"line":244},[7432,7436,7440,7444,7448,7452,7456,7461,7465,7470],{"type":21,"tag":209,"props":7433,"children":7434},{"style":216},[7435],{"type":26,"value":5118},{"type":21,"tag":209,"props":7437,"children":7438},{"style":222},[7439],{"type":26,"value":5600},{"type":21,"tag":209,"props":7441,"children":7442},{"style":360},[7443],{"type":26,"value":5127},{"type":21,"tag":209,"props":7445,"children":7446},{"style":222},[7447],{"type":26,"value":368},{"type":21,"tag":209,"props":7449,"children":7450},{"style":360},[7451],{"type":26,"value":4188},{"type":21,"tag":209,"props":7453,"children":7454},{"style":222},[7455],{"type":26,"value":368},{"type":21,"tag":209,"props":7457,"children":7458},{"style":233},[7459],{"type":26,"value":7460},"'./articles'",{"type":21,"tag":209,"props":7462,"children":7463},{"style":222},[7464],{"type":26,"value":7325},{"type":21,"tag":209,"props":7466,"children":7467},{"style":233},[7468],{"type":26,"value":7469},"\"/articles\"",{"type":21,"tag":209,"props":7471,"children":7472},{"style":222},[7473],{"type":26,"value":469},{"type":21,"tag":209,"props":7475,"children":7476},{"class":211,"line":254},[7477],{"type":21,"tag":209,"props":7478,"children":7479},{"style":222},[7480],{"type":26,"value":4415},{"type":21,"tag":7343,"props":7482,"children":7483},{},[],{"type":26,"value":7485},"(Note again the automatic ",{"type":21,"tag":63,"props":7487,"children":7489},{"className":7488},[],[7490],{"type":26,"value":7469},{"type":26,"value":7492}," prefix which will be applied to those routes)",{"type":21,"tag":3630,"props":7494,"children":7495},{},[7496,7498,7504,7506],{"type":26,"value":7497},"Finally, ",{"type":21,"tag":63,"props":7499,"children":7501},{"className":7500},[],[7502],{"type":26,"value":7503},"routes/api/articles.js",{"type":26,"value":7505}," can start as an empty plugin, ready for us to define routes within:",{"type":21,"tag":200,"props":7507,"children":7509},{"className":202,"code":7508,"language":12,"meta":8,"style":8},"module.exports = async function (fastify, opts) {\n}\n",[7510],{"type":21,"tag":63,"props":7511,"children":7512},{"__ignoreMap":8},[7513,7560],{"type":21,"tag":209,"props":7514,"children":7515},{"class":211,"line":212},[7516,7520,7524,7528,7532,7536,7540,7544,7548,7552,7556],{"type":21,"tag":209,"props":7517,"children":7518},{"style":263},[7519],{"type":26,"value":5534},{"type":21,"tag":209,"props":7521,"children":7522},{"style":222},[7523],{"type":26,"value":378},{"type":21,"tag":209,"props":7525,"children":7526},{"style":263},[7527],{"type":26,"value":5543},{"type":21,"tag":209,"props":7529,"children":7530},{"style":216},[7531],{"type":26,"value":271},{"type":21,"tag":209,"props":7533,"children":7534},{"style":216},[7535],{"type":26,"value":7265},{"type":21,"tag":209,"props":7537,"children":7538},{"style":216},[7539],{"type":26,"value":4789},{"type":21,"tag":209,"props":7541,"children":7542},{"style":222},[7543],{"type":26,"value":5569},{"type":21,"tag":209,"props":7545,"children":7546},{"style":400},[7547],{"type":26,"value":5574},{"type":21,"tag":209,"props":7549,"children":7550},{"style":222},[7551],{"type":26,"value":408},{"type":21,"tag":209,"props":7553,"children":7554},{"style":400},[7555],{"type":26,"value":5583},{"type":21,"tag":209,"props":7557,"children":7558},{"style":222},[7559],{"type":26,"value":5588},{"type":21,"tag":209,"props":7561,"children":7562},{"class":211,"line":244},[7563],{"type":21,"tag":209,"props":7564,"children":7565},{"style":222},[7566],{"type":26,"value":4415},{"type":21,"tag":51,"props":7568,"children":7570},{"id":7569},"migrating-a-route",[7571],{"type":26,"value":7572},"Migrating a route",{"type":21,"tag":22,"props":7574,"children":7575},{},[7576,7578,7583,7585,7591],{"type":26,"value":7577},"With the Fastify ",{"type":21,"tag":63,"props":7579,"children":7581},{"className":7580},[],[7582],{"type":26,"value":7372},{"type":26,"value":7584}," plugin ready to accept new routes, let's look at the first Express route, ",{"type":21,"tag":63,"props":7586,"children":7588},{"className":7587},[],[7589],{"type":26,"value":7590},"GET /api/articles",{"type":26,"value":7592},", piece by piece:",{"type":21,"tag":22,"props":7594,"children":7595},{},[7596,7602],{"type":21,"tag":63,"props":7597,"children":7599},{"className":7598},[],[7600],{"type":26,"value":7601},"routes/legacy/api/articles.js",{"type":26,"value":191},{"type":21,"tag":200,"props":7604,"children":7606},{"className":202,"code":7605,"language":12,"meta":8,"style":8},"/* ... */\n\nrouter.get('/', auth.optional, function(req, res, next) {\n  /* ... */\n});\n\n",[7607],{"type":21,"tag":63,"props":7608,"children":7609},{"__ignoreMap":8},[7610,7617,7624,7685,7693],{"type":21,"tag":209,"props":7611,"children":7612},{"class":211,"line":212},[7613],{"type":21,"tag":209,"props":7614,"children":7615},{"style":448},[7616],{"type":26,"value":4043},{"type":21,"tag":209,"props":7618,"children":7619},{"class":211,"line":244},[7620],{"type":21,"tag":209,"props":7621,"children":7622},{"emptyLinePlaceholder":248},[7623],{"type":26,"value":251},{"type":21,"tag":209,"props":7625,"children":7626},{"class":211,"line":254},[7627,7632,7637,7641,7646,7651,7655,7659,7664,7668,7672,7676,7681],{"type":21,"tag":209,"props":7628,"children":7629},{"style":222},[7630],{"type":26,"value":7631},"router.",{"type":21,"tag":209,"props":7633,"children":7634},{"style":360},[7635],{"type":26,"value":7636},"get",{"type":21,"tag":209,"props":7638,"children":7639},{"style":222},[7640],{"type":26,"value":368},{"type":21,"tag":209,"props":7642,"children":7643},{"style":233},[7644],{"type":26,"value":7645},"'/'",{"type":21,"tag":209,"props":7647,"children":7648},{"style":222},[7649],{"type":26,"value":7650},", auth.optional, ",{"type":21,"tag":209,"props":7652,"children":7653},{"style":216},[7654],{"type":26,"value":4622},{"type":21,"tag":209,"props":7656,"children":7657},{"style":222},[7658],{"type":26,"value":368},{"type":21,"tag":209,"props":7660,"children":7661},{"style":400},[7662],{"type":26,"value":7663},"req",{"type":21,"tag":209,"props":7665,"children":7666},{"style":222},[7667],{"type":26,"value":408},{"type":21,"tag":209,"props":7669,"children":7670},{"style":400},[7671],{"type":26,"value":1385},{"type":21,"tag":209,"props":7673,"children":7674},{"style":222},[7675],{"type":26,"value":408},{"type":21,"tag":209,"props":7677,"children":7678},{"style":400},[7679],{"type":26,"value":7680},"next",{"type":21,"tag":209,"props":7682,"children":7683},{"style":222},[7684],{"type":26,"value":5588},{"type":21,"tag":209,"props":7686,"children":7687},{"class":211,"line":279},[7688],{"type":21,"tag":209,"props":7689,"children":7690},{"style":448},[7691],{"type":26,"value":7692},"  /* ... */\n",{"type":21,"tag":209,"props":7694,"children":7695},{"class":211,"line":288},[7696],{"type":21,"tag":209,"props":7697,"children":7698},{"style":222},[7699],{"type":26,"value":469},{"type":21,"tag":22,"props":7701,"children":7702},{},[7703,7705,7711,7713,7719],{"type":26,"value":7704},"Fastify does have a ",{"type":21,"tag":63,"props":7706,"children":7708},{"className":7707},[],[7709],{"type":26,"value":7710},".get()",{"type":26,"value":7712}," shorthand like this, but I recommend getting used to using the full ",{"type":21,"tag":63,"props":7714,"children":7716},{"className":7715},[],[7717],{"type":26,"value":7718},".route()",{"type":26,"value":7720}," declaration since I find it more readable when other options are defined:",{"type":21,"tag":22,"props":7722,"children":7723},{},[7724,7729],{"type":21,"tag":63,"props":7725,"children":7727},{"className":7726},[],[7728],{"type":26,"value":7503},{"type":26,"value":191},{"type":21,"tag":200,"props":7731,"children":7733},{"className":202,"code":7732,"language":12,"meta":8,"style":8},"  /* ... */\n\n  fastify.route({\n    method: 'GET',\n    url: '/',\n    onRequest: [fastify.authenticatedOptional],\n    handler: async function(request, reply) {\n      /* ... */\n    },\n  });\n\n  /* ... */\n",[7734],{"type":21,"tag":63,"props":7735,"children":7736},{"__ignoreMap":8},[7737,7744,7751,7768,7785,7801,7809,7850,7858,7865,7872,7879],{"type":21,"tag":209,"props":7738,"children":7739},{"class":211,"line":212},[7740],{"type":21,"tag":209,"props":7741,"children":7742},{"style":448},[7743],{"type":26,"value":7692},{"type":21,"tag":209,"props":7745,"children":7746},{"class":211,"line":244},[7747],{"type":21,"tag":209,"props":7748,"children":7749},{"emptyLinePlaceholder":248},[7750],{"type":26,"value":251},{"type":21,"tag":209,"props":7752,"children":7753},{"class":211,"line":254},[7754,7758,7763],{"type":21,"tag":209,"props":7755,"children":7756},{"style":222},[7757],{"type":26,"value":5673},{"type":21,"tag":209,"props":7759,"children":7760},{"style":360},[7761],{"type":26,"value":7762},"route",{"type":21,"tag":209,"props":7764,"children":7765},{"style":222},[7766],{"type":26,"value":7767},"({\n",{"type":21,"tag":209,"props":7769,"children":7770},{"class":211,"line":279},[7771,7776,7781],{"type":21,"tag":209,"props":7772,"children":7773},{"style":222},[7774],{"type":26,"value":7775},"    method: ",{"type":21,"tag":209,"props":7777,"children":7778},{"style":233},[7779],{"type":26,"value":7780},"'GET'",{"type":21,"tag":209,"props":7782,"children":7783},{"style":222},[7784],{"type":26,"value":304},{"type":21,"tag":209,"props":7786,"children":7787},{"class":211,"line":288},[7788,7793,7797],{"type":21,"tag":209,"props":7789,"children":7790},{"style":222},[7791],{"type":26,"value":7792},"    url: ",{"type":21,"tag":209,"props":7794,"children":7795},{"style":233},[7796],{"type":26,"value":7645},{"type":21,"tag":209,"props":7798,"children":7799},{"style":222},[7800],{"type":26,"value":304},{"type":21,"tag":209,"props":7802,"children":7803},{"class":211,"line":307},[7804],{"type":21,"tag":209,"props":7805,"children":7806},{"style":222},[7807],{"type":26,"value":7808},"    onRequest: [fastify.authenticatedOptional],\n",{"type":21,"tag":209,"props":7810,"children":7811},{"class":211,"line":325},[7812,7817,7822,7826,7830,7834,7838,7842,7846],{"type":21,"tag":209,"props":7813,"children":7814},{"style":360},[7815],{"type":26,"value":7816},"    handler",{"type":21,"tag":209,"props":7818,"children":7819},{"style":222},[7820],{"type":26,"value":7821},": ",{"type":21,"tag":209,"props":7823,"children":7824},{"style":216},[7825],{"type":26,"value":1376},{"type":21,"tag":209,"props":7827,"children":7828},{"style":216},[7829],{"type":26,"value":4789},{"type":21,"tag":209,"props":7831,"children":7832},{"style":222},[7833],{"type":26,"value":368},{"type":21,"tag":209,"props":7835,"children":7836},{"style":400},[7837],{"type":26,"value":1343},{"type":21,"tag":209,"props":7839,"children":7840},{"style":222},[7841],{"type":26,"value":408},{"type":21,"tag":209,"props":7843,"children":7844},{"style":400},[7845],{"type":26,"value":6628},{"type":21,"tag":209,"props":7847,"children":7848},{"style":222},[7849],{"type":26,"value":5588},{"type":21,"tag":209,"props":7851,"children":7852},{"class":211,"line":334},[7853],{"type":21,"tag":209,"props":7854,"children":7855},{"style":448},[7856],{"type":26,"value":7857},"      /* ... */\n",{"type":21,"tag":209,"props":7859,"children":7860},{"class":211,"line":343},[7861],{"type":21,"tag":209,"props":7862,"children":7863},{"style":222},[7864],{"type":26,"value":2251},{"type":21,"tag":209,"props":7866,"children":7867},{"class":211,"line":351},[7868],{"type":21,"tag":209,"props":7869,"children":7870},{"style":222},[7871],{"type":26,"value":5110},{"type":21,"tag":209,"props":7873,"children":7874},{"class":211,"line":444},[7875],{"type":21,"tag":209,"props":7876,"children":7877},{"emptyLinePlaceholder":248},[7878],{"type":26,"value":251},{"type":21,"tag":209,"props":7880,"children":7881},{"class":211,"line":454},[7882],{"type":21,"tag":209,"props":7883,"children":7884},{"style":448},[7885],{"type":26,"value":7692},{"type":21,"tag":22,"props":7887,"children":7888},{},[7889,7891,7897,7899,7905],{"type":26,"value":7890},"Note the ",{"type":21,"tag":63,"props":7892,"children":7894},{"className":7893},[],[7895],{"type":26,"value":7896},"onRequest",{"type":26,"value":7898}," hook which uses the authentication hook and decorator we defined previously in the ",{"type":21,"tag":63,"props":7900,"children":7902},{"className":7901},[],[7903],{"type":26,"value":7904},"auth",{"type":26,"value":7906}," plugin.",{"type":21,"tag":22,"props":7908,"children":7909},{},[7910],{"type":26,"value":7911},"Next, the Express route checks for a number of query parameters and fetches some database objects:",{"type":21,"tag":22,"props":7913,"children":7914},{},[7915,7920],{"type":21,"tag":63,"props":7916,"children":7918},{"className":7917},[],[7919],{"type":26,"value":7601},{"type":26,"value":191},{"type":21,"tag":200,"props":7922,"children":7924},{"className":202,"code":7923,"language":12,"meta":8,"style":8},"  /* ... */\n\n  var query = {};\n  var limit = 20;\n  var offset = 0;\n\n  if(typeof req.query.limit !== 'undefined'){\n    limit = req.query.limit;\n  }\n\n  if(typeof req.query.offset !== 'undefined'){\n    offset = req.query.offset;\n  }\n\n  if( typeof req.query.tag !== 'undefined' ){\n    query.tagList = {\"$in\" : [req.query.tag]};\n  }\n\n  Promise.all([\n    req.query.author ? User.findOne({username: req.query.author}) : null,\n    req.query.favorited ? User.findOne({username: req.query.favorited}) : null\n  ]).then(function(results){\n    /* ... */\n  });\n\n  /* ... */\n",[7925],{"type":21,"tag":63,"props":7926,"children":7927},{"__ignoreMap":8},[7928,7935,7942,7964,7989,8014,8021,8056,8073,8080,8087,8119,8136,8143,8150,8184,8210,8217,8224,8246,8287,8321,8354,8362,8369,8376],{"type":21,"tag":209,"props":7929,"children":7930},{"class":211,"line":212},[7931],{"type":21,"tag":209,"props":7932,"children":7933},{"style":448},[7934],{"type":26,"value":7692},{"type":21,"tag":209,"props":7936,"children":7937},{"class":211,"line":244},[7938],{"type":21,"tag":209,"props":7939,"children":7940},{"emptyLinePlaceholder":248},[7941],{"type":26,"value":251},{"type":21,"tag":209,"props":7943,"children":7944},{"class":211,"line":254},[7945,7950,7955,7959],{"type":21,"tag":209,"props":7946,"children":7947},{"style":216},[7948],{"type":26,"value":7949},"  var",{"type":21,"tag":209,"props":7951,"children":7952},{"style":222},[7953],{"type":26,"value":7954}," query ",{"type":21,"tag":209,"props":7956,"children":7957},{"style":216},[7958],{"type":26,"value":1432},{"type":21,"tag":209,"props":7960,"children":7961},{"style":222},[7962],{"type":26,"value":7963}," {};\n",{"type":21,"tag":209,"props":7965,"children":7966},{"class":211,"line":279},[7967,7971,7976,7980,7985],{"type":21,"tag":209,"props":7968,"children":7969},{"style":216},[7970],{"type":26,"value":7949},{"type":21,"tag":209,"props":7972,"children":7973},{"style":222},[7974],{"type":26,"value":7975}," limit ",{"type":21,"tag":209,"props":7977,"children":7978},{"style":216},[7979],{"type":26,"value":1432},{"type":21,"tag":209,"props":7981,"children":7982},{"style":263},[7983],{"type":26,"value":7984}," 20",{"type":21,"tag":209,"props":7986,"children":7987},{"style":222},[7988],{"type":26,"value":241},{"type":21,"tag":209,"props":7990,"children":7991},{"class":211,"line":288},[7992,7996,8001,8005,8010],{"type":21,"tag":209,"props":7993,"children":7994},{"style":216},[7995],{"type":26,"value":7949},{"type":21,"tag":209,"props":7997,"children":7998},{"style":222},[7999],{"type":26,"value":8000}," offset ",{"type":21,"tag":209,"props":8002,"children":8003},{"style":216},[8004],{"type":26,"value":1432},{"type":21,"tag":209,"props":8006,"children":8007},{"style":263},[8008],{"type":26,"value":8009}," 0",{"type":21,"tag":209,"props":8011,"children":8012},{"style":222},[8013],{"type":26,"value":241},{"type":21,"tag":209,"props":8015,"children":8016},{"class":211,"line":307},[8017],{"type":21,"tag":209,"props":8018,"children":8019},{"emptyLinePlaceholder":248},[8020],{"type":26,"value":251},{"type":21,"tag":209,"props":8022,"children":8023},{"class":211,"line":325},[8024,8028,8032,8037,8042,8047,8052],{"type":21,"tag":209,"props":8025,"children":8026},{"style":216},[8027],{"type":26,"value":4847},{"type":21,"tag":209,"props":8029,"children":8030},{"style":222},[8031],{"type":26,"value":368},{"type":21,"tag":209,"props":8033,"children":8034},{"style":216},[8035],{"type":26,"value":8036},"typeof",{"type":21,"tag":209,"props":8038,"children":8039},{"style":222},[8040],{"type":26,"value":8041}," req.query.limit ",{"type":21,"tag":209,"props":8043,"children":8044},{"style":216},[8045],{"type":26,"value":8046},"!==",{"type":21,"tag":209,"props":8048,"children":8049},{"style":233},[8050],{"type":26,"value":8051}," 'undefined'",{"type":21,"tag":209,"props":8053,"children":8054},{"style":222},[8055],{"type":26,"value":2369},{"type":21,"tag":209,"props":8057,"children":8058},{"class":211,"line":334},[8059,8064,8068],{"type":21,"tag":209,"props":8060,"children":8061},{"style":222},[8062],{"type":26,"value":8063},"    limit ",{"type":21,"tag":209,"props":8065,"children":8066},{"style":216},[8067],{"type":26,"value":1432},{"type":21,"tag":209,"props":8069,"children":8070},{"style":222},[8071],{"type":26,"value":8072}," req.query.limit;\n",{"type":21,"tag":209,"props":8074,"children":8075},{"class":211,"line":343},[8076],{"type":21,"tag":209,"props":8077,"children":8078},{"style":222},[8079],{"type":26,"value":4953},{"type":21,"tag":209,"props":8081,"children":8082},{"class":211,"line":351},[8083],{"type":21,"tag":209,"props":8084,"children":8085},{"emptyLinePlaceholder":248},[8086],{"type":26,"value":251},{"type":21,"tag":209,"props":8088,"children":8089},{"class":211,"line":444},[8090,8094,8098,8102,8107,8111,8115],{"type":21,"tag":209,"props":8091,"children":8092},{"style":216},[8093],{"type":26,"value":4847},{"type":21,"tag":209,"props":8095,"children":8096},{"style":222},[8097],{"type":26,"value":368},{"type":21,"tag":209,"props":8099,"children":8100},{"style":216},[8101],{"type":26,"value":8036},{"type":21,"tag":209,"props":8103,"children":8104},{"style":222},[8105],{"type":26,"value":8106}," req.query.offset ",{"type":21,"tag":209,"props":8108,"children":8109},{"style":216},[8110],{"type":26,"value":8046},{"type":21,"tag":209,"props":8112,"children":8113},{"style":233},[8114],{"type":26,"value":8051},{"type":21,"tag":209,"props":8116,"children":8117},{"style":222},[8118],{"type":26,"value":2369},{"type":21,"tag":209,"props":8120,"children":8121},{"class":211,"line":454},[8122,8127,8131],{"type":21,"tag":209,"props":8123,"children":8124},{"style":222},[8125],{"type":26,"value":8126},"    offset ",{"type":21,"tag":209,"props":8128,"children":8129},{"style":216},[8130],{"type":26,"value":1432},{"type":21,"tag":209,"props":8132,"children":8133},{"style":222},[8134],{"type":26,"value":8135}," req.query.offset;\n",{"type":21,"tag":209,"props":8137,"children":8138},{"class":211,"line":463},[8139],{"type":21,"tag":209,"props":8140,"children":8141},{"style":222},[8142],{"type":26,"value":4953},{"type":21,"tag":209,"props":8144,"children":8145},{"class":211,"line":472},[8146],{"type":21,"tag":209,"props":8147,"children":8148},{"emptyLinePlaceholder":248},[8149],{"type":26,"value":251},{"type":21,"tag":209,"props":8151,"children":8152},{"class":211,"line":480},[8153,8157,8162,8166,8171,8175,8179],{"type":21,"tag":209,"props":8154,"children":8155},{"style":216},[8156],{"type":26,"value":4847},{"type":21,"tag":209,"props":8158,"children":8159},{"style":222},[8160],{"type":26,"value":8161},"( ",{"type":21,"tag":209,"props":8163,"children":8164},{"style":216},[8165],{"type":26,"value":8036},{"type":21,"tag":209,"props":8167,"children":8168},{"style":222},[8169],{"type":26,"value":8170}," req.query.tag ",{"type":21,"tag":209,"props":8172,"children":8173},{"style":216},[8174],{"type":26,"value":8046},{"type":21,"tag":209,"props":8176,"children":8177},{"style":233},[8178],{"type":26,"value":8051},{"type":21,"tag":209,"props":8180,"children":8181},{"style":222},[8182],{"type":26,"value":8183}," ){\n",{"type":21,"tag":209,"props":8185,"children":8186},{"class":211,"line":489},[8187,8192,8196,8200,8205],{"type":21,"tag":209,"props":8188,"children":8189},{"style":222},[8190],{"type":26,"value":8191},"    query.tagList ",{"type":21,"tag":209,"props":8193,"children":8194},{"style":216},[8195],{"type":26,"value":1432},{"type":21,"tag":209,"props":8197,"children":8198},{"style":222},[8199],{"type":26,"value":1282},{"type":21,"tag":209,"props":8201,"children":8202},{"style":233},[8203],{"type":26,"value":8204},"\"$in\"",{"type":21,"tag":209,"props":8206,"children":8207},{"style":222},[8208],{"type":26,"value":8209}," : [req.query.tag]};\n",{"type":21,"tag":209,"props":8211,"children":8212},{"class":211,"line":847},[8213],{"type":21,"tag":209,"props":8214,"children":8215},{"style":222},[8216],{"type":26,"value":4953},{"type":21,"tag":209,"props":8218,"children":8219},{"class":211,"line":860},[8220],{"type":21,"tag":209,"props":8221,"children":8222},{"emptyLinePlaceholder":248},[8223],{"type":26,"value":251},{"type":21,"tag":209,"props":8225,"children":8226},{"class":211,"line":877},[8227,8232,8236,8241],{"type":21,"tag":209,"props":8228,"children":8229},{"style":263},[8230],{"type":26,"value":8231},"  Promise",{"type":21,"tag":209,"props":8233,"children":8234},{"style":222},[8235],{"type":26,"value":378},{"type":21,"tag":209,"props":8237,"children":8238},{"style":360},[8239],{"type":26,"value":8240},"all",{"type":21,"tag":209,"props":8242,"children":8243},{"style":222},[8244],{"type":26,"value":8245},"([\n",{"type":21,"tag":209,"props":8247,"children":8248},{"class":211,"line":889},[8249,8254,8259,8264,8269,8274,8278,8283],{"type":21,"tag":209,"props":8250,"children":8251},{"style":222},[8252],{"type":26,"value":8253},"    req.query.author ",{"type":21,"tag":209,"props":8255,"children":8256},{"style":216},[8257],{"type":26,"value":8258},"?",{"type":21,"tag":209,"props":8260,"children":8261},{"style":222},[8262],{"type":26,"value":8263}," User.",{"type":21,"tag":209,"props":8265,"children":8266},{"style":360},[8267],{"type":26,"value":8268},"findOne",{"type":21,"tag":209,"props":8270,"children":8271},{"style":222},[8272],{"type":26,"value":8273},"({username: req.query.author}) ",{"type":21,"tag":209,"props":8275,"children":8276},{"style":216},[8277],{"type":26,"value":191},{"type":21,"tag":209,"props":8279,"children":8280},{"style":263},[8281],{"type":26,"value":8282}," null",{"type":21,"tag":209,"props":8284,"children":8285},{"style":222},[8286],{"type":26,"value":304},{"type":21,"tag":209,"props":8288,"children":8289},{"class":211,"line":902},[8290,8295,8299,8303,8307,8312,8316],{"type":21,"tag":209,"props":8291,"children":8292},{"style":222},[8293],{"type":26,"value":8294},"    req.query.favorited ",{"type":21,"tag":209,"props":8296,"children":8297},{"style":216},[8298],{"type":26,"value":8258},{"type":21,"tag":209,"props":8300,"children":8301},{"style":222},[8302],{"type":26,"value":8263},{"type":21,"tag":209,"props":8304,"children":8305},{"style":360},[8306],{"type":26,"value":8268},{"type":21,"tag":209,"props":8308,"children":8309},{"style":222},[8310],{"type":26,"value":8311},"({username: req.query.favorited}) ",{"type":21,"tag":209,"props":8313,"children":8314},{"style":216},[8315],{"type":26,"value":191},{"type":21,"tag":209,"props":8317,"children":8318},{"style":263},[8319],{"type":26,"value":8320}," null\n",{"type":21,"tag":209,"props":8322,"children":8323},{"class":211,"line":914},[8324,8329,8333,8337,8341,8345,8350],{"type":21,"tag":209,"props":8325,"children":8326},{"style":222},[8327],{"type":26,"value":8328},"  ]).",{"type":21,"tag":209,"props":8330,"children":8331},{"style":360},[8332],{"type":26,"value":2704},{"type":21,"tag":209,"props":8334,"children":8335},{"style":222},[8336],{"type":26,"value":368},{"type":21,"tag":209,"props":8338,"children":8339},{"style":216},[8340],{"type":26,"value":4622},{"type":21,"tag":209,"props":8342,"children":8343},{"style":222},[8344],{"type":26,"value":368},{"type":21,"tag":209,"props":8346,"children":8347},{"style":400},[8348],{"type":26,"value":8349},"results",{"type":21,"tag":209,"props":8351,"children":8352},{"style":222},[8353],{"type":26,"value":2369},{"type":21,"tag":209,"props":8355,"children":8356},{"class":211,"line":922},[8357],{"type":21,"tag":209,"props":8358,"children":8359},{"style":448},[8360],{"type":26,"value":8361},"    /* ... */\n",{"type":21,"tag":209,"props":8363,"children":8364},{"class":211,"line":2312},[8365],{"type":21,"tag":209,"props":8366,"children":8367},{"style":222},[8368],{"type":26,"value":5110},{"type":21,"tag":209,"props":8370,"children":8371},{"class":211,"line":2321},[8372],{"type":21,"tag":209,"props":8373,"children":8374},{"emptyLinePlaceholder":248},[8375],{"type":26,"value":251},{"type":21,"tag":209,"props":8377,"children":8378},{"class":211,"line":2372},[8379],{"type":21,"tag":209,"props":8380,"children":8381},{"style":448},[8382],{"type":26,"value":7692},{"type":21,"tag":22,"props":8384,"children":8385},{},[8386],{"type":26,"value":8387},"This is a place where beyond just replicating the Express route's behaviour, the Fastify route can easily improve upon it by adding more thorough schema validation for these parameters:",{"type":21,"tag":22,"props":8389,"children":8390},{},[8391,8396],{"type":21,"tag":63,"props":8392,"children":8394},{"className":8393},[],[8395],{"type":26,"value":7503},{"type":26,"value":191},{"type":21,"tag":200,"props":8398,"children":8400},{"className":202,"code":8399,"language":12,"meta":8,"style":8},"  fastify.route({\n    method: 'GET',\n    url: '/',\n    onRequest: [fastify.authenticatedOptional],\n    schema: {   // \u003C--- `schema` field added\n      query: {  // \u003C--- query param validation added (also works for body, params, headers)\n        type: \"object\",\n        properties: {\n          limit: {type: \"number\", minimum: 1},\n          offset: {type: \"number\", minimum: 0},\n          tag: {type: \"string\", minLength: 1},\n          author: {type: \"string\", minLength: 1},\n          favorited: {type: \"string\", minLength: 1},\n        },\n        required: [],\n      },\n    },\n    handler: async function(request, reply) {\n      /* ... */\n    },\n  });\n\n  /* ... */\n",[8401],{"type":21,"tag":63,"props":8402,"children":8403},{"__ignoreMap":8},[8404,8419,8434,8449,8456,8469,8482,8499,8507,8534,8559,8585,8609,8633,8640,8648,8655,8662,8701,8708,8715,8722,8729],{"type":21,"tag":209,"props":8405,"children":8406},{"class":211,"line":212},[8407,8411,8415],{"type":21,"tag":209,"props":8408,"children":8409},{"style":222},[8410],{"type":26,"value":5673},{"type":21,"tag":209,"props":8412,"children":8413},{"style":360},[8414],{"type":26,"value":7762},{"type":21,"tag":209,"props":8416,"children":8417},{"style":222},[8418],{"type":26,"value":7767},{"type":21,"tag":209,"props":8420,"children":8421},{"class":211,"line":244},[8422,8426,8430],{"type":21,"tag":209,"props":8423,"children":8424},{"style":222},[8425],{"type":26,"value":7775},{"type":21,"tag":209,"props":8427,"children":8428},{"style":233},[8429],{"type":26,"value":7780},{"type":21,"tag":209,"props":8431,"children":8432},{"style":222},[8433],{"type":26,"value":304},{"type":21,"tag":209,"props":8435,"children":8436},{"class":211,"line":254},[8437,8441,8445],{"type":21,"tag":209,"props":8438,"children":8439},{"style":222},[8440],{"type":26,"value":7792},{"type":21,"tag":209,"props":8442,"children":8443},{"style":233},[8444],{"type":26,"value":7645},{"type":21,"tag":209,"props":8446,"children":8447},{"style":222},[8448],{"type":26,"value":304},{"type":21,"tag":209,"props":8450,"children":8451},{"class":211,"line":279},[8452],{"type":21,"tag":209,"props":8453,"children":8454},{"style":222},[8455],{"type":26,"value":7808},{"type":21,"tag":209,"props":8457,"children":8458},{"class":211,"line":288},[8459,8464],{"type":21,"tag":209,"props":8460,"children":8461},{"style":222},[8462],{"type":26,"value":8463},"    schema: {   ",{"type":21,"tag":209,"props":8465,"children":8466},{"style":448},[8467],{"type":26,"value":8468},"// \u003C--- `schema` field added\n",{"type":21,"tag":209,"props":8470,"children":8471},{"class":211,"line":307},[8472,8477],{"type":21,"tag":209,"props":8473,"children":8474},{"style":222},[8475],{"type":26,"value":8476},"      query: {  ",{"type":21,"tag":209,"props":8478,"children":8479},{"style":448},[8480],{"type":26,"value":8481},"// \u003C--- query param validation added (also works for body, params, headers)\n",{"type":21,"tag":209,"props":8483,"children":8484},{"class":211,"line":325},[8485,8490,8495],{"type":21,"tag":209,"props":8486,"children":8487},{"style":222},[8488],{"type":26,"value":8489},"        type: ",{"type":21,"tag":209,"props":8491,"children":8492},{"style":233},[8493],{"type":26,"value":8494},"\"object\"",{"type":21,"tag":209,"props":8496,"children":8497},{"style":222},[8498],{"type":26,"value":304},{"type":21,"tag":209,"props":8500,"children":8501},{"class":211,"line":334},[8502],{"type":21,"tag":209,"props":8503,"children":8504},{"style":222},[8505],{"type":26,"value":8506},"        properties: {\n",{"type":21,"tag":209,"props":8508,"children":8509},{"class":211,"line":343},[8510,8515,8520,8525,8529],{"type":21,"tag":209,"props":8511,"children":8512},{"style":222},[8513],{"type":26,"value":8514},"          limit: {type: ",{"type":21,"tag":209,"props":8516,"children":8517},{"style":233},[8518],{"type":26,"value":8519},"\"number\"",{"type":21,"tag":209,"props":8521,"children":8522},{"style":222},[8523],{"type":26,"value":8524},", minimum: ",{"type":21,"tag":209,"props":8526,"children":8527},{"style":263},[8528],{"type":26,"value":3224},{"type":21,"tag":209,"props":8530,"children":8531},{"style":222},[8532],{"type":26,"value":8533},"},\n",{"type":21,"tag":209,"props":8535,"children":8536},{"class":211,"line":351},[8537,8542,8546,8550,8555],{"type":21,"tag":209,"props":8538,"children":8539},{"style":222},[8540],{"type":26,"value":8541},"          offset: {type: ",{"type":21,"tag":209,"props":8543,"children":8544},{"style":233},[8545],{"type":26,"value":8519},{"type":21,"tag":209,"props":8547,"children":8548},{"style":222},[8549],{"type":26,"value":8524},{"type":21,"tag":209,"props":8551,"children":8552},{"style":263},[8553],{"type":26,"value":8554},"0",{"type":21,"tag":209,"props":8556,"children":8557},{"style":222},[8558],{"type":26,"value":8533},{"type":21,"tag":209,"props":8560,"children":8561},{"class":211,"line":444},[8562,8567,8572,8577,8581],{"type":21,"tag":209,"props":8563,"children":8564},{"style":222},[8565],{"type":26,"value":8566},"          tag: {type: ",{"type":21,"tag":209,"props":8568,"children":8569},{"style":233},[8570],{"type":26,"value":8571},"\"string\"",{"type":21,"tag":209,"props":8573,"children":8574},{"style":222},[8575],{"type":26,"value":8576},", minLength: ",{"type":21,"tag":209,"props":8578,"children":8579},{"style":263},[8580],{"type":26,"value":3224},{"type":21,"tag":209,"props":8582,"children":8583},{"style":222},[8584],{"type":26,"value":8533},{"type":21,"tag":209,"props":8586,"children":8587},{"class":211,"line":454},[8588,8593,8597,8601,8605],{"type":21,"tag":209,"props":8589,"children":8590},{"style":222},[8591],{"type":26,"value":8592},"          author: {type: ",{"type":21,"tag":209,"props":8594,"children":8595},{"style":233},[8596],{"type":26,"value":8571},{"type":21,"tag":209,"props":8598,"children":8599},{"style":222},[8600],{"type":26,"value":8576},{"type":21,"tag":209,"props":8602,"children":8603},{"style":263},[8604],{"type":26,"value":3224},{"type":21,"tag":209,"props":8606,"children":8607},{"style":222},[8608],{"type":26,"value":8533},{"type":21,"tag":209,"props":8610,"children":8611},{"class":211,"line":463},[8612,8617,8621,8625,8629],{"type":21,"tag":209,"props":8613,"children":8614},{"style":222},[8615],{"type":26,"value":8616},"          favorited: {type: ",{"type":21,"tag":209,"props":8618,"children":8619},{"style":233},[8620],{"type":26,"value":8571},{"type":21,"tag":209,"props":8622,"children":8623},{"style":222},[8624],{"type":26,"value":8576},{"type":21,"tag":209,"props":8626,"children":8627},{"style":263},[8628],{"type":26,"value":3224},{"type":21,"tag":209,"props":8630,"children":8631},{"style":222},[8632],{"type":26,"value":8533},{"type":21,"tag":209,"props":8634,"children":8635},{"class":211,"line":472},[8636],{"type":21,"tag":209,"props":8637,"children":8638},{"style":222},[8639],{"type":26,"value":2522},{"type":21,"tag":209,"props":8641,"children":8642},{"class":211,"line":480},[8643],{"type":21,"tag":209,"props":8644,"children":8645},{"style":222},[8646],{"type":26,"value":8647},"        required: [],\n",{"type":21,"tag":209,"props":8649,"children":8650},{"class":211,"line":489},[8651],{"type":21,"tag":209,"props":8652,"children":8653},{"style":222},[8654],{"type":26,"value":6552},{"type":21,"tag":209,"props":8656,"children":8657},{"class":211,"line":847},[8658],{"type":21,"tag":209,"props":8659,"children":8660},{"style":222},[8661],{"type":26,"value":2251},{"type":21,"tag":209,"props":8663,"children":8664},{"class":211,"line":860},[8665,8669,8673,8677,8681,8685,8689,8693,8697],{"type":21,"tag":209,"props":8666,"children":8667},{"style":360},[8668],{"type":26,"value":7816},{"type":21,"tag":209,"props":8670,"children":8671},{"style":222},[8672],{"type":26,"value":7821},{"type":21,"tag":209,"props":8674,"children":8675},{"style":216},[8676],{"type":26,"value":1376},{"type":21,"tag":209,"props":8678,"children":8679},{"style":216},[8680],{"type":26,"value":4789},{"type":21,"tag":209,"props":8682,"children":8683},{"style":222},[8684],{"type":26,"value":368},{"type":21,"tag":209,"props":8686,"children":8687},{"style":400},[8688],{"type":26,"value":1343},{"type":21,"tag":209,"props":8690,"children":8691},{"style":222},[8692],{"type":26,"value":408},{"type":21,"tag":209,"props":8694,"children":8695},{"style":400},[8696],{"type":26,"value":6628},{"type":21,"tag":209,"props":8698,"children":8699},{"style":222},[8700],{"type":26,"value":5588},{"type":21,"tag":209,"props":8702,"children":8703},{"class":211,"line":877},[8704],{"type":21,"tag":209,"props":8705,"children":8706},{"style":448},[8707],{"type":26,"value":7857},{"type":21,"tag":209,"props":8709,"children":8710},{"class":211,"line":889},[8711],{"type":21,"tag":209,"props":8712,"children":8713},{"style":222},[8714],{"type":26,"value":2251},{"type":21,"tag":209,"props":8716,"children":8717},{"class":211,"line":902},[8718],{"type":21,"tag":209,"props":8719,"children":8720},{"style":222},[8721],{"type":26,"value":5110},{"type":21,"tag":209,"props":8723,"children":8724},{"class":211,"line":914},[8725],{"type":21,"tag":209,"props":8726,"children":8727},{"emptyLinePlaceholder":248},[8728],{"type":26,"value":251},{"type":21,"tag":209,"props":8730,"children":8731},{"class":211,"line":922},[8732],{"type":21,"tag":209,"props":8733,"children":8734},{"style":448},[8735],{"type":26,"value":7692},{"type":21,"tag":22,"props":8737,"children":8738},{},[8739,8741,8746,8748,8753,8755,8761],{"type":26,"value":8740},"Otherwise, the body of this route can be migrated largely unchanged, except with the ",{"type":21,"tag":63,"props":8742,"children":8744},{"className":8743},[],[8745],{"type":26,"value":7663},{"type":26,"value":8747}," variable renamed to ",{"type":21,"tag":63,"props":8749,"children":8751},{"className":8750},[],[8752],{"type":26,"value":1343},{"type":26,"value":8754}," (a purely stylistic choice but one which seems to be the convention in Fastify). The only other difference is where the response is returned; in Express ",{"type":21,"tag":63,"props":8756,"children":8758},{"className":8757},[],[8759],{"type":26,"value":8760},"res.json()",{"type":26,"value":8762}," is called, but Fastify is JSON-enabled by default and so a JavaScript object can just be returned directly.",{"type":21,"tag":22,"props":8764,"children":8765},{},[8766,8768,8774,8776,8782,8784,8790,8792,8798],{"type":26,"value":8767},"The rest of the routes in this module can be migrated similarly, with one exception: some rely on an Express utility called ",{"type":21,"tag":63,"props":8769,"children":8771},{"className":8770},[],[8772],{"type":26,"value":8773},".param()",{"type":26,"value":8775},", for which Fastify doesn't have a direct equivalent. This utility is used in order to automatically fetch an ",{"type":21,"tag":63,"props":8777,"children":8779},{"className":8778},[],[8780],{"type":26,"value":8781},"Article",{"type":26,"value":8783}," object from the database for any route which has a ",{"type":21,"tag":63,"props":8785,"children":8787},{"className":8786},[],[8788],{"type":26,"value":8789},":article",{"type":26,"value":8791}," query parameter, and make it available to the route handler as ",{"type":21,"tag":63,"props":8793,"children":8795},{"className":8794},[],[8796],{"type":26,"value":8797},"req.article",{"type":26,"value":191},{"type":21,"tag":22,"props":8800,"children":8801},{},[8802,8807],{"type":21,"tag":63,"props":8803,"children":8805},{"className":8804},[],[8806],{"type":26,"value":7601},{"type":26,"value":191},{"type":21,"tag":200,"props":8809,"children":8811},{"className":202,"code":8810,"language":12,"meta":8,"style":8},"router.param('article', function(req, res, next, slug) {\n  Article.findOne({ slug: slug})\n    .populate('author')\n    .then(function (article) {\n      if (!article) { return res.sendStatus(404); }\n\n      req.article = article;\n\n      return next();\n    }).catch(next);\n});\n",[8812],{"type":21,"tag":63,"props":8813,"children":8814},{"__ignoreMap":8},[8815,8881,8898,8925,8957,9007,9014,9031,9038,9055,9072],{"type":21,"tag":209,"props":8816,"children":8817},{"class":211,"line":212},[8818,8822,8827,8831,8836,8840,8844,8848,8852,8856,8860,8864,8868,8872,8877],{"type":21,"tag":209,"props":8819,"children":8820},{"style":222},[8821],{"type":26,"value":7631},{"type":21,"tag":209,"props":8823,"children":8824},{"style":360},[8825],{"type":26,"value":8826},"param",{"type":21,"tag":209,"props":8828,"children":8829},{"style":222},[8830],{"type":26,"value":368},{"type":21,"tag":209,"props":8832,"children":8833},{"style":233},[8834],{"type":26,"value":8835},"'article'",{"type":21,"tag":209,"props":8837,"children":8838},{"style":222},[8839],{"type":26,"value":408},{"type":21,"tag":209,"props":8841,"children":8842},{"style":216},[8843],{"type":26,"value":4622},{"type":21,"tag":209,"props":8845,"children":8846},{"style":222},[8847],{"type":26,"value":368},{"type":21,"tag":209,"props":8849,"children":8850},{"style":400},[8851],{"type":26,"value":7663},{"type":21,"tag":209,"props":8853,"children":8854},{"style":222},[8855],{"type":26,"value":408},{"type":21,"tag":209,"props":8857,"children":8858},{"style":400},[8859],{"type":26,"value":1385},{"type":21,"tag":209,"props":8861,"children":8862},{"style":222},[8863],{"type":26,"value":408},{"type":21,"tag":209,"props":8865,"children":8866},{"style":400},[8867],{"type":26,"value":7680},{"type":21,"tag":209,"props":8869,"children":8870},{"style":222},[8871],{"type":26,"value":408},{"type":21,"tag":209,"props":8873,"children":8874},{"style":400},[8875],{"type":26,"value":8876},"slug",{"type":21,"tag":209,"props":8878,"children":8879},{"style":222},[8880],{"type":26,"value":5588},{"type":21,"tag":209,"props":8882,"children":8883},{"class":211,"line":244},[8884,8889,8893],{"type":21,"tag":209,"props":8885,"children":8886},{"style":222},[8887],{"type":26,"value":8888},"  Article.",{"type":21,"tag":209,"props":8890,"children":8891},{"style":360},[8892],{"type":26,"value":8268},{"type":21,"tag":209,"props":8894,"children":8895},{"style":222},[8896],{"type":26,"value":8897},"({ slug: slug})\n",{"type":21,"tag":209,"props":8899,"children":8900},{"class":211,"line":254},[8901,8906,8911,8915,8920],{"type":21,"tag":209,"props":8902,"children":8903},{"style":222},[8904],{"type":26,"value":8905},"    .",{"type":21,"tag":209,"props":8907,"children":8908},{"style":360},[8909],{"type":26,"value":8910},"populate",{"type":21,"tag":209,"props":8912,"children":8913},{"style":222},[8914],{"type":26,"value":368},{"type":21,"tag":209,"props":8916,"children":8917},{"style":233},[8918],{"type":26,"value":8919},"'author'",{"type":21,"tag":209,"props":8921,"children":8922},{"style":222},[8923],{"type":26,"value":8924},")\n",{"type":21,"tag":209,"props":8926,"children":8927},{"class":211,"line":279},[8928,8932,8936,8940,8944,8948,8953],{"type":21,"tag":209,"props":8929,"children":8930},{"style":222},[8931],{"type":26,"value":8905},{"type":21,"tag":209,"props":8933,"children":8934},{"style":360},[8935],{"type":26,"value":2704},{"type":21,"tag":209,"props":8937,"children":8938},{"style":222},[8939],{"type":26,"value":368},{"type":21,"tag":209,"props":8941,"children":8942},{"style":216},[8943],{"type":26,"value":4622},{"type":21,"tag":209,"props":8945,"children":8946},{"style":222},[8947],{"type":26,"value":5569},{"type":21,"tag":209,"props":8949,"children":8950},{"style":400},[8951],{"type":26,"value":8952},"article",{"type":21,"tag":209,"props":8954,"children":8955},{"style":222},[8956],{"type":26,"value":5588},{"type":21,"tag":209,"props":8958,"children":8959},{"class":211,"line":288},[8960,8965,8969,8973,8978,8983,8988,8993,8997,9002],{"type":21,"tag":209,"props":8961,"children":8962},{"style":216},[8963],{"type":26,"value":8964},"      if",{"type":21,"tag":209,"props":8966,"children":8967},{"style":222},[8968],{"type":26,"value":5569},{"type":21,"tag":209,"props":8970,"children":8971},{"style":216},[8972],{"type":26,"value":6455},{"type":21,"tag":209,"props":8974,"children":8975},{"style":222},[8976],{"type":26,"value":8977},"article) { ",{"type":21,"tag":209,"props":8979,"children":8980},{"style":216},[8981],{"type":26,"value":8982},"return",{"type":21,"tag":209,"props":8984,"children":8985},{"style":222},[8986],{"type":26,"value":8987}," res.",{"type":21,"tag":209,"props":8989,"children":8990},{"style":360},[8991],{"type":26,"value":8992},"sendStatus",{"type":21,"tag":209,"props":8994,"children":8995},{"style":222},[8996],{"type":26,"value":368},{"type":21,"tag":209,"props":8998,"children":8999},{"style":263},[9000],{"type":26,"value":9001},"404",{"type":21,"tag":209,"props":9003,"children":9004},{"style":222},[9005],{"type":26,"value":9006},"); }\n",{"type":21,"tag":209,"props":9008,"children":9009},{"class":211,"line":307},[9010],{"type":21,"tag":209,"props":9011,"children":9012},{"emptyLinePlaceholder":248},[9013],{"type":26,"value":251},{"type":21,"tag":209,"props":9015,"children":9016},{"class":211,"line":325},[9017,9022,9026],{"type":21,"tag":209,"props":9018,"children":9019},{"style":222},[9020],{"type":26,"value":9021},"      req.article ",{"type":21,"tag":209,"props":9023,"children":9024},{"style":216},[9025],{"type":26,"value":1432},{"type":21,"tag":209,"props":9027,"children":9028},{"style":222},[9029],{"type":26,"value":9030}," article;\n",{"type":21,"tag":209,"props":9032,"children":9033},{"class":211,"line":334},[9034],{"type":21,"tag":209,"props":9035,"children":9036},{"emptyLinePlaceholder":248},[9037],{"type":26,"value":251},{"type":21,"tag":209,"props":9039,"children":9040},{"class":211,"line":343},[9041,9046,9051],{"type":21,"tag":209,"props":9042,"children":9043},{"style":216},[9044],{"type":26,"value":9045},"      return",{"type":21,"tag":209,"props":9047,"children":9048},{"style":360},[9049],{"type":26,"value":9050}," next",{"type":21,"tag":209,"props":9052,"children":9053},{"style":222},[9054],{"type":26,"value":4123},{"type":21,"tag":209,"props":9056,"children":9057},{"class":211,"line":351},[9058,9063,9067],{"type":21,"tag":209,"props":9059,"children":9060},{"style":222},[9061],{"type":26,"value":9062},"    }).",{"type":21,"tag":209,"props":9064,"children":9065},{"style":360},[9066],{"type":26,"value":5347},{"type":21,"tag":209,"props":9068,"children":9069},{"style":222},[9070],{"type":26,"value":9071},"(next);\n",{"type":21,"tag":209,"props":9073,"children":9074},{"class":211,"line":444},[9075],{"type":21,"tag":209,"props":9076,"children":9077},{"style":222},[9078],{"type":26,"value":469},{"type":21,"tag":22,"props":9080,"children":9081},{},[9082],{"type":26,"value":9083},"It's possible to do the same in Fastify using the more generic \"hooks\" system:",{"type":21,"tag":200,"props":9085,"children":9087},{"className":202,"code":9086,"language":12,"meta":8,"style":8},"fastify.addHook('onRequest', async (request, reply) => {\n  if ('article' in request.params) {\n    request.article = await Article\n      .findOne({ slug: request.params.article})\n      .populate('author');\n\n    if (!request.article) {\n        reply.code(401).send();\n        return reply;\n    }\n  }\n});\n",[9088],{"type":21,"tag":63,"props":9089,"children":9090},{"__ignoreMap":8},[9091,9149,9174,9195,9212,9235,9242,9263,9296,9308,9315,9322],{"type":21,"tag":209,"props":9092,"children":9093},{"class":211,"line":212},[9094,9099,9104,9108,9113,9117,9121,9125,9129,9133,9137,9141,9145],{"type":21,"tag":209,"props":9095,"children":9096},{"style":222},[9097],{"type":26,"value":9098},"fastify.",{"type":21,"tag":209,"props":9100,"children":9101},{"style":360},[9102],{"type":26,"value":9103},"addHook",{"type":21,"tag":209,"props":9105,"children":9106},{"style":222},[9107],{"type":26,"value":368},{"type":21,"tag":209,"props":9109,"children":9110},{"style":233},[9111],{"type":26,"value":9112},"'onRequest'",{"type":21,"tag":209,"props":9114,"children":9115},{"style":222},[9116],{"type":26,"value":408},{"type":21,"tag":209,"props":9118,"children":9119},{"style":216},[9120],{"type":26,"value":1376},{"type":21,"tag":209,"props":9122,"children":9123},{"style":222},[9124],{"type":26,"value":5569},{"type":21,"tag":209,"props":9126,"children":9127},{"style":400},[9128],{"type":26,"value":1343},{"type":21,"tag":209,"props":9130,"children":9131},{"style":222},[9132],{"type":26,"value":408},{"type":21,"tag":209,"props":9134,"children":9135},{"style":400},[9136],{"type":26,"value":6628},{"type":21,"tag":209,"props":9138,"children":9139},{"style":222},[9140],{"type":26,"value":432},{"type":21,"tag":209,"props":9142,"children":9143},{"style":216},[9144],{"type":26,"value":437},{"type":21,"tag":209,"props":9146,"children":9147},{"style":222},[9148],{"type":26,"value":276},{"type":21,"tag":209,"props":9150,"children":9151},{"class":211,"line":244},[9152,9156,9160,9164,9169],{"type":21,"tag":209,"props":9153,"children":9154},{"style":216},[9155],{"type":26,"value":4847},{"type":21,"tag":209,"props":9157,"children":9158},{"style":222},[9159],{"type":26,"value":5569},{"type":21,"tag":209,"props":9161,"children":9162},{"style":233},[9163],{"type":26,"value":8835},{"type":21,"tag":209,"props":9165,"children":9166},{"style":216},[9167],{"type":26,"value":9168}," in",{"type":21,"tag":209,"props":9170,"children":9171},{"style":222},[9172],{"type":26,"value":9173}," request.params) {\n",{"type":21,"tag":209,"props":9175,"children":9176},{"class":211,"line":254},[9177,9182,9186,9190],{"type":21,"tag":209,"props":9178,"children":9179},{"style":222},[9180],{"type":26,"value":9181},"    request.article ",{"type":21,"tag":209,"props":9183,"children":9184},{"style":216},[9185],{"type":26,"value":1432},{"type":21,"tag":209,"props":9187,"children":9188},{"style":216},[9189],{"type":26,"value":1437},{"type":21,"tag":209,"props":9191,"children":9192},{"style":222},[9193],{"type":26,"value":9194}," Article\n",{"type":21,"tag":209,"props":9196,"children":9197},{"class":211,"line":279},[9198,9203,9207],{"type":21,"tag":209,"props":9199,"children":9200},{"style":222},[9201],{"type":26,"value":9202},"      .",{"type":21,"tag":209,"props":9204,"children":9205},{"style":360},[9206],{"type":26,"value":8268},{"type":21,"tag":209,"props":9208,"children":9209},{"style":222},[9210],{"type":26,"value":9211},"({ slug: request.params.article})\n",{"type":21,"tag":209,"props":9213,"children":9214},{"class":211,"line":288},[9215,9219,9223,9227,9231],{"type":21,"tag":209,"props":9216,"children":9217},{"style":222},[9218],{"type":26,"value":9202},{"type":21,"tag":209,"props":9220,"children":9221},{"style":360},[9222],{"type":26,"value":8910},{"type":21,"tag":209,"props":9224,"children":9225},{"style":222},[9226],{"type":26,"value":368},{"type":21,"tag":209,"props":9228,"children":9229},{"style":233},[9230],{"type":26,"value":8919},{"type":21,"tag":209,"props":9232,"children":9233},{"style":222},[9234],{"type":26,"value":2608},{"type":21,"tag":209,"props":9236,"children":9237},{"class":211,"line":307},[9238],{"type":21,"tag":209,"props":9239,"children":9240},{"emptyLinePlaceholder":248},[9241],{"type":26,"value":251},{"type":21,"tag":209,"props":9243,"children":9244},{"class":211,"line":325},[9245,9250,9254,9258],{"type":21,"tag":209,"props":9246,"children":9247},{"style":216},[9248],{"type":26,"value":9249},"    if",{"type":21,"tag":209,"props":9251,"children":9252},{"style":222},[9253],{"type":26,"value":5569},{"type":21,"tag":209,"props":9255,"children":9256},{"style":216},[9257],{"type":26,"value":6455},{"type":21,"tag":209,"props":9259,"children":9260},{"style":222},[9261],{"type":26,"value":9262},"request.article) {\n",{"type":21,"tag":209,"props":9264,"children":9265},{"class":211,"line":334},[9266,9271,9275,9279,9284,9288,9292],{"type":21,"tag":209,"props":9267,"children":9268},{"style":222},[9269],{"type":26,"value":9270},"        reply.",{"type":21,"tag":209,"props":9272,"children":9273},{"style":360},[9274],{"type":26,"value":63},{"type":21,"tag":209,"props":9276,"children":9277},{"style":222},[9278],{"type":26,"value":368},{"type":21,"tag":209,"props":9280,"children":9281},{"style":263},[9282],{"type":26,"value":9283},"401",{"type":21,"tag":209,"props":9285,"children":9286},{"style":222},[9287],{"type":26,"value":2699},{"type":21,"tag":209,"props":9289,"children":9290},{"style":360},[9291],{"type":26,"value":6696},{"type":21,"tag":209,"props":9293,"children":9294},{"style":222},[9295],{"type":26,"value":4123},{"type":21,"tag":209,"props":9297,"children":9298},{"class":211,"line":343},[9299,9303],{"type":21,"tag":209,"props":9300,"children":9301},{"style":216},[9302],{"type":26,"value":3069},{"type":21,"tag":209,"props":9304,"children":9305},{"style":222},[9306],{"type":26,"value":9307}," reply;\n",{"type":21,"tag":209,"props":9309,"children":9310},{"class":211,"line":351},[9311],{"type":21,"tag":209,"props":9312,"children":9313},{"style":222},[9314],{"type":26,"value":331},{"type":21,"tag":209,"props":9316,"children":9317},{"class":211,"line":444},[9318],{"type":21,"tag":209,"props":9319,"children":9320},{"style":222},[9321],{"type":26,"value":4953},{"type":21,"tag":209,"props":9323,"children":9324},{"class":211,"line":454},[9325],{"type":21,"tag":209,"props":9326,"children":9327},{"style":222},[9328],{"type":26,"value":469},{"type":21,"tag":22,"props":9330,"children":9331},{},[9332],{"type":26,"value":9333},"Note that for style reasons however, I opted to remove hooks like these and perform these database requests within the route handlers themselves; this makes the code more direct and easy to reason about, and also allows us to query for the Article in parallel with other database queries.",{"type":21,"tag":22,"props":9335,"children":9336},{},[9337,9338,9344],{"type":26,"value":5943},{"type":21,"tag":29,"props":9339,"children":9342},{"href":9340,"rel":9341},"https://github.com/artandlogic/node-express-to-fastify-example/commit/de495b65e32db961d84db8c78fd96621deac8404",[93],[9343],{"type":26,"value":3592},{"type":26,"value":9345}," to view the rest of the partial conversion to Fastify. This process can continue piece by piece until the last of the Express routes are migrated.",{"type":21,"tag":3596,"props":9347,"children":9349},{"id":9348},"step-3-removing-express-and-related-plugins",[9350],{"type":26,"value":9351},"Step 3: Removing Express and related plugins",{"type":21,"tag":22,"props":9353,"children":9354},{},[9355,9357,9363,9364,9369,9371,9377,9379,9385,9387,9392],{"type":26,"value":9356},"Once the migration is complete, the registration of the ",{"type":21,"tag":63,"props":9358,"children":9360},{"className":9359},[],[9361],{"type":26,"value":9362},"routes/legacy",{"type":26,"value":7045},{"type":21,"tag":63,"props":9365,"children":9367},{"className":9366},[],[9368],{"type":26,"value":3771},{"type":26,"value":9370}," can be removed, the modules in the ",{"type":21,"tag":63,"props":9372,"children":9374},{"className":9373},[],[9375],{"type":26,"value":9376},"legacy/",{"type":26,"value":9378}," directory can be deleted, and all Express-related plugins can be removed from ",{"type":21,"tag":63,"props":9380,"children":9382},{"className":9381},[],[9383],{"type":26,"value":9384},"package.json",{"type":26,"value":9386}," (including ",{"type":21,"tag":63,"props":9388,"children":9390},{"className":9389},[],[9391],{"type":26,"value":3617},{"type":26,"value":9393},"). What's left is an application that has been fully migrated to Fastify, while remaining fully functional at every step along the way.",{"type":21,"tag":22,"props":9395,"children":9396},{},[9397,9398,9404],{"type":26,"value":5943},{"type":21,"tag":29,"props":9399,"children":9402},{"href":9400,"rel":9401},"https://github.com/artandlogic/node-express-to-fastify-example/commit/25da1c0e9b0a3b7d9c6e8b102fd4112796634fdf",[93],[9403],{"type":26,"value":3592},{"type":26,"value":9405}," to view the fully-migrated codebase.",{"type":21,"tag":3596,"props":9407,"children":9409},{"id":9408},"bonus-adding-integration-tests",[9410],{"type":26,"value":9411},"Bonus: Adding integration tests",{"type":21,"tag":22,"props":9413,"children":9414},{},[9415],{"type":26,"value":9416},"This project currently relies on end-to-end tests that execute against a full running instance of the application. It's valuable to have some tests like these, but most of them would be better off as integration tests, such that test cases are independent of one another and they have the ability to set up data before they run.",{"type":21,"tag":22,"props":9418,"children":9419},{},[9420],{"type":26,"value":9421},"To use Fastify's built-in testing utilities to this end, a few minor things in this project need to be refactored:",{"type":21,"tag":3626,"props":9423,"children":9424},{},[9425,9770],{"type":21,"tag":3630,"props":9426,"children":9427},{},[9428,9429,9434,9436,9441,9443,9446,9451,9453,9706,9709,9711,9716,9718,9723,9725,9731,9733,9738,9740,9745,9747,9753,9755,9761,9763,9768],{"type":26,"value":108},{"type":21,"tag":63,"props":9430,"children":9432},{"className":9431},[],[9433],{"type":26,"value":3542},{"type":26,"value":9435}," instance creation needs to be sparated from the place where the it's used to start up the server itself; this is because the test utilities work on the ",{"type":21,"tag":63,"props":9437,"children":9439},{"className":9438},[],[9440],{"type":26,"value":3542},{"type":26,"value":9442}," app itself without starting up a real Webserver.",{"type":21,"tag":7343,"props":9444,"children":9445},{},[],{"type":21,"tag":63,"props":9447,"children":9449},{"className":9448},[],[9450],{"type":26,"value":3771},{"type":26,"value":9452}," is currently doing both:",{"type":21,"tag":200,"props":9454,"children":9456},{"className":202,"code":9455,"language":12,"meta":8,"style":8},"async function build() {\n  /* ... */\n\n  const app = require('fastify')({logger: true});\n\n  /* ... */\n\n  return app;\n}\n\nbuild()\n  .then(app => app.listen({port: 3000}))\n  .then((address) => {\n    console.log('Listening on ' + address);\n  }).catch(console.log);\n",[9457],{"type":21,"tag":63,"props":9458,"children":9459},{"__ignoreMap":8},[9460,9479,9486,9493,9533,9540,9547,9554,9565,9572,9579,9590,9633,9664,9691],{"type":21,"tag":209,"props":9461,"children":9462},{"class":211,"line":212},[9463,9467,9471,9475],{"type":21,"tag":209,"props":9464,"children":9465},{"style":216},[9466],{"type":26,"value":1376},{"type":21,"tag":209,"props":9468,"children":9469},{"style":216},[9470],{"type":26,"value":4789},{"type":21,"tag":209,"props":9472,"children":9473},{"style":360},[9474],{"type":26,"value":4794},{"type":21,"tag":209,"props":9476,"children":9477},{"style":222},[9478],{"type":26,"value":4799},{"type":21,"tag":209,"props":9480,"children":9481},{"class":211,"line":244},[9482],{"type":21,"tag":209,"props":9483,"children":9484},{"style":448},[9485],{"type":26,"value":7692},{"type":21,"tag":209,"props":9487,"children":9488},{"class":211,"line":254},[9489],{"type":21,"tag":209,"props":9490,"children":9491},{"emptyLinePlaceholder":248},[9492],{"type":26,"value":251},{"type":21,"tag":209,"props":9494,"children":9495},{"class":211,"line":279},[9496,9500,9504,9508,9512,9516,9520,9525,9529],{"type":21,"tag":209,"props":9497,"children":9498},{"style":216},[9499],{"type":26,"value":4807},{"type":21,"tag":209,"props":9501,"children":9502},{"style":263},[9503],{"type":26,"value":5064},{"type":21,"tag":209,"props":9505,"children":9506},{"style":216},[9507],{"type":26,"value":271},{"type":21,"tag":209,"props":9509,"children":9510},{"style":360},[9511],{"type":26,"value":3923},{"type":21,"tag":209,"props":9513,"children":9514},{"style":222},[9515],{"type":26,"value":368},{"type":21,"tag":209,"props":9517,"children":9518},{"style":233},[9519],{"type":26,"value":5081},{"type":21,"tag":209,"props":9521,"children":9522},{"style":222},[9523],{"type":26,"value":9524},")({logger: ",{"type":21,"tag":209,"props":9526,"children":9527},{"style":263},[9528],{"type":26,"value":2223},{"type":21,"tag":209,"props":9530,"children":9531},{"style":222},[9532],{"type":26,"value":469},{"type":21,"tag":209,"props":9534,"children":9535},{"class":211,"line":288},[9536],{"type":21,"tag":209,"props":9537,"children":9538},{"emptyLinePlaceholder":248},[9539],{"type":26,"value":251},{"type":21,"tag":209,"props":9541,"children":9542},{"class":211,"line":307},[9543],{"type":21,"tag":209,"props":9544,"children":9545},{"style":448},[9546],{"type":26,"value":7692},{"type":21,"tag":209,"props":9548,"children":9549},{"class":211,"line":325},[9550],{"type":21,"tag":209,"props":9551,"children":9552},{"emptyLinePlaceholder":248},[9553],{"type":26,"value":251},{"type":21,"tag":209,"props":9555,"children":9556},{"class":211,"line":334},[9557,9561],{"type":21,"tag":209,"props":9558,"children":9559},{"style":216},[9560],{"type":26,"value":5193},{"type":21,"tag":209,"props":9562,"children":9563},{"style":222},[9564],{"type":26,"value":5198},{"type":21,"tag":209,"props":9566,"children":9567},{"class":211,"line":343},[9568],{"type":21,"tag":209,"props":9569,"children":9570},{"style":222},[9571],{"type":26,"value":4415},{"type":21,"tag":209,"props":9573,"children":9574},{"class":211,"line":351},[9575],{"type":21,"tag":209,"props":9576,"children":9577},{"emptyLinePlaceholder":248},[9578],{"type":26,"value":251},{"type":21,"tag":209,"props":9580,"children":9581},{"class":211,"line":444},[9582,9586],{"type":21,"tag":209,"props":9583,"children":9584},{"style":360},[9585],{"type":26,"value":5220},{"type":21,"tag":209,"props":9587,"children":9588},{"style":222},[9589],{"type":26,"value":5225},{"type":21,"tag":209,"props":9591,"children":9592},{"class":211,"line":454},[9593,9597,9601,9605,9609,9613,9617,9621,9625,9629],{"type":21,"tag":209,"props":9594,"children":9595},{"style":222},[9596],{"type":26,"value":5233},{"type":21,"tag":209,"props":9598,"children":9599},{"style":360},[9600],{"type":26,"value":2704},{"type":21,"tag":209,"props":9602,"children":9603},{"style":222},[9604],{"type":26,"value":368},{"type":21,"tag":209,"props":9606,"children":9607},{"style":400},[9608],{"type":26,"value":5246},{"type":21,"tag":209,"props":9610,"children":9611},{"style":216},[9612],{"type":26,"value":5251},{"type":21,"tag":209,"props":9614,"children":9615},{"style":222},[9616],{"type":26,"value":4588},{"type":21,"tag":209,"props":9618,"children":9619},{"style":360},[9620],{"type":26,"value":4593},{"type":21,"tag":209,"props":9622,"children":9623},{"style":222},[9624],{"type":26,"value":5264},{"type":21,"tag":209,"props":9626,"children":9627},{"style":263},[9628],{"type":26,"value":5269},{"type":21,"tag":209,"props":9630,"children":9631},{"style":222},[9632],{"type":26,"value":5274},{"type":21,"tag":209,"props":9634,"children":9635},{"class":211,"line":463},[9636,9640,9644,9648,9652,9656,9660],{"type":21,"tag":209,"props":9637,"children":9638},{"style":222},[9639],{"type":26,"value":5233},{"type":21,"tag":209,"props":9641,"children":9642},{"style":360},[9643],{"type":26,"value":2704},{"type":21,"tag":209,"props":9645,"children":9646},{"style":222},[9647],{"type":26,"value":2709},{"type":21,"tag":209,"props":9649,"children":9650},{"style":400},[9651],{"type":26,"value":4662},{"type":21,"tag":209,"props":9653,"children":9654},{"style":222},[9655],{"type":26,"value":432},{"type":21,"tag":209,"props":9657,"children":9658},{"style":216},[9659],{"type":26,"value":437},{"type":21,"tag":209,"props":9661,"children":9662},{"style":222},[9663],{"type":26,"value":276},{"type":21,"tag":209,"props":9665,"children":9666},{"class":211,"line":472},[9667,9671,9675,9679,9683,9687],{"type":21,"tag":209,"props":9668,"children":9669},{"style":222},[9670],{"type":26,"value":1054},{"type":21,"tag":209,"props":9672,"children":9673},{"style":360},[9674],{"type":26,"value":1059},{"type":21,"tag":209,"props":9676,"children":9677},{"style":222},[9678],{"type":26,"value":368},{"type":21,"tag":209,"props":9680,"children":9681},{"style":233},[9682],{"type":26,"value":5325},{"type":21,"tag":209,"props":9684,"children":9685},{"style":216},[9686],{"type":26,"value":4652},{"type":21,"tag":209,"props":9688,"children":9689},{"style":222},[9690],{"type":26,"value":5334},{"type":21,"tag":209,"props":9692,"children":9693},{"class":211,"line":480},[9694,9698,9702],{"type":21,"tag":209,"props":9695,"children":9696},{"style":222},[9697],{"type":26,"value":5342},{"type":21,"tag":209,"props":9699,"children":9700},{"style":360},[9701],{"type":26,"value":5347},{"type":21,"tag":209,"props":9703,"children":9704},{"style":222},[9705],{"type":26,"value":5352},{"type":21,"tag":7343,"props":9707,"children":9708},{},[],{"type":26,"value":9710},"A solution is to have ",{"type":21,"tag":63,"props":9712,"children":9714},{"className":9713},[],[9715],{"type":26,"value":3771},{"type":26,"value":9717}," export its ",{"type":21,"tag":63,"props":9719,"children":9721},{"className":9720},[],[9722],{"type":26,"value":4718},{"type":26,"value":9724}," function, and then create a separate ",{"type":21,"tag":63,"props":9726,"children":9728},{"className":9727},[],[9729],{"type":26,"value":9730},"server.js",{"type":26,"value":9732}," file to move the ",{"type":21,"tag":63,"props":9734,"children":9736},{"className":9735},[],[9737],{"type":26,"value":4718},{"type":26,"value":9739}," invocation into (updating the ",{"type":21,"tag":63,"props":9741,"children":9743},{"className":9742},[],[9744],{"type":26,"value":9384},{"type":26,"value":9746}," scripts so that they invoke ",{"type":21,"tag":63,"props":9748,"children":9750},{"className":9749},[],[9751],{"type":26,"value":9752},"node ./server.js",{"type":26,"value":9754}," instead of ",{"type":21,"tag":63,"props":9756,"children":9758},{"className":9757},[],[9759],{"type":26,"value":9760},"node ./app.js",{"type":26,"value":9762},"). The behaviour is the same, but now the ",{"type":21,"tag":63,"props":9764,"children":9766},{"className":9765},[],[9767],{"type":26,"value":3542},{"type":26,"value":9769}," app can be imported in tests.",{"type":21,"tag":3630,"props":9771,"children":9772},{},[9773,9775,9786,9788],{"type":26,"value":9774},"In in-memory MongoDB database needs to be configured, so that the integration tests can create one. This can be done easily with the ",{"type":21,"tag":29,"props":9776,"children":9779},{"href":9777,"rel":9778},"https://www.npmjs.com/package/mongodb-memory-server",[93],[9780],{"type":21,"tag":63,"props":9781,"children":9783},{"className":9782},[],[9784],{"type":26,"value":9785},"mongodb-memory-server",{"type":26,"value":9787}," package:",{"type":21,"tag":200,"props":9789,"children":9791},{"className":202,"code":9790,"language":12,"meta":8,"style":8},"const {MongoMemoryServer} = require('mongodb-memory-server');\n\nmongod = await MongoMemoryServer.create();\nprocess.env.MONGODB_URI = mongod.getUri();\n\n/* Do testing... */\n\nmongod.stop();\n",[9792],{"type":21,"tag":63,"props":9793,"children":9794},{"__ignoreMap":8},[9795,9836,9843,9873,9903,9910,9918,9925],{"type":21,"tag":209,"props":9796,"children":9797},{"class":211,"line":212},[9798,9802,9806,9811,9815,9819,9823,9827,9832],{"type":21,"tag":209,"props":9799,"children":9800},{"style":216},[9801],{"type":26,"value":260},{"type":21,"tag":209,"props":9803,"children":9804},{"style":222},[9805],{"type":26,"value":1282},{"type":21,"tag":209,"props":9807,"children":9808},{"style":263},[9809],{"type":26,"value":9810},"MongoMemoryServer",{"type":21,"tag":209,"props":9812,"children":9813},{"style":222},[9814],{"type":26,"value":4341},{"type":21,"tag":209,"props":9816,"children":9817},{"style":216},[9818],{"type":26,"value":1432},{"type":21,"tag":209,"props":9820,"children":9821},{"style":360},[9822],{"type":26,"value":3923},{"type":21,"tag":209,"props":9824,"children":9825},{"style":222},[9826],{"type":26,"value":368},{"type":21,"tag":209,"props":9828,"children":9829},{"style":233},[9830],{"type":26,"value":9831},"'mongodb-memory-server'",{"type":21,"tag":209,"props":9833,"children":9834},{"style":222},[9835],{"type":26,"value":2608},{"type":21,"tag":209,"props":9837,"children":9838},{"class":211,"line":244},[9839],{"type":21,"tag":209,"props":9840,"children":9841},{"emptyLinePlaceholder":248},[9842],{"type":26,"value":251},{"type":21,"tag":209,"props":9844,"children":9845},{"class":211,"line":254},[9846,9851,9855,9859,9864,9869],{"type":21,"tag":209,"props":9847,"children":9848},{"style":222},[9849],{"type":26,"value":9850},"mongod ",{"type":21,"tag":209,"props":9852,"children":9853},{"style":216},[9854],{"type":26,"value":1432},{"type":21,"tag":209,"props":9856,"children":9857},{"style":216},[9858],{"type":26,"value":1437},{"type":21,"tag":209,"props":9860,"children":9861},{"style":222},[9862],{"type":26,"value":9863}," MongoMemoryServer.",{"type":21,"tag":209,"props":9865,"children":9866},{"style":360},[9867],{"type":26,"value":9868},"create",{"type":21,"tag":209,"props":9870,"children":9871},{"style":222},[9872],{"type":26,"value":4123},{"type":21,"tag":209,"props":9874,"children":9875},{"class":211,"line":279},[9876,9881,9885,9889,9894,9899],{"type":21,"tag":209,"props":9877,"children":9878},{"style":222},[9879],{"type":26,"value":9880},"process.env.",{"type":21,"tag":209,"props":9882,"children":9883},{"style":263},[9884],{"type":26,"value":4329},{"type":21,"tag":209,"props":9886,"children":9887},{"style":216},[9888],{"type":26,"value":271},{"type":21,"tag":209,"props":9890,"children":9891},{"style":222},[9892],{"type":26,"value":9893}," mongod.",{"type":21,"tag":209,"props":9895,"children":9896},{"style":360},[9897],{"type":26,"value":9898},"getUri",{"type":21,"tag":209,"props":9900,"children":9901},{"style":222},[9902],{"type":26,"value":4123},{"type":21,"tag":209,"props":9904,"children":9905},{"class":211,"line":288},[9906],{"type":21,"tag":209,"props":9907,"children":9908},{"emptyLinePlaceholder":248},[9909],{"type":26,"value":251},{"type":21,"tag":209,"props":9911,"children":9912},{"class":211,"line":307},[9913],{"type":21,"tag":209,"props":9914,"children":9915},{"style":448},[9916],{"type":26,"value":9917},"/* Do testing... */\n",{"type":21,"tag":209,"props":9919,"children":9920},{"class":211,"line":325},[9921],{"type":21,"tag":209,"props":9922,"children":9923},{"emptyLinePlaceholder":248},[9924],{"type":26,"value":251},{"type":21,"tag":209,"props":9926,"children":9927},{"class":211,"line":334},[9928,9933,9938],{"type":21,"tag":209,"props":9929,"children":9930},{"style":222},[9931],{"type":26,"value":9932},"mongod.",{"type":21,"tag":209,"props":9934,"children":9935},{"style":360},[9936],{"type":26,"value":9937},"stop",{"type":21,"tag":209,"props":9939,"children":9940},{"style":222},[9941],{"type":26,"value":4123},{"type":21,"tag":22,"props":9943,"children":9944},{},[9945,9947,9954,9956,9962],{"type":26,"value":9946},"In this case, ",{"type":21,"tag":29,"props":9948,"children":9951},{"href":9949,"rel":9950},"https://node-tap.org/",[93],[9952],{"type":26,"value":9953},"Node-Tap",{"type":26,"value":9955}," was used as the test runner, but any test runner will do. An annotated example of one of these tests is shown below, and the full set of changes (including additional test case examples) can be found ",{"type":21,"tag":29,"props":9957,"children":9960},{"href":9958,"rel":9959},"https://github.com/artandlogic/node-express-to-fastify-example/commit/e2a377060c842b7137e3f8e43bcc92734cb55500",[93],[9961],{"type":26,"value":3592},{"type":26,"value":378},{"type":21,"tag":22,"props":9964,"children":9965},{},[9966,9972],{"type":21,"tag":63,"props":9967,"children":9969},{"className":9968},[],[9970],{"type":26,"value":9971},"tests/users.test.js",{"type":26,"value":191},{"type":21,"tag":200,"props":9974,"children":9976},{"className":202,"code":9975,"language":12,"meta":8,"style":8},"const {MongoMemoryServer} = require('mongodb-memory-server');\nconst {test} = require('tap');\n\nconst build = require('../app')\nconst {deleteAll} = require('../models');\nconst User = require('../models/User');\n\n// Add a test case for /users endpoints. In Node-Tap, test cases can be\n// nested arbitrarily.\ntest('/users', async t => {\n  let mongod, app;\n\n  t.before(async () => {\n    // Create a new in-memory MongoDB instance before the tests run,\n    // and build the Fastify application\n    mongod = await MongoMemoryServer.create();\n    process.env.NODE_ENV = 'test';\n    process.env.MONGODB_URI = mongod.getUri();\n    app = await build();\n  });\n  t.beforeEach(async t => {\n    // Before each test, call a utility which wipes all content from the\n    // database, so that test cases are fully independent.\n    await deleteAll();\n  });\n  t.teardown(async () => {\n    // Shut down the app and stop the database when tests complete.\n    await app.close();\n    await mongod.stop();\n  });\n\n  // Define a test for POST /users\n  await t.test('POST /users', async t => {\n    // Here is the Fastify inject() utility that's being leveraged for testing:\n    // A POST request is being simulated without a Webserver active, but it\n    // otherwise functions the same way that a true POST request would. The\n    // return value is a Promise that resolves to the Response object.\n    const response = await app.inject({\n      method: 'POST',\n      url: '/api/users',\n      headers: {\n        'Content-Type': 'application/json',\n        'X-Requested-With': '',\n      },\n      payload: {\n        user: {\n          email: 'john@jacob.com',\n          password: 'johnnyjacob',\n          username: 'johnjacob',\n        },\n      },\n    })\n\n    // With the Response in hand, whatever necessary test assertions can\n    // be made.\n    t.equal(response.statusCode, 200, 'returns a status code of 200');\n    const body = response.json();\n    t.hasProp(body, 'user', 'Response has \"user\" property\"');\n    t.hasProp(body.user, 'email', 'User has \"email\" property\"');\n    t.hasProp(body.user, 'username', 'User has \"username\" property\"');\n    t.hasProp(body.user, 'token', 'User has \"token\" property\"');\n  });\n});\n",[9977],{"type":21,"tag":63,"props":9978,"children":9979},{"__ignoreMap":8},[9980,10019,10059,10066,10098,10139,10172,10179,10187,10195,10232,10245,10252,10286,10294,10302,10330,10355,10382,10406,10413,10445,10453,10461,10478,10485,10517,10525,10545,10564,10571,10578,10586,10631,10639,10647,10655,10663,10696,10713,10730,10738,10759,10780,10787,10795,10803,10820,10837,10854,10861,10868,10876,10883,10891,10899,10935,10965,11001,11036,11070,11104,11112],{"type":21,"tag":209,"props":9981,"children":9982},{"class":211,"line":212},[9983,9987,9991,9995,9999,10003,10007,10011,10015],{"type":21,"tag":209,"props":9984,"children":9985},{"style":216},[9986],{"type":26,"value":260},{"type":21,"tag":209,"props":9988,"children":9989},{"style":222},[9990],{"type":26,"value":1282},{"type":21,"tag":209,"props":9992,"children":9993},{"style":263},[9994],{"type":26,"value":9810},{"type":21,"tag":209,"props":9996,"children":9997},{"style":222},[9998],{"type":26,"value":4341},{"type":21,"tag":209,"props":10000,"children":10001},{"style":216},[10002],{"type":26,"value":1432},{"type":21,"tag":209,"props":10004,"children":10005},{"style":360},[10006],{"type":26,"value":3923},{"type":21,"tag":209,"props":10008,"children":10009},{"style":222},[10010],{"type":26,"value":368},{"type":21,"tag":209,"props":10012,"children":10013},{"style":233},[10014],{"type":26,"value":9831},{"type":21,"tag":209,"props":10016,"children":10017},{"style":222},[10018],{"type":26,"value":2608},{"type":21,"tag":209,"props":10020,"children":10021},{"class":211,"line":244},[10022,10026,10030,10034,10038,10042,10046,10050,10055],{"type":21,"tag":209,"props":10023,"children":10024},{"style":216},[10025],{"type":26,"value":260},{"type":21,"tag":209,"props":10027,"children":10028},{"style":222},[10029],{"type":26,"value":1282},{"type":21,"tag":209,"props":10031,"children":10032},{"style":263},[10033],{"type":26,"value":6494},{"type":21,"tag":209,"props":10035,"children":10036},{"style":222},[10037],{"type":26,"value":4341},{"type":21,"tag":209,"props":10039,"children":10040},{"style":216},[10041],{"type":26,"value":1432},{"type":21,"tag":209,"props":10043,"children":10044},{"style":360},[10045],{"type":26,"value":3923},{"type":21,"tag":209,"props":10047,"children":10048},{"style":222},[10049],{"type":26,"value":368},{"type":21,"tag":209,"props":10051,"children":10052},{"style":233},[10053],{"type":26,"value":10054},"'tap'",{"type":21,"tag":209,"props":10056,"children":10057},{"style":222},[10058],{"type":26,"value":2608},{"type":21,"tag":209,"props":10060,"children":10061},{"class":211,"line":254},[10062],{"type":21,"tag":209,"props":10063,"children":10064},{"emptyLinePlaceholder":248},[10065],{"type":26,"value":251},{"type":21,"tag":209,"props":10067,"children":10068},{"class":211,"line":279},[10069,10073,10077,10081,10085,10089,10094],{"type":21,"tag":209,"props":10070,"children":10071},{"style":216},[10072],{"type":26,"value":260},{"type":21,"tag":209,"props":10074,"children":10075},{"style":263},[10076],{"type":26,"value":4794},{"type":21,"tag":209,"props":10078,"children":10079},{"style":216},[10080],{"type":26,"value":271},{"type":21,"tag":209,"props":10082,"children":10083},{"style":360},[10084],{"type":26,"value":3923},{"type":21,"tag":209,"props":10086,"children":10087},{"style":222},[10088],{"type":26,"value":368},{"type":21,"tag":209,"props":10090,"children":10091},{"style":233},[10092],{"type":26,"value":10093},"'../app'",{"type":21,"tag":209,"props":10095,"children":10096},{"style":222},[10097],{"type":26,"value":8924},{"type":21,"tag":209,"props":10099,"children":10100},{"class":211,"line":288},[10101,10105,10109,10114,10118,10122,10126,10130,10135],{"type":21,"tag":209,"props":10102,"children":10103},{"style":216},[10104],{"type":26,"value":260},{"type":21,"tag":209,"props":10106,"children":10107},{"style":222},[10108],{"type":26,"value":1282},{"type":21,"tag":209,"props":10110,"children":10111},{"style":263},[10112],{"type":26,"value":10113},"deleteAll",{"type":21,"tag":209,"props":10115,"children":10116},{"style":222},[10117],{"type":26,"value":4341},{"type":21,"tag":209,"props":10119,"children":10120},{"style":216},[10121],{"type":26,"value":1432},{"type":21,"tag":209,"props":10123,"children":10124},{"style":360},[10125],{"type":26,"value":3923},{"type":21,"tag":209,"props":10127,"children":10128},{"style":222},[10129],{"type":26,"value":368},{"type":21,"tag":209,"props":10131,"children":10132},{"style":233},[10133],{"type":26,"value":10134},"'../models'",{"type":21,"tag":209,"props":10136,"children":10137},{"style":222},[10138],{"type":26,"value":2608},{"type":21,"tag":209,"props":10140,"children":10141},{"class":211,"line":307},[10142,10146,10151,10155,10159,10163,10168],{"type":21,"tag":209,"props":10143,"children":10144},{"style":216},[10145],{"type":26,"value":260},{"type":21,"tag":209,"props":10147,"children":10148},{"style":263},[10149],{"type":26,"value":10150}," User",{"type":21,"tag":209,"props":10152,"children":10153},{"style":216},[10154],{"type":26,"value":271},{"type":21,"tag":209,"props":10156,"children":10157},{"style":360},[10158],{"type":26,"value":3923},{"type":21,"tag":209,"props":10160,"children":10161},{"style":222},[10162],{"type":26,"value":368},{"type":21,"tag":209,"props":10164,"children":10165},{"style":233},[10166],{"type":26,"value":10167},"'../models/User'",{"type":21,"tag":209,"props":10169,"children":10170},{"style":222},[10171],{"type":26,"value":2608},{"type":21,"tag":209,"props":10173,"children":10174},{"class":211,"line":325},[10175],{"type":21,"tag":209,"props":10176,"children":10177},{"emptyLinePlaceholder":248},[10178],{"type":26,"value":251},{"type":21,"tag":209,"props":10180,"children":10181},{"class":211,"line":334},[10182],{"type":21,"tag":209,"props":10183,"children":10184},{"style":448},[10185],{"type":26,"value":10186},"// Add a test case for /users endpoints. In Node-Tap, test cases can be\n",{"type":21,"tag":209,"props":10188,"children":10189},{"class":211,"line":343},[10190],{"type":21,"tag":209,"props":10191,"children":10192},{"style":448},[10193],{"type":26,"value":10194},"// nested arbitrarily.\n",{"type":21,"tag":209,"props":10196,"children":10197},{"class":211,"line":351},[10198,10202,10206,10211,10215,10219,10224,10228],{"type":21,"tag":209,"props":10199,"children":10200},{"style":360},[10201],{"type":26,"value":6494},{"type":21,"tag":209,"props":10203,"children":10204},{"style":222},[10205],{"type":26,"value":368},{"type":21,"tag":209,"props":10207,"children":10208},{"style":233},[10209],{"type":26,"value":10210},"'/users'",{"type":21,"tag":209,"props":10212,"children":10213},{"style":222},[10214],{"type":26,"value":408},{"type":21,"tag":209,"props":10216,"children":10217},{"style":216},[10218],{"type":26,"value":1376},{"type":21,"tag":209,"props":10220,"children":10221},{"style":400},[10222],{"type":26,"value":10223}," t",{"type":21,"tag":209,"props":10225,"children":10226},{"style":216},[10227],{"type":26,"value":5251},{"type":21,"tag":209,"props":10229,"children":10230},{"style":222},[10231],{"type":26,"value":276},{"type":21,"tag":209,"props":10233,"children":10234},{"class":211,"line":444},[10235,10240],{"type":21,"tag":209,"props":10236,"children":10237},{"style":216},[10238],{"type":26,"value":10239},"  let",{"type":21,"tag":209,"props":10241,"children":10242},{"style":222},[10243],{"type":26,"value":10244}," mongod, app;\n",{"type":21,"tag":209,"props":10246,"children":10247},{"class":211,"line":454},[10248],{"type":21,"tag":209,"props":10249,"children":10250},{"emptyLinePlaceholder":248},[10251],{"type":26,"value":251},{"type":21,"tag":209,"props":10253,"children":10254},{"class":211,"line":463},[10255,10260,10265,10269,10273,10278,10282],{"type":21,"tag":209,"props":10256,"children":10257},{"style":222},[10258],{"type":26,"value":10259},"  t.",{"type":21,"tag":209,"props":10261,"children":10262},{"style":360},[10263],{"type":26,"value":10264},"before",{"type":21,"tag":209,"props":10266,"children":10267},{"style":222},[10268],{"type":26,"value":368},{"type":21,"tag":209,"props":10270,"children":10271},{"style":216},[10272],{"type":26,"value":1376},{"type":21,"tag":209,"props":10274,"children":10275},{"style":222},[10276],{"type":26,"value":10277}," () ",{"type":21,"tag":209,"props":10279,"children":10280},{"style":216},[10281],{"type":26,"value":437},{"type":21,"tag":209,"props":10283,"children":10284},{"style":222},[10285],{"type":26,"value":276},{"type":21,"tag":209,"props":10287,"children":10288},{"class":211,"line":472},[10289],{"type":21,"tag":209,"props":10290,"children":10291},{"style":448},[10292],{"type":26,"value":10293},"    // Create a new in-memory MongoDB instance before the tests run,\n",{"type":21,"tag":209,"props":10295,"children":10296},{"class":211,"line":480},[10297],{"type":21,"tag":209,"props":10298,"children":10299},{"style":448},[10300],{"type":26,"value":10301},"    // and build the Fastify application\n",{"type":21,"tag":209,"props":10303,"children":10304},{"class":211,"line":489},[10305,10310,10314,10318,10322,10326],{"type":21,"tag":209,"props":10306,"children":10307},{"style":222},[10308],{"type":26,"value":10309},"    mongod ",{"type":21,"tag":209,"props":10311,"children":10312},{"style":216},[10313],{"type":26,"value":1432},{"type":21,"tag":209,"props":10315,"children":10316},{"style":216},[10317],{"type":26,"value":1437},{"type":21,"tag":209,"props":10319,"children":10320},{"style":222},[10321],{"type":26,"value":9863},{"type":21,"tag":209,"props":10323,"children":10324},{"style":360},[10325],{"type":26,"value":9868},{"type":21,"tag":209,"props":10327,"children":10328},{"style":222},[10329],{"type":26,"value":4123},{"type":21,"tag":209,"props":10331,"children":10332},{"class":211,"line":847},[10333,10338,10342,10346,10351],{"type":21,"tag":209,"props":10334,"children":10335},{"style":222},[10336],{"type":26,"value":10337},"    process.env.",{"type":21,"tag":209,"props":10339,"children":10340},{"style":263},[10341],{"type":26,"value":4076},{"type":21,"tag":209,"props":10343,"children":10344},{"style":216},[10345],{"type":26,"value":271},{"type":21,"tag":209,"props":10347,"children":10348},{"style":233},[10349],{"type":26,"value":10350}," 'test'",{"type":21,"tag":209,"props":10352,"children":10353},{"style":222},[10354],{"type":26,"value":241},{"type":21,"tag":209,"props":10356,"children":10357},{"class":211,"line":860},[10358,10362,10366,10370,10374,10378],{"type":21,"tag":209,"props":10359,"children":10360},{"style":222},[10361],{"type":26,"value":10337},{"type":21,"tag":209,"props":10363,"children":10364},{"style":263},[10365],{"type":26,"value":4329},{"type":21,"tag":209,"props":10367,"children":10368},{"style":216},[10369],{"type":26,"value":271},{"type":21,"tag":209,"props":10371,"children":10372},{"style":222},[10373],{"type":26,"value":9893},{"type":21,"tag":209,"props":10375,"children":10376},{"style":360},[10377],{"type":26,"value":9898},{"type":21,"tag":209,"props":10379,"children":10380},{"style":222},[10381],{"type":26,"value":4123},{"type":21,"tag":209,"props":10383,"children":10384},{"class":211,"line":877},[10385,10390,10394,10398,10402],{"type":21,"tag":209,"props":10386,"children":10387},{"style":222},[10388],{"type":26,"value":10389},"    app ",{"type":21,"tag":209,"props":10391,"children":10392},{"style":216},[10393],{"type":26,"value":1432},{"type":21,"tag":209,"props":10395,"children":10396},{"style":216},[10397],{"type":26,"value":1437},{"type":21,"tag":209,"props":10399,"children":10400},{"style":360},[10401],{"type":26,"value":4794},{"type":21,"tag":209,"props":10403,"children":10404},{"style":222},[10405],{"type":26,"value":4123},{"type":21,"tag":209,"props":10407,"children":10408},{"class":211,"line":889},[10409],{"type":21,"tag":209,"props":10410,"children":10411},{"style":222},[10412],{"type":26,"value":5110},{"type":21,"tag":209,"props":10414,"children":10415},{"class":211,"line":902},[10416,10420,10425,10429,10433,10437,10441],{"type":21,"tag":209,"props":10417,"children":10418},{"style":222},[10419],{"type":26,"value":10259},{"type":21,"tag":209,"props":10421,"children":10422},{"style":360},[10423],{"type":26,"value":10424},"beforeEach",{"type":21,"tag":209,"props":10426,"children":10427},{"style":222},[10428],{"type":26,"value":368},{"type":21,"tag":209,"props":10430,"children":10431},{"style":216},[10432],{"type":26,"value":1376},{"type":21,"tag":209,"props":10434,"children":10435},{"style":400},[10436],{"type":26,"value":10223},{"type":21,"tag":209,"props":10438,"children":10439},{"style":216},[10440],{"type":26,"value":5251},{"type":21,"tag":209,"props":10442,"children":10443},{"style":222},[10444],{"type":26,"value":276},{"type":21,"tag":209,"props":10446,"children":10447},{"class":211,"line":914},[10448],{"type":21,"tag":209,"props":10449,"children":10450},{"style":448},[10451],{"type":26,"value":10452},"    // Before each test, call a utility which wipes all content from the\n",{"type":21,"tag":209,"props":10454,"children":10455},{"class":211,"line":922},[10456],{"type":21,"tag":209,"props":10457,"children":10458},{"style":448},[10459],{"type":26,"value":10460},"    // database, so that test cases are fully independent.\n",{"type":21,"tag":209,"props":10462,"children":10463},{"class":211,"line":2312},[10464,10469,10474],{"type":21,"tag":209,"props":10465,"children":10466},{"style":216},[10467],{"type":26,"value":10468},"    await",{"type":21,"tag":209,"props":10470,"children":10471},{"style":360},[10472],{"type":26,"value":10473}," deleteAll",{"type":21,"tag":209,"props":10475,"children":10476},{"style":222},[10477],{"type":26,"value":4123},{"type":21,"tag":209,"props":10479,"children":10480},{"class":211,"line":2321},[10481],{"type":21,"tag":209,"props":10482,"children":10483},{"style":222},[10484],{"type":26,"value":5110},{"type":21,"tag":209,"props":10486,"children":10487},{"class":211,"line":2372},[10488,10492,10497,10501,10505,10509,10513],{"type":21,"tag":209,"props":10489,"children":10490},{"style":222},[10491],{"type":26,"value":10259},{"type":21,"tag":209,"props":10493,"children":10494},{"style":360},[10495],{"type":26,"value":10496},"teardown",{"type":21,"tag":209,"props":10498,"children":10499},{"style":222},[10500],{"type":26,"value":368},{"type":21,"tag":209,"props":10502,"children":10503},{"style":216},[10504],{"type":26,"value":1376},{"type":21,"tag":209,"props":10506,"children":10507},{"style":222},[10508],{"type":26,"value":10277},{"type":21,"tag":209,"props":10510,"children":10511},{"style":216},[10512],{"type":26,"value":437},{"type":21,"tag":209,"props":10514,"children":10515},{"style":222},[10516],{"type":26,"value":276},{"type":21,"tag":209,"props":10518,"children":10519},{"class":211,"line":2381},[10520],{"type":21,"tag":209,"props":10521,"children":10522},{"style":448},[10523],{"type":26,"value":10524},"    // Shut down the app and stop the database when tests complete.\n",{"type":21,"tag":209,"props":10526,"children":10527},{"class":211,"line":2389},[10528,10532,10536,10541],{"type":21,"tag":209,"props":10529,"children":10530},{"style":216},[10531],{"type":26,"value":10468},{"type":21,"tag":209,"props":10533,"children":10534},{"style":222},[10535],{"type":26,"value":4588},{"type":21,"tag":209,"props":10537,"children":10538},{"style":360},[10539],{"type":26,"value":10540},"close",{"type":21,"tag":209,"props":10542,"children":10543},{"style":222},[10544],{"type":26,"value":4123},{"type":21,"tag":209,"props":10546,"children":10547},{"class":211,"line":2397},[10548,10552,10556,10560],{"type":21,"tag":209,"props":10549,"children":10550},{"style":216},[10551],{"type":26,"value":10468},{"type":21,"tag":209,"props":10553,"children":10554},{"style":222},[10555],{"type":26,"value":9893},{"type":21,"tag":209,"props":10557,"children":10558},{"style":360},[10559],{"type":26,"value":9937},{"type":21,"tag":209,"props":10561,"children":10562},{"style":222},[10563],{"type":26,"value":4123},{"type":21,"tag":209,"props":10565,"children":10566},{"class":211,"line":2406},[10567],{"type":21,"tag":209,"props":10568,"children":10569},{"style":222},[10570],{"type":26,"value":5110},{"type":21,"tag":209,"props":10572,"children":10573},{"class":211,"line":2415},[10574],{"type":21,"tag":209,"props":10575,"children":10576},{"emptyLinePlaceholder":248},[10577],{"type":26,"value":251},{"type":21,"tag":209,"props":10579,"children":10580},{"class":211,"line":2424},[10581],{"type":21,"tag":209,"props":10582,"children":10583},{"style":448},[10584],{"type":26,"value":10585},"  // Define a test for POST /users\n",{"type":21,"tag":209,"props":10587,"children":10588},{"class":211,"line":2433},[10589,10593,10598,10602,10606,10611,10615,10619,10623,10627],{"type":21,"tag":209,"props":10590,"children":10591},{"style":216},[10592],{"type":26,"value":5118},{"type":21,"tag":209,"props":10594,"children":10595},{"style":222},[10596],{"type":26,"value":10597}," t.",{"type":21,"tag":209,"props":10599,"children":10600},{"style":360},[10601],{"type":26,"value":6494},{"type":21,"tag":209,"props":10603,"children":10604},{"style":222},[10605],{"type":26,"value":368},{"type":21,"tag":209,"props":10607,"children":10608},{"style":233},[10609],{"type":26,"value":10610},"'POST /users'",{"type":21,"tag":209,"props":10612,"children":10613},{"style":222},[10614],{"type":26,"value":408},{"type":21,"tag":209,"props":10616,"children":10617},{"style":216},[10618],{"type":26,"value":1376},{"type":21,"tag":209,"props":10620,"children":10621},{"style":400},[10622],{"type":26,"value":10223},{"type":21,"tag":209,"props":10624,"children":10625},{"style":216},[10626],{"type":26,"value":5251},{"type":21,"tag":209,"props":10628,"children":10629},{"style":222},[10630],{"type":26,"value":276},{"type":21,"tag":209,"props":10632,"children":10633},{"class":211,"line":2442},[10634],{"type":21,"tag":209,"props":10635,"children":10636},{"style":448},[10637],{"type":26,"value":10638},"    // Here is the Fastify inject() utility that's being leveraged for testing:\n",{"type":21,"tag":209,"props":10640,"children":10641},{"class":211,"line":2471},[10642],{"type":21,"tag":209,"props":10643,"children":10644},{"style":448},[10645],{"type":26,"value":10646},"    // A POST request is being simulated without a Webserver active, but it\n",{"type":21,"tag":209,"props":10648,"children":10649},{"class":211,"line":2480},[10650],{"type":21,"tag":209,"props":10651,"children":10652},{"style":448},[10653],{"type":26,"value":10654},"    // otherwise functions the same way that a true POST request would. The\n",{"type":21,"tag":209,"props":10656,"children":10657},{"class":211,"line":2489},[10658],{"type":21,"tag":209,"props":10659,"children":10660},{"style":448},[10661],{"type":26,"value":10662},"    // return value is a Promise that resolves to the Response object.\n",{"type":21,"tag":209,"props":10664,"children":10665},{"class":211,"line":2516},[10666,10670,10675,10679,10683,10687,10692],{"type":21,"tag":209,"props":10667,"children":10668},{"style":216},[10669],{"type":26,"value":1268},{"type":21,"tag":209,"props":10671,"children":10672},{"style":263},[10673],{"type":26,"value":10674}," response",{"type":21,"tag":209,"props":10676,"children":10677},{"style":216},[10678],{"type":26,"value":271},{"type":21,"tag":209,"props":10680,"children":10681},{"style":216},[10682],{"type":26,"value":1437},{"type":21,"tag":209,"props":10684,"children":10685},{"style":222},[10686],{"type":26,"value":4588},{"type":21,"tag":209,"props":10688,"children":10689},{"style":360},[10690],{"type":26,"value":10691},"inject",{"type":21,"tag":209,"props":10693,"children":10694},{"style":222},[10695],{"type":26,"value":7767},{"type":21,"tag":209,"props":10697,"children":10698},{"class":211,"line":2525},[10699,10704,10709],{"type":21,"tag":209,"props":10700,"children":10701},{"style":222},[10702],{"type":26,"value":10703},"      method: ",{"type":21,"tag":209,"props":10705,"children":10706},{"style":233},[10707],{"type":26,"value":10708},"'POST'",{"type":21,"tag":209,"props":10710,"children":10711},{"style":222},[10712],{"type":26,"value":304},{"type":21,"tag":209,"props":10714,"children":10715},{"class":211,"line":2533},[10716,10721,10726],{"type":21,"tag":209,"props":10717,"children":10718},{"style":222},[10719],{"type":26,"value":10720},"      url: ",{"type":21,"tag":209,"props":10722,"children":10723},{"style":233},[10724],{"type":26,"value":10725},"'/api/users'",{"type":21,"tag":209,"props":10727,"children":10728},{"style":222},[10729],{"type":26,"value":304},{"type":21,"tag":209,"props":10731,"children":10732},{"class":211,"line":2542},[10733],{"type":21,"tag":209,"props":10734,"children":10735},{"style":222},[10736],{"type":26,"value":10737},"      headers: {\n",{"type":21,"tag":209,"props":10739,"children":10740},{"class":211,"line":2550},[10741,10746,10750,10755],{"type":21,"tag":209,"props":10742,"children":10743},{"style":233},[10744],{"type":26,"value":10745},"        'Content-Type'",{"type":21,"tag":209,"props":10747,"children":10748},{"style":222},[10749],{"type":26,"value":7821},{"type":21,"tag":209,"props":10751,"children":10752},{"style":233},[10753],{"type":26,"value":10754},"'application/json'",{"type":21,"tag":209,"props":10756,"children":10757},{"style":222},[10758],{"type":26,"value":304},{"type":21,"tag":209,"props":10760,"children":10761},{"class":211,"line":2564},[10762,10767,10771,10776],{"type":21,"tag":209,"props":10763,"children":10764},{"style":233},[10765],{"type":26,"value":10766},"        'X-Requested-With'",{"type":21,"tag":209,"props":10768,"children":10769},{"style":222},[10770],{"type":26,"value":7821},{"type":21,"tag":209,"props":10772,"children":10773},{"style":233},[10774],{"type":26,"value":10775},"''",{"type":21,"tag":209,"props":10777,"children":10778},{"style":222},[10779],{"type":26,"value":304},{"type":21,"tag":209,"props":10781,"children":10782},{"class":211,"line":2611},[10783],{"type":21,"tag":209,"props":10784,"children":10785},{"style":222},[10786],{"type":26,"value":6552},{"type":21,"tag":209,"props":10788,"children":10789},{"class":211,"line":2619},[10790],{"type":21,"tag":209,"props":10791,"children":10792},{"style":222},[10793],{"type":26,"value":10794},"      payload: {\n",{"type":21,"tag":209,"props":10796,"children":10797},{"class":211,"line":2627},[10798],{"type":21,"tag":209,"props":10799,"children":10800},{"style":222},[10801],{"type":26,"value":10802},"        user: {\n",{"type":21,"tag":209,"props":10804,"children":10805},{"class":211,"line":2636},[10806,10811,10816],{"type":21,"tag":209,"props":10807,"children":10808},{"style":222},[10809],{"type":26,"value":10810},"          email: ",{"type":21,"tag":209,"props":10812,"children":10813},{"style":233},[10814],{"type":26,"value":10815},"'john@jacob.com'",{"type":21,"tag":209,"props":10817,"children":10818},{"style":222},[10819],{"type":26,"value":304},{"type":21,"tag":209,"props":10821,"children":10822},{"class":211,"line":2644},[10823,10828,10833],{"type":21,"tag":209,"props":10824,"children":10825},{"style":222},[10826],{"type":26,"value":10827},"          password: ",{"type":21,"tag":209,"props":10829,"children":10830},{"style":233},[10831],{"type":26,"value":10832},"'johnnyjacob'",{"type":21,"tag":209,"props":10834,"children":10835},{"style":222},[10836],{"type":26,"value":304},{"type":21,"tag":209,"props":10838,"children":10839},{"class":211,"line":2657},[10840,10845,10850],{"type":21,"tag":209,"props":10841,"children":10842},{"style":222},[10843],{"type":26,"value":10844},"          username: ",{"type":21,"tag":209,"props":10846,"children":10847},{"style":233},[10848],{"type":26,"value":10849},"'johnjacob'",{"type":21,"tag":209,"props":10851,"children":10852},{"style":222},[10853],{"type":26,"value":304},{"type":21,"tag":209,"props":10855,"children":10856},{"class":211,"line":2728},[10857],{"type":21,"tag":209,"props":10858,"children":10859},{"style":222},[10860],{"type":26,"value":2522},{"type":21,"tag":209,"props":10862,"children":10863},{"class":211,"line":2758},[10864],{"type":21,"tag":209,"props":10865,"children":10866},{"style":222},[10867],{"type":26,"value":6552},{"type":21,"tag":209,"props":10869,"children":10870},{"class":211,"line":2776},[10871],{"type":21,"tag":209,"props":10872,"children":10873},{"style":222},[10874],{"type":26,"value":10875},"    })\n",{"type":21,"tag":209,"props":10877,"children":10878},{"class":211,"line":2785},[10879],{"type":21,"tag":209,"props":10880,"children":10881},{"emptyLinePlaceholder":248},[10882],{"type":26,"value":251},{"type":21,"tag":209,"props":10884,"children":10885},{"class":211,"line":2793},[10886],{"type":21,"tag":209,"props":10887,"children":10888},{"style":448},[10889],{"type":26,"value":10890},"    // With the Response in hand, whatever necessary test assertions can\n",{"type":21,"tag":209,"props":10892,"children":10893},{"class":211,"line":2801},[10894],{"type":21,"tag":209,"props":10895,"children":10896},{"style":448},[10897],{"type":26,"value":10898},"    // be made.\n",{"type":21,"tag":209,"props":10900,"children":10901},{"class":211,"line":2809},[10902,10907,10912,10917,10922,10926,10931],{"type":21,"tag":209,"props":10903,"children":10904},{"style":222},[10905],{"type":26,"value":10906},"    t.",{"type":21,"tag":209,"props":10908,"children":10909},{"style":360},[10910],{"type":26,"value":10911},"equal",{"type":21,"tag":209,"props":10913,"children":10914},{"style":222},[10915],{"type":26,"value":10916},"(response.statusCode, ",{"type":21,"tag":209,"props":10918,"children":10919},{"style":263},[10920],{"type":26,"value":10921},"200",{"type":21,"tag":209,"props":10923,"children":10924},{"style":222},[10925],{"type":26,"value":408},{"type":21,"tag":209,"props":10927,"children":10928},{"style":233},[10929],{"type":26,"value":10930},"'returns a status code of 200'",{"type":21,"tag":209,"props":10932,"children":10933},{"style":222},[10934],{"type":26,"value":2608},{"type":21,"tag":209,"props":10936,"children":10938},{"class":211,"line":10937},57,[10939,10943,10948,10952,10957,10961],{"type":21,"tag":209,"props":10940,"children":10941},{"style":216},[10942],{"type":26,"value":1268},{"type":21,"tag":209,"props":10944,"children":10945},{"style":263},[10946],{"type":26,"value":10947}," body",{"type":21,"tag":209,"props":10949,"children":10950},{"style":216},[10951],{"type":26,"value":271},{"type":21,"tag":209,"props":10953,"children":10954},{"style":222},[10955],{"type":26,"value":10956}," response.",{"type":21,"tag":209,"props":10958,"children":10959},{"style":360},[10960],{"type":26,"value":4268},{"type":21,"tag":209,"props":10962,"children":10963},{"style":222},[10964],{"type":26,"value":4123},{"type":21,"tag":209,"props":10966,"children":10968},{"class":211,"line":10967},58,[10969,10973,10978,10983,10988,10992,10997],{"type":21,"tag":209,"props":10970,"children":10971},{"style":222},[10972],{"type":26,"value":10906},{"type":21,"tag":209,"props":10974,"children":10975},{"style":360},[10976],{"type":26,"value":10977},"hasProp",{"type":21,"tag":209,"props":10979,"children":10980},{"style":222},[10981],{"type":26,"value":10982},"(body, ",{"type":21,"tag":209,"props":10984,"children":10985},{"style":233},[10986],{"type":26,"value":10987},"'user'",{"type":21,"tag":209,"props":10989,"children":10990},{"style":222},[10991],{"type":26,"value":408},{"type":21,"tag":209,"props":10993,"children":10994},{"style":233},[10995],{"type":26,"value":10996},"'Response has \"user\" property\"'",{"type":21,"tag":209,"props":10998,"children":10999},{"style":222},[11000],{"type":26,"value":2608},{"type":21,"tag":209,"props":11002,"children":11004},{"class":211,"line":11003},59,[11005,11009,11013,11018,11023,11027,11032],{"type":21,"tag":209,"props":11006,"children":11007},{"style":222},[11008],{"type":26,"value":10906},{"type":21,"tag":209,"props":11010,"children":11011},{"style":360},[11012],{"type":26,"value":10977},{"type":21,"tag":209,"props":11014,"children":11015},{"style":222},[11016],{"type":26,"value":11017},"(body.user, ",{"type":21,"tag":209,"props":11019,"children":11020},{"style":233},[11021],{"type":26,"value":11022},"'email'",{"type":21,"tag":209,"props":11024,"children":11025},{"style":222},[11026],{"type":26,"value":408},{"type":21,"tag":209,"props":11028,"children":11029},{"style":233},[11030],{"type":26,"value":11031},"'User has \"email\" property\"'",{"type":21,"tag":209,"props":11033,"children":11034},{"style":222},[11035],{"type":26,"value":2608},{"type":21,"tag":209,"props":11037,"children":11039},{"class":211,"line":11038},60,[11040,11044,11048,11052,11057,11061,11066],{"type":21,"tag":209,"props":11041,"children":11042},{"style":222},[11043],{"type":26,"value":10906},{"type":21,"tag":209,"props":11045,"children":11046},{"style":360},[11047],{"type":26,"value":10977},{"type":21,"tag":209,"props":11049,"children":11050},{"style":222},[11051],{"type":26,"value":11017},{"type":21,"tag":209,"props":11053,"children":11054},{"style":233},[11055],{"type":26,"value":11056},"'username'",{"type":21,"tag":209,"props":11058,"children":11059},{"style":222},[11060],{"type":26,"value":408},{"type":21,"tag":209,"props":11062,"children":11063},{"style":233},[11064],{"type":26,"value":11065},"'User has \"username\" property\"'",{"type":21,"tag":209,"props":11067,"children":11068},{"style":222},[11069],{"type":26,"value":2608},{"type":21,"tag":209,"props":11071,"children":11073},{"class":211,"line":11072},61,[11074,11078,11082,11086,11091,11095,11100],{"type":21,"tag":209,"props":11075,"children":11076},{"style":222},[11077],{"type":26,"value":10906},{"type":21,"tag":209,"props":11079,"children":11080},{"style":360},[11081],{"type":26,"value":10977},{"type":21,"tag":209,"props":11083,"children":11084},{"style":222},[11085],{"type":26,"value":11017},{"type":21,"tag":209,"props":11087,"children":11088},{"style":233},[11089],{"type":26,"value":11090},"'token'",{"type":21,"tag":209,"props":11092,"children":11093},{"style":222},[11094],{"type":26,"value":408},{"type":21,"tag":209,"props":11096,"children":11097},{"style":233},[11098],{"type":26,"value":11099},"'User has \"token\" property\"'",{"type":21,"tag":209,"props":11101,"children":11102},{"style":222},[11103],{"type":26,"value":2608},{"type":21,"tag":209,"props":11105,"children":11107},{"class":211,"line":11106},62,[11108],{"type":21,"tag":209,"props":11109,"children":11110},{"style":222},[11111],{"type":26,"value":5110},{"type":21,"tag":209,"props":11113,"children":11115},{"class":211,"line":11114},63,[11116],{"type":21,"tag":209,"props":11117,"children":11118},{"style":222},[11119],{"type":26,"value":469},{"type":21,"tag":3596,"props":11121,"children":11123},{"id":11122},"conclusions",[11124],{"type":26,"value":11125},"Conclusions",{"type":21,"tag":22,"props":11127,"children":11128},{},[11129,11131,11136],{"type":26,"value":11130},"Completing this migration took me several hours, some of which was ramping up on ",{"type":21,"tag":63,"props":11132,"children":11134},{"className":11133},[],[11135],{"type":26,"value":3617},{"type":26,"value":11137}," and making changes to the app structure, but a lot of which was working through each migrated API endpoint. Consequently, I think the time it takes to complete a migration is going to scale linearly with the size of a project.",{"type":21,"tag":22,"props":11139,"children":11140},{},[11141],{"type":26,"value":11142},"While I do think Fastify is a better choice than Express as a lightweight Web framework for Node.js, the cost of migrating relative to the benefits makes it such that I would only recommend doing it in specific scenarios, for example for small or early-stage projects, or when a major refactor is already going to take place. That said, I found the process itself to be smooth and reliable, and with good pre-existing test coverage I feel it's about as safe to do as any major refactor can be.",{"type":21,"tag":22,"props":11144,"children":11145},{},[11146,11148,11153],{"type":26,"value":11147},"I hope this example is helpful for anyone considering making the switch to Fastify; the full source code is available on GitHub ",{"type":21,"tag":29,"props":11149,"children":11151},{"href":3588,"rel":11150},[93],[11152],{"type":26,"value":3592},{"type":26,"value":378},{"type":21,"tag":3490,"props":11155,"children":11156},{},[11157],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":11159},[11160,11161,11162,11163,11168,11169,11170],{"id":3598,"depth":244,"text":3601},{"id":3661,"depth":244,"text":3664},{"id":3795,"depth":244,"text":3798},{"id":5954,"depth":244,"text":5957,"children":11164},[11165,11166,11167],{"id":5960,"depth":254,"text":5963},{"id":7013,"depth":254,"text":7016},{"id":7569,"depth":254,"text":7572},{"id":9348,"depth":244,"text":9351},{"id":9408,"depth":244,"text":9411},{"id":11122,"depth":244,"text":11125},"content:phendry:2022-07-28:MigratingFromExpressToFastifyPart2.md","phendry/2022-07-28/MigratingFromExpressToFastifyPart2.md","phendry/2022-07-28/MigratingFromExpressToFastifyPart2",{"user":11175,"name":11176},"phendry","Paul Hendry",{"_path":11178,"_dir":11179,"_draft":7,"_partial":7,"_locale":8,"title":11180,"description":11181,"image":11182,"tags":11183,"publishDate":11184,"excerpt":11181,"body":11185,"_type":3511,"_id":11655,"_source":3513,"_file":11656,"_stem":11657,"_extension":3516,"author":11658},"/phendry/2022-07-21/migratingfromexpresstofastifypart1","2022-07-21","Migrating from Express to Fastify, Part 1","Express.js has for years been the dominant lightweight Web framework for Node.js, but over time its development has stalled, with its latest major version (5.0) still in pre-release nearly eight years after its first alpha release. There's a lot to be said for this sort of stability in a foundational dependency for a project, but it's worth assessing whether the added features of competing frameworks are worth making a switch. In this article we'll be looking at Fastify in particular, to understand what it has to offer compared to Express and how difficult it is to migrate an existing Express project.","/phendry/2022-07-21/img/Migrating from Express to Fastify, Part 1.png",[12,3527],"2023-12-01",{"type":18,"children":11186,"toc":11641},[11187,11204,11210,11215,11220,11226,11239,11245,11259,11279,11328,11334,11365,11371,11385,11391,11396,11421,11426,11448,11454,11459,11495,11501,11533,11538,11577,11583,11588,11593,11609,11621],{"type":21,"tag":22,"props":11188,"children":11189},{},[11190,11195,11197,11202],{"type":21,"tag":29,"props":11191,"children":11193},{"href":3547,"rel":11192},[93],[11194],{"type":26,"value":3551},{"type":26,"value":11196}," has for years been the dominant lightweight Web framework for Node.js, but over time its development has stalled, with its latest major version (5.0) still in pre-release nearly eight years after its first alpha release. There's a lot to be said for this sort of stability in a foundational dependency for a project, but it's worth assessing whether the added features of competing frameworks are worth making a switch. In this article we'll be looking at ",{"type":21,"tag":29,"props":11198,"children":11200},{"href":3538,"rel":11199},[93],[11201],{"type":26,"value":3542},{"type":26,"value":11203}," in particular, to understand what it has to offer compared to Express and how difficult it is to migrate an existing Express project.",{"type":21,"tag":3596,"props":11205,"children":11207},{"id":11206},"why-fastify",[11208],{"type":26,"value":11209},"Why Fastify?",{"type":21,"tag":22,"props":11211,"children":11212},{},[11213],{"type":26,"value":11214},"Like Express, Fastify is lightweight and unopinionated, it's very popular (which bodes well for the longevity of the project), it has good documentation, and it provides comparable features (routing, templating, middleware, etc).",{"type":21,"tag":22,"props":11216,"children":11217},{},[11218],{"type":26,"value":11219},"It has considerably more to offer, however:",{"type":21,"tag":51,"props":11221,"children":11223},{"id":11222},"a-committed-long-term-support-schedule",[11224],{"type":26,"value":11225},"A committed long-term support schedule",{"type":21,"tag":22,"props":11227,"children":11228},{},[11229,11230,11237],{"type":26,"value":108},{"type":21,"tag":29,"props":11231,"children":11234},{"href":11232,"rel":11233},"https://www.fastify.io/docs/latest/Reference/LTS/",[93],[11235],{"type":26,"value":11236},"LTS documentation",{"type":26,"value":11238}," makes it easy to see the end-of-life date and supported Node versions of a given release. For a foundational dependency like a Web framework, upgrades have the potential to be time-consuming and error-prone, so being able to do so on a predictable schedule is key.",{"type":21,"tag":51,"props":11240,"children":11242},{"id":11241},"quality-major-version-upgrade-guides",[11243],{"type":26,"value":11244},"Quality major version upgrade guides",{"type":21,"tag":22,"props":11246,"children":11247},{},[11248,11250,11257],{"type":26,"value":11249},"The project has a history of providing comprehensive ",{"type":21,"tag":29,"props":11251,"children":11254},{"href":11252,"rel":11253},"https://www.fastify.io/docs/latest/Guides/Migration-Guide-V4/",[93],[11255],{"type":26,"value":11256},"migration guides",{"type":26,"value":11258},", which provides a lot of reassurance that future upgrades can be done smoothly, systematically and without introducing bugs.",{"type":21,"tag":51,"props":11260,"children":11262},{"id":11261},"built-in-asyncawait-support",[11263,11265,11270,11271,11277],{"type":26,"value":11264},"Built-in ",{"type":21,"tag":63,"props":11266,"children":11268},{"className":11267},[],[11269],{"type":26,"value":1376},{"type":26,"value":6460},{"type":21,"tag":63,"props":11272,"children":11274},{"className":11273},[],[11275],{"type":26,"value":11276},"await",{"type":26,"value":11278}," support",{"type":21,"tag":22,"props":11280,"children":11281},{},[11282,11284,11300,11302,11308,11309,11314,11316,11327],{"type":26,"value":11283},"While it's a small feature, Fastify's route handlers support ",{"type":21,"tag":29,"props":11285,"children":11288},{"href":11286,"rel":11287},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function",[93],[11289,11294,11295],{"type":21,"tag":63,"props":11290,"children":11292},{"className":11291},[],[11293],{"type":26,"value":1376},{"type":26,"value":6460},{"type":21,"tag":63,"props":11296,"children":11298},{"className":11297},[],[11299],{"type":26,"value":11276},{"type":26,"value":11301}," syntax by default, catching errors and turning them into HTTP 500 responses. In Express, async errors are unhandled unless handled manually with a ",{"type":21,"tag":63,"props":11303,"children":11305},{"className":11304},[],[11306],{"type":26,"value":11307},"try",{"type":26,"value":6460},{"type":21,"tag":63,"props":11310,"children":11312},{"className":11311},[],[11313],{"type":26,"value":5347},{"type":26,"value":11315}," or with an added dependency like ",{"type":21,"tag":29,"props":11317,"children":11320},{"href":11318,"rel":11319},"https://github.com/Abazhenov/express-async-handler",[93],[11321],{"type":21,"tag":63,"props":11322,"children":11324},{"className":11323},[],[11325],{"type":26,"value":11326},"express-async-handler",{"type":26,"value":378},{"type":21,"tag":51,"props":11329,"children":11331},{"id":11330},"built-in-request-validation",[11332],{"type":26,"value":11333},"Built-in request validation",{"type":21,"tag":22,"props":11335,"children":11336},{},[11337,11339,11346,11348,11355,11357,11363],{"type":26,"value":11338},"Something that's often missing from Express projects is comprehensive request validation, and this is a source of bugs and security vulnerabilities. Fastify has a ",{"type":21,"tag":29,"props":11340,"children":11343},{"href":11341,"rel":11342},"https://www.fastify.io/docs/latest/Reference/Validation-and-Serialization/",[93],[11344],{"type":26,"value":11345},"robust validation system",{"type":26,"value":11347}," based on the ",{"type":21,"tag":29,"props":11349,"children":11352},{"href":11350,"rel":11351},"https://json-schema.org/",[93],[11353],{"type":26,"value":11354},"JSON Schema",{"type":26,"value":11356}," specification, making validation as easy as adding a ",{"type":21,"tag":63,"props":11358,"children":11360},{"className":11359},[],[11361],{"type":26,"value":11362},"schema",{"type":26,"value":11364}," key to a route's options.",{"type":21,"tag":51,"props":11366,"children":11368},{"id":11367},"large-ecosystem-of-core-plugins",[11369],{"type":26,"value":11370},"Large ecosystem of \"core\" plugins",{"type":21,"tag":22,"props":11372,"children":11373},{},[11374,11376,11383],{"type":26,"value":11375},"Fastify's ",{"type":21,"tag":29,"props":11377,"children":11380},{"href":11378,"rel":11379},"https://www.fastify.io/docs/latest/Guides/Ecosystem/",[93],[11381],{"type":26,"value":11382},"plugin ecosystem",{"type":26,"value":11384}," is comparable to Express, but one thing that sets it apart is that many of these plugins are \"core\" plugins maintained by the Fastify team themselves. A project's Achilles' heel can be a dependency on some community third-party library whose author has dropped off the radar, and yet this risk is not always apparent when developers are choosing to take on a new dependency. Having a large list of core plugins to choose from means having a lot of additional functionality at your disposal without increasing your project's dependence on third parties.",{"type":21,"tag":51,"props":11386,"children":11388},{"id":11387},"built-in-testing-capabilities",[11389],{"type":26,"value":11390},"Built-in testing capabilities",{"type":21,"tag":22,"props":11392,"children":11393},{},[11394],{"type":26,"value":11395},"Express does not provide any functionality intended for testing, which means projects tend to either",{"type":21,"tag":3626,"props":11397,"children":11398},{},[11399,11411,11416],{"type":21,"tag":3630,"props":11400,"children":11401},{},[11402,11404,11409],{"type":26,"value":11403},"start up a full Webserver and use a tool like ",{"type":21,"tag":29,"props":11405,"children":11407},{"href":3756,"rel":11406},[93],[11408],{"type":26,"value":3760},{"type":26,"value":11410}," to test via real API requests,",{"type":21,"tag":3630,"props":11412,"children":11413},{},[11414],{"type":26,"value":11415},"expose route handlers and test them independently of the routing, or",{"type":21,"tag":3630,"props":11417,"children":11418},{},[11419],{"type":26,"value":11420},"skip integration tests entirely.",{"type":21,"tag":22,"props":11422,"children":11423},{},[11424],{"type":26,"value":11425},"Integration testing against a running Webserver is slow, and it's brittle given how limited the options are for setting up test data or mocking external services. Testing route handlers is better, but it leaves a gap in test coverage (the untested routing/middleware/validation).",{"type":21,"tag":22,"props":11427,"children":11428},{},[11429,11431,11438,11440,11446],{"type":26,"value":11430},"Fastify, on the other hand, provides ",{"type":21,"tag":29,"props":11432,"children":11435},{"href":11433,"rel":11434},"https://www.fastify.io/docs/latest/Guides/Testing/",[93],[11436],{"type":26,"value":11437},"testing utilities",{"type":26,"value":11439}," which allow for mock requests to be processed using a ",{"type":21,"tag":63,"props":11441,"children":11443},{"className":11442},[],[11444],{"type":26,"value":11445},".inject()",{"type":26,"value":11447}," method, without spinning up a Webserver. This means tests are fast, and they allow for arbitrary setup/teardown logic (like opening database connections and loading test data), while still being test framework independent.",{"type":21,"tag":51,"props":11449,"children":11451},{"id":11450},"typescript-compatibility",[11452],{"type":26,"value":11453},"TypeScript compatibility",{"type":21,"tag":22,"props":11455,"children":11456},{},[11457],{"type":26,"value":11458},"There are TypeScript typings for Express, and Fastify is similarly a JS project with added TypeScript typings (as opposed to being designed from the ground up to leverage a type system).",{"type":21,"tag":22,"props":11460,"children":11461},{},[11462,11464,11471,11473,11479,11480,11486,11487,11493],{"type":26,"value":11463},"However, Fastify also provides ",{"type":21,"tag":29,"props":11465,"children":11468},{"href":11466,"rel":11467},"https://www.fastify.io/docs/latest/Reference/TypeScript/",[93],[11469],{"type":26,"value":11470},"official documentation",{"type":26,"value":11472}," for usage in TypeScript, which in particular shows its really great capability (via an added library) of building TypeScript types out of request validation schemas. What this means is that when using TypeScript, the ",{"type":21,"tag":63,"props":11474,"children":11476},{"className":11475},[],[11477],{"type":26,"value":11478},"request.params",{"type":26,"value":408},{"type":21,"tag":63,"props":11481,"children":11483},{"className":11482},[],[11484],{"type":26,"value":11485},"request.query",{"type":26,"value":5997},{"type":21,"tag":63,"props":11488,"children":11490},{"className":11489},[],[11491],{"type":26,"value":11492},"request.body",{"type":26,"value":11494}," fields will have types matching their validated content, ensuring that the validation code and the application code are in sync.",{"type":21,"tag":51,"props":11496,"children":11498},{"id":11497},"and-more",[11499],{"type":26,"value":11500},"...and more",{"type":21,"tag":3679,"props":11502,"children":11503},{},[11504,11509,11521],{"type":21,"tag":3630,"props":11505,"children":11506},{},[11507],{"type":26,"value":11508},"Built-in JSON support such that route handlers don't need to encode/decode JSON manually, which is a nice convenience",{"type":21,"tag":3630,"props":11510,"children":11511},{},[11512,11514],{"type":26,"value":11513},"Built-in logging via ",{"type":21,"tag":29,"props":11515,"children":11518},{"href":11516,"rel":11517},"https://github.com/pinojs/pino",[93],[11519],{"type":26,"value":11520},"pino",{"type":21,"tag":3630,"props":11522,"children":11523},{},[11524,11526],{"type":26,"value":11525},"Speed, with Fastify performancing much better than Express in ",{"type":21,"tag":29,"props":11527,"children":11530},{"href":11528,"rel":11529},"https://www.fastify.io/benchmarks/",[93],[11531],{"type":26,"value":11532},"benchmarks",{"type":21,"tag":22,"props":11534,"children":11535},{},[11536],{"type":26,"value":11537},"There are many other quality JavaScript Web frameworks to consider, but without going into a full comparison, I don't think they fill the role of Express quite so well as Fastify does:",{"type":21,"tag":3679,"props":11539,"children":11540},{},[11541,11553,11565],{"type":21,"tag":3630,"props":11542,"children":11543},{},[11544,11551],{"type":21,"tag":29,"props":11545,"children":11548},{"href":11546,"rel":11547},"https://nestjs.com/",[93],[11549],{"type":26,"value":11550},"NestJS",{"type":26,"value":11552}," is great in its own right as a heavyweight, opinionated framework (which can optionally be based on Fastify), but it's not a good fit for small projects or ones which need a lot of flexibility.",{"type":21,"tag":3630,"props":11554,"children":11555},{},[11556,11563],{"type":21,"tag":29,"props":11557,"children":11560},{"href":11558,"rel":11559},"https://koajs.com/",[93],[11561],{"type":26,"value":11562},"Koa",{"type":26,"value":11564}," is great for being very similar to Express while still adding some welcome features, but it doesn't have nearly the feature set of Fastify.",{"type":21,"tag":3630,"props":11566,"children":11567},{},[11568,11575],{"type":21,"tag":29,"props":11569,"children":11572},{"href":11570,"rel":11571},"https://adonisjs.com/",[93],[11573],{"type":26,"value":11574},"AdonisJS",{"type":26,"value":11576}," is pretty comparable to Fastify and it's TypeScript-first, but it doesn't have quite the same plugin ecosystem.",{"type":21,"tag":3596,"props":11578,"children":11580},{"id":11579},"pros-and-cons-of-migrating-from-express-to-fastify",[11581],{"type":26,"value":11582},"Pros and Cons of Migrating from Express to Fastify",{"type":21,"tag":22,"props":11584,"children":11585},{},[11586],{"type":26,"value":11587},"For a greenfield Node.js project, I would readily choose Fastify over Express; it just gives developers access to so many added features, all in an opt-in fashion so they don't get in the way, in a well-maintained project that feels like it will still be around in five years' time.",{"type":21,"tag":22,"props":11589,"children":11590},{},[11591],{"type":26,"value":11592},"Whether or not to migrate an existing Express project to Fastify, however, is a more difficult question.",{"type":21,"tag":22,"props":11594,"children":11595},{},[11596,11598,11607],{"type":26,"value":11597},"Such a migration doesn't need to happen in a single step; there's a ",{"type":21,"tag":29,"props":11599,"children":11601},{"href":3609,"rel":11600},[93],[11602],{"type":21,"tag":63,"props":11603,"children":11605},{"className":11604},[],[11606],{"type":26,"value":3617},{"type":26,"value":11608}," plugin which allows an entire Express router to be loaded inside of a Fastify application, allowing both to exist simultaneously for a time. The plugin documentation advises against using it as a long-term solution, so it is intended to be part of a full migration and not for maintaining a set of legacy Express routes long-term. Still, Fastify is different enough from Express that a migration is time-consuming, and differences in its request and response objects means that application code in the route handlers needs to be touched as well.",{"type":21,"tag":22,"props":11610,"children":11611},{},[11612,11614,11619],{"type":26,"value":11613},"While Fastify provides a ton of added functionality, almost all that functionality can be tacked on to Express via third-party libraries, so there's little reason why a project would flat-out ",{"type":21,"tag":1084,"props":11615,"children":11616},{},[11617],{"type":26,"value":11618},"need",{"type":26,"value":11620}," to migrate. Express gets the job done; unless the project has a long life ahead, good test coverage to cover a migration, and tens of hours to spare to implement it, it's probably best to stick with Express.",{"type":21,"tag":22,"props":11622,"children":11623},{},[11624,11626,11632,11634,11639],{"type":26,"value":11625},"...That said, in order to come to that conlusion I needed to see just how easy (or hard) it was to migrate a project, so that's just what I did. In Part 2 we'll look at the process of converting an ",{"type":21,"tag":29,"props":11627,"children":11629},{"href":3561,"rel":11628},[93],[11630],{"type":26,"value":11631},"Express implementation",{"type":26,"value":11633}," of the ",{"type":21,"tag":29,"props":11635,"children":11637},{"href":3574,"rel":11636},[93],[11638],{"type":26,"value":3578},{"type":26,"value":11640},", to get an idea of what it looks like to migrate a non-trivial application to Fastify.",{"title":8,"searchDepth":254,"depth":254,"links":11642},[11643,11654],{"id":11206,"depth":244,"text":11209,"children":11644},[11645,11646,11647,11649,11650,11651,11652,11653],{"id":11222,"depth":254,"text":11225},{"id":11241,"depth":254,"text":11244},{"id":11261,"depth":254,"text":11648},"Built-in async/await support",{"id":11330,"depth":254,"text":11333},{"id":11367,"depth":254,"text":11370},{"id":11387,"depth":254,"text":11390},{"id":11450,"depth":254,"text":11453},{"id":11497,"depth":254,"text":11500},{"id":11579,"depth":244,"text":11582},"content:phendry:2022-07-21:MigratingFromExpressToFastifyPart1.md","phendry/2022-07-21/MigratingFromExpressToFastifyPart1.md","phendry/2022-07-21/MigratingFromExpressToFastifyPart1",{"user":11175,"name":11176},{"_path":11660,"_dir":11661,"_draft":7,"_partial":7,"_locale":8,"title":11662,"description":11663,"tags":11664,"publishDate":11666,"image":11667,"excerpt":11663,"body":11668,"_type":3511,"_id":12430,"_source":3513,"_file":12431,"_stem":12432,"_extension":3516,"author":12433},"/phendry/2021-06/smoothupgradestovue3","2021-06","Smooth Upgrades to Vue 3","This post assumes basic familiarity with Vue.js v2.x.",[12,13,11665],"how-to","2021-07-01","/phendry/2021-06/img/vue-transition.jpg",{"type":18,"children":11669,"toc":12424},[11670,11686,11691,11828,11842,11856,11862,11874,11946,11958,11964,11969,12020,12025,12031,12045,12050,12139,12153,12216,12229,12297,12303,12308,12398,12420],{"type":21,"tag":22,"props":11671,"children":11672},{},[11673],{"type":21,"tag":1084,"props":11674,"children":11675},{},[11676,11678,11685],{"type":26,"value":11677},"This post assumes basic familiarity with ",{"type":21,"tag":29,"props":11679,"children":11682},{"href":11680,"rel":11681},"https://vuejs.org/",[93],[11683],{"type":26,"value":11684},"Vue.js v2.x",{"type":26,"value":378},{"type":21,"tag":22,"props":11687,"children":11688},{},[11689],{"type":26,"value":11690},"Vue 3, the Progressive JavaScript Framework, introduces some compelling new features:",{"type":21,"tag":3679,"props":11692,"children":11693},{},[11694,11706,11729,11751,11763,11775,11793,11815],{"type":21,"tag":3630,"props":11695,"children":11696},{},[11697,11698,11704],{"type":26,"value":108},{"type":21,"tag":29,"props":11699,"children":11702},{"href":11700,"rel":11701},"https://v3.vuejs.org/guide/composition-api-introduction.html",[93],[11703],{"type":26,"value":189},{"type":26,"value":11705}," introduces a new, more flexible, TypeScript-friendly syntax for defining components (albeit at the cost of a bit more complexity);",{"type":21,"tag":3630,"props":11707,"children":11708},{},[11709,11711,11718,11720,11727],{"type":26,"value":11710},"Significant ",{"type":21,"tag":29,"props":11712,"children":11715},{"href":11713,"rel":11714},"https://docs.google.com/spreadsheets/d/1VJFx-kQ4KjJmnpDXIEaig-cVAAJtpIGLZNbv3Lr4CR0/edit#gid=0",[93],[11716],{"type":26,"value":11717},"reported performance improvements",{"type":26,"value":11719}," over v2, in addition to reduced bundle sizes as a result of ",{"type":21,"tag":29,"props":11721,"children":11724},{"href":11722,"rel":11723},"https://v3.vuejs.org/guide/migration/global-api-treeshaking.html",[93],[11725],{"type":26,"value":11726},"global API tree-shaking",{"type":26,"value":11728},";",{"type":21,"tag":3630,"props":11730,"children":11731},{},[11732,11734,11741,11743,11749],{"type":26,"value":11733},"An updated ",{"type":21,"tag":29,"props":11735,"children":11738},{"href":11736,"rel":11737},"https://v3.vuejs.org/guide/reactivity.html#what-is-reactivity",[93],[11739],{"type":26,"value":11740},"reactivity system",{"type":26,"value":11742}," based on ",{"type":21,"tag":63,"props":11744,"children":11746},{"className":11745},[],[11747],{"type":26,"value":11748},"Proxy",{"type":26,"value":11750},", which eliminates a common source of bugs when using arrays and objects;",{"type":21,"tag":3630,"props":11752,"children":11753},{},[11754,11761],{"type":21,"tag":29,"props":11755,"children":11758},{"href":11756,"rel":11757},"https://vitejs.dev/",[93],[11759],{"type":26,"value":11760},"Vite",{"type":26,"value":11762},", a new set of frontend tooling for a lightning-fast development experience;",{"type":21,"tag":3630,"props":11764,"children":11765},{},[11766,11773],{"type":21,"tag":29,"props":11767,"children":11770},{"href":11768,"rel":11769},"https://v3.vuejs.org/guide/migration/fragments.html",[93],[11771],{"type":26,"value":11772},"Fragments",{"type":26,"value":11774},", allowing multiple root elements in Vue components;",{"type":21,"tag":3630,"props":11776,"children":11777},{},[11778,11780,11791],{"type":26,"value":11779},"[Experimental] The ",{"type":21,"tag":29,"props":11781,"children":11784},{"href":11782,"rel":11783},"https://github.com/vuejs/rfcs/blob/script-setup-2/active-rfcs/0000-script-setup.md",[93],[11785],{"type":21,"tag":63,"props":11786,"children":11788},{"className":11787},[],[11789],{"type":26,"value":11790},"\u003Cscript setup>",{"type":26,"value":11792}," syntax, for a nicer syntax when committing fully to the Composition API in a component;",{"type":21,"tag":3630,"props":11794,"children":11795},{},[11796,11798,11805,11807,11813],{"type":26,"value":11797},"[Experimental] ",{"type":21,"tag":29,"props":11799,"children":11802},{"href":11800,"rel":11801},"https://github.com/vuejs/rfcs/blob/style-vars-2/active-rfcs/0000-sfc-style-variables.md",[93],[11803],{"type":26,"value":11804},"State-driven CSS Variables",{"type":26,"value":11806},", allowing data bindings within the ",{"type":21,"tag":63,"props":11808,"children":11810},{"className":11809},[],[11811],{"type":26,"value":11812},"\u003Cstyle>",{"type":26,"value":11814}," section of components;",{"type":21,"tag":3630,"props":11816,"children":11817},{},[11818,11819,11826],{"type":26,"value":11779},{"type":21,"tag":29,"props":11820,"children":11823},{"href":11821,"rel":11822},"https://v3.vuejs.org/guide/migration/suspense.html",[93],[11824],{"type":26,"value":11825},"Suspense",{"type":26,"value":11827}," component, which makes it much easier to write asynchronous components that display a \"loading\" UI while they're processing.",{"type":21,"tag":22,"props":11829,"children":11830},{},[11831,11833,11840],{"type":26,"value":11832},"It's a valuable upgrade in terms of performance and developer productivity. The question is, how do you get there? While v3 does not make any drastic API changes compared to v2, the changes it does make are ",{"type":21,"tag":29,"props":11834,"children":11837},{"href":11835,"rel":11836},"https://v3.vuejs.org/guide/migration/introduction.html#breaking-changes",[93],[11838],{"type":26,"value":11839},"numerous",{"type":26,"value":11841},", and as of the initial v3.0 release, these breaking changes would need to be migrated in one fell swoop.",{"type":21,"tag":22,"props":11843,"children":11844},{},[11845,11847,11854],{"type":26,"value":11846},"Fortunately, the Vue.js team has recently released the ",{"type":21,"tag":29,"props":11848,"children":11851},{"href":11849,"rel":11850},"https://v3.vuejs.org/guide/migration/migration-build.html",[93],[11852],{"type":26,"value":11853},"Migration Build",{"type":26,"value":11855},", which makes it possible (and easy) to make a smooth transition from v2 to v3.",{"type":21,"tag":3596,"props":11857,"children":11859},{"id":11858},"vue-3-compatibility-caveats",[11860],{"type":26,"value":11861},"Vue 3 Compatibility Caveats",{"type":21,"tag":22,"props":11863,"children":11864},{},[11865,11867,11872],{"type":26,"value":11866},"There are a few reasons why you might ",{"type":21,"tag":1084,"props":11868,"children":11869},{},[11870],{"type":26,"value":11871},"not",{"type":26,"value":11873}," be ready to introduce Vue 3 into your project:",{"type":21,"tag":3679,"props":11875,"children":11876},{},[11877,11897],{"type":21,"tag":3630,"props":11878,"children":11879},{},[11880,11886,11888,11895],{"type":21,"tag":11881,"props":11882,"children":11883},"strong",{},[11884],{"type":26,"value":11885},"IE11 Compatibility:",{"type":26,"value":11887}," Support for Internet Exporer 11 and other \"legacy\" browsers was previously promised in a subsequent update, but it has been ",{"type":21,"tag":29,"props":11889,"children":11892},{"href":11890,"rel":11891},"https://github.com/vuejs/rfcs/blob/master/active-rfcs/0038-vue3-ie11-support.md",[93],[11893],{"type":26,"value":11894},"formally dropped",{"type":26,"value":11896}," from the Vue 3 roadmap. If your project needs to support IE or other \"legacy\" browsers, you'll likely be sticking to Vue v2.x indefinitely.",{"type":21,"tag":3630,"props":11898,"children":11899},{},[11900,11905,11907],{"type":21,"tag":11881,"props":11901,"children":11902},{},[11903],{"type":26,"value":11904},"Framework Compatibiilty:",{"type":26,"value":11906}," Many major component libraries and frameworks need time to make the upgrade. If you depend on one of them, you'll be dependent on their upgrade to v3. For example:\n",{"type":21,"tag":3679,"props":11908,"children":11909},{},[11910,11922,11934],{"type":21,"tag":3630,"props":11911,"children":11912},{},[11913,11915],{"type":26,"value":11914},"Bootstrap-Vue: ",{"type":21,"tag":29,"props":11916,"children":11919},{"href":11917,"rel":11918},"https://github.com/bootstrap-vue/bootstrap-vue/issues/5196",[93],[11920],{"type":26,"value":11921},"On roadmap, but no timeline",{"type":21,"tag":3630,"props":11923,"children":11924},{},[11925,11927],{"type":26,"value":11926},"Nuxt.js: ",{"type":21,"tag":29,"props":11928,"children":11931},{"href":11929,"rel":11930},"https://github.com/nuxt/nuxt.js/issues/5708",[93],[11932],{"type":26,"value":11933},"On roadmap for Nuxt v3, but no timeline",{"type":21,"tag":3630,"props":11935,"children":11936},{},[11937,11939],{"type":26,"value":11938},"Vuetify: ",{"type":21,"tag":29,"props":11940,"children":11943},{"href":11941,"rel":11942},"https://vuetifyjs.com/en/introduction/roadmap/",[93],[11944],{"type":26,"value":11945},"support available in Vuetify v3.0 alpha; full support in Q3 2021",{"type":21,"tag":22,"props":11947,"children":11948},{},[11949,11951,11957],{"type":26,"value":11950},"Make sure that your project's dependencies and supported platforms allow for the upgrade. If not, keep in mind that some v3 features are being backported to v2, such as the ",{"type":21,"tag":29,"props":11952,"children":11955},{"href":11953,"rel":11954},"https://github.com/vuejs/composition-api",[93],[11956],{"type":26,"value":189},{"type":26,"value":378},{"type":21,"tag":3596,"props":11959,"children":11961},{"id":11960},"what-is-the-migration-build",[11962],{"type":26,"value":11963},"What is the Migration Build?",{"type":21,"tag":22,"props":11965,"children":11966},{},[11967],{"type":26,"value":11968},"The Migration Build is an alternative build of Vue 3 which provides configurable Vue 2 compatible behaviour. It enables a gradual migration process:",{"type":21,"tag":3626,"props":11970,"children":11971},{},[11972,11991,11996,12001],{"type":21,"tag":3630,"props":11973,"children":11974},{},[11975,11977,11982,11984,11990],{"type":26,"value":11976},"Swap out your ",{"type":21,"tag":63,"props":11978,"children":11980},{"className":11979},[],[11981],{"type":26,"value":13},{"type":26,"value":11983}," v2.x dependency with ",{"type":21,"tag":63,"props":11985,"children":11987},{"className":11986},[],[11988],{"type":26,"value":11989},"@vue/compat",{"type":26,"value":11728},{"type":21,"tag":3630,"props":11992,"children":11993},{},[11994],{"type":26,"value":11995},"Configure the Migration Build to be fully v2-compatible;",{"type":21,"tag":3630,"props":11997,"children":11998},{},[11999],{"type":26,"value":12000},"One breaking change at a time, configure the Migration Build to be v3-compatible for that feature, and fix any occurrences of it in your project;",{"type":21,"tag":3630,"props":12002,"children":12003},{},[12004,12006,12011,12013,12018],{"type":26,"value":12005},"Swap out ",{"type":21,"tag":63,"props":12007,"children":12009},{"className":12008},[],[12010],{"type":26,"value":11989},{"type":26,"value":12012}," for ",{"type":21,"tag":63,"props":12014,"children":12016},{"className":12015},[],[12017],{"type":26,"value":13},{"type":26,"value":12019}," 3.x once your project is fully migrated to v3.",{"type":21,"tag":22,"props":12021,"children":12022},{},[12023],{"type":26,"value":12024},"The amount of overhead introduced by this compability build is relatively small, so it's even possible to make releases while in the intermediate state between v2 and v3 compatibility. The Vue.js team has guaranteed to maintain this migration build at least until the end of 2021, but after that no firm commitments have been made, so if you've made the decision to upgrade, it's best not to delay for too long.",{"type":21,"tag":3596,"props":12026,"children":12028},{"id":12027},"using-the-migration-build",[12029],{"type":26,"value":12030},"Using the Migration Build",{"type":21,"tag":22,"props":12032,"children":12033},{},[12034,12036,12043],{"type":26,"value":12035},"The first step of course is installation, and the ",{"type":21,"tag":29,"props":12037,"children":12040},{"href":12038,"rel":12039},"https://v3.vuejs.org/guide/migration/migration-build.html#installation",[93],[12041],{"type":26,"value":12042},"official installation documentation",{"type":26,"value":12044}," is easy to follow.",{"type":21,"tag":22,"props":12046,"children":12047},{},[12048],{"type":26,"value":12049},"Configuration is straightforward, and can be done both globally or on a per-component basis. A global configuration can be created with a snippet like this in the root of the application:",{"type":21,"tag":200,"props":12051,"children":12053},{"className":202,"code":12052,"language":12,"meta":8,"style":8},"import { configureCompat } from 'vue';\n\nconfigureCompat({\n   // By default, each feature is v2 compatible. Set individual features to\n   // `false` like so to switch them to v3 compatibility.\n   GLOBAL_MOUNT: false,\n});\n",[12054],{"type":21,"tag":63,"props":12055,"children":12056},{"__ignoreMap":8},[12057,12081,12088,12100,12108,12116,12132],{"type":21,"tag":209,"props":12058,"children":12059},{"class":211,"line":212},[12060,12064,12069,12073,12077],{"type":21,"tag":209,"props":12061,"children":12062},{"style":216},[12063],{"type":26,"value":219},{"type":21,"tag":209,"props":12065,"children":12066},{"style":222},[12067],{"type":26,"value":12068}," { configureCompat } ",{"type":21,"tag":209,"props":12070,"children":12071},{"style":216},[12072],{"type":26,"value":230},{"type":21,"tag":209,"props":12074,"children":12075},{"style":233},[12076],{"type":26,"value":1640},{"type":21,"tag":209,"props":12078,"children":12079},{"style":222},[12080],{"type":26,"value":241},{"type":21,"tag":209,"props":12082,"children":12083},{"class":211,"line":244},[12084],{"type":21,"tag":209,"props":12085,"children":12086},{"emptyLinePlaceholder":248},[12087],{"type":26,"value":251},{"type":21,"tag":209,"props":12089,"children":12090},{"class":211,"line":254},[12091,12096],{"type":21,"tag":209,"props":12092,"children":12093},{"style":360},[12094],{"type":26,"value":12095},"configureCompat",{"type":21,"tag":209,"props":12097,"children":12098},{"style":222},[12099],{"type":26,"value":7767},{"type":21,"tag":209,"props":12101,"children":12102},{"class":211,"line":279},[12103],{"type":21,"tag":209,"props":12104,"children":12105},{"style":448},[12106],{"type":26,"value":12107},"   // By default, each feature is v2 compatible. Set individual features to\n",{"type":21,"tag":209,"props":12109,"children":12110},{"class":211,"line":288},[12111],{"type":21,"tag":209,"props":12112,"children":12113},{"style":448},[12114],{"type":26,"value":12115},"   // `false` like so to switch them to v3 compatibility.\n",{"type":21,"tag":209,"props":12117,"children":12118},{"class":211,"line":307},[12119,12124,12128],{"type":21,"tag":209,"props":12120,"children":12121},{"style":222},[12122],{"type":26,"value":12123},"   GLOBAL_MOUNT: ",{"type":21,"tag":209,"props":12125,"children":12126},{"style":263},[12127],{"type":26,"value":4243},{"type":21,"tag":209,"props":12129,"children":12130},{"style":222},[12131],{"type":26,"value":304},{"type":21,"tag":209,"props":12133,"children":12134},{"class":211,"line":325},[12135],{"type":21,"tag":209,"props":12136,"children":12137},{"style":222},[12138],{"type":26,"value":469},{"type":21,"tag":22,"props":12140,"children":12141},{},[12142,12144,12151],{"type":26,"value":12143},"Once installed and configured, your v3-upgraded application should, for the most part, function just the same as before. From here, the ",{"type":21,"tag":29,"props":12145,"children":12148},{"href":12146,"rel":12147},"https://v3.vuejs.org/guide/migration/migration-build.html#feature-reference",[93],[12149],{"type":26,"value":12150},"Feature Reference",{"type":26,"value":12152}," in the official documentation is where you'll find a list of the individual v3 features to enable in order to migrate your project. They're separated into four \"Compatibility Types\", in a sensible order for sequentially working through them. These are:",{"type":21,"tag":3679,"props":12154,"children":12155},{},[12156,12172,12182,12206],{"type":21,"tag":3630,"props":12157,"children":12158},{},[12159,12164,12166,12170],{"type":21,"tag":11881,"props":12160,"children":12161},{},[12162],{"type":26,"value":12163},"Incompatible:",{"type":26,"value":12165}," These are a handful of features for which the Migration Build does ",{"type":21,"tag":1084,"props":12167,"children":12168},{},[12169],{"type":26,"value":11871},{"type":26,"value":12171}," provide v2 compatibility; it only provides warnings for easy identification of code that requires migrating. If any of these warnings appear, they'll need to be addressed upfront.",{"type":21,"tag":3630,"props":12173,"children":12174},{},[12175,12180],{"type":21,"tag":11881,"props":12176,"children":12177},{},[12178],{"type":26,"value":12179},"Partially Compatible With Caveats:",{"type":26,"value":12181}," These features don't behave 100% identically to v2 in compatibility mode, but as long as you aren't relying on private Vue APIs, this is unlikely to be a problem.",{"type":21,"tag":3630,"props":12183,"children":12184},{},[12185,12190,12192,12196,12198,12204],{"type":21,"tag":11881,"props":12186,"children":12187},{},[12188],{"type":26,"value":12189},"Compat Only (No Warning)",{"type":26,"value":12191},": These features are v2-compatible but do ",{"type":21,"tag":1084,"props":12193,"children":12194},{},[12195],{"type":26,"value":11871},{"type":26,"value":12197}," issue a warning to identify code which needs migrating. Curently this is only the ",{"type":21,"tag":63,"props":12199,"children":12201},{"className":12200},[],[12202],{"type":26,"value":12203},"TRANSITION_CLASSES",{"type":26,"value":12205}," feature, instances of which are easy to find via text search.",{"type":21,"tag":3630,"props":12207,"children":12208},{},[12209,12214],{"type":21,"tag":11881,"props":12210,"children":12211},{},[12212],{"type":26,"value":12213},"Fully Compatible",{"type":26,"value":12215},": These features ought to behave identically to v2.",{"type":21,"tag":22,"props":12217,"children":12218},{},[12219,12221,12227],{"type":26,"value":12220},"For each feature, simply migrate each v2-style occurrence, then set ",{"type":21,"tag":63,"props":12222,"children":12224},{"className":12223},[],[12225],{"type":26,"value":12226},"FEATURE_NAME: false",{"type":26,"value":12228}," in your compatibility configuration in order to switch the Vue build to use the v3 behavior.",{"type":21,"tag":22,"props":12230,"children":12231},{},[12232,12234,12240,12242,12249,12251,12257,12259,12264,12266,12272,12274,12280,12281,12287,12289,12295],{"type":26,"value":12233},"For example, consider the ",{"type":21,"tag":63,"props":12235,"children":12237},{"className":12236},[],[12238],{"type":26,"value":12239},"INSTANCE_SCOPED_SLOTS",{"type":26,"value":12241}," compatibility feature. The Feature Reference provides a ",{"type":21,"tag":29,"props":12243,"children":12246},{"href":12244,"rel":12245},"https://v3.vuejs.org/guide/migration/slots-unification.html",[93],[12247],{"type":26,"value":12248},"link",{"type":26,"value":12250}," to the relevant migration documentation, which tells you that ",{"type":21,"tag":63,"props":12252,"children":12254},{"className":12253},[],[12255],{"type":26,"value":12256},"this.$scopedSlots",{"type":26,"value":12258}," has been removed due to the unification of normal/scoped slots in v3. The \"Migration Strategy\" section at the bottom describes simple steps to take: replace occurrences of ",{"type":21,"tag":63,"props":12260,"children":12262},{"className":12261},[],[12263],{"type":26,"value":12256},{"type":26,"value":12265}," with ",{"type":21,"tag":63,"props":12267,"children":12269},{"className":12268},[],[12270],{"type":26,"value":12271},"this.$slots",{"type":26,"value":12273},", and then replace occurrences of ",{"type":21,"tag":63,"props":12275,"children":12277},{"className":12276},[],[12278],{"type":26,"value":12279},"this.$slots.mySlot",{"type":26,"value":12265},{"type":21,"tag":63,"props":12282,"children":12284},{"className":12283},[],[12285],{"type":26,"value":12286},"this.$slots.mySlot()",{"type":26,"value":12288},". This can easily be done in a few moments using find-and-replace, after which ",{"type":21,"tag":63,"props":12290,"children":12292},{"className":12291},[],[12293],{"type":26,"value":12294},"INSTANCE_SCOPED_SLOTS: false",{"type":26,"value":12296}," can be set in your compatibility configuration, one step closer to v3 compatibility.",{"type":21,"tag":3596,"props":12298,"children":12300},{"id":12299},"recap",[12301],{"type":26,"value":12302},"Recap",{"type":21,"tag":22,"props":12304,"children":12305},{},[12306],{"type":26,"value":12307},"Overall, the Migration Build allows for a gradual development process of migration that looks something like this:",{"type":21,"tag":3626,"props":12309,"children":12310},{},[12311,12339,12344],{"type":21,"tag":3630,"props":12312,"children":12313},{},[12314,12316],{"type":26,"value":12315},"Replace your project's Vue 2.x dependency with the Vue 3 Migration Build\n",{"type":21,"tag":3626,"props":12317,"children":12318},{},[12319,12324,12329,12334],{"type":21,"tag":3630,"props":12320,"children":12321},{},[12322],{"type":26,"value":12323},"Install and configure it for full v2 compatibility",{"type":21,"tag":3630,"props":12325,"children":12326},{},[12327],{"type":26,"value":12328},"Migrate the handful of features marked \"Incompatible\" in order to restore your application to full function",{"type":21,"tag":3630,"props":12330,"children":12331},{},[12332],{"type":26,"value":12333},"Peform some smoke testing to ensure that everything is back to normal",{"type":21,"tag":3630,"props":12335,"children":12336},{},[12337],{"type":26,"value":12338},"Merge this change into your mainline development branch",{"type":21,"tag":3630,"props":12340,"children":12341},{},[12342],{"type":26,"value":12343},"Continue regular development as required, potentially even making releases along the way",{"type":21,"tag":3630,"props":12345,"children":12346},{},[12347,12349,12355,12356],{"type":26,"value":12348},"While ",{"type":21,"tag":63,"props":12350,"children":12352},{"className":12351},[],[12353],{"type":26,"value":12354},"numUnmigratedFeatures > 0",{"type":26,"value":304},{"type":21,"tag":3626,"props":12357,"children":12358},{},[12359,12371,12383,12388,12393],{"type":21,"tag":3630,"props":12360,"children":12361},{},[12362,12364,12369],{"type":26,"value":12363},"Use the ",{"type":21,"tag":29,"props":12365,"children":12367},{"href":12146,"rel":12366},[93],[12368],{"type":26,"value":12150},{"type":26,"value":12370}," documentation to identify the next compatibility feature to disable",{"type":21,"tag":3630,"props":12372,"children":12373},{},[12374,12376,12381],{"type":26,"value":12375},"Switch to v3 behavior by setting ",{"type":21,"tag":63,"props":12377,"children":12379},{"className":12378},[],[12380],{"type":26,"value":12226},{"type":26,"value":12382}," in your Migration Build configuration",{"type":21,"tag":3630,"props":12384,"children":12385},{},[12386],{"type":26,"value":12387},"Use the documentation link in the Feature Reference to jump to relevant information about how to migrate to v3",{"type":21,"tag":3630,"props":12389,"children":12390},{},[12391],{"type":26,"value":12392},"Migrate all occurrences in your project",{"type":21,"tag":3630,"props":12394,"children":12395},{},[12396],{"type":26,"value":12397},"Merge this change into your mainline development branch (which ensures that any subsequent commits must use the v3 behavior)",{"type":21,"tag":22,"props":12399,"children":12400},{},[12401,12403,12410,12412,12419],{"type":26,"value":12402},"This easy and comprehensive upgrade process, combined with how infrequently Vue makes breaking API changes to begin with, arguably makes it best-in-class among JavaScript UI framworks in terms of long-term maintenance (although React is ",{"type":21,"tag":29,"props":12404,"children":12407},{"href":12405,"rel":12406},"https://reactjs.org/blog/2020/10/20/react-v17.html#gradual-upgrades",[93],[12408],{"type":26,"value":12409},"introducing a similar upgrade process",{"type":26,"value":12411}," for the upcoming version 18). It's one of the reasons ",{"type":21,"tag":29,"props":12413,"children":12416},{"href":12414,"rel":12415},"https://artandlogic.com/2020/02/why-vue/",[93],[12417],{"type":26,"value":12418},"why we recommend Vue",{"type":26,"value":378},{"type":21,"tag":3490,"props":12421,"children":12422},{},[12423],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":12425},[12426,12427,12428,12429],{"id":11858,"depth":244,"text":11861},{"id":11960,"depth":244,"text":11963},{"id":12027,"depth":244,"text":12030},{"id":12299,"depth":244,"text":12302},"content:phendry:2021-06:SmoothUpgradesToVue3.md","phendry/2021-06/SmoothUpgradesToVue3.md","phendry/2021-06/SmoothUpgradesToVue3",{"user":11175,"name":11176},{"_path":12435,"_dir":12436,"_draft":7,"_partial":7,"_locale":8,"title":12437,"description":12438,"excerpt":12439,"publishDate":12440,"image":12441,"tags":12442,"body":12443,"_type":3511,"_id":13041,"_source":3513,"_file":13042,"_stem":13043,"_extension":3516,"author":13044},"/ckeefer/2020-1/why-vue","2020-1","Why Vue","Why choose Vue over any other front-end framework?","For web development, when all other considerations are equal, we recommend choosing Vue. Here’s why:","2020-01-01","/ckeefer/2020-1/img/vue-wall.jpg",[12,13],{"type":18,"children":12444,"toc":12995},[12445,12459,12465,12471,12476,12482,12504,12527,12533,12538,12543,12548,12553,12558,12563,12569,12574,12579,12584,12597,12603,12608,12613,12618,12632,12637,12643,12648,12653,12658,12690,12712,12718,12723,12728,12733,12744,12758,12764,12769,12774,12779,12784,12798,12803,12809,12814,12819,12824,12838,12861,12867,12872,12877,12882,12905,12911,12916,12921,12926,12931,12941,12951,12957,12962,12967,12972],{"type":21,"tag":22,"props":12446,"children":12447},{},[12448,12450,12457],{"type":26,"value":12449},"For web development, when all other considerations are equal, we recommend choosing ",{"type":21,"tag":29,"props":12451,"children":12454},{"href":12452,"rel":12453},"https://www.google.com/url?q=https://vuejs.org/&sa=D&ust=1579208471588000",[93],[12455],{"type":26,"value":12456},"Vue",{"type":26,"value":12458},". Here’s why:",{"type":21,"tag":3596,"props":12460,"children":12462},{"id":12461},"excellent-documentation",[12463],{"type":26,"value":12464},"Excellent Documentation",{"type":21,"tag":51,"props":12466,"children":12468},{"id":12467},"executive-summary",[12469],{"type":26,"value":12470},"Executive Summary",{"type":21,"tag":22,"props":12472,"children":12473},{},[12474],{"type":26,"value":12475},"High quality documentation leads to better results - less time is spent wrestling with the framework or head-scratching about why something is working the way it is, and more time is spent making your project its best.",{"type":21,"tag":51,"props":12477,"children":12479},{"id":12478},"more-details",[12480],{"type":26,"value":12481},"More Details",{"type":21,"tag":22,"props":12483,"children":12484},{},[12485,12487,12494,12496,12503],{"type":26,"value":12486},"The Vue documentation is well written, comprehensive, and instructive. In addition to a ",{"type":21,"tag":29,"props":12488,"children":12491},{"href":12489,"rel":12490},"https://www.google.com/url?q=https://vuejs.org/v2/guide/&sa=D&ust=1579208471590000",[93],[12492],{"type":26,"value":12493},"Guide",{"type":26,"value":12495}," which introduces the various concepts of Vue with helpful examples, looking under the hood is encouraged and supported via a full documentation of the ",{"type":21,"tag":29,"props":12497,"children":12500},{"href":12498,"rel":12499},"https://www.google.com/url?q=https://vuejs.org/v2/api/&sa=D&ust=1579208471590000",[93],[12501],{"type":26,"value":12502},"API",{"type":26,"value":378},{"type":21,"tag":22,"props":12505,"children":12506},{},[12507,12509,12516,12518,12525],{"type":26,"value":12508},"Vue then goes the extra mile by providing a ",{"type":21,"tag":29,"props":12510,"children":12513},{"href":12511,"rel":12512},"https://www.google.com/url?q=https://vuejs.org/v2/style-guide/&sa=D&ust=1579208471591000",[93],[12514],{"type":26,"value":12515},"style guide",{"type":26,"value":12517}," which, for an organization which already has an established style guide (",{"type":21,"tag":29,"props":12519,"children":12522},{"href":12520,"rel":12521},"https://styleguide.artandlogic.com",[93],[12523],{"type":26,"value":12524},"as we do at A+L",{"type":26,"value":12526},"), is most useful in illuminating certain potential pitfalls when working with Vue, as well as providing some simple examples and recipes.",{"type":21,"tag":3596,"props":12528,"children":12530},{"id":12529},"performance",[12531],{"type":26,"value":12532},"Performance",{"type":21,"tag":51,"props":12534,"children":12536},{"id":12535},"executive-summary-1",[12537],{"type":26,"value":12470},{"type":21,"tag":22,"props":12539,"children":12540},{},[12541],{"type":26,"value":12542},"Vue can help eliminate some common patterns of code that lead to poor performance, making your application faster and more responsive.",{"type":21,"tag":51,"props":12544,"children":12546},{"id":12545},"more-details-1",[12547],{"type":26,"value":12481},{"type":21,"tag":22,"props":12549,"children":12550},{},[12551],{"type":26,"value":12552},"Vue uses a virtual DOM implementation. There’s a great deal to be said on this topic, and this should be considered an extremely pared-down summary.",{"type":21,"tag":22,"props":12554,"children":12555},{},[12556],{"type":26,"value":12557},"While reading and writing to the real DOM is a fast and inexpensive operation, the knock-on effects – layout re-calculation and repainting – are slow and expensive operations. Vue, by using a virtual DOM and efficient diffing algorithm, updates as little of the real DOM as possible, and batches such updates, to allow for the minimum of costly knock-on effects, improving rendering time and responsiveness.",{"type":21,"tag":22,"props":12559,"children":12560},{},[12561],{"type":26,"value":12562},"While directly manipulating the DOM can be faster if done carefully and correctly, in practice the dreaded WRW (Write-Read-Write) anti-pattern is all too common, leading to multiple costly repaints. A virtual DOM eliminates this issue.",{"type":21,"tag":3596,"props":12564,"children":12566},{"id":12565},"reactive",[12567],{"type":26,"value":12568},"Reactive",{"type":21,"tag":51,"props":12570,"children":12572},{"id":12571},"executive-summary-2",[12573],{"type":26,"value":12470},{"type":21,"tag":22,"props":12575,"children":12576},{},[12577],{"type":26,"value":12578},"A reactive framework automatically handles some of the work of keeping the UI up-to-date with new values, allowing your project’s developers to focus on business logic rather than presentation.",{"type":21,"tag":51,"props":12580,"children":12582},{"id":12581},"more-details-2",[12583],{"type":26,"value":12481},{"type":21,"tag":22,"props":12585,"children":12586},{},[12587,12589,12595],{"type":26,"value":12588},"Like the React framework before it, Vue is ",{"type":21,"tag":29,"props":12590,"children":12593},{"href":12591,"rel":12592},"https://www.google.com/url?q=https://vuejs.org/v2/guide/reactivity.html&sa=D&ust=1579208471595000",[93],[12594],{"type":26,"value":12565},{"type":26,"value":12596},". This means that, with a little setup work, changing values in JS can create seamless, effortless changes within the UI that relies on those values. Instead of needing to imperatively manipulate the DOM to make updates, simply change the reactive property, and the node that relies on it will be re-rendered with the updated value in place.",{"type":21,"tag":3596,"props":12598,"children":12600},{"id":12599},"progressive",[12601],{"type":26,"value":12602},"Progressive",{"type":21,"tag":51,"props":12604,"children":12606},{"id":12605},"executive-summary-3",[12607],{"type":26,"value":12470},{"type":21,"tag":22,"props":12609,"children":12610},{},[12611],{"type":26,"value":12612},"You can begin integrating Vue into your existing project right away and begin experiencing its benefits, without needing to change the way the whole application works all at once.",{"type":21,"tag":51,"props":12614,"children":12616},{"id":12615},"more-details-3",[12617],{"type":26,"value":12481},{"type":21,"tag":22,"props":12619,"children":12620},{},[12621,12623,12630],{"type":26,"value":12622},"Vue is fairly lightweight, and can be attached to a single given DOM node, even using the existing DOM structure as it’s template if it finds one, allowing Vue to take over an existing page and ",{"type":21,"tag":29,"props":12624,"children":12627},{"href":12625,"rel":12626},"https://www.google.com/url?q=https://en.wikipedia.org/wiki/Progressive_enhancement&sa=D&ust=1579208471598000",[93],[12628],{"type":26,"value":12629},"progressively enhance",{"type":26,"value":12631}," it.",{"type":21,"tag":22,"props":12633,"children":12634},{},[12635],{"type":26,"value":12636},"This makes it a good candidate not just as the backbone of a new project, but also for introducing into an existing project to offer enhanced functionality in one small area of the application and slowly expanding from there.",{"type":21,"tag":3596,"props":12638,"children":12640},{"id":12639},"extensible",[12641],{"type":26,"value":12642},"Extensible",{"type":21,"tag":51,"props":12644,"children":12646},{"id":12645},"executive-summary-4",[12647],{"type":26,"value":12470},{"type":21,"tag":22,"props":12649,"children":12650},{},[12651],{"type":26,"value":12652},"Vue has a thriving ecosystem containing many elements that can be added to your application to add new functionality; and Vue is flexible enough to allow your developers to extend and enhance the way it works.",{"type":21,"tag":51,"props":12654,"children":12656},{"id":12655},"more-details-4",[12657],{"type":26,"value":12481},{"type":21,"tag":22,"props":12659,"children":12660},{},[12661,12663,12670,12672,12679,12681,12688],{"type":26,"value":12662},"Vue focuses on, as the name suggests, the view aspect of the familiar MVC model (although Vue actually subscribes to the ",{"type":21,"tag":29,"props":12664,"children":12667},{"href":12665,"rel":12666},"https://www.google.com/url?q=https://en.wikipedia.org/wiki/Model%25E2%2580%2593view%25E2%2580%2593viewmodel&sa=D&ust=1579208471600000",[93],[12668],{"type":26,"value":12669},"MVVM pattern",{"type":26,"value":12671},"). Other modules within the Vue ecosystem focus on routing (",{"type":21,"tag":29,"props":12673,"children":12676},{"href":12674,"rel":12675},"https://www.google.com/url?q=https://router.vuejs.org/&sa=D&ust=1579208471600000",[93],[12677],{"type":26,"value":12678},"Vue-Router",{"type":26,"value":12680},"), state management (",{"type":21,"tag":29,"props":12682,"children":12685},{"href":12683,"rel":12684},"https://www.google.com/url?q=https://vuex.vuejs.org/&sa=D&ust=1579208471601000",[93],[12686],{"type":26,"value":12687},"Vuex",{"type":26,"value":12689},"), and extend Vue.",{"type":21,"tag":22,"props":12691,"children":12692},{},[12693,12695,12702,12704,12711],{"type":26,"value":12694},"There are ",{"type":21,"tag":29,"props":12696,"children":12699},{"href":12697,"rel":12698},"https://www.google.com/url?q=https://github.com/vuejs/awesome-vue&sa=D&ust=1579208471602000",[93],[12700],{"type":26,"value":12701},"many other Vue plugins",{"type":26,"value":12703}," within a healthy developer ecosystem, and creating your own plugins is ",{"type":21,"tag":29,"props":12705,"children":12708},{"href":12706,"rel":12707},"https://www.google.com/url?q=https://vuejs.org/v2/guide/plugins.html&sa=D&ust=1579208471602000",[93],[12709],{"type":26,"value":12710},"easy and well documented",{"type":26,"value":378},{"type":21,"tag":3596,"props":12713,"children":12715},{"id":12714},"single-file-components",[12716],{"type":26,"value":12717},"Single File Components",{"type":21,"tag":51,"props":12719,"children":12721},{"id":12720},"executive-summary-5",[12722],{"type":26,"value":12470},{"type":21,"tag":22,"props":12724,"children":12725},{},[12726],{"type":26,"value":12727},"Vue supports organizing structure, logic and styling together in the same file, enabling better organization of your application’s code that leads to less time wasted tracking down what piece of code is doing what in your project.",{"type":21,"tag":51,"props":12729,"children":12731},{"id":12730},"more-details-5",[12732],{"type":26,"value":12481},{"type":21,"tag":22,"props":12734,"children":12735},{},[12736,12742],{"type":21,"tag":29,"props":12737,"children":12740},{"href":12738,"rel":12739},"https://www.google.com/url?q=https://vuejs.org/v2/guide/single-file-components.html&sa=D&ust=1579208471604000",[93],[12741],{"type":26,"value":12717},{"type":26,"value":12743}," are useful units for organizing the structure, logic and styling of a reusable component into an atomic form, and make it much easier to reason about the operation and composition of a given component compared to a more traditional approach. Separation of concerns is maintained without requiring the elements of a given component to be spread across many different files.",{"type":21,"tag":22,"props":12745,"children":12746},{},[12747,12749,12756],{"type":26,"value":12748},"This approach borrows many of the best ideas of the standardized ",{"type":21,"tag":29,"props":12750,"children":12753},{"href":12751,"rel":12752},"https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/Web_Components&sa=D&ust=1579208471605000",[93],[12754],{"type":26,"value":12755},"Web Components",{"type":26,"value":12757},", without that standard’s compatibility limitations.",{"type":21,"tag":3596,"props":12759,"children":12761},{"id":12760},"familiar-templates",[12762],{"type":26,"value":12763},"Familiar Templates",{"type":21,"tag":51,"props":12765,"children":12767},{"id":12766},"executive-summary-6",[12768],{"type":26,"value":12470},{"type":21,"tag":22,"props":12770,"children":12771},{},[12772],{"type":26,"value":12773},"By using HTML and related familiar syntax, your project’s developers can start writing readable, easily understood application structure from day one.",{"type":21,"tag":51,"props":12775,"children":12777},{"id":12776},"more-details-6",[12778],{"type":26,"value":12481},{"type":21,"tag":22,"props":12780,"children":12781},{},[12782],{"type":26,"value":12783},"In place of React’s JSX, or yet another DSL, Vue allows you to use the familiar syntax of HTML in your templates. Similar to angular, directives live as attributes on your elements, and custom elements can be declared, imported and used like standard html tags. It’s elegant and effective.",{"type":21,"tag":22,"props":12785,"children":12786},{},[12787,12789,12796],{"type":26,"value":12788},"And if you’re a fan of ",{"type":21,"tag":29,"props":12790,"children":12793},{"href":12791,"rel":12792},"https://www.google.com/url?q=https://pugjs.org/api/getting-started.html&sa=D&ust=1579208471607000",[93],[12794],{"type":26,"value":12795},"Pug",{"type":26,"value":12797},", you can use that instead (or in addition to) your HTML templates, eliminating the verbosity of HTML without losing any of the familiar syntax.",{"type":21,"tag":22,"props":12799,"children":12800},{},[12801],{"type":26,"value":12802},"Vue does allow falling back to directly writing render functions, if for some reason your use case requires it, as well as supporting JSX if desired.",{"type":21,"tag":3596,"props":12804,"children":12806},{"id":12805},"integrated-toolchain",[12807],{"type":26,"value":12808},"Integrated Toolchain",{"type":21,"tag":51,"props":12810,"children":12812},{"id":12811},"executive-summary-7",[12813],{"type":26,"value":12470},{"type":21,"tag":22,"props":12815,"children":12816},{},[12817],{"type":26,"value":12818},"Vue comes packaged with a suite of tools that give your project’s developers a hand in getting your application code built and running, boosting productivity.",{"type":21,"tag":51,"props":12820,"children":12822},{"id":12821},"more-details-7",[12823],{"type":26,"value":12481},{"type":21,"tag":22,"props":12825,"children":12826},{},[12827,12829,12836],{"type":26,"value":12828},"In order to take advantage of some of the features of Vue, you need a toolchain to build the scripts, extract the various components, and tie everything together. Vue comes with toolchain support out-of-the-box via the ",{"type":21,"tag":29,"props":12830,"children":12833},{"href":12831,"rel":12832},"https://www.google.com/url?q=https://cli.vuejs.org/&sa=D&ust=1579208471609000",[93],[12834],{"type":26,"value":12835},"vue-cli",{"type":26,"value":12837},", which even provides a limited web-based GUI for customizing certain aspects of your project and adding community-provided plugins.",{"type":21,"tag":22,"props":12839,"children":12840},{},[12841,12843,12850,12852,12859],{"type":26,"value":12842},"Under the hood, vue-cli relies on ",{"type":21,"tag":29,"props":12844,"children":12847},{"href":12845,"rel":12846},"https://www.google.com/url?q=https://webpack.js.org/&sa=D&ust=1579208471610000",[93],[12848],{"type":26,"value":12849},"webpack",{"type":26,"value":12851},", and ",{"type":21,"tag":29,"props":12853,"children":12856},{"href":12854,"rel":12855},"https://www.google.com/url?q=https://cli.vuejs.org/guide/webpack.html&sa=D&ust=1579208471611000",[93],[12857],{"type":26,"value":12858},"provides guidance and tools",{"type":26,"value":12860}," for interacting with it if the standard configuration isn’t sufficient for your project’s needs.",{"type":21,"tag":3596,"props":12862,"children":12864},{"id":12863},"cross-platform-support",[12865],{"type":26,"value":12866},"Cross-Platform Support",{"type":21,"tag":51,"props":12868,"children":12870},{"id":12869},"executive-summary-8",[12871],{"type":26,"value":12470},{"type":21,"tag":22,"props":12873,"children":12874},{},[12875],{"type":26,"value":12876},"Vue can be used to create native mobile applications, and take advantage of the functionality of the platform that might not be available to web applications, like the accelerometer or push notifications.",{"type":21,"tag":51,"props":12878,"children":12880},{"id":12879},"more-details-8",[12881],{"type":26,"value":12481},{"type":21,"tag":22,"props":12883,"children":12884},{},[12885,12887,12894,12896,12903],{"type":26,"value":12886},"Via ",{"type":21,"tag":29,"props":12888,"children":12891},{"href":12889,"rel":12890},"https://www.google.com/url?q=https://vue-native.io/&sa=D&ust=1579208471613000",[93],[12892],{"type":26,"value":12893},"Vue Native",{"type":26,"value":12895},", developing cross-platform mobile applications using Vue is straightforward and powerful. Under the hood, Vue Native is really ",{"type":21,"tag":29,"props":12897,"children":12900},{"href":12898,"rel":12899},"https://www.google.com/url?q=https://vue-native.io/docs/index.html%23What-is-Vue-Native&sa=D&ust=1579208471613000",[93],[12901],{"type":26,"value":12902},"React Native",{"type":26,"value":12904},", providing a wrapper around the latter’s APIs, so all of the same Pros and Cons that apply to React Native apply here, with the significant pro that the continued development on React Native directly benefits the Vue Native platform as well.",{"type":21,"tag":3596,"props":12906,"children":12908},{"id":12907},"widely-used",[12909],{"type":26,"value":12910},"Widely Used",{"type":21,"tag":51,"props":12912,"children":12914},{"id":12913},"executive-summary-9",[12915],{"type":26,"value":12470},{"type":21,"tag":22,"props":12917,"children":12918},{},[12919],{"type":26,"value":12920},"Vue is widely used in web application development. Using technologies that are widely accepted reduces future project risks that components will not continue to be maintained or accessing knowledgeable developers for maintenance will become prohibitively expensive or difficult.",{"type":21,"tag":51,"props":12922,"children":12924},{"id":12923},"more-details-9",[12925],{"type":26,"value":12481},{"type":21,"tag":22,"props":12927,"children":12928},{},[12929],{"type":26,"value":12930},"Companies like Gitlab, Nintendo, Facebook and Netflix make use of  Vue in their development toolset.",{"type":21,"tag":22,"props":12932,"children":12933},{},[12934],{"type":21,"tag":29,"props":12935,"children":12938},{"href":12936,"rel":12937},"https://www.google.com/url?q=https://www.netguru.com/blog/13-top-companies-that-have-trusted-vue.js-examples-of-applications&sa=D&ust=1579208471615000",[93],[12939],{"type":26,"value":12940},"https://www.netguru.com/blog/13-top-companies-that-have-trusted-vue.js-examples-of-applications",{"type":21,"tag":22,"props":12942,"children":12943},{},[12944],{"type":21,"tag":29,"props":12945,"children":12948},{"href":12946,"rel":12947},"https://www.google.com/url?q=https://www.techuz.com/blog/top-9-websites-built-using-vue-js/&sa=D&ust=1579208471616000",[93],[12949],{"type":26,"value":12950},"https://www.techuz.com/blog/top-9-websites-built-using-vue-js/",{"type":21,"tag":3596,"props":12952,"children":12954},{"id":12953},"open-source",[12955],{"type":26,"value":12956},"Open Source",{"type":21,"tag":51,"props":12958,"children":12960},{"id":12959},"executive-summary-10",[12961],{"type":26,"value":12470},{"type":21,"tag":22,"props":12963,"children":12964},{},[12965],{"type":26,"value":12966},"Using an open source technology eliminates the future risk that a vendor will change licensing terms or go out of business which could lead to unexpected costs to transition to a different technology.",{"type":21,"tag":51,"props":12968,"children":12970},{"id":12969},"more-details-10",[12971],{"type":26,"value":12481},{"type":21,"tag":22,"props":12973,"children":12974},{},[12975,12977,12984,12986,12993],{"type":26,"value":12976},"Vue is ",{"type":21,"tag":29,"props":12978,"children":12981},{"href":12979,"rel":12980},"https://www.google.com/url?q=https://github.com/vuejs/vuejs.org/blob/master/LICENSE&sa=D&ust=1579208471618000",[93],[12982],{"type":26,"value":12983},"MIT licensed",{"type":26,"value":12985},".The ",{"type":21,"tag":29,"props":12987,"children":12990},{"href":12988,"rel":12989},"https://www.google.com/url?q=https://opensource.org/licenses/MIT&sa=D&ust=1579208471618000",[93],[12991],{"type":26,"value":12992},"MIT License",{"type":26,"value":12994}," is one of the most permissive open source licenses, allowing you to transform the original source, bundle it with your own application in any form, and does not require open sourcing the resulting application. The only requirement is to include the license and copyright notice originally bundled with the source code, making software under this license an excellent choice for inclusion in commercial products.",{"title":8,"searchDepth":254,"depth":254,"links":12996},[12997,13001,13005,13009,13013,13017,13021,13025,13029,13033,13037],{"id":12461,"depth":244,"text":12464,"children":12998},[12999,13000],{"id":12467,"depth":254,"text":12470},{"id":12478,"depth":254,"text":12481},{"id":12529,"depth":244,"text":12532,"children":13002},[13003,13004],{"id":12535,"depth":254,"text":12470},{"id":12545,"depth":254,"text":12481},{"id":12565,"depth":244,"text":12568,"children":13006},[13007,13008],{"id":12571,"depth":254,"text":12470},{"id":12581,"depth":254,"text":12481},{"id":12599,"depth":244,"text":12602,"children":13010},[13011,13012],{"id":12605,"depth":254,"text":12470},{"id":12615,"depth":254,"text":12481},{"id":12639,"depth":244,"text":12642,"children":13014},[13015,13016],{"id":12645,"depth":254,"text":12470},{"id":12655,"depth":254,"text":12481},{"id":12714,"depth":244,"text":12717,"children":13018},[13019,13020],{"id":12720,"depth":254,"text":12470},{"id":12730,"depth":254,"text":12481},{"id":12760,"depth":244,"text":12763,"children":13022},[13023,13024],{"id":12766,"depth":254,"text":12470},{"id":12776,"depth":254,"text":12481},{"id":12805,"depth":244,"text":12808,"children":13026},[13027,13028],{"id":12811,"depth":254,"text":12470},{"id":12821,"depth":254,"text":12481},{"id":12863,"depth":244,"text":12866,"children":13030},[13031,13032],{"id":12869,"depth":254,"text":12470},{"id":12879,"depth":254,"text":12481},{"id":12907,"depth":244,"text":12910,"children":13034},[13035,13036],{"id":12913,"depth":254,"text":12470},{"id":12923,"depth":254,"text":12481},{"id":12953,"depth":244,"text":12956,"children":13038},[13039,13040],{"id":12959,"depth":254,"text":12470},{"id":12969,"depth":254,"text":12481},"content:ckeefer:2020-1:Why Vue.md","ckeefer/2020-1/Why Vue.md","ckeefer/2020-1/Why Vue",{"user":3518,"name":3519},{"_path":13046,"_dir":13047,"_draft":7,"_partial":7,"_locale":8,"title":13048,"description":13049,"excerpt":13049,"image":13050,"publishDate":13051,"tags":13052,"body":13054,"_type":3511,"_id":15890,"_source":3513,"_file":15891,"_stem":15892,"_extension":3516,"author":15893},"/ckeefer/2019-1/unlockingwebaudio","2019-1","Unlocking Web Audio","\"It's going to be the coolest thing ever.\"","/ckeefer/2019-1/img/featured_image.jpg","2019-01-01",[12,13053],"audio",{"type":18,"children":13055,"toc":15883},[13056,13064,13069,13077,13082,13113,13126,13131,13136,13150,13156,13170,13193,13206,13229,13234,13710,13715,13754,13767,13789,13801,13843,13869,13874,13886,13892,13906,13911,13916,13921,13926,13932,13937,15774,15793,15804,15816,15829,15851,15856,15879],{"type":21,"tag":13057,"props":13058,"children":13059},"blockquote",{},[13060],{"type":21,"tag":22,"props":13061,"children":13062},{},[13063],{"type":26,"value":13049},{"type":21,"tag":22,"props":13065,"children":13066},{},[13067],{"type":26,"value":13068},"You know enough by now to be doubtful when a client makes this statement, but you're willing to entertain the idea that this may not, in fact, be a tragedy in the making.",{"type":21,"tag":13057,"props":13070,"children":13071},{},[13072],{"type":21,"tag":22,"props":13073,"children":13074},{},[13075],{"type":26,"value":13076},"\"It's going to be a music machine - like, full keyboard and everything - but each of the keys is going to be mapped to - wait for it - cat sounds! We'll call it the 'Meowsic Machine'! Oh, and we need it to be accessible to everyone via the Web. Which is easy, right?",{"type":21,"tag":22,"props":13078,"children":13079},{},[13080],{"type":26,"value":13081},"You are reminded that the universe can be a cruel place.",{"type":21,"tag":22,"props":13083,"children":13084},{},[13085,13087,13094,13096,13102,13104,13111],{"type":26,"value":13086},"It's now your job to make this happen. Over the course of a few posts, we're going to look at the ",{"type":21,"tag":29,"props":13088,"children":13091},{"href":13089,"rel":13090},"https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API",[93],[13092],{"type":26,"value":13093},"Web Audio API",{"type":26,"value":13095},", and build the Meowsic Machine together. In the process, we'll also enjoy a dalliance with ",{"type":21,"tag":29,"props":13097,"children":13099},{"href":11680,"rel":13098},[93],[13100],{"type":26,"value":13101},"Vue.js",{"type":26,"value":13103},", and dip our toes into the deep-end with ",{"type":21,"tag":29,"props":13105,"children":13108},{"href":13106,"rel":13107},"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers",[93],[13109],{"type":26,"value":13110},"Web Workers",{"type":26,"value":13112},". Today, we take the first step in this historic journey - convincing the browser to actually let us play sounds.",{"type":21,"tag":51,"props":13114,"children":13116},{"id":13115},"periodicwave-isnt-that-something-the-crowd-does-at-a-sports-game",[13117,13124],{"type":21,"tag":29,"props":13118,"children":13121},{"href":13119,"rel":13120},"https://developer.mozilla.org/en-US/docs/Web/API/PeriodicWave",[93],[13122],{"type":26,"value":13123},"PeriodicWave",{"type":26,"value":13125},"... Isn't that something the crowd does at a sports game?",{"type":21,"tag":22,"props":13127,"children":13128},{},[13129],{"type":26,"value":13130},"The Web Audio API is rather intimidating at first glance if you're not used to dealing with the low-level vagaries of audio - you feed in an appropriate file to the right OS API, it gets converted to PCM via magic, cat sounds come out of the speakers, right?",{"type":21,"tag":22,"props":13132,"children":13133},{},[13134],{"type":26,"value":13135},"(If you're coming from the world of dealing regularly with said vagaries, you're probably thinking \"this API is weird - there's a mix of high-level and low-level constructs, and why is setting up a standard ring buffer so hard?\" We'll get to those details/criticisms/workarounds in a future post).",{"type":21,"tag":22,"props":13137,"children":13138},{},[13139,13141,13148],{"type":26,"value":13140},"It is, however, an unquestionably better API for playing sounds - especially dynamically created sounds - than any web standard to date. It's also ",{"type":21,"tag":29,"props":13142,"children":13145},{"href":13143,"rel":13144},"https://caniuse.com/#search=web%20audio%20api",[93],[13146],{"type":26,"value":13147},"fairly well supported across the board",{"type":26,"value":13149}," by browsers, so there's no reason not to dig in and get to work.",{"type":21,"tag":51,"props":13151,"children":13153},{"id":13152},"kiss",[13154],{"type":26,"value":13155},"KISS",{"type":21,"tag":22,"props":13157,"children":13158},{},[13159,13161,13168],{"type":26,"value":13160},"So, let's start at the very beginning. If you haven't already, check out MDN's ",{"type":21,"tag":29,"props":13162,"children":13165},{"href":13163,"rel":13164},"https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Basic_concepts_behind_Web_Audio_API",[93],[13166],{"type":26,"value":13167},"Basic concepts behind Web Audio API",{"type":26,"value":13169}," article. It's a great introduction into some of the basics of not just the API, but playing sounds in general.",{"type":21,"tag":22,"props":13171,"children":13172},{},[13173,13175,13182,13184,13191],{"type":26,"value":13174},"We just want to play some cat sounds, though, not delve into the ",{"type":21,"tag":29,"props":13176,"children":13179},{"href":13177,"rel":13178},"https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem",[93],[13180],{"type":26,"value":13181},"Nyquist-Shannon Sampling Theorem",{"type":26,"value":13183},", or reprise the history of the ",{"type":21,"tag":29,"props":13185,"children":13188},{"href":13186,"rel":13187},"https://en.wikipedia.org/wiki/U-matic#Digital_audio",[93],[13189],{"type":26,"value":13190},"44.1kHz sampling frequency",{"type":26,"value":13192},". Can't we just skip to the good stuff?",{"type":21,"tag":22,"props":13194,"children":13195},{},[13196,13198,13204],{"type":26,"value":13197},"So, let's assume we have a sound file, ",{"type":21,"tag":63,"props":13199,"children":13201},{"className":13200},[],[13202],{"type":26,"value":13203},"meow.mp3",{"type":26,"value":13205},". We're going to rely on the browser have the right codec to decode this file, and we're not going to try and loop it, alter its gain, or perform any transformations of it—we're just going to play it.",{"type":21,"tag":22,"props":13207,"children":13208},{},[13209,13211,13218,13220,13227],{"type":26,"value":13210},"We could do something this simple with the ",{"type":21,"tag":29,"props":13212,"children":13215},{"href":13213,"rel":13214},"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio",[93],[13216],{"type":26,"value":13217},"Audio Element",{"type":26,"value":13219},"—but we want to do bigger and cooler things in the future. It is worth noting, however, that an audio element ",{"type":21,"tag":29,"props":13221,"children":13224},{"href":13222,"rel":13223},"https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createMediaElementSource",[93],[13225],{"type":26,"value":13226},"can be used as the source for an Web Audio Context",{"type":26,"value":13228}," - we may delve more into this in the future.",{"type":21,"tag":22,"props":13230,"children":13231},{},[13232],{"type":26,"value":13233},"For now, let's get this party started:",{"type":21,"tag":200,"props":13235,"children":13237},{"className":202,"code":13236,"language":12,"meta":8,"style":8},"const _audioCtx = new (window.AudioContext || window.webkitAudioContext)();\n\n    /**\n     * Allow the requester to load a new sfx, specifying a file to load.\n     * @param {string} sfxFile\n     * @returns {Promise\u003CArrayBuffer>}\n     */\n    async function load (sfxFile) {\n        const _sfxFile = await fetch(sfxFile);\n        return await _sfxFile.arrayBuffer();\n    };\n\n    /**\n     * Load and play the specified file.\n     * @param sfxFile\n     * @returns {Promise\u003CAudioBufferSourceNode>}\n     */\n    function play (sfxFile) {\n        return load(sfxFile).then((arrayBuffer) => {\n            const audioBuffer = _audioCtx.decodeAudioData(arrayBuffer);\n            const sourceNode = _audioCtx.createBufferSource();\n            sourceNode.buffer = audioBuffer;\n            sourceNode.connect(_audioCtx.destination);\n            sourceNode.start();\n\n            return sourceNode;\n        });\n    };\n",[13238],{"type":21,"tag":63,"props":13239,"children":13240},{"__ignoreMap":8},[13241,13276,13283,13291,13299,13322,13339,13347,13377,13407,13432,13440,13447,13454,13462,13477,13493,13500,13524,13564,13596,13625,13642,13659,13675,13682,13695,13703],{"type":21,"tag":209,"props":13242,"children":13243},{"class":211,"line":212},[13244,13248,13253,13257,13261,13266,13271],{"type":21,"tag":209,"props":13245,"children":13246},{"style":216},[13247],{"type":26,"value":260},{"type":21,"tag":209,"props":13249,"children":13250},{"style":263},[13251],{"type":26,"value":13252}," _audioCtx",{"type":21,"tag":209,"props":13254,"children":13255},{"style":216},[13256],{"type":26,"value":271},{"type":21,"tag":209,"props":13258,"children":13259},{"style":216},[13260],{"type":26,"value":6371},{"type":21,"tag":209,"props":13262,"children":13263},{"style":222},[13264],{"type":26,"value":13265}," (window.AudioContext ",{"type":21,"tag":209,"props":13267,"children":13268},{"style":216},[13269],{"type":26,"value":13270},"||",{"type":21,"tag":209,"props":13272,"children":13273},{"style":222},[13274],{"type":26,"value":13275}," window.webkitAudioContext)();\n",{"type":21,"tag":209,"props":13277,"children":13278},{"class":211,"line":244},[13279],{"type":21,"tag":209,"props":13280,"children":13281},{"emptyLinePlaceholder":248},[13282],{"type":26,"value":251},{"type":21,"tag":209,"props":13284,"children":13285},{"class":211,"line":254},[13286],{"type":21,"tag":209,"props":13287,"children":13288},{"style":448},[13289],{"type":26,"value":13290},"    /**\n",{"type":21,"tag":209,"props":13292,"children":13293},{"class":211,"line":279},[13294],{"type":21,"tag":209,"props":13295,"children":13296},{"style":448},[13297],{"type":26,"value":13298},"     * Allow the requester to load a new sfx, specifying a file to load.\n",{"type":21,"tag":209,"props":13300,"children":13301},{"class":211,"line":288},[13302,13307,13312,13317],{"type":21,"tag":209,"props":13303,"children":13304},{"style":448},[13305],{"type":26,"value":13306},"     * ",{"type":21,"tag":209,"props":13308,"children":13309},{"style":216},[13310],{"type":26,"value":13311},"@param",{"type":21,"tag":209,"props":13313,"children":13314},{"style":360},[13315],{"type":26,"value":13316}," {string}",{"type":21,"tag":209,"props":13318,"children":13319},{"style":222},[13320],{"type":26,"value":13321}," sfxFile\n",{"type":21,"tag":209,"props":13323,"children":13324},{"class":211,"line":307},[13325,13329,13334],{"type":21,"tag":209,"props":13326,"children":13327},{"style":448},[13328],{"type":26,"value":13306},{"type":21,"tag":209,"props":13330,"children":13331},{"style":216},[13332],{"type":26,"value":13333},"@returns",{"type":21,"tag":209,"props":13335,"children":13336},{"style":360},[13337],{"type":26,"value":13338}," {Promise\u003CArrayBuffer>}\n",{"type":21,"tag":209,"props":13340,"children":13341},{"class":211,"line":325},[13342],{"type":21,"tag":209,"props":13343,"children":13344},{"style":448},[13345],{"type":26,"value":13346},"     */\n",{"type":21,"tag":209,"props":13348,"children":13349},{"class":211,"line":334},[13350,13355,13359,13364,13368,13373],{"type":21,"tag":209,"props":13351,"children":13352},{"style":216},[13353],{"type":26,"value":13354},"    async",{"type":21,"tag":209,"props":13356,"children":13357},{"style":216},[13358],{"type":26,"value":4789},{"type":21,"tag":209,"props":13360,"children":13361},{"style":360},[13362],{"type":26,"value":13363}," load",{"type":21,"tag":209,"props":13365,"children":13366},{"style":222},[13367],{"type":26,"value":5569},{"type":21,"tag":209,"props":13369,"children":13370},{"style":400},[13371],{"type":26,"value":13372},"sfxFile",{"type":21,"tag":209,"props":13374,"children":13375},{"style":222},[13376],{"type":26,"value":5588},{"type":21,"tag":209,"props":13378,"children":13379},{"class":211,"line":343},[13380,13384,13389,13393,13397,13402],{"type":21,"tag":209,"props":13381,"children":13382},{"style":216},[13383],{"type":26,"value":3332},{"type":21,"tag":209,"props":13385,"children":13386},{"style":263},[13387],{"type":26,"value":13388}," _sfxFile",{"type":21,"tag":209,"props":13390,"children":13391},{"style":216},[13392],{"type":26,"value":271},{"type":21,"tag":209,"props":13394,"children":13395},{"style":216},[13396],{"type":26,"value":1437},{"type":21,"tag":209,"props":13398,"children":13399},{"style":360},[13400],{"type":26,"value":13401}," fetch",{"type":21,"tag":209,"props":13403,"children":13404},{"style":222},[13405],{"type":26,"value":13406},"(sfxFile);\n",{"type":21,"tag":209,"props":13408,"children":13409},{"class":211,"line":351},[13410,13414,13418,13423,13428],{"type":21,"tag":209,"props":13411,"children":13412},{"style":216},[13413],{"type":26,"value":3069},{"type":21,"tag":209,"props":13415,"children":13416},{"style":216},[13417],{"type":26,"value":1437},{"type":21,"tag":209,"props":13419,"children":13420},{"style":222},[13421],{"type":26,"value":13422}," _sfxFile.",{"type":21,"tag":209,"props":13424,"children":13425},{"style":360},[13426],{"type":26,"value":13427},"arrayBuffer",{"type":21,"tag":209,"props":13429,"children":13430},{"style":222},[13431],{"type":26,"value":4123},{"type":21,"tag":209,"props":13433,"children":13434},{"class":211,"line":444},[13435],{"type":21,"tag":209,"props":13436,"children":13437},{"style":222},[13438],{"type":26,"value":13439},"    };\n",{"type":21,"tag":209,"props":13441,"children":13442},{"class":211,"line":454},[13443],{"type":21,"tag":209,"props":13444,"children":13445},{"emptyLinePlaceholder":248},[13446],{"type":26,"value":251},{"type":21,"tag":209,"props":13448,"children":13449},{"class":211,"line":463},[13450],{"type":21,"tag":209,"props":13451,"children":13452},{"style":448},[13453],{"type":26,"value":13290},{"type":21,"tag":209,"props":13455,"children":13456},{"class":211,"line":472},[13457],{"type":21,"tag":209,"props":13458,"children":13459},{"style":448},[13460],{"type":26,"value":13461},"     * Load and play the specified file.\n",{"type":21,"tag":209,"props":13463,"children":13464},{"class":211,"line":480},[13465,13469,13473],{"type":21,"tag":209,"props":13466,"children":13467},{"style":448},[13468],{"type":26,"value":13306},{"type":21,"tag":209,"props":13470,"children":13471},{"style":216},[13472],{"type":26,"value":13311},{"type":21,"tag":209,"props":13474,"children":13475},{"style":222},[13476],{"type":26,"value":13321},{"type":21,"tag":209,"props":13478,"children":13479},{"class":211,"line":489},[13480,13484,13488],{"type":21,"tag":209,"props":13481,"children":13482},{"style":448},[13483],{"type":26,"value":13306},{"type":21,"tag":209,"props":13485,"children":13486},{"style":216},[13487],{"type":26,"value":13333},{"type":21,"tag":209,"props":13489,"children":13490},{"style":360},[13491],{"type":26,"value":13492}," {Promise\u003CAudioBufferSourceNode>}\n",{"type":21,"tag":209,"props":13494,"children":13495},{"class":211,"line":847},[13496],{"type":21,"tag":209,"props":13497,"children":13498},{"style":448},[13499],{"type":26,"value":13346},{"type":21,"tag":209,"props":13501,"children":13502},{"class":211,"line":860},[13503,13507,13512,13516,13520],{"type":21,"tag":209,"props":13504,"children":13505},{"style":216},[13506],{"type":26,"value":2981},{"type":21,"tag":209,"props":13508,"children":13509},{"style":360},[13510],{"type":26,"value":13511}," play",{"type":21,"tag":209,"props":13513,"children":13514},{"style":222},[13515],{"type":26,"value":5569},{"type":21,"tag":209,"props":13517,"children":13518},{"style":400},[13519],{"type":26,"value":13372},{"type":21,"tag":209,"props":13521,"children":13522},{"style":222},[13523],{"type":26,"value":5588},{"type":21,"tag":209,"props":13525,"children":13526},{"class":211,"line":877},[13527,13531,13535,13540,13544,13548,13552,13556,13560],{"type":21,"tag":209,"props":13528,"children":13529},{"style":216},[13530],{"type":26,"value":3069},{"type":21,"tag":209,"props":13532,"children":13533},{"style":360},[13534],{"type":26,"value":13363},{"type":21,"tag":209,"props":13536,"children":13537},{"style":222},[13538],{"type":26,"value":13539},"(sfxFile).",{"type":21,"tag":209,"props":13541,"children":13542},{"style":360},[13543],{"type":26,"value":2704},{"type":21,"tag":209,"props":13545,"children":13546},{"style":222},[13547],{"type":26,"value":2709},{"type":21,"tag":209,"props":13549,"children":13550},{"style":400},[13551],{"type":26,"value":13427},{"type":21,"tag":209,"props":13553,"children":13554},{"style":222},[13555],{"type":26,"value":432},{"type":21,"tag":209,"props":13557,"children":13558},{"style":216},[13559],{"type":26,"value":437},{"type":21,"tag":209,"props":13561,"children":13562},{"style":222},[13563],{"type":26,"value":276},{"type":21,"tag":209,"props":13565,"children":13566},{"class":211,"line":889},[13567,13572,13577,13581,13586,13591],{"type":21,"tag":209,"props":13568,"children":13569},{"style":216},[13570],{"type":26,"value":13571},"            const",{"type":21,"tag":209,"props":13573,"children":13574},{"style":263},[13575],{"type":26,"value":13576}," audioBuffer",{"type":21,"tag":209,"props":13578,"children":13579},{"style":216},[13580],{"type":26,"value":271},{"type":21,"tag":209,"props":13582,"children":13583},{"style":222},[13584],{"type":26,"value":13585}," _audioCtx.",{"type":21,"tag":209,"props":13587,"children":13588},{"style":360},[13589],{"type":26,"value":13590},"decodeAudioData",{"type":21,"tag":209,"props":13592,"children":13593},{"style":222},[13594],{"type":26,"value":13595},"(arrayBuffer);\n",{"type":21,"tag":209,"props":13597,"children":13598},{"class":211,"line":902},[13599,13603,13608,13612,13616,13621],{"type":21,"tag":209,"props":13600,"children":13601},{"style":216},[13602],{"type":26,"value":13571},{"type":21,"tag":209,"props":13604,"children":13605},{"style":263},[13606],{"type":26,"value":13607}," sourceNode",{"type":21,"tag":209,"props":13609,"children":13610},{"style":216},[13611],{"type":26,"value":271},{"type":21,"tag":209,"props":13613,"children":13614},{"style":222},[13615],{"type":26,"value":13585},{"type":21,"tag":209,"props":13617,"children":13618},{"style":360},[13619],{"type":26,"value":13620},"createBufferSource",{"type":21,"tag":209,"props":13622,"children":13623},{"style":222},[13624],{"type":26,"value":4123},{"type":21,"tag":209,"props":13626,"children":13627},{"class":211,"line":914},[13628,13633,13637],{"type":21,"tag":209,"props":13629,"children":13630},{"style":222},[13631],{"type":26,"value":13632},"            sourceNode.buffer ",{"type":21,"tag":209,"props":13634,"children":13635},{"style":216},[13636],{"type":26,"value":1432},{"type":21,"tag":209,"props":13638,"children":13639},{"style":222},[13640],{"type":26,"value":13641}," audioBuffer;\n",{"type":21,"tag":209,"props":13643,"children":13644},{"class":211,"line":922},[13645,13650,13654],{"type":21,"tag":209,"props":13646,"children":13647},{"style":222},[13648],{"type":26,"value":13649},"            sourceNode.",{"type":21,"tag":209,"props":13651,"children":13652},{"style":360},[13653],{"type":26,"value":4319},{"type":21,"tag":209,"props":13655,"children":13656},{"style":222},[13657],{"type":26,"value":13658},"(_audioCtx.destination);\n",{"type":21,"tag":209,"props":13660,"children":13661},{"class":211,"line":2312},[13662,13666,13671],{"type":21,"tag":209,"props":13663,"children":13664},{"style":222},[13665],{"type":26,"value":13649},{"type":21,"tag":209,"props":13667,"children":13668},{"style":360},[13669],{"type":26,"value":13670},"start",{"type":21,"tag":209,"props":13672,"children":13673},{"style":222},[13674],{"type":26,"value":4123},{"type":21,"tag":209,"props":13676,"children":13677},{"class":211,"line":2321},[13678],{"type":21,"tag":209,"props":13679,"children":13680},{"emptyLinePlaceholder":248},[13681],{"type":26,"value":251},{"type":21,"tag":209,"props":13683,"children":13684},{"class":211,"line":2372},[13685,13690],{"type":21,"tag":209,"props":13686,"children":13687},{"style":216},[13688],{"type":26,"value":13689},"            return",{"type":21,"tag":209,"props":13691,"children":13692},{"style":222},[13693],{"type":26,"value":13694}," sourceNode;\n",{"type":21,"tag":209,"props":13696,"children":13697},{"class":211,"line":2381},[13698],{"type":21,"tag":209,"props":13699,"children":13700},{"style":222},[13701],{"type":26,"value":13702},"        });\n",{"type":21,"tag":209,"props":13704,"children":13705},{"class":211,"line":2389},[13706],{"type":21,"tag":209,"props":13707,"children":13708},{"style":222},[13709],{"type":26,"value":13439},{"type":21,"tag":22,"props":13711,"children":13712},{},[13713],{"type":26,"value":13714},"Okay, let's unpack it:",{"type":21,"tag":22,"props":13716,"children":13717},{},[13718,13720,13727,13729,13736,13738,13744,13746,13752],{"type":26,"value":13719},"First, we create our ",{"type":21,"tag":29,"props":13721,"children":13724},{"href":13722,"rel":13723},"https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/AudioContext",[93],[13725],{"type":26,"value":13726},"audio context",{"type":26,"value":13728},"—if you've dealt with the ",{"type":21,"tag":29,"props":13730,"children":13733},{"href":13731,"rel":13732},"https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API",[93],[13734],{"type":26,"value":13735},"Canvas API",{"type":26,"value":13737}," this is familiar—this is going to be our audio processing graph object. We look for the standard ",{"type":21,"tag":63,"props":13739,"children":13741},{"className":13740},[],[13742],{"type":26,"value":13743},"AudioContext",{"type":26,"value":13745}," object first, and if we can't find, we try to fall back to the browser-prefixed version, ",{"type":21,"tag":63,"props":13747,"children":13749},{"className":13748},[],[13750],{"type":26,"value":13751},"webkitAudioContext",{"type":26,"value":13753},", to broaden our browser support.",{"type":21,"tag":22,"props":13755,"children":13756},{},[13757,13759,13765],{"type":26,"value":13758},"Then, we declare an ",{"type":21,"tag":29,"props":13760,"children":13762},{"href":11286,"rel":13761},[93],[13763],{"type":26,"value":13764},"async function",{"type":26,"value":13766},". This is part of the ECMAScript 2017 spec, but if you're able to use the Web Audio API, you're probably able to use this too. Async/Await is a wonderful bit of sugar over Promises, and you should take advantage of it if you can.",{"type":21,"tag":22,"props":13768,"children":13769},{},[13770,13772,13778,13780,13787],{"type":26,"value":13771},"Within this async function, ",{"type":21,"tag":63,"props":13773,"children":13775},{"className":13774},[],[13776],{"type":26,"value":13777},"load",{"type":26,"value":13779},", we rely on the ",{"type":21,"tag":29,"props":13781,"children":13784},{"href":13782,"rel":13783},"https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API",[93],[13785],{"type":26,"value":13786},"Fetch API",{"type":26,"value":13788}," to go and get the file for us (my, aren't we linking to MDN an awful lot in this post!). There's no reason we couldn't use XMLHttpRequest here instead, but fetch is wonderfully compact and again, if you can use Web Audio, you can almost certainly use fetch.",{"type":21,"tag":22,"props":13790,"children":13791},{},[13792,13793,13799],{"type":26,"value":27},{"type":21,"tag":29,"props":13794,"children":13797},{"href":13795,"rel":13796},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await",[93],[13798],{"type":26,"value":11276},{"type":26,"value":13800}," the response from fetch, and then get the response body as an array buffer and return it.",{"type":21,"tag":22,"props":13802,"children":13803},{},[13804,13805,13811,13813,13818,13820,13825,13827,13834,13836,13842],{"type":26,"value":1604},{"type":21,"tag":63,"props":13806,"children":13808},{"className":13807},[],[13809],{"type":26,"value":13810},"play",{"type":26,"value":13812},", we perform both the loading and playing, so our api becomes just a call to ",{"type":21,"tag":63,"props":13814,"children":13816},{"className":13815},[],[13817],{"type":26,"value":13810},{"type":26,"value":13819}," with the file location and wait on the promise returned from our async ",{"type":21,"tag":63,"props":13821,"children":13823},{"className":13822},[],[13824],{"type":26,"value":13777},{"type":26,"value":13826}," function. Then, we need to decode the audio data, turning it into PCM, and then create an ",{"type":21,"tag":29,"props":13828,"children":13831},{"href":13829,"rel":13830},"https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode",[93],[13832],{"type":26,"value":13833},"AudioBufferSourceNode",{"type":26,"value":13835}," from the return (that's the call to ",{"type":21,"tag":63,"props":13837,"children":13839},{"className":13838},[],[13840],{"type":26,"value":13841},"_audioCtx.createBufferSource()",{"type":26,"value":2699},{"type":21,"tag":22,"props":13844,"children":13845},{},[13846,13848,13853,13855,13860,13862,13867],{"type":26,"value":13847},"We then set our buffer source to draw from the audio buffer we've created out of the array buffer we created out of the file (",{"type":21,"tag":1084,"props":13849,"children":13850},{},[13851],{"type":26,"value":13852},"whew",{"type":26,"value":13854},"), and connect it to the destination of the audio context (e.g. the audio context output, like speakers), and ",{"type":21,"tag":11881,"props":13856,"children":13857},{},[13858],{"type":26,"value":13859},"finally",{"type":26,"value":13861}," we can call ",{"type":21,"tag":63,"props":13863,"children":13865},{"className":13864},[],[13866],{"type":26,"value":13670},{"type":26,"value":13868}," on the sourceNode to have it start pumping its audio into the audio context.",{"type":21,"tag":22,"props":13870,"children":13871},{},[13872],{"type":26,"value":13873},"Easy-peasy.",{"type":21,"tag":22,"props":13875,"children":13876},{},[13877,13879,13884],{"type":26,"value":13878},"Except... if you do this with your ",{"type":21,"tag":63,"props":13880,"children":13882},{"className":13881},[],[13883],{"type":26,"value":13203},{"type":26,"value":13885}," file, you won't hear anything. The file will successfully be fetched, loaded, decoded... but not played. What's going on?",{"type":21,"tag":51,"props":13887,"children":13889},{"id":13888},"now-hear-this",[13890],{"type":26,"value":13891},"Now Hear This",{"type":21,"tag":22,"props":13893,"children":13894},{},[13895,13897,13904],{"type":26,"value":13896},"You've hit the browser's ",{"type":21,"tag":29,"props":13898,"children":13901},{"href":13899,"rel":13900},"https://developers.google.com/web/updates/2018/11/web-audio-autoplay",[93],[13902],{"type":26,"value":13903},"autoplay policy",{"type":26,"value":13905},". Nobody likes opening a new tab and having whatever website they've just navigated to start blaring their addiction to spongebob to the whole office. So, most browsers have various autoplay policies which restrict what the page can do with media before the user has interacted with it.",{"type":21,"tag":22,"props":13907,"children":13908},{},[13909],{"type":26,"value":13910},"For our purposes today, this boils down to not being able to play audio until the user has interacted with the page in some easily measurable way - that is, clicked/tapped on it.",{"type":21,"tag":22,"props":13912,"children":13913},{},[13914],{"type":26,"value":13915},"So, in order to unlock our audio, we'll need to listen for that interaction, and wait to play our sounds until after we've received it. We don't want to have to download and play real audio to make that happen, so we'll need to create an empty sound buffer that we can use as our stalking horse.",{"type":21,"tag":22,"props":13917,"children":13918},{},[13919],{"type":26,"value":13920},"Also, if you tried the above example on iOS, it would have failed regardless of autoplay policies, because iOS is a special snowflake and hasn't updated their audio APIs in a while. Let's handle that too.",{"type":21,"tag":22,"props":13922,"children":13923},{},[13924],{"type":26,"value":13925},"Oh, and it would be nice not to need to re-download a file every time we want to play it if we anticipate needing to play it multiple times. Let's throw that in there for good measure.",{"type":21,"tag":51,"props":13927,"children":13929},{"id":13928},"kiss-redux",[13930],{"type":26,"value":13931},"KISS Redux",{"type":21,"tag":22,"props":13933,"children":13934},{},[13935],{"type":26,"value":13936},"Let's update our example above, and we'll walk through the new bits together:",{"type":21,"tag":200,"props":13938,"children":13940},{"className":202,"code":13939,"language":12,"meta":8,"style":8},"(function() {\n    const _af_buffers = new Map(),\n        _audioCtx = new (window.AudioContext || window.webkitAudioContext)();\n    let _isUnlocked = false;\n\n    /**\n     * A shim to handle browsers which still expect the old callback-based decodeAudioData,\n     * notably iOS Safari - as usual.\n     * @param arraybuffer\n     * @returns {Promise\u003Cany>}\n     * @private\n     */\n    function _decodeShim(arraybuffer) {\n        return new Promise((resolve, reject) => {\n            _audioCtx.decodeAudioData(arraybuffer, (buffer) => {\n                return resolve(buffer);\n            }, (err) => {\n                return reject(err);\n            });\n        });\n    }\n\n    /**\n     * Some browsers/devices will only allow audio to be played after a user interaction.\n     * Attempt to automatically unlock audio on the first user interaction.\n     * Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/\n     * Borrows in part from: https://github.com/goldfire/howler.js/blob/master/src/howler.core.js\n     */\n    function _unlockAudio() {\n        if (_isUnlocked) return;\n\n        // Scratch buffer to prevent memory leaks on iOS.\n        // See: https://stackoverflow.com/questions/24119684/web-audio-api-memory-leaks-on-mobile-platforms\n        const _scratchBuffer = _audioCtx.createBuffer(1, 1, 22050);\n\n        // We call this when user interaction will allow us to unlock\n        // the audio API.\n        var unlock = function (e) {\n            var source = _audioCtx.createBufferSource();\n            source.buffer = _scratchBuffer;\n            source.connect(_audioCtx.destination);\n\n            // Play the empty buffer.\n            source.start(0);\n\n            // Calling resume() on a stack initiated by user gesture is\n            // what actually unlocks the audio on Chrome >= 55.\n            if (typeof _audioCtx.resume === 'function') {\n                _audioCtx.resume();\n            }\n\n            // Once the source has fired the onended event, indicating it did indeed play,\n            // we can know that the audio API is now unlocked.\n            source.onended = function () {\n                source.disconnect(0);\n\n                // Don't bother trying to unlock the API more than once!\n                _isUnlocked = true;\n\n                // Remove the click/touch listeners.\n                document.removeEventListener('touchstart', unlock, true);\n                document.removeEventListener('touchend', unlock, true);\n                document.removeEventListener('click', unlock, true);\n            };\n        };\n\n        // Setup click/touch listeners to capture the first interaction\n        // within this context.\n        document.addEventListener('touchstart', unlock, true);\n        document.addEventListener('touchend', unlock, true);\n        document.addEventListener('click', unlock, true);\n    }\n\n    /**\n     * Allow the requester to load a new sfx, specifying a file to load.\n     * We store the decoded audio data for future (re-)use.\n     * @param {string} sfxFile\n     * @returns {Promise\u003CAudioBuffer>}\n     */\n    async function load (sfxFile) {\n        if (_af_buffers.has(sfxFile)) {\n            return _af_buffers.get(sfxFile);\n        }\n\n        const _sfxFile = await fetch(sfxFile);\n        const arraybuffer = await _sfxFile.arrayBuffer();\n        let audiobuffer;\n\n        try {\n            audiobuffer = await _audioCtx.decodeAudioData(arraybuffer);\n        } catch (e) {\n            // Browser wants older callback based usage of decodeAudioData\n            audiobuffer = await _decodeShim(arraybuffer);\n        }\n\n        _af_buffers.set(sfxFile, audiobuffer);\n\n        return audiobuffer;\n    };\n\n    /**\n     * Play the specified file, loading it first - either retrieving it from the saved buffers, or fetching\n     * it from the network.\n     * @param sfxFile\n     * @returns {Promise\u003CAudioBufferSourceNode>}\n     */\n    function play (sfxFile) {\n        return load(sfxFile).then((audioBuffer) => {\n            const sourceNode = _audioCtx.createBufferSource();\n            sourceNode.buffer = audioBuffer;\n            sourceNode.connect(_audioCtx.destination);\n            sourceNode.start();\n\n            return sourceNode;\n        });\n    };\n\n    _unlockAudio();\n}());\n\n",[13941],{"type":21,"tag":63,"props":13942,"children":13943},{"__ignoreMap":8},[13944,13959,13989,14017,14043,14050,14057,14065,14073,14089,14105,14117,14124,14149,14195,14229,14247,14272,14288,14295,14302,14309,14316,14323,14331,14339,14347,14355,14362,14378,14398,14405,14413,14421,14475,14482,14490,14498,14532,14561,14578,14594,14601,14609,14632,14639,14647,14655,14690,14707,14715,14722,14730,14738,14763,14788,14795,14803,14824,14831,14839,14874,14906,14938,14947,14956,14964,14973,14982,15016,15048,15080,15088,15096,15104,15112,15121,15141,15158,15166,15194,15217,15238,15246,15254,15282,15315,15329,15337,15350,15380,15398,15407,15431,15439,15447,15465,15473,15485,15493,15501,15509,15518,15527,15543,15559,15567,15591,15632,15660,15676,15692,15708,15716,15728,15736,15744,15752,15765],{"type":21,"tag":209,"props":13945,"children":13946},{"class":211,"line":212},[13947,13951,13955],{"type":21,"tag":209,"props":13948,"children":13949},{"style":222},[13950],{"type":26,"value":368},{"type":21,"tag":209,"props":13952,"children":13953},{"style":216},[13954],{"type":26,"value":4622},{"type":21,"tag":209,"props":13956,"children":13957},{"style":222},[13958],{"type":26,"value":4799},{"type":21,"tag":209,"props":13960,"children":13961},{"class":211,"line":244},[13962,13966,13971,13975,13979,13984],{"type":21,"tag":209,"props":13963,"children":13964},{"style":216},[13965],{"type":26,"value":1268},{"type":21,"tag":209,"props":13967,"children":13968},{"style":263},[13969],{"type":26,"value":13970}," _af_buffers",{"type":21,"tag":209,"props":13972,"children":13973},{"style":216},[13974],{"type":26,"value":271},{"type":21,"tag":209,"props":13976,"children":13977},{"style":216},[13978],{"type":26,"value":6371},{"type":21,"tag":209,"props":13980,"children":13981},{"style":360},[13982],{"type":26,"value":13983}," Map",{"type":21,"tag":209,"props":13985,"children":13986},{"style":222},[13987],{"type":26,"value":13988},"(),\n",{"type":21,"tag":209,"props":13990,"children":13991},{"class":211,"line":254},[13992,13997,14001,14005,14009,14013],{"type":21,"tag":209,"props":13993,"children":13994},{"style":263},[13995],{"type":26,"value":13996},"        _audioCtx",{"type":21,"tag":209,"props":13998,"children":13999},{"style":216},[14000],{"type":26,"value":271},{"type":21,"tag":209,"props":14002,"children":14003},{"style":216},[14004],{"type":26,"value":6371},{"type":21,"tag":209,"props":14006,"children":14007},{"style":222},[14008],{"type":26,"value":13265},{"type":21,"tag":209,"props":14010,"children":14011},{"style":216},[14012],{"type":26,"value":13270},{"type":21,"tag":209,"props":14014,"children":14015},{"style":222},[14016],{"type":26,"value":13275},{"type":21,"tag":209,"props":14018,"children":14019},{"class":211,"line":279},[14020,14025,14030,14034,14039],{"type":21,"tag":209,"props":14021,"children":14022},{"style":216},[14023],{"type":26,"value":14024},"    let",{"type":21,"tag":209,"props":14026,"children":14027},{"style":222},[14028],{"type":26,"value":14029}," _isUnlocked ",{"type":21,"tag":209,"props":14031,"children":14032},{"style":216},[14033],{"type":26,"value":1432},{"type":21,"tag":209,"props":14035,"children":14036},{"style":263},[14037],{"type":26,"value":14038}," false",{"type":21,"tag":209,"props":14040,"children":14041},{"style":222},[14042],{"type":26,"value":241},{"type":21,"tag":209,"props":14044,"children":14045},{"class":211,"line":288},[14046],{"type":21,"tag":209,"props":14047,"children":14048},{"emptyLinePlaceholder":248},[14049],{"type":26,"value":251},{"type":21,"tag":209,"props":14051,"children":14052},{"class":211,"line":307},[14053],{"type":21,"tag":209,"props":14054,"children":14055},{"style":448},[14056],{"type":26,"value":13290},{"type":21,"tag":209,"props":14058,"children":14059},{"class":211,"line":325},[14060],{"type":21,"tag":209,"props":14061,"children":14062},{"style":448},[14063],{"type":26,"value":14064},"     * A shim to handle browsers which still expect the old callback-based decodeAudioData,\n",{"type":21,"tag":209,"props":14066,"children":14067},{"class":211,"line":334},[14068],{"type":21,"tag":209,"props":14069,"children":14070},{"style":448},[14071],{"type":26,"value":14072},"     * notably iOS Safari - as usual.\n",{"type":21,"tag":209,"props":14074,"children":14075},{"class":211,"line":343},[14076,14080,14084],{"type":21,"tag":209,"props":14077,"children":14078},{"style":448},[14079],{"type":26,"value":13306},{"type":21,"tag":209,"props":14081,"children":14082},{"style":216},[14083],{"type":26,"value":13311},{"type":21,"tag":209,"props":14085,"children":14086},{"style":222},[14087],{"type":26,"value":14088}," arraybuffer\n",{"type":21,"tag":209,"props":14090,"children":14091},{"class":211,"line":351},[14092,14096,14100],{"type":21,"tag":209,"props":14093,"children":14094},{"style":448},[14095],{"type":26,"value":13306},{"type":21,"tag":209,"props":14097,"children":14098},{"style":216},[14099],{"type":26,"value":13333},{"type":21,"tag":209,"props":14101,"children":14102},{"style":360},[14103],{"type":26,"value":14104}," {Promise\u003Cany>}\n",{"type":21,"tag":209,"props":14106,"children":14107},{"class":211,"line":444},[14108,14112],{"type":21,"tag":209,"props":14109,"children":14110},{"style":448},[14111],{"type":26,"value":13306},{"type":21,"tag":209,"props":14113,"children":14114},{"style":216},[14115],{"type":26,"value":14116},"@private\n",{"type":21,"tag":209,"props":14118,"children":14119},{"class":211,"line":454},[14120],{"type":21,"tag":209,"props":14121,"children":14122},{"style":448},[14123],{"type":26,"value":13346},{"type":21,"tag":209,"props":14125,"children":14126},{"class":211,"line":463},[14127,14131,14136,14140,14145],{"type":21,"tag":209,"props":14128,"children":14129},{"style":216},[14130],{"type":26,"value":2981},{"type":21,"tag":209,"props":14132,"children":14133},{"style":360},[14134],{"type":26,"value":14135}," _decodeShim",{"type":21,"tag":209,"props":14137,"children":14138},{"style":222},[14139],{"type":26,"value":368},{"type":21,"tag":209,"props":14141,"children":14142},{"style":400},[14143],{"type":26,"value":14144},"arraybuffer",{"type":21,"tag":209,"props":14146,"children":14147},{"style":222},[14148],{"type":26,"value":5588},{"type":21,"tag":209,"props":14150,"children":14151},{"class":211,"line":472},[14152,14156,14160,14165,14169,14174,14178,14183,14187,14191],{"type":21,"tag":209,"props":14153,"children":14154},{"style":216},[14155],{"type":26,"value":3069},{"type":21,"tag":209,"props":14157,"children":14158},{"style":216},[14159],{"type":26,"value":6371},{"type":21,"tag":209,"props":14161,"children":14162},{"style":263},[14163],{"type":26,"value":14164}," Promise",{"type":21,"tag":209,"props":14166,"children":14167},{"style":222},[14168],{"type":26,"value":2709},{"type":21,"tag":209,"props":14170,"children":14171},{"style":400},[14172],{"type":26,"value":14173},"resolve",{"type":21,"tag":209,"props":14175,"children":14176},{"style":222},[14177],{"type":26,"value":408},{"type":21,"tag":209,"props":14179,"children":14180},{"style":400},[14181],{"type":26,"value":14182},"reject",{"type":21,"tag":209,"props":14184,"children":14185},{"style":222},[14186],{"type":26,"value":432},{"type":21,"tag":209,"props":14188,"children":14189},{"style":216},[14190],{"type":26,"value":437},{"type":21,"tag":209,"props":14192,"children":14193},{"style":222},[14194],{"type":26,"value":276},{"type":21,"tag":209,"props":14196,"children":14197},{"class":211,"line":480},[14198,14203,14207,14212,14217,14221,14225],{"type":21,"tag":209,"props":14199,"children":14200},{"style":222},[14201],{"type":26,"value":14202},"            _audioCtx.",{"type":21,"tag":209,"props":14204,"children":14205},{"style":360},[14206],{"type":26,"value":13590},{"type":21,"tag":209,"props":14208,"children":14209},{"style":222},[14210],{"type":26,"value":14211},"(arraybuffer, (",{"type":21,"tag":209,"props":14213,"children":14214},{"style":400},[14215],{"type":26,"value":14216},"buffer",{"type":21,"tag":209,"props":14218,"children":14219},{"style":222},[14220],{"type":26,"value":432},{"type":21,"tag":209,"props":14222,"children":14223},{"style":216},[14224],{"type":26,"value":437},{"type":21,"tag":209,"props":14226,"children":14227},{"style":222},[14228],{"type":26,"value":276},{"type":21,"tag":209,"props":14230,"children":14231},{"class":211,"line":489},[14232,14237,14242],{"type":21,"tag":209,"props":14233,"children":14234},{"style":216},[14235],{"type":26,"value":14236},"                return",{"type":21,"tag":209,"props":14238,"children":14239},{"style":360},[14240],{"type":26,"value":14241}," resolve",{"type":21,"tag":209,"props":14243,"children":14244},{"style":222},[14245],{"type":26,"value":14246},"(buffer);\n",{"type":21,"tag":209,"props":14248,"children":14249},{"class":211,"line":847},[14250,14255,14260,14264,14268],{"type":21,"tag":209,"props":14251,"children":14252},{"style":222},[14253],{"type":26,"value":14254},"            }, (",{"type":21,"tag":209,"props":14256,"children":14257},{"style":400},[14258],{"type":26,"value":14259},"err",{"type":21,"tag":209,"props":14261,"children":14262},{"style":222},[14263],{"type":26,"value":432},{"type":21,"tag":209,"props":14265,"children":14266},{"style":216},[14267],{"type":26,"value":437},{"type":21,"tag":209,"props":14269,"children":14270},{"style":222},[14271],{"type":26,"value":276},{"type":21,"tag":209,"props":14273,"children":14274},{"class":211,"line":860},[14275,14279,14284],{"type":21,"tag":209,"props":14276,"children":14277},{"style":216},[14278],{"type":26,"value":14236},{"type":21,"tag":209,"props":14280,"children":14281},{"style":360},[14282],{"type":26,"value":14283}," reject",{"type":21,"tag":209,"props":14285,"children":14286},{"style":222},[14287],{"type":26,"value":6701},{"type":21,"tag":209,"props":14289,"children":14290},{"class":211,"line":877},[14291],{"type":21,"tag":209,"props":14292,"children":14293},{"style":222},[14294],{"type":26,"value":2782},{"type":21,"tag":209,"props":14296,"children":14297},{"class":211,"line":889},[14298],{"type":21,"tag":209,"props":14299,"children":14300},{"style":222},[14301],{"type":26,"value":13702},{"type":21,"tag":209,"props":14303,"children":14304},{"class":211,"line":902},[14305],{"type":21,"tag":209,"props":14306,"children":14307},{"style":222},[14308],{"type":26,"value":331},{"type":21,"tag":209,"props":14310,"children":14311},{"class":211,"line":914},[14312],{"type":21,"tag":209,"props":14313,"children":14314},{"emptyLinePlaceholder":248},[14315],{"type":26,"value":251},{"type":21,"tag":209,"props":14317,"children":14318},{"class":211,"line":922},[14319],{"type":21,"tag":209,"props":14320,"children":14321},{"style":448},[14322],{"type":26,"value":13290},{"type":21,"tag":209,"props":14324,"children":14325},{"class":211,"line":2312},[14326],{"type":21,"tag":209,"props":14327,"children":14328},{"style":448},[14329],{"type":26,"value":14330},"     * Some browsers/devices will only allow audio to be played after a user interaction.\n",{"type":21,"tag":209,"props":14332,"children":14333},{"class":211,"line":2321},[14334],{"type":21,"tag":209,"props":14335,"children":14336},{"style":448},[14337],{"type":26,"value":14338},"     * Attempt to automatically unlock audio on the first user interaction.\n",{"type":21,"tag":209,"props":14340,"children":14341},{"class":211,"line":2372},[14342],{"type":21,"tag":209,"props":14343,"children":14344},{"style":448},[14345],{"type":26,"value":14346},"     * Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/\n",{"type":21,"tag":209,"props":14348,"children":14349},{"class":211,"line":2381},[14350],{"type":21,"tag":209,"props":14351,"children":14352},{"style":448},[14353],{"type":26,"value":14354},"     * Borrows in part from: https://github.com/goldfire/howler.js/blob/master/src/howler.core.js\n",{"type":21,"tag":209,"props":14356,"children":14357},{"class":211,"line":2389},[14358],{"type":21,"tag":209,"props":14359,"children":14360},{"style":448},[14361],{"type":26,"value":13346},{"type":21,"tag":209,"props":14363,"children":14364},{"class":211,"line":2397},[14365,14369,14374],{"type":21,"tag":209,"props":14366,"children":14367},{"style":216},[14368],{"type":26,"value":2981},{"type":21,"tag":209,"props":14370,"children":14371},{"style":360},[14372],{"type":26,"value":14373}," _unlockAudio",{"type":21,"tag":209,"props":14375,"children":14376},{"style":222},[14377],{"type":26,"value":4799},{"type":21,"tag":209,"props":14379,"children":14380},{"class":211,"line":2406},[14381,14385,14390,14394],{"type":21,"tag":209,"props":14382,"children":14383},{"style":216},[14384],{"type":26,"value":6334},{"type":21,"tag":209,"props":14386,"children":14387},{"style":222},[14388],{"type":26,"value":14389}," (_isUnlocked) ",{"type":21,"tag":209,"props":14391,"children":14392},{"style":216},[14393],{"type":26,"value":8982},{"type":21,"tag":209,"props":14395,"children":14396},{"style":222},[14397],{"type":26,"value":241},{"type":21,"tag":209,"props":14399,"children":14400},{"class":211,"line":2415},[14401],{"type":21,"tag":209,"props":14402,"children":14403},{"emptyLinePlaceholder":248},[14404],{"type":26,"value":251},{"type":21,"tag":209,"props":14406,"children":14407},{"class":211,"line":2424},[14408],{"type":21,"tag":209,"props":14409,"children":14410},{"style":448},[14411],{"type":26,"value":14412},"        // Scratch buffer to prevent memory leaks on iOS.\n",{"type":21,"tag":209,"props":14414,"children":14415},{"class":211,"line":2433},[14416],{"type":21,"tag":209,"props":14417,"children":14418},{"style":448},[14419],{"type":26,"value":14420},"        // See: https://stackoverflow.com/questions/24119684/web-audio-api-memory-leaks-on-mobile-platforms\n",{"type":21,"tag":209,"props":14422,"children":14423},{"class":211,"line":2442},[14424,14428,14433,14437,14441,14446,14450,14454,14458,14462,14466,14471],{"type":21,"tag":209,"props":14425,"children":14426},{"style":216},[14427],{"type":26,"value":3332},{"type":21,"tag":209,"props":14429,"children":14430},{"style":263},[14431],{"type":26,"value":14432}," _scratchBuffer",{"type":21,"tag":209,"props":14434,"children":14435},{"style":216},[14436],{"type":26,"value":271},{"type":21,"tag":209,"props":14438,"children":14439},{"style":222},[14440],{"type":26,"value":13585},{"type":21,"tag":209,"props":14442,"children":14443},{"style":360},[14444],{"type":26,"value":14445},"createBuffer",{"type":21,"tag":209,"props":14447,"children":14448},{"style":222},[14449],{"type":26,"value":368},{"type":21,"tag":209,"props":14451,"children":14452},{"style":263},[14453],{"type":26,"value":3224},{"type":21,"tag":209,"props":14455,"children":14456},{"style":222},[14457],{"type":26,"value":408},{"type":21,"tag":209,"props":14459,"children":14460},{"style":263},[14461],{"type":26,"value":3224},{"type":21,"tag":209,"props":14463,"children":14464},{"style":222},[14465],{"type":26,"value":408},{"type":21,"tag":209,"props":14467,"children":14468},{"style":263},[14469],{"type":26,"value":14470},"22050",{"type":21,"tag":209,"props":14472,"children":14473},{"style":222},[14474],{"type":26,"value":2608},{"type":21,"tag":209,"props":14476,"children":14477},{"class":211,"line":2471},[14478],{"type":21,"tag":209,"props":14479,"children":14480},{"emptyLinePlaceholder":248},[14481],{"type":26,"value":251},{"type":21,"tag":209,"props":14483,"children":14484},{"class":211,"line":2480},[14485],{"type":21,"tag":209,"props":14486,"children":14487},{"style":448},[14488],{"type":26,"value":14489},"        // We call this when user interaction will allow us to unlock\n",{"type":21,"tag":209,"props":14491,"children":14492},{"class":211,"line":2489},[14493],{"type":21,"tag":209,"props":14494,"children":14495},{"style":448},[14496],{"type":26,"value":14497},"        // the audio API.\n",{"type":21,"tag":209,"props":14499,"children":14500},{"class":211,"line":2516},[14501,14506,14511,14515,14519,14523,14528],{"type":21,"tag":209,"props":14502,"children":14503},{"style":216},[14504],{"type":26,"value":14505},"        var",{"type":21,"tag":209,"props":14507,"children":14508},{"style":360},[14509],{"type":26,"value":14510}," unlock",{"type":21,"tag":209,"props":14512,"children":14513},{"style":216},[14514],{"type":26,"value":271},{"type":21,"tag":209,"props":14516,"children":14517},{"style":216},[14518],{"type":26,"value":4789},{"type":21,"tag":209,"props":14520,"children":14521},{"style":222},[14522],{"type":26,"value":5569},{"type":21,"tag":209,"props":14524,"children":14525},{"style":400},[14526],{"type":26,"value":14527},"e",{"type":21,"tag":209,"props":14529,"children":14530},{"style":222},[14531],{"type":26,"value":5588},{"type":21,"tag":209,"props":14533,"children":14534},{"class":211,"line":2525},[14535,14540,14545,14549,14553,14557],{"type":21,"tag":209,"props":14536,"children":14537},{"style":216},[14538],{"type":26,"value":14539},"            var",{"type":21,"tag":209,"props":14541,"children":14542},{"style":222},[14543],{"type":26,"value":14544}," source ",{"type":21,"tag":209,"props":14546,"children":14547},{"style":216},[14548],{"type":26,"value":1432},{"type":21,"tag":209,"props":14550,"children":14551},{"style":222},[14552],{"type":26,"value":13585},{"type":21,"tag":209,"props":14554,"children":14555},{"style":360},[14556],{"type":26,"value":13620},{"type":21,"tag":209,"props":14558,"children":14559},{"style":222},[14560],{"type":26,"value":4123},{"type":21,"tag":209,"props":14562,"children":14563},{"class":211,"line":2533},[14564,14569,14573],{"type":21,"tag":209,"props":14565,"children":14566},{"style":222},[14567],{"type":26,"value":14568},"            source.buffer ",{"type":21,"tag":209,"props":14570,"children":14571},{"style":216},[14572],{"type":26,"value":1432},{"type":21,"tag":209,"props":14574,"children":14575},{"style":222},[14576],{"type":26,"value":14577}," _scratchBuffer;\n",{"type":21,"tag":209,"props":14579,"children":14580},{"class":211,"line":2542},[14581,14586,14590],{"type":21,"tag":209,"props":14582,"children":14583},{"style":222},[14584],{"type":26,"value":14585},"            source.",{"type":21,"tag":209,"props":14587,"children":14588},{"style":360},[14589],{"type":26,"value":4319},{"type":21,"tag":209,"props":14591,"children":14592},{"style":222},[14593],{"type":26,"value":13658},{"type":21,"tag":209,"props":14595,"children":14596},{"class":211,"line":2550},[14597],{"type":21,"tag":209,"props":14598,"children":14599},{"emptyLinePlaceholder":248},[14600],{"type":26,"value":251},{"type":21,"tag":209,"props":14602,"children":14603},{"class":211,"line":2564},[14604],{"type":21,"tag":209,"props":14605,"children":14606},{"style":448},[14607],{"type":26,"value":14608},"            // Play the empty buffer.\n",{"type":21,"tag":209,"props":14610,"children":14611},{"class":211,"line":2611},[14612,14616,14620,14624,14628],{"type":21,"tag":209,"props":14613,"children":14614},{"style":222},[14615],{"type":26,"value":14585},{"type":21,"tag":209,"props":14617,"children":14618},{"style":360},[14619],{"type":26,"value":13670},{"type":21,"tag":209,"props":14621,"children":14622},{"style":222},[14623],{"type":26,"value":368},{"type":21,"tag":209,"props":14625,"children":14626},{"style":263},[14627],{"type":26,"value":8554},{"type":21,"tag":209,"props":14629,"children":14630},{"style":222},[14631],{"type":26,"value":2608},{"type":21,"tag":209,"props":14633,"children":14634},{"class":211,"line":2619},[14635],{"type":21,"tag":209,"props":14636,"children":14637},{"emptyLinePlaceholder":248},[14638],{"type":26,"value":251},{"type":21,"tag":209,"props":14640,"children":14641},{"class":211,"line":2627},[14642],{"type":21,"tag":209,"props":14643,"children":14644},{"style":448},[14645],{"type":26,"value":14646},"            // Calling resume() on a stack initiated by user gesture is\n",{"type":21,"tag":209,"props":14648,"children":14649},{"class":211,"line":2636},[14650],{"type":21,"tag":209,"props":14651,"children":14652},{"style":448},[14653],{"type":26,"value":14654},"            // what actually unlocks the audio on Chrome >= 55.\n",{"type":21,"tag":209,"props":14656,"children":14657},{"class":211,"line":2644},[14658,14663,14667,14671,14676,14681,14686],{"type":21,"tag":209,"props":14659,"children":14660},{"style":216},[14661],{"type":26,"value":14662},"            if",{"type":21,"tag":209,"props":14664,"children":14665},{"style":222},[14666],{"type":26,"value":5569},{"type":21,"tag":209,"props":14668,"children":14669},{"style":216},[14670],{"type":26,"value":8036},{"type":21,"tag":209,"props":14672,"children":14673},{"style":222},[14674],{"type":26,"value":14675}," _audioCtx.resume ",{"type":21,"tag":209,"props":14677,"children":14678},{"style":216},[14679],{"type":26,"value":14680},"===",{"type":21,"tag":209,"props":14682,"children":14683},{"style":233},[14684],{"type":26,"value":14685}," 'function'",{"type":21,"tag":209,"props":14687,"children":14688},{"style":222},[14689],{"type":26,"value":5588},{"type":21,"tag":209,"props":14691,"children":14692},{"class":211,"line":2657},[14693,14698,14703],{"type":21,"tag":209,"props":14694,"children":14695},{"style":222},[14696],{"type":26,"value":14697},"                _audioCtx.",{"type":21,"tag":209,"props":14699,"children":14700},{"style":360},[14701],{"type":26,"value":14702},"resume",{"type":21,"tag":209,"props":14704,"children":14705},{"style":222},[14706],{"type":26,"value":4123},{"type":21,"tag":209,"props":14708,"children":14709},{"class":211,"line":2728},[14710],{"type":21,"tag":209,"props":14711,"children":14712},{"style":222},[14713],{"type":26,"value":14714},"            }\n",{"type":21,"tag":209,"props":14716,"children":14717},{"class":211,"line":2758},[14718],{"type":21,"tag":209,"props":14719,"children":14720},{"emptyLinePlaceholder":248},[14721],{"type":26,"value":251},{"type":21,"tag":209,"props":14723,"children":14724},{"class":211,"line":2776},[14725],{"type":21,"tag":209,"props":14726,"children":14727},{"style":448},[14728],{"type":26,"value":14729},"            // Once the source has fired the onended event, indicating it did indeed play,\n",{"type":21,"tag":209,"props":14731,"children":14732},{"class":211,"line":2785},[14733],{"type":21,"tag":209,"props":14734,"children":14735},{"style":448},[14736],{"type":26,"value":14737},"            // we can know that the audio API is now unlocked.\n",{"type":21,"tag":209,"props":14739,"children":14740},{"class":211,"line":2793},[14741,14745,14750,14754,14758],{"type":21,"tag":209,"props":14742,"children":14743},{"style":222},[14744],{"type":26,"value":14585},{"type":21,"tag":209,"props":14746,"children":14747},{"style":360},[14748],{"type":26,"value":14749},"onended",{"type":21,"tag":209,"props":14751,"children":14752},{"style":216},[14753],{"type":26,"value":271},{"type":21,"tag":209,"props":14755,"children":14756},{"style":216},[14757],{"type":26,"value":4789},{"type":21,"tag":209,"props":14759,"children":14760},{"style":222},[14761],{"type":26,"value":14762}," () {\n",{"type":21,"tag":209,"props":14764,"children":14765},{"class":211,"line":2801},[14766,14771,14776,14780,14784],{"type":21,"tag":209,"props":14767,"children":14768},{"style":222},[14769],{"type":26,"value":14770},"                source.",{"type":21,"tag":209,"props":14772,"children":14773},{"style":360},[14774],{"type":26,"value":14775},"disconnect",{"type":21,"tag":209,"props":14777,"children":14778},{"style":222},[14779],{"type":26,"value":368},{"type":21,"tag":209,"props":14781,"children":14782},{"style":263},[14783],{"type":26,"value":8554},{"type":21,"tag":209,"props":14785,"children":14786},{"style":222},[14787],{"type":26,"value":2608},{"type":21,"tag":209,"props":14789,"children":14790},{"class":211,"line":2809},[14791],{"type":21,"tag":209,"props":14792,"children":14793},{"emptyLinePlaceholder":248},[14794],{"type":26,"value":251},{"type":21,"tag":209,"props":14796,"children":14797},{"class":211,"line":10937},[14798],{"type":21,"tag":209,"props":14799,"children":14800},{"style":448},[14801],{"type":26,"value":14802},"                // Don't bother trying to unlock the API more than once!\n",{"type":21,"tag":209,"props":14804,"children":14805},{"class":211,"line":10967},[14806,14811,14815,14820],{"type":21,"tag":209,"props":14807,"children":14808},{"style":222},[14809],{"type":26,"value":14810},"                _isUnlocked ",{"type":21,"tag":209,"props":14812,"children":14813},{"style":216},[14814],{"type":26,"value":1432},{"type":21,"tag":209,"props":14816,"children":14817},{"style":263},[14818],{"type":26,"value":14819}," true",{"type":21,"tag":209,"props":14821,"children":14822},{"style":222},[14823],{"type":26,"value":241},{"type":21,"tag":209,"props":14825,"children":14826},{"class":211,"line":11003},[14827],{"type":21,"tag":209,"props":14828,"children":14829},{"emptyLinePlaceholder":248},[14830],{"type":26,"value":251},{"type":21,"tag":209,"props":14832,"children":14833},{"class":211,"line":11038},[14834],{"type":21,"tag":209,"props":14835,"children":14836},{"style":448},[14837],{"type":26,"value":14838},"                // Remove the click/touch listeners.\n",{"type":21,"tag":209,"props":14840,"children":14841},{"class":211,"line":11072},[14842,14847,14852,14856,14861,14866,14870],{"type":21,"tag":209,"props":14843,"children":14844},{"style":222},[14845],{"type":26,"value":14846},"                document.",{"type":21,"tag":209,"props":14848,"children":14849},{"style":360},[14850],{"type":26,"value":14851},"removeEventListener",{"type":21,"tag":209,"props":14853,"children":14854},{"style":222},[14855],{"type":26,"value":368},{"type":21,"tag":209,"props":14857,"children":14858},{"style":233},[14859],{"type":26,"value":14860},"'touchstart'",{"type":21,"tag":209,"props":14862,"children":14863},{"style":222},[14864],{"type":26,"value":14865},", unlock, ",{"type":21,"tag":209,"props":14867,"children":14868},{"style":263},[14869],{"type":26,"value":2223},{"type":21,"tag":209,"props":14871,"children":14872},{"style":222},[14873],{"type":26,"value":2608},{"type":21,"tag":209,"props":14875,"children":14876},{"class":211,"line":11106},[14877,14881,14885,14889,14894,14898,14902],{"type":21,"tag":209,"props":14878,"children":14879},{"style":222},[14880],{"type":26,"value":14846},{"type":21,"tag":209,"props":14882,"children":14883},{"style":360},[14884],{"type":26,"value":14851},{"type":21,"tag":209,"props":14886,"children":14887},{"style":222},[14888],{"type":26,"value":368},{"type":21,"tag":209,"props":14890,"children":14891},{"style":233},[14892],{"type":26,"value":14893},"'touchend'",{"type":21,"tag":209,"props":14895,"children":14896},{"style":222},[14897],{"type":26,"value":14865},{"type":21,"tag":209,"props":14899,"children":14900},{"style":263},[14901],{"type":26,"value":2223},{"type":21,"tag":209,"props":14903,"children":14904},{"style":222},[14905],{"type":26,"value":2608},{"type":21,"tag":209,"props":14907,"children":14908},{"class":211,"line":11114},[14909,14913,14917,14921,14926,14930,14934],{"type":21,"tag":209,"props":14910,"children":14911},{"style":222},[14912],{"type":26,"value":14846},{"type":21,"tag":209,"props":14914,"children":14915},{"style":360},[14916],{"type":26,"value":14851},{"type":21,"tag":209,"props":14918,"children":14919},{"style":222},[14920],{"type":26,"value":368},{"type":21,"tag":209,"props":14922,"children":14923},{"style":233},[14924],{"type":26,"value":14925},"'click'",{"type":21,"tag":209,"props":14927,"children":14928},{"style":222},[14929],{"type":26,"value":14865},{"type":21,"tag":209,"props":14931,"children":14932},{"style":263},[14933],{"type":26,"value":2223},{"type":21,"tag":209,"props":14935,"children":14936},{"style":222},[14937],{"type":26,"value":2608},{"type":21,"tag":209,"props":14939,"children":14941},{"class":211,"line":14940},64,[14942],{"type":21,"tag":209,"props":14943,"children":14944},{"style":222},[14945],{"type":26,"value":14946},"            };\n",{"type":21,"tag":209,"props":14948,"children":14950},{"class":211,"line":14949},65,[14951],{"type":21,"tag":209,"props":14952,"children":14953},{"style":222},[14954],{"type":26,"value":14955},"        };\n",{"type":21,"tag":209,"props":14957,"children":14959},{"class":211,"line":14958},66,[14960],{"type":21,"tag":209,"props":14961,"children":14962},{"emptyLinePlaceholder":248},[14963],{"type":26,"value":251},{"type":21,"tag":209,"props":14965,"children":14967},{"class":211,"line":14966},67,[14968],{"type":21,"tag":209,"props":14969,"children":14970},{"style":448},[14971],{"type":26,"value":14972},"        // Setup click/touch listeners to capture the first interaction\n",{"type":21,"tag":209,"props":14974,"children":14976},{"class":211,"line":14975},68,[14977],{"type":21,"tag":209,"props":14978,"children":14979},{"style":448},[14980],{"type":26,"value":14981},"        // within this context.\n",{"type":21,"tag":209,"props":14983,"children":14985},{"class":211,"line":14984},69,[14986,14991,14996,15000,15004,15008,15012],{"type":21,"tag":209,"props":14987,"children":14988},{"style":222},[14989],{"type":26,"value":14990},"        document.",{"type":21,"tag":209,"props":14992,"children":14993},{"style":360},[14994],{"type":26,"value":14995},"addEventListener",{"type":21,"tag":209,"props":14997,"children":14998},{"style":222},[14999],{"type":26,"value":368},{"type":21,"tag":209,"props":15001,"children":15002},{"style":233},[15003],{"type":26,"value":14860},{"type":21,"tag":209,"props":15005,"children":15006},{"style":222},[15007],{"type":26,"value":14865},{"type":21,"tag":209,"props":15009,"children":15010},{"style":263},[15011],{"type":26,"value":2223},{"type":21,"tag":209,"props":15013,"children":15014},{"style":222},[15015],{"type":26,"value":2608},{"type":21,"tag":209,"props":15017,"children":15019},{"class":211,"line":15018},70,[15020,15024,15028,15032,15036,15040,15044],{"type":21,"tag":209,"props":15021,"children":15022},{"style":222},[15023],{"type":26,"value":14990},{"type":21,"tag":209,"props":15025,"children":15026},{"style":360},[15027],{"type":26,"value":14995},{"type":21,"tag":209,"props":15029,"children":15030},{"style":222},[15031],{"type":26,"value":368},{"type":21,"tag":209,"props":15033,"children":15034},{"style":233},[15035],{"type":26,"value":14893},{"type":21,"tag":209,"props":15037,"children":15038},{"style":222},[15039],{"type":26,"value":14865},{"type":21,"tag":209,"props":15041,"children":15042},{"style":263},[15043],{"type":26,"value":2223},{"type":21,"tag":209,"props":15045,"children":15046},{"style":222},[15047],{"type":26,"value":2608},{"type":21,"tag":209,"props":15049,"children":15051},{"class":211,"line":15050},71,[15052,15056,15060,15064,15068,15072,15076],{"type":21,"tag":209,"props":15053,"children":15054},{"style":222},[15055],{"type":26,"value":14990},{"type":21,"tag":209,"props":15057,"children":15058},{"style":360},[15059],{"type":26,"value":14995},{"type":21,"tag":209,"props":15061,"children":15062},{"style":222},[15063],{"type":26,"value":368},{"type":21,"tag":209,"props":15065,"children":15066},{"style":233},[15067],{"type":26,"value":14925},{"type":21,"tag":209,"props":15069,"children":15070},{"style":222},[15071],{"type":26,"value":14865},{"type":21,"tag":209,"props":15073,"children":15074},{"style":263},[15075],{"type":26,"value":2223},{"type":21,"tag":209,"props":15077,"children":15078},{"style":222},[15079],{"type":26,"value":2608},{"type":21,"tag":209,"props":15081,"children":15083},{"class":211,"line":15082},72,[15084],{"type":21,"tag":209,"props":15085,"children":15086},{"style":222},[15087],{"type":26,"value":331},{"type":21,"tag":209,"props":15089,"children":15091},{"class":211,"line":15090},73,[15092],{"type":21,"tag":209,"props":15093,"children":15094},{"emptyLinePlaceholder":248},[15095],{"type":26,"value":251},{"type":21,"tag":209,"props":15097,"children":15099},{"class":211,"line":15098},74,[15100],{"type":21,"tag":209,"props":15101,"children":15102},{"style":448},[15103],{"type":26,"value":13290},{"type":21,"tag":209,"props":15105,"children":15107},{"class":211,"line":15106},75,[15108],{"type":21,"tag":209,"props":15109,"children":15110},{"style":448},[15111],{"type":26,"value":13298},{"type":21,"tag":209,"props":15113,"children":15115},{"class":211,"line":15114},76,[15116],{"type":21,"tag":209,"props":15117,"children":15118},{"style":448},[15119],{"type":26,"value":15120},"     * We store the decoded audio data for future (re-)use.\n",{"type":21,"tag":209,"props":15122,"children":15124},{"class":211,"line":15123},77,[15125,15129,15133,15137],{"type":21,"tag":209,"props":15126,"children":15127},{"style":448},[15128],{"type":26,"value":13306},{"type":21,"tag":209,"props":15130,"children":15131},{"style":216},[15132],{"type":26,"value":13311},{"type":21,"tag":209,"props":15134,"children":15135},{"style":360},[15136],{"type":26,"value":13316},{"type":21,"tag":209,"props":15138,"children":15139},{"style":222},[15140],{"type":26,"value":13321},{"type":21,"tag":209,"props":15142,"children":15144},{"class":211,"line":15143},78,[15145,15149,15153],{"type":21,"tag":209,"props":15146,"children":15147},{"style":448},[15148],{"type":26,"value":13306},{"type":21,"tag":209,"props":15150,"children":15151},{"style":216},[15152],{"type":26,"value":13333},{"type":21,"tag":209,"props":15154,"children":15155},{"style":360},[15156],{"type":26,"value":15157}," {Promise\u003CAudioBuffer>}\n",{"type":21,"tag":209,"props":15159,"children":15161},{"class":211,"line":15160},79,[15162],{"type":21,"tag":209,"props":15163,"children":15164},{"style":448},[15165],{"type":26,"value":13346},{"type":21,"tag":209,"props":15167,"children":15169},{"class":211,"line":15168},80,[15170,15174,15178,15182,15186,15190],{"type":21,"tag":209,"props":15171,"children":15172},{"style":216},[15173],{"type":26,"value":13354},{"type":21,"tag":209,"props":15175,"children":15176},{"style":216},[15177],{"type":26,"value":4789},{"type":21,"tag":209,"props":15179,"children":15180},{"style":360},[15181],{"type":26,"value":13363},{"type":21,"tag":209,"props":15183,"children":15184},{"style":222},[15185],{"type":26,"value":5569},{"type":21,"tag":209,"props":15187,"children":15188},{"style":400},[15189],{"type":26,"value":13372},{"type":21,"tag":209,"props":15191,"children":15192},{"style":222},[15193],{"type":26,"value":5588},{"type":21,"tag":209,"props":15195,"children":15197},{"class":211,"line":15196},81,[15198,15202,15207,15212],{"type":21,"tag":209,"props":15199,"children":15200},{"style":216},[15201],{"type":26,"value":6334},{"type":21,"tag":209,"props":15203,"children":15204},{"style":222},[15205],{"type":26,"value":15206}," (_af_buffers.",{"type":21,"tag":209,"props":15208,"children":15209},{"style":360},[15210],{"type":26,"value":15211},"has",{"type":21,"tag":209,"props":15213,"children":15214},{"style":222},[15215],{"type":26,"value":15216},"(sfxFile)) {\n",{"type":21,"tag":209,"props":15218,"children":15220},{"class":211,"line":15219},82,[15221,15225,15230,15234],{"type":21,"tag":209,"props":15222,"children":15223},{"style":216},[15224],{"type":26,"value":13689},{"type":21,"tag":209,"props":15226,"children":15227},{"style":222},[15228],{"type":26,"value":15229}," _af_buffers.",{"type":21,"tag":209,"props":15231,"children":15232},{"style":360},[15233],{"type":26,"value":7636},{"type":21,"tag":209,"props":15235,"children":15236},{"style":222},[15237],{"type":26,"value":13406},{"type":21,"tag":209,"props":15239,"children":15241},{"class":211,"line":15240},83,[15242],{"type":21,"tag":209,"props":15243,"children":15244},{"style":222},[15245],{"type":26,"value":2235},{"type":21,"tag":209,"props":15247,"children":15249},{"class":211,"line":15248},84,[15250],{"type":21,"tag":209,"props":15251,"children":15252},{"emptyLinePlaceholder":248},[15253],{"type":26,"value":251},{"type":21,"tag":209,"props":15255,"children":15257},{"class":211,"line":15256},85,[15258,15262,15266,15270,15274,15278],{"type":21,"tag":209,"props":15259,"children":15260},{"style":216},[15261],{"type":26,"value":3332},{"type":21,"tag":209,"props":15263,"children":15264},{"style":263},[15265],{"type":26,"value":13388},{"type":21,"tag":209,"props":15267,"children":15268},{"style":216},[15269],{"type":26,"value":271},{"type":21,"tag":209,"props":15271,"children":15272},{"style":216},[15273],{"type":26,"value":1437},{"type":21,"tag":209,"props":15275,"children":15276},{"style":360},[15277],{"type":26,"value":13401},{"type":21,"tag":209,"props":15279,"children":15280},{"style":222},[15281],{"type":26,"value":13406},{"type":21,"tag":209,"props":15283,"children":15285},{"class":211,"line":15284},86,[15286,15290,15295,15299,15303,15307,15311],{"type":21,"tag":209,"props":15287,"children":15288},{"style":216},[15289],{"type":26,"value":3332},{"type":21,"tag":209,"props":15291,"children":15292},{"style":263},[15293],{"type":26,"value":15294}," arraybuffer",{"type":21,"tag":209,"props":15296,"children":15297},{"style":216},[15298],{"type":26,"value":271},{"type":21,"tag":209,"props":15300,"children":15301},{"style":216},[15302],{"type":26,"value":1437},{"type":21,"tag":209,"props":15304,"children":15305},{"style":222},[15306],{"type":26,"value":13422},{"type":21,"tag":209,"props":15308,"children":15309},{"style":360},[15310],{"type":26,"value":13427},{"type":21,"tag":209,"props":15312,"children":15313},{"style":222},[15314],{"type":26,"value":4123},{"type":21,"tag":209,"props":15316,"children":15318},{"class":211,"line":15317},87,[15319,15324],{"type":21,"tag":209,"props":15320,"children":15321},{"style":216},[15322],{"type":26,"value":15323},"        let",{"type":21,"tag":209,"props":15325,"children":15326},{"style":222},[15327],{"type":26,"value":15328}," audiobuffer;\n",{"type":21,"tag":209,"props":15330,"children":15332},{"class":211,"line":15331},88,[15333],{"type":21,"tag":209,"props":15334,"children":15335},{"emptyLinePlaceholder":248},[15336],{"type":26,"value":251},{"type":21,"tag":209,"props":15338,"children":15340},{"class":211,"line":15339},89,[15341,15346],{"type":21,"tag":209,"props":15342,"children":15343},{"style":216},[15344],{"type":26,"value":15345},"        try",{"type":21,"tag":209,"props":15347,"children":15348},{"style":222},[15349],{"type":26,"value":276},{"type":21,"tag":209,"props":15351,"children":15353},{"class":211,"line":15352},90,[15354,15359,15363,15367,15371,15375],{"type":21,"tag":209,"props":15355,"children":15356},{"style":222},[15357],{"type":26,"value":15358},"            audiobuffer ",{"type":21,"tag":209,"props":15360,"children":15361},{"style":216},[15362],{"type":26,"value":1432},{"type":21,"tag":209,"props":15364,"children":15365},{"style":216},[15366],{"type":26,"value":1437},{"type":21,"tag":209,"props":15368,"children":15369},{"style":222},[15370],{"type":26,"value":13585},{"type":21,"tag":209,"props":15372,"children":15373},{"style":360},[15374],{"type":26,"value":13590},{"type":21,"tag":209,"props":15376,"children":15377},{"style":222},[15378],{"type":26,"value":15379},"(arraybuffer);\n",{"type":21,"tag":209,"props":15381,"children":15383},{"class":211,"line":15382},91,[15384,15389,15393],{"type":21,"tag":209,"props":15385,"children":15386},{"style":222},[15387],{"type":26,"value":15388},"        } ",{"type":21,"tag":209,"props":15390,"children":15391},{"style":216},[15392],{"type":26,"value":5347},{"type":21,"tag":209,"props":15394,"children":15395},{"style":222},[15396],{"type":26,"value":15397}," (e) {\n",{"type":21,"tag":209,"props":15399,"children":15401},{"class":211,"line":15400},92,[15402],{"type":21,"tag":209,"props":15403,"children":15404},{"style":448},[15405],{"type":26,"value":15406},"            // Browser wants older callback based usage of decodeAudioData\n",{"type":21,"tag":209,"props":15408,"children":15410},{"class":211,"line":15409},93,[15411,15415,15419,15423,15427],{"type":21,"tag":209,"props":15412,"children":15413},{"style":222},[15414],{"type":26,"value":15358},{"type":21,"tag":209,"props":15416,"children":15417},{"style":216},[15418],{"type":26,"value":1432},{"type":21,"tag":209,"props":15420,"children":15421},{"style":216},[15422],{"type":26,"value":1437},{"type":21,"tag":209,"props":15424,"children":15425},{"style":360},[15426],{"type":26,"value":14135},{"type":21,"tag":209,"props":15428,"children":15429},{"style":222},[15430],{"type":26,"value":15379},{"type":21,"tag":209,"props":15432,"children":15434},{"class":211,"line":15433},94,[15435],{"type":21,"tag":209,"props":15436,"children":15437},{"style":222},[15438],{"type":26,"value":2235},{"type":21,"tag":209,"props":15440,"children":15442},{"class":211,"line":15441},95,[15443],{"type":21,"tag":209,"props":15444,"children":15445},{"emptyLinePlaceholder":248},[15446],{"type":26,"value":251},{"type":21,"tag":209,"props":15448,"children":15450},{"class":211,"line":15449},96,[15451,15456,15460],{"type":21,"tag":209,"props":15452,"children":15453},{"style":222},[15454],{"type":26,"value":15455},"        _af_buffers.",{"type":21,"tag":209,"props":15457,"children":15458},{"style":360},[15459],{"type":26,"value":4386},{"type":21,"tag":209,"props":15461,"children":15462},{"style":222},[15463],{"type":26,"value":15464},"(sfxFile, audiobuffer);\n",{"type":21,"tag":209,"props":15466,"children":15468},{"class":211,"line":15467},97,[15469],{"type":21,"tag":209,"props":15470,"children":15471},{"emptyLinePlaceholder":248},[15472],{"type":26,"value":251},{"type":21,"tag":209,"props":15474,"children":15476},{"class":211,"line":15475},98,[15477,15481],{"type":21,"tag":209,"props":15478,"children":15479},{"style":216},[15480],{"type":26,"value":3069},{"type":21,"tag":209,"props":15482,"children":15483},{"style":222},[15484],{"type":26,"value":15328},{"type":21,"tag":209,"props":15486,"children":15488},{"class":211,"line":15487},99,[15489],{"type":21,"tag":209,"props":15490,"children":15491},{"style":222},[15492],{"type":26,"value":13439},{"type":21,"tag":209,"props":15494,"children":15496},{"class":211,"line":15495},100,[15497],{"type":21,"tag":209,"props":15498,"children":15499},{"emptyLinePlaceholder":248},[15500],{"type":26,"value":251},{"type":21,"tag":209,"props":15502,"children":15504},{"class":211,"line":15503},101,[15505],{"type":21,"tag":209,"props":15506,"children":15507},{"style":448},[15508],{"type":26,"value":13290},{"type":21,"tag":209,"props":15510,"children":15512},{"class":211,"line":15511},102,[15513],{"type":21,"tag":209,"props":15514,"children":15515},{"style":448},[15516],{"type":26,"value":15517},"     * Play the specified file, loading it first - either retrieving it from the saved buffers, or fetching\n",{"type":21,"tag":209,"props":15519,"children":15521},{"class":211,"line":15520},103,[15522],{"type":21,"tag":209,"props":15523,"children":15524},{"style":448},[15525],{"type":26,"value":15526},"     * it from the network.\n",{"type":21,"tag":209,"props":15528,"children":15530},{"class":211,"line":15529},104,[15531,15535,15539],{"type":21,"tag":209,"props":15532,"children":15533},{"style":448},[15534],{"type":26,"value":13306},{"type":21,"tag":209,"props":15536,"children":15537},{"style":216},[15538],{"type":26,"value":13311},{"type":21,"tag":209,"props":15540,"children":15541},{"style":222},[15542],{"type":26,"value":13321},{"type":21,"tag":209,"props":15544,"children":15546},{"class":211,"line":15545},105,[15547,15551,15555],{"type":21,"tag":209,"props":15548,"children":15549},{"style":448},[15550],{"type":26,"value":13306},{"type":21,"tag":209,"props":15552,"children":15553},{"style":216},[15554],{"type":26,"value":13333},{"type":21,"tag":209,"props":15556,"children":15557},{"style":360},[15558],{"type":26,"value":13492},{"type":21,"tag":209,"props":15560,"children":15562},{"class":211,"line":15561},106,[15563],{"type":21,"tag":209,"props":15564,"children":15565},{"style":448},[15566],{"type":26,"value":13346},{"type":21,"tag":209,"props":15568,"children":15570},{"class":211,"line":15569},107,[15571,15575,15579,15583,15587],{"type":21,"tag":209,"props":15572,"children":15573},{"style":216},[15574],{"type":26,"value":2981},{"type":21,"tag":209,"props":15576,"children":15577},{"style":360},[15578],{"type":26,"value":13511},{"type":21,"tag":209,"props":15580,"children":15581},{"style":222},[15582],{"type":26,"value":5569},{"type":21,"tag":209,"props":15584,"children":15585},{"style":400},[15586],{"type":26,"value":13372},{"type":21,"tag":209,"props":15588,"children":15589},{"style":222},[15590],{"type":26,"value":5588},{"type":21,"tag":209,"props":15592,"children":15594},{"class":211,"line":15593},108,[15595,15599,15603,15607,15611,15615,15620,15624,15628],{"type":21,"tag":209,"props":15596,"children":15597},{"style":216},[15598],{"type":26,"value":3069},{"type":21,"tag":209,"props":15600,"children":15601},{"style":360},[15602],{"type":26,"value":13363},{"type":21,"tag":209,"props":15604,"children":15605},{"style":222},[15606],{"type":26,"value":13539},{"type":21,"tag":209,"props":15608,"children":15609},{"style":360},[15610],{"type":26,"value":2704},{"type":21,"tag":209,"props":15612,"children":15613},{"style":222},[15614],{"type":26,"value":2709},{"type":21,"tag":209,"props":15616,"children":15617},{"style":400},[15618],{"type":26,"value":15619},"audioBuffer",{"type":21,"tag":209,"props":15621,"children":15622},{"style":222},[15623],{"type":26,"value":432},{"type":21,"tag":209,"props":15625,"children":15626},{"style":216},[15627],{"type":26,"value":437},{"type":21,"tag":209,"props":15629,"children":15630},{"style":222},[15631],{"type":26,"value":276},{"type":21,"tag":209,"props":15633,"children":15635},{"class":211,"line":15634},109,[15636,15640,15644,15648,15652,15656],{"type":21,"tag":209,"props":15637,"children":15638},{"style":216},[15639],{"type":26,"value":13571},{"type":21,"tag":209,"props":15641,"children":15642},{"style":263},[15643],{"type":26,"value":13607},{"type":21,"tag":209,"props":15645,"children":15646},{"style":216},[15647],{"type":26,"value":271},{"type":21,"tag":209,"props":15649,"children":15650},{"style":222},[15651],{"type":26,"value":13585},{"type":21,"tag":209,"props":15653,"children":15654},{"style":360},[15655],{"type":26,"value":13620},{"type":21,"tag":209,"props":15657,"children":15658},{"style":222},[15659],{"type":26,"value":4123},{"type":21,"tag":209,"props":15661,"children":15663},{"class":211,"line":15662},110,[15664,15668,15672],{"type":21,"tag":209,"props":15665,"children":15666},{"style":222},[15667],{"type":26,"value":13632},{"type":21,"tag":209,"props":15669,"children":15670},{"style":216},[15671],{"type":26,"value":1432},{"type":21,"tag":209,"props":15673,"children":15674},{"style":222},[15675],{"type":26,"value":13641},{"type":21,"tag":209,"props":15677,"children":15679},{"class":211,"line":15678},111,[15680,15684,15688],{"type":21,"tag":209,"props":15681,"children":15682},{"style":222},[15683],{"type":26,"value":13649},{"type":21,"tag":209,"props":15685,"children":15686},{"style":360},[15687],{"type":26,"value":4319},{"type":21,"tag":209,"props":15689,"children":15690},{"style":222},[15691],{"type":26,"value":13658},{"type":21,"tag":209,"props":15693,"children":15695},{"class":211,"line":15694},112,[15696,15700,15704],{"type":21,"tag":209,"props":15697,"children":15698},{"style":222},[15699],{"type":26,"value":13649},{"type":21,"tag":209,"props":15701,"children":15702},{"style":360},[15703],{"type":26,"value":13670},{"type":21,"tag":209,"props":15705,"children":15706},{"style":222},[15707],{"type":26,"value":4123},{"type":21,"tag":209,"props":15709,"children":15711},{"class":211,"line":15710},113,[15712],{"type":21,"tag":209,"props":15713,"children":15714},{"emptyLinePlaceholder":248},[15715],{"type":26,"value":251},{"type":21,"tag":209,"props":15717,"children":15719},{"class":211,"line":15718},114,[15720,15724],{"type":21,"tag":209,"props":15721,"children":15722},{"style":216},[15723],{"type":26,"value":13689},{"type":21,"tag":209,"props":15725,"children":15726},{"style":222},[15727],{"type":26,"value":13694},{"type":21,"tag":209,"props":15729,"children":15731},{"class":211,"line":15730},115,[15732],{"type":21,"tag":209,"props":15733,"children":15734},{"style":222},[15735],{"type":26,"value":13702},{"type":21,"tag":209,"props":15737,"children":15739},{"class":211,"line":15738},116,[15740],{"type":21,"tag":209,"props":15741,"children":15742},{"style":222},[15743],{"type":26,"value":13439},{"type":21,"tag":209,"props":15745,"children":15747},{"class":211,"line":15746},117,[15748],{"type":21,"tag":209,"props":15749,"children":15750},{"emptyLinePlaceholder":248},[15751],{"type":26,"value":251},{"type":21,"tag":209,"props":15753,"children":15755},{"class":211,"line":15754},118,[15756,15761],{"type":21,"tag":209,"props":15757,"children":15758},{"style":360},[15759],{"type":26,"value":15760},"    _unlockAudio",{"type":21,"tag":209,"props":15762,"children":15763},{"style":222},[15764],{"type":26,"value":4123},{"type":21,"tag":209,"props":15766,"children":15768},{"class":211,"line":15767},119,[15769],{"type":21,"tag":209,"props":15770,"children":15771},{"style":222},[15772],{"type":26,"value":15773},"}());\n",{"type":21,"tag":22,"props":15775,"children":15776},{},[15777,15779,15784,15786,15791],{"type":26,"value":15778},"That's the ticket! Now, when we load our ",{"type":21,"tag":63,"props":15780,"children":15782},{"className":15781},[],[15783],{"type":26,"value":13203},{"type":26,"value":15785}," by calling ",{"type":21,"tag":63,"props":15787,"children":15789},{"className":15788},[],[15790],{"type":26,"value":13810},{"type":26,"value":15792},", we attempt to fetch the audiobuffer from our impromptu cache if possible, or fallback to fetching it. (Note that it's important we cache the decoded audiobuffer, rather than the fetched array buffer—decoding is expensive! However, if we're planning to fetch large compressed files, these will be decoded into PCM and potentially eat up a huge chunk of memory - keep an eye on the tradeoff!)",{"type":21,"tag":22,"props":15794,"children":15795},{},[15796,15797,15802],{"type":26,"value":1604},{"type":21,"tag":63,"props":15798,"children":15800},{"className":15799},[],[15801],{"type":26,"value":13777},{"type":26,"value":15803},", we also perform the decoding, falling back to a decode shim if the browser throws an error (as it does in iOS), due to out-of-date API implementation.",{"type":21,"tag":22,"props":15805,"children":15806},{},[15807,15809,15814],{"type":26,"value":15808},"Otherwise, ",{"type":21,"tag":63,"props":15810,"children":15812},{"className":15811},[],[15813],{"type":26,"value":13810},{"type":26,"value":15815}," looks pretty much the same.",{"type":21,"tag":22,"props":15817,"children":15818},{},[15819,15821,15827],{"type":26,"value":15820},"And finally, we've wrapped all of this in an IIFE, with ",{"type":21,"tag":63,"props":15822,"children":15824},{"className":15823},[],[15825],{"type":26,"value":15826},"_unlockAudio",{"type":26,"value":15828}," getting called as soon as the IIFE is executed, adding touch/click listeners to the document so we can unlock the audio API as soon as the user has indicated they're willing to interact with our site.",{"type":21,"tag":22,"props":15830,"children":15831},{},[15832,15834,15841,15842,15849],{"type":26,"value":15833},"Phew! That's a fair amount of work to play a single file! Depending on the needs of your project, you may want to explore some of the libraries that can handle some of the grunt work for you, like ",{"type":21,"tag":29,"props":15835,"children":15838},{"href":15836,"rel":15837},"https://howlerjs.com/",[93],[15839],{"type":26,"value":15840},"Howler.js",{"type":26,"value":5997},{"type":21,"tag":29,"props":15843,"children":15846},{"href":15844,"rel":15845},"https://createjs.com/soundjs",[93],[15847],{"type":26,"value":15848},"SoundJS",{"type":26,"value":15850},". There's no magic, though, and you may need to dive into the true depths for your use case.",{"type":21,"tag":22,"props":15852,"children":15853},{},[15854],{"type":26,"value":15855},"The Meowsic machine project is on its way - next time, we prepare to begin working on the UI with Vue.js.",{"type":21,"tag":22,"props":15857,"children":15858},{},[15859],{"type":21,"tag":1084,"props":15860,"children":15861},{},[15862,15864,15871,15872],{"type":26,"value":15863},"Images from Wikipedia Commons: ",{"type":21,"tag":29,"props":15865,"children":15868},{"href":15866,"rel":15867},"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Compactcassette.jpg/800px-Compactcassette.jpg",[93],[15869],{"type":26,"value":15870},"cassette",{"type":26,"value":408},{"type":21,"tag":29,"props":15873,"children":15876},{"href":15874,"rel":15875},"https://commons.wikimedia.org/wiki/Category:Padlocks",[93],[15877],{"type":26,"value":15878},"padlock",{"type":21,"tag":3490,"props":15880,"children":15881},{},[15882],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":15884},[15885,15887,15888,15889],{"id":13115,"depth":254,"text":15886},"PeriodicWave... Isn't that something the crowd does at a sports game?",{"id":13152,"depth":254,"text":13155},{"id":13888,"depth":254,"text":13891},{"id":13928,"depth":254,"text":13931},"content:ckeefer:2019-1:UnlockingWebAudio.md","ckeefer/2019-1/UnlockingWebAudio.md","ckeefer/2019-1/UnlockingWebAudio",{"user":3518,"name":3519},{"_path":15895,"_dir":15896,"_draft":7,"_partial":7,"_locale":8,"title":15897,"description":15898,"publishDate":15899,"tags":15900,"excerpt":15898,"body":15901,"_type":3511,"_id":16589,"_source":3513,"_file":16590,"_stem":16591,"_extension":3516,"author":16592},"/ckeefer/2017-1/downloadingclientsidecontent","2017-1","Downloading Client-side Generated Content","A young developer, new to the Tao of the client-side, comes to a Master of the way, and speaks thusly: \"Oh Master, our application nears completion; and lo, cat pics can be drawn upon, and captions fixated thereto, for the creation of humour and the bounteous enjoyment of our users.\"","2017-02-06",[12],{"type":18,"children":15902,"toc":16585},[15903,15907,15912,15917,15922,15927,15932,15954,15975,15980,16018,16023,16041,16064,16069,16123,16136,16182,16187,16192,16234,16253,16272,16301,16307,16312,16325,16338,16422,16427,16490,16495,16576,16581],{"type":21,"tag":22,"props":15904,"children":15905},{},[15906],{"type":26,"value":15898},{"type":21,"tag":22,"props":15908,"children":15909},{},[15910],{"type":26,"value":15911},"\"This is good,\" responded the Master.",{"type":21,"tag":22,"props":15913,"children":15914},{},[15915],{"type":26,"value":15916},"\"But now, I and the acolyte of the server-side have come unto a disagreement, for I wish to render the image to be saved on the client, and by means cunning, reflect the image from the server back unto the grateful user when downloading is desired; but he who develops the server says this is wasteful, and bids me send the minimum data to him, so that the image can be rendered on the server, and then served to the user - but to me this is folly, for do we not then have dependencies in the server on image libraries which we could otherwise do without? And so we are at an impasse.\"",{"type":21,"tag":22,"props":15918,"children":15919},{},[15920],{"type":26,"value":15921},"The Master shook his head at the folly of youth. \"You may tell the acolyte of the server that his services shall not be needed in this instance,\" he told the young developer. \"The shortest journey is one that ends where it begins.\"",{"type":21,"tag":22,"props":15923,"children":15924},{},[15925],{"type":26,"value":15926},"And the young developer was enlightened.",{"type":21,"tag":22,"props":15928,"children":15929},{},[15930],{"type":26,"value":15931},"In times past, offering content generated in the browser for download by the user was a difficult proposition - one needed to rely on plugins like Flash (boo! hiss!), or on sending the content up to the server to be sent back to the user with the appropriate headers to trigger a download, incurring the cost of the bandwidth up and down in the process.",{"type":21,"tag":22,"props":15933,"children":15934},{},[15935,15937,15944,15946,15953],{"type":26,"value":15936},"It's still not a straightforward prospect if you need to support older browsers - even IE 11 will require you to dip your toes into the shark-infested pool of browser-specific extensions like ",{"type":21,"tag":29,"props":15938,"children":15941},{"href":15939,"rel":15940},"https://msdn.microsoft.com/en-us/library/hh779016(v=vs.85).aspx",[93],[15942],{"type":26,"value":15943},"msSaveBlob",{"type":26,"value":15945},"; and then there's aborted efforts like the ",{"type":21,"tag":29,"props":15947,"children":15950},{"href":15948,"rel":15949},"https://developer.mozilla.org/en-US/docs/Web/API/FileSystem",[93],[15951],{"type":26,"value":15952},"FileSystem API",{"type":26,"value":378},{"type":21,"tag":22,"props":15955,"children":15956},{},[15957,15959,15966,15967,15974],{"type":26,"value":15958},"However, if you've managed to make a reliance on only modern/evergreen browsers stick for your project, a couple of HTML5 APIs have your content downloading needs covered - the ",{"type":21,"tag":29,"props":15960,"children":15963},{"href":15961,"rel":15962},"http://caniuse.com/#feat=download",[93],[15964],{"type":26,"value":15965},"Download Attribute",{"type":26,"value":5997},{"type":21,"tag":29,"props":15968,"children":15971},{"href":15969,"rel":15970},"http://caniuse.com/#feat=bloburls",[93],[15972],{"type":26,"value":15973},"Blob URLs",{"type":26,"value":378},{"type":21,"tag":3596,"props":15976,"children":15978},{"id":15977},"blob-urls",[15979],{"type":26,"value":15973},{"type":21,"tag":22,"props":15981,"children":15982},{},[15983,15985,15991,15993,16000,16002,16008,16010,16016],{"type":26,"value":15984},"So what are ",{"type":21,"tag":29,"props":15986,"children":15989},{"href":15987,"rel":15988},"https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL",[93],[15990],{"type":26,"value":15973},{"type":26,"value":15992},"? In short, they're a way of referencing a ",{"type":21,"tag":29,"props":15994,"children":15997},{"href":15995,"rel":15996},"https://developer.mozilla.org/en/docs/Web/API/Blob",[93],[15998],{"type":26,"value":15999},"Blob",{"type":26,"value":16001}," in the browser that allows us to interact with it like it was a remote file reference - for instance, we can assign it as the value of the ",{"type":21,"tag":63,"props":16003,"children":16005},{"className":16004},[],[16006],{"type":26,"value":16007},"src",{"type":26,"value":16009}," attribute of an ",{"type":21,"tag":63,"props":16011,"children":16013},{"className":16012},[],[16014],{"type":26,"value":16015},"img",{"type":26,"value":16017}," tag.",{"type":21,"tag":22,"props":16019,"children":16020},{},[16021],{"type":26,"value":16022},"Of course, Blob URLs are only useful if you can use Blobs, so you can implicitly expect any browser supporting the former to support the latter as well. This make getting a blob url a three part process, each of which we'll be discussing today:",{"type":21,"tag":3626,"props":16024,"children":16025},{},[16026,16031,16036],{"type":21,"tag":3630,"props":16027,"children":16028},{},[16029],{"type":26,"value":16030},"Get the blob;",{"type":21,"tag":3630,"props":16032,"children":16033},{},[16034],{"type":26,"value":16035},"Create the object url for the blob;",{"type":21,"tag":3630,"props":16037,"children":16038},{},[16039],{"type":26,"value":16040},"After we're finished with the url, revoke it.",{"type":21,"tag":22,"props":16042,"children":16043},{},[16044,16046,16053,16055,16062],{"type":26,"value":16045},"In our scenario above, getting a Blob is trivial - the ",{"type":21,"tag":29,"props":16047,"children":16050},{"href":16048,"rel":16049},"https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement",[93],[16051],{"type":26,"value":16052},"HTMLCanvasElement",{"type":26,"value":16054}," interface offers us a convenient ",{"type":21,"tag":29,"props":16056,"children":16059},{"href":16057,"rel":16058},"https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob",[93],[16060],{"type":26,"value":16061},"toBlob",{"type":26,"value":16063}," function that we can call asynchronously to get the contents of the canvas as a Blob.",{"type":21,"tag":22,"props":16065,"children":16066},{},[16067],{"type":26,"value":16068},"Let's say we had a bunch of comma-seperated values that we wanted to give to the user instead, however. In that case, we can just construct a new Blob from the string, like so:",{"type":21,"tag":200,"props":16070,"children":16072},{"className":202,"code":16071,"language":12,"meta":8,"style":8},"// Assuming we have our CSV in a string variable named 'csv'.\nvar blob = new Blob(csv, {type: 'text/csv'});\n",[16073],{"type":21,"tag":63,"props":16074,"children":16075},{"__ignoreMap":8},[16076,16084],{"type":21,"tag":209,"props":16077,"children":16078},{"class":211,"line":212},[16079],{"type":21,"tag":209,"props":16080,"children":16081},{"style":448},[16082],{"type":26,"value":16083},"// Assuming we have our CSV in a string variable named 'csv'.\n",{"type":21,"tag":209,"props":16085,"children":16086},{"class":211,"line":244},[16087,16091,16096,16100,16104,16109,16114,16119],{"type":21,"tag":209,"props":16088,"children":16089},{"style":216},[16090],{"type":26,"value":3909},{"type":21,"tag":209,"props":16092,"children":16093},{"style":222},[16094],{"type":26,"value":16095}," blob ",{"type":21,"tag":209,"props":16097,"children":16098},{"style":216},[16099],{"type":26,"value":1432},{"type":21,"tag":209,"props":16101,"children":16102},{"style":216},[16103],{"type":26,"value":6371},{"type":21,"tag":209,"props":16105,"children":16106},{"style":360},[16107],{"type":26,"value":16108}," Blob",{"type":21,"tag":209,"props":16110,"children":16111},{"style":222},[16112],{"type":26,"value":16113},"(csv, {type: ",{"type":21,"tag":209,"props":16115,"children":16116},{"style":233},[16117],{"type":26,"value":16118},"'text/csv'",{"type":21,"tag":209,"props":16120,"children":16121},{"style":222},[16122],{"type":26,"value":469},{"type":21,"tag":22,"props":16124,"children":16125},{},[16126,16128,16135],{"type":26,"value":16127},"Easy, right? We could also do this with arbitrary binary data, passing in a ",{"type":21,"tag":29,"props":16129,"children":16132},{"href":16130,"rel":16131},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays",[93],[16133],{"type":26,"value":16134},"typed array",{"type":26,"value":191},{"type":21,"tag":200,"props":16137,"children":16141},{"className":16138,"code":16139,"language":16140,"meta":8,"style":8},"language-javascript shiki shiki-themes github-light github-dark","var blob = new Blob([the_typed_array], {type: 'application/octet-stream'});\n","javascript",[16142],{"type":21,"tag":63,"props":16143,"children":16144},{"__ignoreMap":8},[16145],{"type":21,"tag":209,"props":16146,"children":16147},{"class":211,"line":212},[16148,16152,16156,16160,16164,16168,16173,16178],{"type":21,"tag":209,"props":16149,"children":16150},{"style":216},[16151],{"type":26,"value":3909},{"type":21,"tag":209,"props":16153,"children":16154},{"style":222},[16155],{"type":26,"value":16095},{"type":21,"tag":209,"props":16157,"children":16158},{"style":216},[16159],{"type":26,"value":1432},{"type":21,"tag":209,"props":16161,"children":16162},{"style":216},[16163],{"type":26,"value":6371},{"type":21,"tag":209,"props":16165,"children":16166},{"style":360},[16167],{"type":26,"value":16108},{"type":21,"tag":209,"props":16169,"children":16170},{"style":222},[16171],{"type":26,"value":16172},"([the_typed_array], {type: ",{"type":21,"tag":209,"props":16174,"children":16175},{"style":233},[16176],{"type":26,"value":16177},"'application/octet-stream'",{"type":21,"tag":209,"props":16179,"children":16180},{"style":222},[16181],{"type":26,"value":469},{"type":21,"tag":22,"props":16183,"children":16184},{},[16185],{"type":26,"value":16186},"This could be generating save files for games, user-specific executables, etc.",{"type":21,"tag":22,"props":16188,"children":16189},{},[16190],{"type":26,"value":16191},"Now that we have our blob one way or the other, creating the object URL is just as easy:",{"type":21,"tag":200,"props":16193,"children":16195},{"className":16138,"code":16194,"language":16140,"meta":8,"style":8},"var blobURL = URL.createObjectURL(blob);\n",[16196],{"type":21,"tag":63,"props":16197,"children":16198},{"__ignoreMap":8},[16199],{"type":21,"tag":209,"props":16200,"children":16201},{"class":211,"line":212},[16202,16206,16211,16215,16220,16224,16229],{"type":21,"tag":209,"props":16203,"children":16204},{"style":216},[16205],{"type":26,"value":3909},{"type":21,"tag":209,"props":16207,"children":16208},{"style":222},[16209],{"type":26,"value":16210}," blobURL ",{"type":21,"tag":209,"props":16212,"children":16213},{"style":216},[16214],{"type":26,"value":1432},{"type":21,"tag":209,"props":16216,"children":16217},{"style":263},[16218],{"type":26,"value":16219}," URL",{"type":21,"tag":209,"props":16221,"children":16222},{"style":222},[16223],{"type":26,"value":378},{"type":21,"tag":209,"props":16225,"children":16226},{"style":360},[16227],{"type":26,"value":16228},"createObjectURL",{"type":21,"tag":209,"props":16230,"children":16231},{"style":222},[16232],{"type":26,"value":16233},"(blob);\n",{"type":21,"tag":22,"props":16235,"children":16236},{},[16237,16239,16244,16246,16251],{"type":26,"value":16238},"On the topic of point 3, above, we ",{"type":21,"tag":1084,"props":16240,"children":16241},{},[16242],{"type":26,"value":16243},"could",{"type":26,"value":16245}," just rely on the garbage collection of the browser - the lifetime of our object urls are tied to the document. However, it's good practice to revoke the urls yourself - otherwise blobs that could otherwise be garbage collected may stick around, unecessarily consuming memory. Also keep in mind that each object url is unique - if you call ",{"type":21,"tag":63,"props":16247,"children":16249},{"className":16248},[],[16250],{"type":26,"value":16228},{"type":26,"value":16252}," against the same blob three times, you get three different URLs you'll need to revoke separately.",{"type":21,"tag":22,"props":16254,"children":16255},{},[16256,16258,16263,16265,16270],{"type":26,"value":16257},"On the other hand, if you're using the object url as, for example, the ",{"type":21,"tag":63,"props":16259,"children":16261},{"className":16260},[],[16262],{"type":26,"value":16007},{"type":26,"value":16264}," of an ",{"type":21,"tag":63,"props":16266,"children":16268},{"className":16267},[],[16269],{"type":26,"value":16015},{"type":26,"value":16271},", you don't want to revoke said URL until you remove the img from the DOM, otherwise you'll end up with a broken img tag.",{"type":21,"tag":200,"props":16273,"children":16275},{"className":16138,"code":16274,"language":16140,"meta":8,"style":8},"URL.revokeObjectURL(blobURL);\n",[16276],{"type":21,"tag":63,"props":16277,"children":16278},{"__ignoreMap":8},[16279],{"type":21,"tag":209,"props":16280,"children":16281},{"class":211,"line":212},[16282,16287,16291,16296],{"type":21,"tag":209,"props":16283,"children":16284},{"style":263},[16285],{"type":26,"value":16286},"URL",{"type":21,"tag":209,"props":16288,"children":16289},{"style":222},[16290],{"type":26,"value":378},{"type":21,"tag":209,"props":16292,"children":16293},{"style":360},[16294],{"type":26,"value":16295},"revokeObjectURL",{"type":21,"tag":209,"props":16297,"children":16298},{"style":222},[16299],{"type":26,"value":16300},"(blobURL);\n",{"type":21,"tag":3596,"props":16302,"children":16304},{"id":16303},"anchor-download-attribute",[16305],{"type":26,"value":16306},"Anchor Download Attribute",{"type":21,"tag":22,"props":16308,"children":16309},{},[16310],{"type":26,"value":16311},"For a while, it seemed like browser vendors were set to give us a more comprehensive access to the file system, or some sandboxed portion thereof. That withered on the vine, but it didn't take with it the need to sometimes download generated content - and so we have the anchor download attribute. It's actually a pleasantly intuitive overloading of the anchor element - classically, we might point to a file on a server with the anchor element, expecting that the user would click on it and thereby trigger the download - assuming the server sent the appropriate headers.",{"type":21,"tag":22,"props":16313,"children":16314},{},[16315,16317,16323],{"type":26,"value":16316},"In this case, we can indicate that we want the client to download whatever the anchor is pointing to, even if the ",{"type":21,"tag":63,"props":16318,"children":16320},{"className":16319},[],[16321],{"type":26,"value":16322},"content-disposition",{"type":26,"value":16324}," headers we would normally require aren't sent, and we can specify a default name for the resulting file - and combining that with object urls lets us inform the browser that we want it to download the client-side Blob that the anchor is pointing to.",{"type":21,"tag":22,"props":16326,"children":16327},{},[16328,16330,16336],{"type":26,"value":16329},"So, assuming we have a ",{"type":21,"tag":63,"props":16331,"children":16333},{"className":16332},[],[16334],{"type":26,"value":16335},"blobURL",{"type":26,"value":16337}," from the process above:",{"type":21,"tag":200,"props":16339,"children":16341},{"className":16138,"code":16340,"language":16140,"meta":8,"style":8},"var anchor = document.createElement('a');\nanchor.href = blobURL;\nanchor.download = 'name_of_file.ext';\n",[16342],{"type":21,"tag":63,"props":16343,"children":16344},{"__ignoreMap":8},[16345,16384,16401],{"type":21,"tag":209,"props":16346,"children":16347},{"class":211,"line":212},[16348,16352,16357,16361,16366,16371,16375,16380],{"type":21,"tag":209,"props":16349,"children":16350},{"style":216},[16351],{"type":26,"value":3909},{"type":21,"tag":209,"props":16353,"children":16354},{"style":222},[16355],{"type":26,"value":16356}," anchor ",{"type":21,"tag":209,"props":16358,"children":16359},{"style":216},[16360],{"type":26,"value":1432},{"type":21,"tag":209,"props":16362,"children":16363},{"style":222},[16364],{"type":26,"value":16365}," document.",{"type":21,"tag":209,"props":16367,"children":16368},{"style":360},[16369],{"type":26,"value":16370},"createElement",{"type":21,"tag":209,"props":16372,"children":16373},{"style":222},[16374],{"type":26,"value":368},{"type":21,"tag":209,"props":16376,"children":16377},{"style":233},[16378],{"type":26,"value":16379},"'a'",{"type":21,"tag":209,"props":16381,"children":16382},{"style":222},[16383],{"type":26,"value":2608},{"type":21,"tag":209,"props":16385,"children":16386},{"class":211,"line":244},[16387,16392,16396],{"type":21,"tag":209,"props":16388,"children":16389},{"style":222},[16390],{"type":26,"value":16391},"anchor.href ",{"type":21,"tag":209,"props":16393,"children":16394},{"style":216},[16395],{"type":26,"value":1432},{"type":21,"tag":209,"props":16397,"children":16398},{"style":222},[16399],{"type":26,"value":16400}," blobURL;\n",{"type":21,"tag":209,"props":16402,"children":16403},{"class":211,"line":254},[16404,16409,16413,16418],{"type":21,"tag":209,"props":16405,"children":16406},{"style":222},[16407],{"type":26,"value":16408},"anchor.download ",{"type":21,"tag":209,"props":16410,"children":16411},{"style":216},[16412],{"type":26,"value":1432},{"type":21,"tag":209,"props":16414,"children":16415},{"style":233},[16416],{"type":26,"value":16417}," 'name_of_file.ext'",{"type":21,"tag":209,"props":16419,"children":16420},{"style":222},[16421],{"type":26,"value":241},{"type":21,"tag":22,"props":16423,"children":16424},{},[16425],{"type":26,"value":16426},"If we wanted to show this anchor to the user for them to click on, we could simply add it wherever appropriate. If, however, we wanted to trigger a download automatically, this too is fairly straightforward:",{"type":21,"tag":200,"props":16428,"children":16430},{"className":16138,"code":16429,"language":16140,"meta":8,"style":8},"anchor.style.display = \"none\";\ndocument.body.appendChild(anchor);\nanchor.click();\n",[16431],{"type":21,"tag":63,"props":16432,"children":16433},{"__ignoreMap":8},[16434,16455,16473],{"type":21,"tag":209,"props":16435,"children":16436},{"class":211,"line":212},[16437,16442,16446,16451],{"type":21,"tag":209,"props":16438,"children":16439},{"style":222},[16440],{"type":26,"value":16441},"anchor.style.display ",{"type":21,"tag":209,"props":16443,"children":16444},{"style":216},[16445],{"type":26,"value":1432},{"type":21,"tag":209,"props":16447,"children":16448},{"style":233},[16449],{"type":26,"value":16450}," \"none\"",{"type":21,"tag":209,"props":16452,"children":16453},{"style":222},[16454],{"type":26,"value":241},{"type":21,"tag":209,"props":16456,"children":16457},{"class":211,"line":244},[16458,16463,16468],{"type":21,"tag":209,"props":16459,"children":16460},{"style":222},[16461],{"type":26,"value":16462},"document.body.",{"type":21,"tag":209,"props":16464,"children":16465},{"style":360},[16466],{"type":26,"value":16467},"appendChild",{"type":21,"tag":209,"props":16469,"children":16470},{"style":222},[16471],{"type":26,"value":16472},"(anchor);\n",{"type":21,"tag":209,"props":16474,"children":16475},{"class":211,"line":254},[16476,16481,16486],{"type":21,"tag":209,"props":16477,"children":16478},{"style":222},[16479],{"type":26,"value":16480},"anchor.",{"type":21,"tag":209,"props":16482,"children":16483},{"style":360},[16484],{"type":26,"value":16485},"click",{"type":21,"tag":209,"props":16487,"children":16488},{"style":222},[16489],{"type":26,"value":4123},{"type":21,"tag":22,"props":16491,"children":16492},{},[16493],{"type":26,"value":16494},"Note that we still need to add the anchor to the body. Because this triggers the blocking download logic in the browser, we can then add a little further logic in a timeout to remove the anchor (and, if we're done with the url, revoke it):",{"type":21,"tag":200,"props":16496,"children":16498},{"className":16138,"code":16497,"language":16140,"meta":8,"style":8},"setTimeout(function(){\n    URL.revokeObjectURL(url);\n    document.body.removeChild(anchor);\n}, 1);\n",[16499],{"type":21,"tag":63,"props":16500,"children":16501},{"__ignoreMap":8},[16502,16522,16543,16560],{"type":21,"tag":209,"props":16503,"children":16504},{"class":211,"line":212},[16505,16510,16514,16518],{"type":21,"tag":209,"props":16506,"children":16507},{"style":360},[16508],{"type":26,"value":16509},"setTimeout",{"type":21,"tag":209,"props":16511,"children":16512},{"style":222},[16513],{"type":26,"value":368},{"type":21,"tag":209,"props":16515,"children":16516},{"style":216},[16517],{"type":26,"value":4622},{"type":21,"tag":209,"props":16519,"children":16520},{"style":222},[16521],{"type":26,"value":2561},{"type":21,"tag":209,"props":16523,"children":16524},{"class":211,"line":244},[16525,16530,16534,16538],{"type":21,"tag":209,"props":16526,"children":16527},{"style":263},[16528],{"type":26,"value":16529},"    URL",{"type":21,"tag":209,"props":16531,"children":16532},{"style":222},[16533],{"type":26,"value":378},{"type":21,"tag":209,"props":16535,"children":16536},{"style":360},[16537],{"type":26,"value":16295},{"type":21,"tag":209,"props":16539,"children":16540},{"style":222},[16541],{"type":26,"value":16542},"(url);\n",{"type":21,"tag":209,"props":16544,"children":16545},{"class":211,"line":254},[16546,16551,16556],{"type":21,"tag":209,"props":16547,"children":16548},{"style":222},[16549],{"type":26,"value":16550},"    document.body.",{"type":21,"tag":209,"props":16552,"children":16553},{"style":360},[16554],{"type":26,"value":16555},"removeChild",{"type":21,"tag":209,"props":16557,"children":16558},{"style":222},[16559],{"type":26,"value":16472},{"type":21,"tag":209,"props":16561,"children":16562},{"class":211,"line":279},[16563,16568,16572],{"type":21,"tag":209,"props":16564,"children":16565},{"style":222},[16566],{"type":26,"value":16567},"}, ",{"type":21,"tag":209,"props":16569,"children":16570},{"style":263},[16571],{"type":26,"value":3224},{"type":21,"tag":209,"props":16573,"children":16574},{"style":222},[16575],{"type":26,"value":2608},{"type":21,"tag":22,"props":16577,"children":16578},{},[16579],{"type":26,"value":16580},"And now, the user should be presented with a download of the client-side generated content, with the specified name, without needing any plugins or bounces off the server. Beautiful.",{"type":21,"tag":3490,"props":16582,"children":16583},{},[16584],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":16586},[16587,16588],{"id":15977,"depth":244,"text":15973},{"id":16303,"depth":244,"text":16306},"content:ckeefer:2017-1:downloadingclientsidecontent.md","ckeefer/2017-1/downloadingclientsidecontent.md","ckeefer/2017-1/downloadingclientsidecontent",{"user":3518,"name":3519},{"_path":16594,"_dir":16595,"_draft":7,"_partial":7,"_locale":8,"title":16596,"description":16597,"publishDate":16598,"tags":16599,"excerpt":16597,"body":16601,"_type":3511,"_id":20331,"_source":3513,"_file":20332,"_stem":20333,"_extension":3516,"author":20334},"/ckeefer/2016-7/gofetch2","2016-7","Go Fetch 2! (JavaScript Fetch API)","Last time we discussed the Fetch API in general, taking a look at how it differed from the XMLHttpRequest API, and some of its advantages. Today, we're going to take a look at a little library that you can include in your projects today that offers you localStorage caching for the Fetch API.","2016-10-10",[12,16600,3527],"jquery",{"type":18,"children":16602,"toc":20324},[16603,16614,16620,16633,16639,16652,16679,16692,16697,16703,16717,16723,16728,16757,17365,17384,17709,17722,17728,17741,20320],{"type":21,"tag":22,"props":16604,"children":16605},{},[16606,16612],{"type":21,"tag":29,"props":16607,"children":16609},{"href":16608},"/search/user:ckeefer/go/fetch",[16610],{"type":26,"value":16611},"Last time",{"type":26,"value":16613}," we discussed the Fetch API in general, taking a look at how it differed from the XMLHttpRequest API, and some of its advantages. Today, we're going to take a look at a little library that you can include in your projects today that offers you localStorage caching for the Fetch API.",{"type":21,"tag":51,"props":16615,"children":16617},{"id":16616},"tlwr",[16618],{"type":26,"value":16619},"TL;WR",{"type":21,"tag":22,"props":16621,"children":16622},{},[16623,16625,16632],{"type":26,"value":16624},"If you're anxious to get to the good stuff, you can head straight to the ",{"type":21,"tag":29,"props":16626,"children":16629},{"href":16627,"rel":16628},"https://github.com/SaneMethod/fetchCache",[93],[16630],{"type":26,"value":16631},"fetchCache Github Repo",{"type":26,"value":378},{"type":21,"tag":51,"props":16634,"children":16636},{"id":16635},"cache-control",[16637],{"type":26,"value":16638},"Cache Control",{"type":21,"tag":22,"props":16640,"children":16641},{},[16642,16644,16650],{"type":26,"value":16643},"Before we get started, those of you more familiar with the Fetch API might be wondering why we need to use localStorage for caching fetch request responses at all. Isn't that what the ",{"type":21,"tag":63,"props":16645,"children":16647},{"className":16646},[],[16648],{"type":26,"value":16649},"cache",{"type":26,"value":16651}," property in the fetch settings is for?",{"type":21,"tag":22,"props":16653,"children":16654},{},[16655,16657,16663,16664,16670,16671,16677],{"type":26,"value":16656},"Yes and no. The cache setting allows you greater control over the standard HTTP cache, so that you don't need to use the old trick of appending a datetime string to your request for 'cache-busting' purposes, as you might have done in the past with XHR. Instead, you can simply specify ",{"type":21,"tag":63,"props":16658,"children":16660},{"className":16659},[],[16661],{"type":26,"value":16662},"cache:'no-store'",{"type":26,"value":1922},{"type":21,"tag":63,"props":16665,"children":16667},{"className":16666},[],[16668],{"type":26,"value":16669},"cache:'no-cache'",{"type":26,"value":1922},{"type":21,"tag":63,"props":16672,"children":16674},{"className":16673},[],[16675],{"type":26,"value":16676},"cache:'reload'",{"type":26,"value":16678},", depending on your use case.",{"type":21,"tag":22,"props":16680,"children":16681},{},[16682,16684,16690],{"type":26,"value":16683},"You can also bypass a network request (potentially useful for offline usage) and pull from the HTTP cache via ",{"type":21,"tag":63,"props":16685,"children":16687},{"className":16686},[],[16688],{"type":26,"value":16689},"cache:'force-cache'",{"type":26,"value":16691},", which appears to accomplish one of the goals of caching in localStorage.",{"type":21,"tag":22,"props":16693,"children":16694},{},[16695],{"type":26,"value":16696},"However, that's as far as our control over the cache goes. We can't specify how long we want items to remain in the cache, or what requests line up with which contents of the cache, or validate the contents of the cache before returning them. For that, we need to wrap fetch with a bit of custom logic to allow us to handle the caching ourselves.",{"type":21,"tag":51,"props":16698,"children":16700},{"id":16699},"looks-familiar",[16701],{"type":26,"value":16702},"Looks Familiar",{"type":21,"tag":22,"props":16704,"children":16705},{},[16706,16708,16715],{"type":26,"value":16707},"Just before we dive in, you may find that the API I'm about to present looks familiar - maybe because you've used ",{"type":21,"tag":29,"props":16709,"children":16712},{"href":16710,"rel":16711},"https://github.com/SaneMethod/jquery-ajax-localstorage-cache",[93],[16713],{"type":26,"value":16714},"JALC",{"type":26,"value":16716},", the plugin for similar caching with jQuery.ajax. The API similarity is most definitely on purpose, and you should feel comfortable moving from one to the other.",{"type":21,"tag":51,"props":16718,"children":16720},{"id":16719},"the-breakdown",[16721],{"type":26,"value":16722},"The Breakdown",{"type":21,"tag":22,"props":16724,"children":16725},{},[16726],{"type":26,"value":16727},"So, let's take a look at the code, and discuss what's happening.",{"type":21,"tag":22,"props":16729,"children":16730},{},[16731,16733,16740,16742,16748,16749,16755],{"type":26,"value":16732},"For those of you who've used JALC, much of this will look familiar, and you can reference ",{"type":21,"tag":29,"props":16734,"children":16737},{"href":16735,"rel":16736},"https://artandlogic.com/2013/06/ajax-caching-transports-compatible-with-jquery-deferred/",[93],[16738],{"type":26,"value":16739},"this previous breakdown of the core parts of JALC for more details",{"type":26,"value":16741},", so we'll skip over those. Let's take a look at our ",{"type":21,"tag":63,"props":16743,"children":16745},{"className":16744},[],[16746],{"type":26,"value":16747},"cacheResponse",{"type":26,"value":5997},{"type":21,"tag":63,"props":16750,"children":16752},{"className":16751},[],[16753],{"type":26,"value":16754},"provideResponse",{"type":26,"value":16756}," functions, as they're the juicy bits.",{"type":21,"tag":200,"props":16758,"children":16760},{"className":16138,"code":16759,"language":16140,"meta":8,"style":8},"   /**\n    * Cache the response into our storage object.\n    * We clone the response so that we can drain the stream without making it\n    * unavailable to future handlers.\n    *\n    * @param {string} cacheKey Key under which to cache the data string. Bound in\n    * fetch override.\n    * @param {Storage} storage Object implementing Storage interface to store cached data\n    * (text or json exclusively) in. Bound in fetch override.\n    * @param {Number} hourstl Number of hours this value shoud remain in the cache.\n    * Bound in fetch override.\n    * @param {Response} response\n    */\nfunction cacheResponse(cacheKey, storage, hourstl, response) {\n    var cres = response.clone(),\n        dataType = (response.headers.get('Content-Type') || 'text/plain').toLowerCase();\n\n    cres.text().then((text) => {\n        try {\n            storage.setItem(cacheKey, text);\n            storage.setItem(cacheKey + 'cachettl', +new Date() + 1000 * 60 * 60 * hourstl);\n            storage.setItem(cacheKey + 'dataType', dataType);\n        } catch (e) {\n            // Remove any incomplete data that may have been saved before the exception was caught\n            removeFromStorage(storage, cacheKey);\n            console.log('Cache Error: ' + e, cacheKey, text);\n        }\n    });\n\n    return response;\n}\n\n",[16761],{"type":21,"tag":63,"props":16762,"children":16763},{"__ignoreMap":8},[16764,16772,16780,16788,16796,16804,16830,16838,16864,16872,16898,16906,16927,16935,16987,17017,17073,17080,17121,17132,17150,17231,17260,17275,17283,17296,17325,17332,17339,17346,17358],{"type":21,"tag":209,"props":16765,"children":16766},{"class":211,"line":212},[16767],{"type":21,"tag":209,"props":16768,"children":16769},{"style":448},[16770],{"type":26,"value":16771},"   /**\n",{"type":21,"tag":209,"props":16773,"children":16774},{"class":211,"line":244},[16775],{"type":21,"tag":209,"props":16776,"children":16777},{"style":448},[16778],{"type":26,"value":16779},"    * Cache the response into our storage object.\n",{"type":21,"tag":209,"props":16781,"children":16782},{"class":211,"line":254},[16783],{"type":21,"tag":209,"props":16784,"children":16785},{"style":448},[16786],{"type":26,"value":16787},"    * We clone the response so that we can drain the stream without making it\n",{"type":21,"tag":209,"props":16789,"children":16790},{"class":211,"line":279},[16791],{"type":21,"tag":209,"props":16792,"children":16793},{"style":448},[16794],{"type":26,"value":16795},"    * unavailable to future handlers.\n",{"type":21,"tag":209,"props":16797,"children":16798},{"class":211,"line":288},[16799],{"type":21,"tag":209,"props":16800,"children":16801},{"style":448},[16802],{"type":26,"value":16803},"    *\n",{"type":21,"tag":209,"props":16805,"children":16806},{"class":211,"line":307},[16807,16812,16816,16820,16825],{"type":21,"tag":209,"props":16808,"children":16809},{"style":448},[16810],{"type":26,"value":16811},"    * ",{"type":21,"tag":209,"props":16813,"children":16814},{"style":216},[16815],{"type":26,"value":13311},{"type":21,"tag":209,"props":16817,"children":16818},{"style":360},[16819],{"type":26,"value":13316},{"type":21,"tag":209,"props":16821,"children":16822},{"style":222},[16823],{"type":26,"value":16824}," cacheKey",{"type":21,"tag":209,"props":16826,"children":16827},{"style":448},[16828],{"type":26,"value":16829}," Key under which to cache the data string. Bound in\n",{"type":21,"tag":209,"props":16831,"children":16832},{"class":211,"line":325},[16833],{"type":21,"tag":209,"props":16834,"children":16835},{"style":448},[16836],{"type":26,"value":16837},"    * fetch override.\n",{"type":21,"tag":209,"props":16839,"children":16840},{"class":211,"line":334},[16841,16845,16849,16854,16859],{"type":21,"tag":209,"props":16842,"children":16843},{"style":448},[16844],{"type":26,"value":16811},{"type":21,"tag":209,"props":16846,"children":16847},{"style":216},[16848],{"type":26,"value":13311},{"type":21,"tag":209,"props":16850,"children":16851},{"style":360},[16852],{"type":26,"value":16853}," {Storage}",{"type":21,"tag":209,"props":16855,"children":16856},{"style":222},[16857],{"type":26,"value":16858}," storage",{"type":21,"tag":209,"props":16860,"children":16861},{"style":448},[16862],{"type":26,"value":16863}," Object implementing Storage interface to store cached data\n",{"type":21,"tag":209,"props":16865,"children":16866},{"class":211,"line":343},[16867],{"type":21,"tag":209,"props":16868,"children":16869},{"style":448},[16870],{"type":26,"value":16871},"    * (text or json exclusively) in. Bound in fetch override.\n",{"type":21,"tag":209,"props":16873,"children":16874},{"class":211,"line":351},[16875,16879,16883,16888,16893],{"type":21,"tag":209,"props":16876,"children":16877},{"style":448},[16878],{"type":26,"value":16811},{"type":21,"tag":209,"props":16880,"children":16881},{"style":216},[16882],{"type":26,"value":13311},{"type":21,"tag":209,"props":16884,"children":16885},{"style":360},[16886],{"type":26,"value":16887}," {Number}",{"type":21,"tag":209,"props":16889,"children":16890},{"style":222},[16891],{"type":26,"value":16892}," hourstl",{"type":21,"tag":209,"props":16894,"children":16895},{"style":448},[16896],{"type":26,"value":16897}," Number of hours this value shoud remain in the cache.\n",{"type":21,"tag":209,"props":16899,"children":16900},{"class":211,"line":444},[16901],{"type":21,"tag":209,"props":16902,"children":16903},{"style":448},[16904],{"type":26,"value":16905},"    * Bound in fetch override.\n",{"type":21,"tag":209,"props":16907,"children":16908},{"class":211,"line":454},[16909,16913,16917,16922],{"type":21,"tag":209,"props":16910,"children":16911},{"style":448},[16912],{"type":26,"value":16811},{"type":21,"tag":209,"props":16914,"children":16915},{"style":216},[16916],{"type":26,"value":13311},{"type":21,"tag":209,"props":16918,"children":16919},{"style":360},[16920],{"type":26,"value":16921}," {Response}",{"type":21,"tag":209,"props":16923,"children":16924},{"style":222},[16925],{"type":26,"value":16926}," response\n",{"type":21,"tag":209,"props":16928,"children":16929},{"class":211,"line":463},[16930],{"type":21,"tag":209,"props":16931,"children":16932},{"style":448},[16933],{"type":26,"value":16934},"    */\n",{"type":21,"tag":209,"props":16936,"children":16937},{"class":211,"line":472},[16938,16942,16947,16951,16956,16960,16965,16969,16974,16978,16983],{"type":21,"tag":209,"props":16939,"children":16940},{"style":216},[16941],{"type":26,"value":4622},{"type":21,"tag":209,"props":16943,"children":16944},{"style":360},[16945],{"type":26,"value":16946}," cacheResponse",{"type":21,"tag":209,"props":16948,"children":16949},{"style":222},[16950],{"type":26,"value":368},{"type":21,"tag":209,"props":16952,"children":16953},{"style":400},[16954],{"type":26,"value":16955},"cacheKey",{"type":21,"tag":209,"props":16957,"children":16958},{"style":222},[16959],{"type":26,"value":408},{"type":21,"tag":209,"props":16961,"children":16962},{"style":400},[16963],{"type":26,"value":16964},"storage",{"type":21,"tag":209,"props":16966,"children":16967},{"style":222},[16968],{"type":26,"value":408},{"type":21,"tag":209,"props":16970,"children":16971},{"style":400},[16972],{"type":26,"value":16973},"hourstl",{"type":21,"tag":209,"props":16975,"children":16976},{"style":222},[16977],{"type":26,"value":408},{"type":21,"tag":209,"props":16979,"children":16980},{"style":400},[16981],{"type":26,"value":16982},"response",{"type":21,"tag":209,"props":16984,"children":16985},{"style":222},[16986],{"type":26,"value":5588},{"type":21,"tag":209,"props":16988,"children":16989},{"class":211,"line":480},[16990,16995,17000,17004,17008,17013],{"type":21,"tag":209,"props":16991,"children":16992},{"style":216},[16993],{"type":26,"value":16994},"    var",{"type":21,"tag":209,"props":16996,"children":16997},{"style":222},[16998],{"type":26,"value":16999}," cres ",{"type":21,"tag":209,"props":17001,"children":17002},{"style":216},[17003],{"type":26,"value":1432},{"type":21,"tag":209,"props":17005,"children":17006},{"style":222},[17007],{"type":26,"value":10956},{"type":21,"tag":209,"props":17009,"children":17010},{"style":360},[17011],{"type":26,"value":17012},"clone",{"type":21,"tag":209,"props":17014,"children":17015},{"style":222},[17016],{"type":26,"value":13988},{"type":21,"tag":209,"props":17018,"children":17019},{"class":211,"line":489},[17020,17025,17029,17034,17038,17042,17047,17051,17055,17060,17064,17069],{"type":21,"tag":209,"props":17021,"children":17022},{"style":222},[17023],{"type":26,"value":17024},"        dataType ",{"type":21,"tag":209,"props":17026,"children":17027},{"style":216},[17028],{"type":26,"value":1432},{"type":21,"tag":209,"props":17030,"children":17031},{"style":222},[17032],{"type":26,"value":17033}," (response.headers.",{"type":21,"tag":209,"props":17035,"children":17036},{"style":360},[17037],{"type":26,"value":7636},{"type":21,"tag":209,"props":17039,"children":17040},{"style":222},[17041],{"type":26,"value":368},{"type":21,"tag":209,"props":17043,"children":17044},{"style":233},[17045],{"type":26,"value":17046},"'Content-Type'",{"type":21,"tag":209,"props":17048,"children":17049},{"style":222},[17050],{"type":26,"value":432},{"type":21,"tag":209,"props":17052,"children":17053},{"style":216},[17054],{"type":26,"value":13270},{"type":21,"tag":209,"props":17056,"children":17057},{"style":233},[17058],{"type":26,"value":17059}," 'text/plain'",{"type":21,"tag":209,"props":17061,"children":17062},{"style":222},[17063],{"type":26,"value":2699},{"type":21,"tag":209,"props":17065,"children":17066},{"style":360},[17067],{"type":26,"value":17068},"toLowerCase",{"type":21,"tag":209,"props":17070,"children":17071},{"style":222},[17072],{"type":26,"value":4123},{"type":21,"tag":209,"props":17074,"children":17075},{"class":211,"line":847},[17076],{"type":21,"tag":209,"props":17077,"children":17078},{"emptyLinePlaceholder":248},[17079],{"type":26,"value":251},{"type":21,"tag":209,"props":17081,"children":17082},{"class":211,"line":860},[17083,17088,17092,17097,17101,17105,17109,17113,17117],{"type":21,"tag":209,"props":17084,"children":17085},{"style":222},[17086],{"type":26,"value":17087},"    cres.",{"type":21,"tag":209,"props":17089,"children":17090},{"style":360},[17091],{"type":26,"value":26},{"type":21,"tag":209,"props":17093,"children":17094},{"style":222},[17095],{"type":26,"value":17096},"().",{"type":21,"tag":209,"props":17098,"children":17099},{"style":360},[17100],{"type":26,"value":2704},{"type":21,"tag":209,"props":17102,"children":17103},{"style":222},[17104],{"type":26,"value":2709},{"type":21,"tag":209,"props":17106,"children":17107},{"style":400},[17108],{"type":26,"value":26},{"type":21,"tag":209,"props":17110,"children":17111},{"style":222},[17112],{"type":26,"value":432},{"type":21,"tag":209,"props":17114,"children":17115},{"style":216},[17116],{"type":26,"value":437},{"type":21,"tag":209,"props":17118,"children":17119},{"style":222},[17120],{"type":26,"value":276},{"type":21,"tag":209,"props":17122,"children":17123},{"class":211,"line":877},[17124,17128],{"type":21,"tag":209,"props":17125,"children":17126},{"style":216},[17127],{"type":26,"value":15345},{"type":21,"tag":209,"props":17129,"children":17130},{"style":222},[17131],{"type":26,"value":276},{"type":21,"tag":209,"props":17133,"children":17134},{"class":211,"line":889},[17135,17140,17145],{"type":21,"tag":209,"props":17136,"children":17137},{"style":222},[17138],{"type":26,"value":17139},"            storage.",{"type":21,"tag":209,"props":17141,"children":17142},{"style":360},[17143],{"type":26,"value":17144},"setItem",{"type":21,"tag":209,"props":17146,"children":17147},{"style":222},[17148],{"type":26,"value":17149},"(cacheKey, text);\n",{"type":21,"tag":209,"props":17151,"children":17152},{"class":211,"line":902},[17153,17157,17161,17166,17171,17176,17180,17185,17190,17195,17199,17204,17209,17214,17218,17222,17226],{"type":21,"tag":209,"props":17154,"children":17155},{"style":222},[17156],{"type":26,"value":17139},{"type":21,"tag":209,"props":17158,"children":17159},{"style":360},[17160],{"type":26,"value":17144},{"type":21,"tag":209,"props":17162,"children":17163},{"style":222},[17164],{"type":26,"value":17165},"(cacheKey ",{"type":21,"tag":209,"props":17167,"children":17168},{"style":216},[17169],{"type":26,"value":17170},"+",{"type":21,"tag":209,"props":17172,"children":17173},{"style":233},[17174],{"type":26,"value":17175}," 'cachettl'",{"type":21,"tag":209,"props":17177,"children":17178},{"style":222},[17179],{"type":26,"value":408},{"type":21,"tag":209,"props":17181,"children":17182},{"style":216},[17183],{"type":26,"value":17184},"+new",{"type":21,"tag":209,"props":17186,"children":17187},{"style":360},[17188],{"type":26,"value":17189}," Date",{"type":21,"tag":209,"props":17191,"children":17192},{"style":222},[17193],{"type":26,"value":17194},"() ",{"type":21,"tag":209,"props":17196,"children":17197},{"style":216},[17198],{"type":26,"value":17170},{"type":21,"tag":209,"props":17200,"children":17201},{"style":263},[17202],{"type":26,"value":17203}," 1000",{"type":21,"tag":209,"props":17205,"children":17206},{"style":216},[17207],{"type":26,"value":17208}," *",{"type":21,"tag":209,"props":17210,"children":17211},{"style":263},[17212],{"type":26,"value":17213}," 60",{"type":21,"tag":209,"props":17215,"children":17216},{"style":216},[17217],{"type":26,"value":17208},{"type":21,"tag":209,"props":17219,"children":17220},{"style":263},[17221],{"type":26,"value":17213},{"type":21,"tag":209,"props":17223,"children":17224},{"style":216},[17225],{"type":26,"value":17208},{"type":21,"tag":209,"props":17227,"children":17228},{"style":222},[17229],{"type":26,"value":17230}," hourstl);\n",{"type":21,"tag":209,"props":17232,"children":17233},{"class":211,"line":914},[17234,17238,17242,17246,17250,17255],{"type":21,"tag":209,"props":17235,"children":17236},{"style":222},[17237],{"type":26,"value":17139},{"type":21,"tag":209,"props":17239,"children":17240},{"style":360},[17241],{"type":26,"value":17144},{"type":21,"tag":209,"props":17243,"children":17244},{"style":222},[17245],{"type":26,"value":17165},{"type":21,"tag":209,"props":17247,"children":17248},{"style":216},[17249],{"type":26,"value":17170},{"type":21,"tag":209,"props":17251,"children":17252},{"style":233},[17253],{"type":26,"value":17254}," 'dataType'",{"type":21,"tag":209,"props":17256,"children":17257},{"style":222},[17258],{"type":26,"value":17259},", dataType);\n",{"type":21,"tag":209,"props":17261,"children":17262},{"class":211,"line":922},[17263,17267,17271],{"type":21,"tag":209,"props":17264,"children":17265},{"style":222},[17266],{"type":26,"value":15388},{"type":21,"tag":209,"props":17268,"children":17269},{"style":216},[17270],{"type":26,"value":5347},{"type":21,"tag":209,"props":17272,"children":17273},{"style":222},[17274],{"type":26,"value":15397},{"type":21,"tag":209,"props":17276,"children":17277},{"class":211,"line":2312},[17278],{"type":21,"tag":209,"props":17279,"children":17280},{"style":448},[17281],{"type":26,"value":17282},"            // Remove any incomplete data that may have been saved before the exception was caught\n",{"type":21,"tag":209,"props":17284,"children":17285},{"class":211,"line":2321},[17286,17291],{"type":21,"tag":209,"props":17287,"children":17288},{"style":360},[17289],{"type":26,"value":17290},"            removeFromStorage",{"type":21,"tag":209,"props":17292,"children":17293},{"style":222},[17294],{"type":26,"value":17295},"(storage, cacheKey);\n",{"type":21,"tag":209,"props":17297,"children":17298},{"class":211,"line":2372},[17299,17303,17307,17311,17316,17320],{"type":21,"tag":209,"props":17300,"children":17301},{"style":222},[17302],{"type":26,"value":2495},{"type":21,"tag":209,"props":17304,"children":17305},{"style":360},[17306],{"type":26,"value":1059},{"type":21,"tag":209,"props":17308,"children":17309},{"style":222},[17310],{"type":26,"value":368},{"type":21,"tag":209,"props":17312,"children":17313},{"style":233},[17314],{"type":26,"value":17315},"'Cache Error: '",{"type":21,"tag":209,"props":17317,"children":17318},{"style":216},[17319],{"type":26,"value":4652},{"type":21,"tag":209,"props":17321,"children":17322},{"style":222},[17323],{"type":26,"value":17324}," e, cacheKey, text);\n",{"type":21,"tag":209,"props":17326,"children":17327},{"class":211,"line":2381},[17328],{"type":21,"tag":209,"props":17329,"children":17330},{"style":222},[17331],{"type":26,"value":2235},{"type":21,"tag":209,"props":17333,"children":17334},{"class":211,"line":2389},[17335],{"type":21,"tag":209,"props":17336,"children":17337},{"style":222},[17338],{"type":26,"value":3391},{"type":21,"tag":209,"props":17340,"children":17341},{"class":211,"line":2397},[17342],{"type":21,"tag":209,"props":17343,"children":17344},{"emptyLinePlaceholder":248},[17345],{"type":26,"value":251},{"type":21,"tag":209,"props":17347,"children":17348},{"class":211,"line":2406},[17349,17353],{"type":21,"tag":209,"props":17350,"children":17351},{"style":216},[17352],{"type":26,"value":1298},{"type":21,"tag":209,"props":17354,"children":17355},{"style":222},[17356],{"type":26,"value":17357}," response;\n",{"type":21,"tag":209,"props":17359,"children":17360},{"class":211,"line":2415},[17361],{"type":21,"tag":209,"props":17362,"children":17363},{"style":222},[17364],{"type":26,"value":4415},{"type":21,"tag":22,"props":17366,"children":17367},{},[17368,17370,17375,17377,17382],{"type":26,"value":17369},"The interesting bit here is you'll see we clone the response. This is so we can 'drain' it with the ",{"type":21,"tag":63,"props":17371,"children":17373},{"className":17372},[],[17374],{"type":26,"value":26},{"type":26,"value":17376}," reader and store the results, without making the response unavailable to future promise handler blocks. By cloning the response, we get a buffered clone of the response value that we can do with as we wish, and we can pass the original response on to be handled however the future ",{"type":21,"tag":63,"props":17378,"children":17380},{"className":17379},[],[17381],{"type":26,"value":2704},{"type":26,"value":17383}," blocks wish to.",{"type":21,"tag":200,"props":17385,"children":17387},{"className":16138,"code":17386,"language":16140,"meta":8,"style":8},"   /**\n    * Create a new response containing the cached value, and return a promise\n    * that resolves with this response.\n    *\n    * @param value\n    * @param dataType\n    * @returns {Promise}\n    */\nfunction provideResponse(value, dataType) {\n    var response = new Response(\n        value,\n        {\n            status: 200,\n            statusText: 'success',\n            headers: {\n                'Content-Type': dataType\n            }\n        }\n    );\n\n    return new Promise(function (resolve, reject) {\n        resolve(response);\n    });\n}\n",[17388],{"type":21,"tag":63,"props":17389,"children":17390},{"__ignoreMap":8},[17391,17398,17406,17414,17421,17437,17453,17469,17476,17510,17540,17548,17556,17572,17589,17597,17610,17617,17624,17632,17639,17682,17695,17702],{"type":21,"tag":209,"props":17392,"children":17393},{"class":211,"line":212},[17394],{"type":21,"tag":209,"props":17395,"children":17396},{"style":448},[17397],{"type":26,"value":16771},{"type":21,"tag":209,"props":17399,"children":17400},{"class":211,"line":244},[17401],{"type":21,"tag":209,"props":17402,"children":17403},{"style":448},[17404],{"type":26,"value":17405},"    * Create a new response containing the cached value, and return a promise\n",{"type":21,"tag":209,"props":17407,"children":17408},{"class":211,"line":254},[17409],{"type":21,"tag":209,"props":17410,"children":17411},{"style":448},[17412],{"type":26,"value":17413},"    * that resolves with this response.\n",{"type":21,"tag":209,"props":17415,"children":17416},{"class":211,"line":279},[17417],{"type":21,"tag":209,"props":17418,"children":17419},{"style":448},[17420],{"type":26,"value":16803},{"type":21,"tag":209,"props":17422,"children":17423},{"class":211,"line":288},[17424,17428,17432],{"type":21,"tag":209,"props":17425,"children":17426},{"style":448},[17427],{"type":26,"value":16811},{"type":21,"tag":209,"props":17429,"children":17430},{"style":216},[17431],{"type":26,"value":13311},{"type":21,"tag":209,"props":17433,"children":17434},{"style":222},[17435],{"type":26,"value":17436}," value\n",{"type":21,"tag":209,"props":17438,"children":17439},{"class":211,"line":307},[17440,17444,17448],{"type":21,"tag":209,"props":17441,"children":17442},{"style":448},[17443],{"type":26,"value":16811},{"type":21,"tag":209,"props":17445,"children":17446},{"style":216},[17447],{"type":26,"value":13311},{"type":21,"tag":209,"props":17449,"children":17450},{"style":222},[17451],{"type":26,"value":17452}," dataType\n",{"type":21,"tag":209,"props":17454,"children":17455},{"class":211,"line":325},[17456,17460,17464],{"type":21,"tag":209,"props":17457,"children":17458},{"style":448},[17459],{"type":26,"value":16811},{"type":21,"tag":209,"props":17461,"children":17462},{"style":216},[17463],{"type":26,"value":13333},{"type":21,"tag":209,"props":17465,"children":17466},{"style":360},[17467],{"type":26,"value":17468}," {Promise}\n",{"type":21,"tag":209,"props":17470,"children":17471},{"class":211,"line":334},[17472],{"type":21,"tag":209,"props":17473,"children":17474},{"style":448},[17475],{"type":26,"value":16934},{"type":21,"tag":209,"props":17477,"children":17478},{"class":211,"line":343},[17479,17483,17488,17492,17497,17501,17506],{"type":21,"tag":209,"props":17480,"children":17481},{"style":216},[17482],{"type":26,"value":4622},{"type":21,"tag":209,"props":17484,"children":17485},{"style":360},[17486],{"type":26,"value":17487}," provideResponse",{"type":21,"tag":209,"props":17489,"children":17490},{"style":222},[17491],{"type":26,"value":368},{"type":21,"tag":209,"props":17493,"children":17494},{"style":400},[17495],{"type":26,"value":17496},"value",{"type":21,"tag":209,"props":17498,"children":17499},{"style":222},[17500],{"type":26,"value":408},{"type":21,"tag":209,"props":17502,"children":17503},{"style":400},[17504],{"type":26,"value":17505},"dataType",{"type":21,"tag":209,"props":17507,"children":17508},{"style":222},[17509],{"type":26,"value":5588},{"type":21,"tag":209,"props":17511,"children":17512},{"class":211,"line":351},[17513,17517,17522,17526,17530,17535],{"type":21,"tag":209,"props":17514,"children":17515},{"style":216},[17516],{"type":26,"value":16994},{"type":21,"tag":209,"props":17518,"children":17519},{"style":222},[17520],{"type":26,"value":17521}," response ",{"type":21,"tag":209,"props":17523,"children":17524},{"style":216},[17525],{"type":26,"value":1432},{"type":21,"tag":209,"props":17527,"children":17528},{"style":216},[17529],{"type":26,"value":6371},{"type":21,"tag":209,"props":17531,"children":17532},{"style":360},[17533],{"type":26,"value":17534}," Response",{"type":21,"tag":209,"props":17536,"children":17537},{"style":222},[17538],{"type":26,"value":17539},"(\n",{"type":21,"tag":209,"props":17541,"children":17542},{"class":211,"line":444},[17543],{"type":21,"tag":209,"props":17544,"children":17545},{"style":222},[17546],{"type":26,"value":17547},"        value,\n",{"type":21,"tag":209,"props":17549,"children":17550},{"class":211,"line":454},[17551],{"type":21,"tag":209,"props":17552,"children":17553},{"style":222},[17554],{"type":26,"value":17555},"        {\n",{"type":21,"tag":209,"props":17557,"children":17558},{"class":211,"line":463},[17559,17564,17568],{"type":21,"tag":209,"props":17560,"children":17561},{"style":222},[17562],{"type":26,"value":17563},"            status: ",{"type":21,"tag":209,"props":17565,"children":17566},{"style":263},[17567],{"type":26,"value":10921},{"type":21,"tag":209,"props":17569,"children":17570},{"style":222},[17571],{"type":26,"value":304},{"type":21,"tag":209,"props":17573,"children":17574},{"class":211,"line":472},[17575,17580,17585],{"type":21,"tag":209,"props":17576,"children":17577},{"style":222},[17578],{"type":26,"value":17579},"            statusText: ",{"type":21,"tag":209,"props":17581,"children":17582},{"style":233},[17583],{"type":26,"value":17584},"'success'",{"type":21,"tag":209,"props":17586,"children":17587},{"style":222},[17588],{"type":26,"value":304},{"type":21,"tag":209,"props":17590,"children":17591},{"class":211,"line":480},[17592],{"type":21,"tag":209,"props":17593,"children":17594},{"style":222},[17595],{"type":26,"value":17596},"            headers: {\n",{"type":21,"tag":209,"props":17598,"children":17599},{"class":211,"line":489},[17600,17605],{"type":21,"tag":209,"props":17601,"children":17602},{"style":233},[17603],{"type":26,"value":17604},"                'Content-Type'",{"type":21,"tag":209,"props":17606,"children":17607},{"style":222},[17608],{"type":26,"value":17609},": dataType\n",{"type":21,"tag":209,"props":17611,"children":17612},{"class":211,"line":847},[17613],{"type":21,"tag":209,"props":17614,"children":17615},{"style":222},[17616],{"type":26,"value":14714},{"type":21,"tag":209,"props":17618,"children":17619},{"class":211,"line":860},[17620],{"type":21,"tag":209,"props":17621,"children":17622},{"style":222},[17623],{"type":26,"value":2235},{"type":21,"tag":209,"props":17625,"children":17626},{"class":211,"line":877},[17627],{"type":21,"tag":209,"props":17628,"children":17629},{"style":222},[17630],{"type":26,"value":17631},"    );\n",{"type":21,"tag":209,"props":17633,"children":17634},{"class":211,"line":889},[17635],{"type":21,"tag":209,"props":17636,"children":17637},{"emptyLinePlaceholder":248},[17638],{"type":26,"value":251},{"type":21,"tag":209,"props":17640,"children":17641},{"class":211,"line":902},[17642,17646,17650,17654,17658,17662,17666,17670,17674,17678],{"type":21,"tag":209,"props":17643,"children":17644},{"style":216},[17645],{"type":26,"value":1298},{"type":21,"tag":209,"props":17647,"children":17648},{"style":216},[17649],{"type":26,"value":6371},{"type":21,"tag":209,"props":17651,"children":17652},{"style":263},[17653],{"type":26,"value":14164},{"type":21,"tag":209,"props":17655,"children":17656},{"style":222},[17657],{"type":26,"value":368},{"type":21,"tag":209,"props":17659,"children":17660},{"style":216},[17661],{"type":26,"value":4622},{"type":21,"tag":209,"props":17663,"children":17664},{"style":222},[17665],{"type":26,"value":5569},{"type":21,"tag":209,"props":17667,"children":17668},{"style":400},[17669],{"type":26,"value":14173},{"type":21,"tag":209,"props":17671,"children":17672},{"style":222},[17673],{"type":26,"value":408},{"type":21,"tag":209,"props":17675,"children":17676},{"style":400},[17677],{"type":26,"value":14182},{"type":21,"tag":209,"props":17679,"children":17680},{"style":222},[17681],{"type":26,"value":5588},{"type":21,"tag":209,"props":17683,"children":17684},{"class":211,"line":914},[17685,17690],{"type":21,"tag":209,"props":17686,"children":17687},{"style":360},[17688],{"type":26,"value":17689},"        resolve",{"type":21,"tag":209,"props":17691,"children":17692},{"style":222},[17693],{"type":26,"value":17694},"(response);\n",{"type":21,"tag":209,"props":17696,"children":17697},{"class":211,"line":922},[17698],{"type":21,"tag":209,"props":17699,"children":17700},{"style":222},[17701],{"type":26,"value":3391},{"type":21,"tag":209,"props":17703,"children":17704},{"class":211,"line":2312},[17705],{"type":21,"tag":209,"props":17706,"children":17707},{"style":222},[17708],{"type":26,"value":4415},{"type":21,"tag":22,"props":17710,"children":17711},{},[17712,17714,17720],{"type":26,"value":17713},"Here's the last really interesting bit, and it demonstrates the advantage of having access to the ",{"type":21,"tag":63,"props":17715,"children":17717},{"className":17716},[],[17718],{"type":26,"value":17719},"Response",{"type":26,"value":17721}," primitive - we can create our own streamable response by simply feeding in the value to the Response constructor, and return a new Promise as the fetch API expects immediately resolving with our response.",{"type":21,"tag":51,"props":17723,"children":17725},{"id":17724},"all-together-now",[17726],{"type":26,"value":17727},"All Together Now",{"type":21,"tag":22,"props":17729,"children":17730},{},[17731,17733,17739],{"type":26,"value":17732},"Here's the full code as of the time of this writing, and I recommend taking a look at the ",{"type":21,"tag":29,"props":17734,"children":17736},{"href":16627,"rel":17735},[93],[17737],{"type":26,"value":17738},"github repo",{"type":26,"value":17740}," for the up-to-date version. As always, let me know if you have any questions in the comments.",{"type":21,"tag":200,"props":17742,"children":17744},{"className":16138,"code":17743,"language":16140,"meta":8,"style":8},"/**\n * Copyright (c) Christopher Keefer, 2016.\n * https://github.com/SaneMethod/fetchCache\n *\n * Override fetch in the global context to allow us to cache the response to fetch in a Storage interface\n * implementing object (such as localStorage).\n */\n(function (fetch) {\n    /* If the context doesn't support fetch, we won't attempt to patch in our\n     caching using fetch, for obvious reasons. */\n    if (!fetch) return;\n\n    /**\n     * Generate the cache key under which to store the local data - either the cache key supplied,\n     * or one generated from the url, the Content-type header (if specified) and the body (if specified).\n     *\n     * @returns {string}\n     */\n    function genCacheKey(url, settings) {\n        var {headers:{'Content-type': type}} = ('headers' in settings) ? settings : {headers: {}},\n            {body} = settings;\n\n        return settings.cacheKey || url + (type || '') + (body || '');\n    }\n\n    /**\n     * Determine whether we're using localStorage or, if the user has specified something other than a boolean\n     * value for options.localCache, whether the value appears to satisfy the plugin's requirements.\n     * Otherwise, throw a new TypeError indicating what type of value we expect.\n     *\n     * @param {boolean|object} storage\n     * @returns {boolean|object}\n     */\n    function getStorage(storage) {\n        if (!storage) return false;\n        if (storage === true) return self.localStorage;\n        if (typeof storage === \"object\" && 'getItem' in storage &&\n            'removeItem' in storage && 'setItem' in storage) {\n            return storage;\n        }\n        throw new TypeError(\"localCache must either be a boolean value, \" +\n            \"or an object which implements the Storage interface.\");\n    }\n\n    /**\n     * Remove the item specified by cacheKey and its attendant meta items from storage.\n     *\n     * @param {Storage|object} storage\n     * @param {string} cacheKey\n     */\n    function removeFromStorage(storage, cacheKey) {\n        storage.removeItem(cacheKey);\n        storage.removeItem(cacheKey + 'cachettl');\n        storage.removeItem(cacheKey + 'dataType');\n    }\n\n    /**\n     * Cache the response into our storage object.\n     * We clone the response so that we can drain the stream without making it\n     * unavailable to future handlers.\n     *\n     * @param {string} cacheKey Key under which to cache the data string. Bound in\n     * fetch override.\n     * @param {Storage} storage Object implementing Storage interface to store cached data\n     * (text or json exclusively) in. Bound in fetch override.\n     * @param {Number} hourstl Number of hours this value shoud remain in the cache.\n     * Bound in fetch override.\n     * @param {Response} response\n     */\n    function cacheResponse(cacheKey, storage, hourstl, response) {\n        var cres = response.clone(),\n            dataType = (response.headers.get('Content-Type') || 'text/plain').toLowerCase();\n\n        cres.text().then((text) => {\n            try {\n                storage.setItem(cacheKey, text);\n                storage.setItem(cacheKey + 'cachettl', +new Date() + 1000 * 60 * 60 * hourstl);\n                storage.setItem(cacheKey + 'dataType', dataType);\n            } catch (e) {\n                // Remove any incomplete data that may have been saved before the exception was caught\n                removeFromStorage(storage, cacheKey);\n                console.log('Cache Error: ' + e, cacheKey, text);\n            }\n        });\n\n        return response;\n    }\n\n    /**\n     * Create a new response containing the cached value, and return a promise\n     * that resolves with this response.\n     *\n     * @param value\n     * @param dataType\n     * @returns {Promise}\n     */\n    function provideResponse(value, dataType) {\n        var response = new Response(\n            value,\n            {\n                status: 200,\n                statusText: 'success',\n                headers: {\n                    'Content-Type': dataType\n                }\n            }\n        );\n\n        return new Promise(function (resolve, reject) {\n            resolve(response);\n        });\n    }\n\n    /**\n     * Override fetch on the global context, so that we can intercept\n     * fetch calls and respond with locally cached content, if available.\n     * New parameters available on the call to fetch:\n     * localCache   : true // required - either a boolean (if true, localStorage is used,\n     * if false request is not cached or returned from cache), or an object implementing the\n     * Storage interface, in which case that object is used instead.\n     * cacheTTL     : 5, // optional, cache time in hours, default is 5. Use float numbers for\n     * values less than a full hour (e.g. 0.5 for 1/2 hour).\n     * cacheKey     : 'post', // optional - key under which cached string will be stored.\n     * isCacheValid : function  // optional - return true for valid, false for invalid.\n     */\n    self.fetch = function (url, settings) {\n        var storage = getStorage(settings.localCache),\n            hourstl = settings.cacheTTL || 5,\n            cacheKey = genCacheKey(url, settings),\n            cacheValid = settings.isCacheValid,\n            ttl,\n            value,\n            dataType;\n\n        if (!storage) return fetch(url, settings);\n\n        ttl = storage.getItem(cacheKey + 'cachettl');\n\n        if (cacheValid && typeof cacheValid === 'function' && !cacheValid()) {\n            removeFromStorage(storage, cacheKey);\n            ttl = 0;\n        }\n\n        if (ttl && ttl \u003C +new Date()) {\n            removeFromStorage(storage, cacheKey);\n        }\n\n        value = storage.getItem(cacheKey);\n\n        if (!value) {\n            /* If not cached, we'll make the request and add a then block to the resulting promise,\n             in which we'll cache the result. */\n            return fetch(url, settings).then(cacheResponse.bind(null, cacheKey, storage, hourstl));\n        }\n\n        /* Value is cached, so we'll simply create and respond with a promise of our own,\n         and provide a response object. */\n        dataType = storage.getItem(cacheKey + 'dataType') || 'text/plain';\n        return provideResponse(value, dataType);\n    };\n})(self.fetch);\n",[17745],{"type":21,"tag":63,"props":17746,"children":17747},{"__ignoreMap":8},[17748,17755,17763,17771,17779,17787,17795,17802,17826,17834,17842,17870,17877,17884,17892,17900,17908,17924,17931,17965,18036,18053,18060,18124,18131,18138,18145,18153,18161,18169,18176,18197,18213,18220,18244,18276,18309,18361,18396,18408,18415,18446,18458,18465,18472,18479,18487,18494,18514,18534,18541,18573,18591,18618,18645,18652,18659,18666,18674,18682,18690,18697,18720,18728,18751,18759,18782,18790,18809,18816,18863,18890,18942,18949,18989,19001,19017,19088,19115,19131,19139,19151,19178,19185,19192,19199,19210,19217,19224,19231,19239,19247,19254,19269,19284,19299,19306,19337,19364,19372,19380,19396,19412,19420,19432,19440,19447,19455,19462,19505,19517,19524,19531,19538,19545,19553,19561,19569,19582,19590,19599,19613,19622,19636,19650,19658,19699,19724,19755,19777,19795,19804,19812,19821,19829,19862,19870,19909,19917,19971,19983,20004,20012,20020,20059,20071,20079,20087,20112,20120,20141,20150,20159,20204,20212,20220,20229,20238,20286,20303,20311],{"type":21,"tag":209,"props":17749,"children":17750},{"class":211,"line":212},[17751],{"type":21,"tag":209,"props":17752,"children":17753},{"style":448},[17754],{"type":26,"value":731},{"type":21,"tag":209,"props":17756,"children":17757},{"class":211,"line":244},[17758],{"type":21,"tag":209,"props":17759,"children":17760},{"style":448},[17761],{"type":26,"value":17762}," * Copyright (c) Christopher Keefer, 2016.\n",{"type":21,"tag":209,"props":17764,"children":17765},{"class":211,"line":254},[17766],{"type":21,"tag":209,"props":17767,"children":17768},{"style":448},[17769],{"type":26,"value":17770}," * https://github.com/SaneMethod/fetchCache\n",{"type":21,"tag":209,"props":17772,"children":17773},{"class":211,"line":279},[17774],{"type":21,"tag":209,"props":17775,"children":17776},{"style":448},[17777],{"type":26,"value":17778}," *\n",{"type":21,"tag":209,"props":17780,"children":17781},{"class":211,"line":288},[17782],{"type":21,"tag":209,"props":17783,"children":17784},{"style":448},[17785],{"type":26,"value":17786}," * Override fetch in the global context to allow us to cache the response to fetch in a Storage interface\n",{"type":21,"tag":209,"props":17788,"children":17789},{"class":211,"line":307},[17790],{"type":21,"tag":209,"props":17791,"children":17792},{"style":448},[17793],{"type":26,"value":17794}," * implementing object (such as localStorage).\n",{"type":21,"tag":209,"props":17796,"children":17797},{"class":211,"line":325},[17798],{"type":21,"tag":209,"props":17799,"children":17800},{"style":448},[17801],{"type":26,"value":755},{"type":21,"tag":209,"props":17803,"children":17804},{"class":211,"line":334},[17805,17809,17813,17817,17822],{"type":21,"tag":209,"props":17806,"children":17807},{"style":222},[17808],{"type":26,"value":368},{"type":21,"tag":209,"props":17810,"children":17811},{"style":216},[17812],{"type":26,"value":4622},{"type":21,"tag":209,"props":17814,"children":17815},{"style":222},[17816],{"type":26,"value":5569},{"type":21,"tag":209,"props":17818,"children":17819},{"style":400},[17820],{"type":26,"value":17821},"fetch",{"type":21,"tag":209,"props":17823,"children":17824},{"style":222},[17825],{"type":26,"value":5588},{"type":21,"tag":209,"props":17827,"children":17828},{"class":211,"line":343},[17829],{"type":21,"tag":209,"props":17830,"children":17831},{"style":448},[17832],{"type":26,"value":17833},"    /* If the context doesn't support fetch, we won't attempt to patch in our\n",{"type":21,"tag":209,"props":17835,"children":17836},{"class":211,"line":351},[17837],{"type":21,"tag":209,"props":17838,"children":17839},{"style":448},[17840],{"type":26,"value":17841},"     caching using fetch, for obvious reasons. */\n",{"type":21,"tag":209,"props":17843,"children":17844},{"class":211,"line":444},[17845,17849,17853,17857,17862,17866],{"type":21,"tag":209,"props":17846,"children":17847},{"style":216},[17848],{"type":26,"value":9249},{"type":21,"tag":209,"props":17850,"children":17851},{"style":222},[17852],{"type":26,"value":5569},{"type":21,"tag":209,"props":17854,"children":17855},{"style":216},[17856],{"type":26,"value":6455},{"type":21,"tag":209,"props":17858,"children":17859},{"style":222},[17860],{"type":26,"value":17861},"fetch) ",{"type":21,"tag":209,"props":17863,"children":17864},{"style":216},[17865],{"type":26,"value":8982},{"type":21,"tag":209,"props":17867,"children":17868},{"style":222},[17869],{"type":26,"value":241},{"type":21,"tag":209,"props":17871,"children":17872},{"class":211,"line":454},[17873],{"type":21,"tag":209,"props":17874,"children":17875},{"emptyLinePlaceholder":248},[17876],{"type":26,"value":251},{"type":21,"tag":209,"props":17878,"children":17879},{"class":211,"line":463},[17880],{"type":21,"tag":209,"props":17881,"children":17882},{"style":448},[17883],{"type":26,"value":13290},{"type":21,"tag":209,"props":17885,"children":17886},{"class":211,"line":472},[17887],{"type":21,"tag":209,"props":17888,"children":17889},{"style":448},[17890],{"type":26,"value":17891},"     * Generate the cache key under which to store the local data - either the cache key supplied,\n",{"type":21,"tag":209,"props":17893,"children":17894},{"class":211,"line":480},[17895],{"type":21,"tag":209,"props":17896,"children":17897},{"style":448},[17898],{"type":26,"value":17899},"     * or one generated from the url, the Content-type header (if specified) and the body (if specified).\n",{"type":21,"tag":209,"props":17901,"children":17902},{"class":211,"line":489},[17903],{"type":21,"tag":209,"props":17904,"children":17905},{"style":448},[17906],{"type":26,"value":17907},"     *\n",{"type":21,"tag":209,"props":17909,"children":17910},{"class":211,"line":847},[17911,17915,17919],{"type":21,"tag":209,"props":17912,"children":17913},{"style":448},[17914],{"type":26,"value":13306},{"type":21,"tag":209,"props":17916,"children":17917},{"style":216},[17918],{"type":26,"value":13333},{"type":21,"tag":209,"props":17920,"children":17921},{"style":360},[17922],{"type":26,"value":17923}," {string}\n",{"type":21,"tag":209,"props":17925,"children":17926},{"class":211,"line":860},[17927],{"type":21,"tag":209,"props":17928,"children":17929},{"style":448},[17930],{"type":26,"value":13346},{"type":21,"tag":209,"props":17932,"children":17933},{"class":211,"line":877},[17934,17938,17943,17947,17952,17956,17961],{"type":21,"tag":209,"props":17935,"children":17936},{"style":216},[17937],{"type":26,"value":2981},{"type":21,"tag":209,"props":17939,"children":17940},{"style":360},[17941],{"type":26,"value":17942}," genCacheKey",{"type":21,"tag":209,"props":17944,"children":17945},{"style":222},[17946],{"type":26,"value":368},{"type":21,"tag":209,"props":17948,"children":17949},{"style":400},[17950],{"type":26,"value":17951},"url",{"type":21,"tag":209,"props":17953,"children":17954},{"style":222},[17955],{"type":26,"value":408},{"type":21,"tag":209,"props":17957,"children":17958},{"style":400},[17959],{"type":26,"value":17960},"settings",{"type":21,"tag":209,"props":17962,"children":17963},{"style":222},[17964],{"type":26,"value":5588},{"type":21,"tag":209,"props":17966,"children":17967},{"class":211,"line":889},[17968,17972,17976,17981,17986,17991,17996,18000,18004,18009,18013,18018,18022,18027,18031],{"type":21,"tag":209,"props":17969,"children":17970},{"style":216},[17971],{"type":26,"value":14505},{"type":21,"tag":209,"props":17973,"children":17974},{"style":222},[17975],{"type":26,"value":1282},{"type":21,"tag":209,"props":17977,"children":17978},{"style":400},[17979],{"type":26,"value":17980},"headers",{"type":21,"tag":209,"props":17982,"children":17983},{"style":222},[17984],{"type":26,"value":17985},":{",{"type":21,"tag":209,"props":17987,"children":17988},{"style":233},[17989],{"type":26,"value":17990},"'Content-type'",{"type":21,"tag":209,"props":17992,"children":17993},{"style":222},[17994],{"type":26,"value":17995},": type}} ",{"type":21,"tag":209,"props":17997,"children":17998},{"style":216},[17999],{"type":26,"value":1432},{"type":21,"tag":209,"props":18001,"children":18002},{"style":222},[18003],{"type":26,"value":5569},{"type":21,"tag":209,"props":18005,"children":18006},{"style":233},[18007],{"type":26,"value":18008},"'headers'",{"type":21,"tag":209,"props":18010,"children":18011},{"style":216},[18012],{"type":26,"value":9168},{"type":21,"tag":209,"props":18014,"children":18015},{"style":222},[18016],{"type":26,"value":18017}," settings) ",{"type":21,"tag":209,"props":18019,"children":18020},{"style":216},[18021],{"type":26,"value":8258},{"type":21,"tag":209,"props":18023,"children":18024},{"style":222},[18025],{"type":26,"value":18026}," settings ",{"type":21,"tag":209,"props":18028,"children":18029},{"style":216},[18030],{"type":26,"value":191},{"type":21,"tag":209,"props":18032,"children":18033},{"style":222},[18034],{"type":26,"value":18035}," {headers: {}},\n",{"type":21,"tag":209,"props":18037,"children":18038},{"class":211,"line":902},[18039,18044,18048],{"type":21,"tag":209,"props":18040,"children":18041},{"style":222},[18042],{"type":26,"value":18043},"            {body} ",{"type":21,"tag":209,"props":18045,"children":18046},{"style":216},[18047],{"type":26,"value":1432},{"type":21,"tag":209,"props":18049,"children":18050},{"style":222},[18051],{"type":26,"value":18052}," settings;\n",{"type":21,"tag":209,"props":18054,"children":18055},{"class":211,"line":914},[18056],{"type":21,"tag":209,"props":18057,"children":18058},{"emptyLinePlaceholder":248},[18059],{"type":26,"value":251},{"type":21,"tag":209,"props":18061,"children":18062},{"class":211,"line":922},[18063,18067,18072,18076,18081,18085,18090,18094,18099,18103,18107,18112,18116,18120],{"type":21,"tag":209,"props":18064,"children":18065},{"style":216},[18066],{"type":26,"value":3069},{"type":21,"tag":209,"props":18068,"children":18069},{"style":222},[18070],{"type":26,"value":18071}," settings.cacheKey ",{"type":21,"tag":209,"props":18073,"children":18074},{"style":216},[18075],{"type":26,"value":13270},{"type":21,"tag":209,"props":18077,"children":18078},{"style":222},[18079],{"type":26,"value":18080}," url ",{"type":21,"tag":209,"props":18082,"children":18083},{"style":216},[18084],{"type":26,"value":17170},{"type":21,"tag":209,"props":18086,"children":18087},{"style":222},[18088],{"type":26,"value":18089}," (type ",{"type":21,"tag":209,"props":18091,"children":18092},{"style":216},[18093],{"type":26,"value":13270},{"type":21,"tag":209,"props":18095,"children":18096},{"style":233},[18097],{"type":26,"value":18098}," ''",{"type":21,"tag":209,"props":18100,"children":18101},{"style":222},[18102],{"type":26,"value":432},{"type":21,"tag":209,"props":18104,"children":18105},{"style":216},[18106],{"type":26,"value":17170},{"type":21,"tag":209,"props":18108,"children":18109},{"style":222},[18110],{"type":26,"value":18111}," (body ",{"type":21,"tag":209,"props":18113,"children":18114},{"style":216},[18115],{"type":26,"value":13270},{"type":21,"tag":209,"props":18117,"children":18118},{"style":233},[18119],{"type":26,"value":18098},{"type":21,"tag":209,"props":18121,"children":18122},{"style":222},[18123],{"type":26,"value":2608},{"type":21,"tag":209,"props":18125,"children":18126},{"class":211,"line":2312},[18127],{"type":21,"tag":209,"props":18128,"children":18129},{"style":222},[18130],{"type":26,"value":331},{"type":21,"tag":209,"props":18132,"children":18133},{"class":211,"line":2321},[18134],{"type":21,"tag":209,"props":18135,"children":18136},{"emptyLinePlaceholder":248},[18137],{"type":26,"value":251},{"type":21,"tag":209,"props":18139,"children":18140},{"class":211,"line":2372},[18141],{"type":21,"tag":209,"props":18142,"children":18143},{"style":448},[18144],{"type":26,"value":13290},{"type":21,"tag":209,"props":18146,"children":18147},{"class":211,"line":2381},[18148],{"type":21,"tag":209,"props":18149,"children":18150},{"style":448},[18151],{"type":26,"value":18152},"     * Determine whether we're using localStorage or, if the user has specified something other than a boolean\n",{"type":21,"tag":209,"props":18154,"children":18155},{"class":211,"line":2389},[18156],{"type":21,"tag":209,"props":18157,"children":18158},{"style":448},[18159],{"type":26,"value":18160},"     * value for options.localCache, whether the value appears to satisfy the plugin's requirements.\n",{"type":21,"tag":209,"props":18162,"children":18163},{"class":211,"line":2397},[18164],{"type":21,"tag":209,"props":18165,"children":18166},{"style":448},[18167],{"type":26,"value":18168},"     * Otherwise, throw a new TypeError indicating what type of value we expect.\n",{"type":21,"tag":209,"props":18170,"children":18171},{"class":211,"line":2406},[18172],{"type":21,"tag":209,"props":18173,"children":18174},{"style":448},[18175],{"type":26,"value":17907},{"type":21,"tag":209,"props":18177,"children":18178},{"class":211,"line":2415},[18179,18183,18187,18192],{"type":21,"tag":209,"props":18180,"children":18181},{"style":448},[18182],{"type":26,"value":13306},{"type":21,"tag":209,"props":18184,"children":18185},{"style":216},[18186],{"type":26,"value":13311},{"type":21,"tag":209,"props":18188,"children":18189},{"style":360},[18190],{"type":26,"value":18191}," {boolean|object}",{"type":21,"tag":209,"props":18193,"children":18194},{"style":222},[18195],{"type":26,"value":18196}," storage\n",{"type":21,"tag":209,"props":18198,"children":18199},{"class":211,"line":2424},[18200,18204,18208],{"type":21,"tag":209,"props":18201,"children":18202},{"style":448},[18203],{"type":26,"value":13306},{"type":21,"tag":209,"props":18205,"children":18206},{"style":216},[18207],{"type":26,"value":13333},{"type":21,"tag":209,"props":18209,"children":18210},{"style":360},[18211],{"type":26,"value":18212}," {boolean|object}\n",{"type":21,"tag":209,"props":18214,"children":18215},{"class":211,"line":2433},[18216],{"type":21,"tag":209,"props":18217,"children":18218},{"style":448},[18219],{"type":26,"value":13346},{"type":21,"tag":209,"props":18221,"children":18222},{"class":211,"line":2442},[18223,18227,18232,18236,18240],{"type":21,"tag":209,"props":18224,"children":18225},{"style":216},[18226],{"type":26,"value":2981},{"type":21,"tag":209,"props":18228,"children":18229},{"style":360},[18230],{"type":26,"value":18231}," getStorage",{"type":21,"tag":209,"props":18233,"children":18234},{"style":222},[18235],{"type":26,"value":368},{"type":21,"tag":209,"props":18237,"children":18238},{"style":400},[18239],{"type":26,"value":16964},{"type":21,"tag":209,"props":18241,"children":18242},{"style":222},[18243],{"type":26,"value":5588},{"type":21,"tag":209,"props":18245,"children":18246},{"class":211,"line":2471},[18247,18251,18255,18259,18264,18268,18272],{"type":21,"tag":209,"props":18248,"children":18249},{"style":216},[18250],{"type":26,"value":6334},{"type":21,"tag":209,"props":18252,"children":18253},{"style":222},[18254],{"type":26,"value":5569},{"type":21,"tag":209,"props":18256,"children":18257},{"style":216},[18258],{"type":26,"value":6455},{"type":21,"tag":209,"props":18260,"children":18261},{"style":222},[18262],{"type":26,"value":18263},"storage) ",{"type":21,"tag":209,"props":18265,"children":18266},{"style":216},[18267],{"type":26,"value":8982},{"type":21,"tag":209,"props":18269,"children":18270},{"style":263},[18271],{"type":26,"value":14038},{"type":21,"tag":209,"props":18273,"children":18274},{"style":222},[18275],{"type":26,"value":241},{"type":21,"tag":209,"props":18277,"children":18278},{"class":211,"line":2480},[18279,18283,18288,18292,18296,18300,18304],{"type":21,"tag":209,"props":18280,"children":18281},{"style":216},[18282],{"type":26,"value":6334},{"type":21,"tag":209,"props":18284,"children":18285},{"style":222},[18286],{"type":26,"value":18287}," (storage ",{"type":21,"tag":209,"props":18289,"children":18290},{"style":216},[18291],{"type":26,"value":14680},{"type":21,"tag":209,"props":18293,"children":18294},{"style":263},[18295],{"type":26,"value":14819},{"type":21,"tag":209,"props":18297,"children":18298},{"style":222},[18299],{"type":26,"value":432},{"type":21,"tag":209,"props":18301,"children":18302},{"style":216},[18303],{"type":26,"value":8982},{"type":21,"tag":209,"props":18305,"children":18306},{"style":222},[18307],{"type":26,"value":18308}," self.localStorage;\n",{"type":21,"tag":209,"props":18310,"children":18311},{"class":211,"line":2489},[18312,18316,18320,18324,18329,18333,18338,18343,18348,18352,18356],{"type":21,"tag":209,"props":18313,"children":18314},{"style":216},[18315],{"type":26,"value":6334},{"type":21,"tag":209,"props":18317,"children":18318},{"style":222},[18319],{"type":26,"value":5569},{"type":21,"tag":209,"props":18321,"children":18322},{"style":216},[18323],{"type":26,"value":8036},{"type":21,"tag":209,"props":18325,"children":18326},{"style":222},[18327],{"type":26,"value":18328}," storage ",{"type":21,"tag":209,"props":18330,"children":18331},{"style":216},[18332],{"type":26,"value":14680},{"type":21,"tag":209,"props":18334,"children":18335},{"style":233},[18336],{"type":26,"value":18337}," \"object\"",{"type":21,"tag":209,"props":18339,"children":18340},{"style":216},[18341],{"type":26,"value":18342}," &&",{"type":21,"tag":209,"props":18344,"children":18345},{"style":233},[18346],{"type":26,"value":18347}," 'getItem'",{"type":21,"tag":209,"props":18349,"children":18350},{"style":216},[18351],{"type":26,"value":9168},{"type":21,"tag":209,"props":18353,"children":18354},{"style":222},[18355],{"type":26,"value":18328},{"type":21,"tag":209,"props":18357,"children":18358},{"style":216},[18359],{"type":26,"value":18360},"&&\n",{"type":21,"tag":209,"props":18362,"children":18363},{"class":211,"line":2516},[18364,18369,18373,18377,18382,18387,18391],{"type":21,"tag":209,"props":18365,"children":18366},{"style":233},[18367],{"type":26,"value":18368},"            'removeItem'",{"type":21,"tag":209,"props":18370,"children":18371},{"style":216},[18372],{"type":26,"value":9168},{"type":21,"tag":209,"props":18374,"children":18375},{"style":222},[18376],{"type":26,"value":18328},{"type":21,"tag":209,"props":18378,"children":18379},{"style":216},[18380],{"type":26,"value":18381},"&&",{"type":21,"tag":209,"props":18383,"children":18384},{"style":233},[18385],{"type":26,"value":18386}," 'setItem'",{"type":21,"tag":209,"props":18388,"children":18389},{"style":216},[18390],{"type":26,"value":9168},{"type":21,"tag":209,"props":18392,"children":18393},{"style":222},[18394],{"type":26,"value":18395}," storage) {\n",{"type":21,"tag":209,"props":18397,"children":18398},{"class":211,"line":2525},[18399,18403],{"type":21,"tag":209,"props":18400,"children":18401},{"style":216},[18402],{"type":26,"value":13689},{"type":21,"tag":209,"props":18404,"children":18405},{"style":222},[18406],{"type":26,"value":18407}," storage;\n",{"type":21,"tag":209,"props":18409,"children":18410},{"class":211,"line":2533},[18411],{"type":21,"tag":209,"props":18412,"children":18413},{"style":222},[18414],{"type":26,"value":2235},{"type":21,"tag":209,"props":18416,"children":18417},{"class":211,"line":2542},[18418,18423,18427,18432,18436,18441],{"type":21,"tag":209,"props":18419,"children":18420},{"style":216},[18421],{"type":26,"value":18422},"        throw",{"type":21,"tag":209,"props":18424,"children":18425},{"style":216},[18426],{"type":26,"value":6371},{"type":21,"tag":209,"props":18428,"children":18429},{"style":360},[18430],{"type":26,"value":18431}," TypeError",{"type":21,"tag":209,"props":18433,"children":18434},{"style":222},[18435],{"type":26,"value":368},{"type":21,"tag":209,"props":18437,"children":18438},{"style":233},[18439],{"type":26,"value":18440},"\"localCache must either be a boolean value, \"",{"type":21,"tag":209,"props":18442,"children":18443},{"style":216},[18444],{"type":26,"value":18445}," +\n",{"type":21,"tag":209,"props":18447,"children":18448},{"class":211,"line":2550},[18449,18454],{"type":21,"tag":209,"props":18450,"children":18451},{"style":233},[18452],{"type":26,"value":18453},"            \"or an object which implements the Storage interface.\"",{"type":21,"tag":209,"props":18455,"children":18456},{"style":222},[18457],{"type":26,"value":2608},{"type":21,"tag":209,"props":18459,"children":18460},{"class":211,"line":2564},[18461],{"type":21,"tag":209,"props":18462,"children":18463},{"style":222},[18464],{"type":26,"value":331},{"type":21,"tag":209,"props":18466,"children":18467},{"class":211,"line":2611},[18468],{"type":21,"tag":209,"props":18469,"children":18470},{"emptyLinePlaceholder":248},[18471],{"type":26,"value":251},{"type":21,"tag":209,"props":18473,"children":18474},{"class":211,"line":2619},[18475],{"type":21,"tag":209,"props":18476,"children":18477},{"style":448},[18478],{"type":26,"value":13290},{"type":21,"tag":209,"props":18480,"children":18481},{"class":211,"line":2627},[18482],{"type":21,"tag":209,"props":18483,"children":18484},{"style":448},[18485],{"type":26,"value":18486},"     * Remove the item specified by cacheKey and its attendant meta items from storage.\n",{"type":21,"tag":209,"props":18488,"children":18489},{"class":211,"line":2636},[18490],{"type":21,"tag":209,"props":18491,"children":18492},{"style":448},[18493],{"type":26,"value":17907},{"type":21,"tag":209,"props":18495,"children":18496},{"class":211,"line":2644},[18497,18501,18505,18510],{"type":21,"tag":209,"props":18498,"children":18499},{"style":448},[18500],{"type":26,"value":13306},{"type":21,"tag":209,"props":18502,"children":18503},{"style":216},[18504],{"type":26,"value":13311},{"type":21,"tag":209,"props":18506,"children":18507},{"style":360},[18508],{"type":26,"value":18509}," {Storage|object}",{"type":21,"tag":209,"props":18511,"children":18512},{"style":222},[18513],{"type":26,"value":18196},{"type":21,"tag":209,"props":18515,"children":18516},{"class":211,"line":2657},[18517,18521,18525,18529],{"type":21,"tag":209,"props":18518,"children":18519},{"style":448},[18520],{"type":26,"value":13306},{"type":21,"tag":209,"props":18522,"children":18523},{"style":216},[18524],{"type":26,"value":13311},{"type":21,"tag":209,"props":18526,"children":18527},{"style":360},[18528],{"type":26,"value":13316},{"type":21,"tag":209,"props":18530,"children":18531},{"style":222},[18532],{"type":26,"value":18533}," cacheKey\n",{"type":21,"tag":209,"props":18535,"children":18536},{"class":211,"line":2728},[18537],{"type":21,"tag":209,"props":18538,"children":18539},{"style":448},[18540],{"type":26,"value":13346},{"type":21,"tag":209,"props":18542,"children":18543},{"class":211,"line":2758},[18544,18548,18553,18557,18561,18565,18569],{"type":21,"tag":209,"props":18545,"children":18546},{"style":216},[18547],{"type":26,"value":2981},{"type":21,"tag":209,"props":18549,"children":18550},{"style":360},[18551],{"type":26,"value":18552}," removeFromStorage",{"type":21,"tag":209,"props":18554,"children":18555},{"style":222},[18556],{"type":26,"value":368},{"type":21,"tag":209,"props":18558,"children":18559},{"style":400},[18560],{"type":26,"value":16964},{"type":21,"tag":209,"props":18562,"children":18563},{"style":222},[18564],{"type":26,"value":408},{"type":21,"tag":209,"props":18566,"children":18567},{"style":400},[18568],{"type":26,"value":16955},{"type":21,"tag":209,"props":18570,"children":18571},{"style":222},[18572],{"type":26,"value":5588},{"type":21,"tag":209,"props":18574,"children":18575},{"class":211,"line":2776},[18576,18581,18586],{"type":21,"tag":209,"props":18577,"children":18578},{"style":222},[18579],{"type":26,"value":18580},"        storage.",{"type":21,"tag":209,"props":18582,"children":18583},{"style":360},[18584],{"type":26,"value":18585},"removeItem",{"type":21,"tag":209,"props":18587,"children":18588},{"style":222},[18589],{"type":26,"value":18590},"(cacheKey);\n",{"type":21,"tag":209,"props":18592,"children":18593},{"class":211,"line":2785},[18594,18598,18602,18606,18610,18614],{"type":21,"tag":209,"props":18595,"children":18596},{"style":222},[18597],{"type":26,"value":18580},{"type":21,"tag":209,"props":18599,"children":18600},{"style":360},[18601],{"type":26,"value":18585},{"type":21,"tag":209,"props":18603,"children":18604},{"style":222},[18605],{"type":26,"value":17165},{"type":21,"tag":209,"props":18607,"children":18608},{"style":216},[18609],{"type":26,"value":17170},{"type":21,"tag":209,"props":18611,"children":18612},{"style":233},[18613],{"type":26,"value":17175},{"type":21,"tag":209,"props":18615,"children":18616},{"style":222},[18617],{"type":26,"value":2608},{"type":21,"tag":209,"props":18619,"children":18620},{"class":211,"line":2793},[18621,18625,18629,18633,18637,18641],{"type":21,"tag":209,"props":18622,"children":18623},{"style":222},[18624],{"type":26,"value":18580},{"type":21,"tag":209,"props":18626,"children":18627},{"style":360},[18628],{"type":26,"value":18585},{"type":21,"tag":209,"props":18630,"children":18631},{"style":222},[18632],{"type":26,"value":17165},{"type":21,"tag":209,"props":18634,"children":18635},{"style":216},[18636],{"type":26,"value":17170},{"type":21,"tag":209,"props":18638,"children":18639},{"style":233},[18640],{"type":26,"value":17254},{"type":21,"tag":209,"props":18642,"children":18643},{"style":222},[18644],{"type":26,"value":2608},{"type":21,"tag":209,"props":18646,"children":18647},{"class":211,"line":2801},[18648],{"type":21,"tag":209,"props":18649,"children":18650},{"style":222},[18651],{"type":26,"value":331},{"type":21,"tag":209,"props":18653,"children":18654},{"class":211,"line":2809},[18655],{"type":21,"tag":209,"props":18656,"children":18657},{"emptyLinePlaceholder":248},[18658],{"type":26,"value":251},{"type":21,"tag":209,"props":18660,"children":18661},{"class":211,"line":10937},[18662],{"type":21,"tag":209,"props":18663,"children":18664},{"style":448},[18665],{"type":26,"value":13290},{"type":21,"tag":209,"props":18667,"children":18668},{"class":211,"line":10967},[18669],{"type":21,"tag":209,"props":18670,"children":18671},{"style":448},[18672],{"type":26,"value":18673},"     * Cache the response into our storage object.\n",{"type":21,"tag":209,"props":18675,"children":18676},{"class":211,"line":11003},[18677],{"type":21,"tag":209,"props":18678,"children":18679},{"style":448},[18680],{"type":26,"value":18681},"     * We clone the response so that we can drain the stream without making it\n",{"type":21,"tag":209,"props":18683,"children":18684},{"class":211,"line":11038},[18685],{"type":21,"tag":209,"props":18686,"children":18687},{"style":448},[18688],{"type":26,"value":18689},"     * unavailable to future handlers.\n",{"type":21,"tag":209,"props":18691,"children":18692},{"class":211,"line":11072},[18693],{"type":21,"tag":209,"props":18694,"children":18695},{"style":448},[18696],{"type":26,"value":17907},{"type":21,"tag":209,"props":18698,"children":18699},{"class":211,"line":11106},[18700,18704,18708,18712,18716],{"type":21,"tag":209,"props":18701,"children":18702},{"style":448},[18703],{"type":26,"value":13306},{"type":21,"tag":209,"props":18705,"children":18706},{"style":216},[18707],{"type":26,"value":13311},{"type":21,"tag":209,"props":18709,"children":18710},{"style":360},[18711],{"type":26,"value":13316},{"type":21,"tag":209,"props":18713,"children":18714},{"style":222},[18715],{"type":26,"value":16824},{"type":21,"tag":209,"props":18717,"children":18718},{"style":448},[18719],{"type":26,"value":16829},{"type":21,"tag":209,"props":18721,"children":18722},{"class":211,"line":11114},[18723],{"type":21,"tag":209,"props":18724,"children":18725},{"style":448},[18726],{"type":26,"value":18727},"     * fetch override.\n",{"type":21,"tag":209,"props":18729,"children":18730},{"class":211,"line":14940},[18731,18735,18739,18743,18747],{"type":21,"tag":209,"props":18732,"children":18733},{"style":448},[18734],{"type":26,"value":13306},{"type":21,"tag":209,"props":18736,"children":18737},{"style":216},[18738],{"type":26,"value":13311},{"type":21,"tag":209,"props":18740,"children":18741},{"style":360},[18742],{"type":26,"value":16853},{"type":21,"tag":209,"props":18744,"children":18745},{"style":222},[18746],{"type":26,"value":16858},{"type":21,"tag":209,"props":18748,"children":18749},{"style":448},[18750],{"type":26,"value":16863},{"type":21,"tag":209,"props":18752,"children":18753},{"class":211,"line":14949},[18754],{"type":21,"tag":209,"props":18755,"children":18756},{"style":448},[18757],{"type":26,"value":18758},"     * (text or json exclusively) in. Bound in fetch override.\n",{"type":21,"tag":209,"props":18760,"children":18761},{"class":211,"line":14958},[18762,18766,18770,18774,18778],{"type":21,"tag":209,"props":18763,"children":18764},{"style":448},[18765],{"type":26,"value":13306},{"type":21,"tag":209,"props":18767,"children":18768},{"style":216},[18769],{"type":26,"value":13311},{"type":21,"tag":209,"props":18771,"children":18772},{"style":360},[18773],{"type":26,"value":16887},{"type":21,"tag":209,"props":18775,"children":18776},{"style":222},[18777],{"type":26,"value":16892},{"type":21,"tag":209,"props":18779,"children":18780},{"style":448},[18781],{"type":26,"value":16897},{"type":21,"tag":209,"props":18783,"children":18784},{"class":211,"line":14966},[18785],{"type":21,"tag":209,"props":18786,"children":18787},{"style":448},[18788],{"type":26,"value":18789},"     * Bound in fetch override.\n",{"type":21,"tag":209,"props":18791,"children":18792},{"class":211,"line":14975},[18793,18797,18801,18805],{"type":21,"tag":209,"props":18794,"children":18795},{"style":448},[18796],{"type":26,"value":13306},{"type":21,"tag":209,"props":18798,"children":18799},{"style":216},[18800],{"type":26,"value":13311},{"type":21,"tag":209,"props":18802,"children":18803},{"style":360},[18804],{"type":26,"value":16921},{"type":21,"tag":209,"props":18806,"children":18807},{"style":222},[18808],{"type":26,"value":16926},{"type":21,"tag":209,"props":18810,"children":18811},{"class":211,"line":14984},[18812],{"type":21,"tag":209,"props":18813,"children":18814},{"style":448},[18815],{"type":26,"value":13346},{"type":21,"tag":209,"props":18817,"children":18818},{"class":211,"line":15018},[18819,18823,18827,18831,18835,18839,18843,18847,18851,18855,18859],{"type":21,"tag":209,"props":18820,"children":18821},{"style":216},[18822],{"type":26,"value":2981},{"type":21,"tag":209,"props":18824,"children":18825},{"style":360},[18826],{"type":26,"value":16946},{"type":21,"tag":209,"props":18828,"children":18829},{"style":222},[18830],{"type":26,"value":368},{"type":21,"tag":209,"props":18832,"children":18833},{"style":400},[18834],{"type":26,"value":16955},{"type":21,"tag":209,"props":18836,"children":18837},{"style":222},[18838],{"type":26,"value":408},{"type":21,"tag":209,"props":18840,"children":18841},{"style":400},[18842],{"type":26,"value":16964},{"type":21,"tag":209,"props":18844,"children":18845},{"style":222},[18846],{"type":26,"value":408},{"type":21,"tag":209,"props":18848,"children":18849},{"style":400},[18850],{"type":26,"value":16973},{"type":21,"tag":209,"props":18852,"children":18853},{"style":222},[18854],{"type":26,"value":408},{"type":21,"tag":209,"props":18856,"children":18857},{"style":400},[18858],{"type":26,"value":16982},{"type":21,"tag":209,"props":18860,"children":18861},{"style":222},[18862],{"type":26,"value":5588},{"type":21,"tag":209,"props":18864,"children":18865},{"class":211,"line":15050},[18866,18870,18874,18878,18882,18886],{"type":21,"tag":209,"props":18867,"children":18868},{"style":216},[18869],{"type":26,"value":14505},{"type":21,"tag":209,"props":18871,"children":18872},{"style":222},[18873],{"type":26,"value":16999},{"type":21,"tag":209,"props":18875,"children":18876},{"style":216},[18877],{"type":26,"value":1432},{"type":21,"tag":209,"props":18879,"children":18880},{"style":222},[18881],{"type":26,"value":10956},{"type":21,"tag":209,"props":18883,"children":18884},{"style":360},[18885],{"type":26,"value":17012},{"type":21,"tag":209,"props":18887,"children":18888},{"style":222},[18889],{"type":26,"value":13988},{"type":21,"tag":209,"props":18891,"children":18892},{"class":211,"line":15082},[18893,18898,18902,18906,18910,18914,18918,18922,18926,18930,18934,18938],{"type":21,"tag":209,"props":18894,"children":18895},{"style":222},[18896],{"type":26,"value":18897},"            dataType ",{"type":21,"tag":209,"props":18899,"children":18900},{"style":216},[18901],{"type":26,"value":1432},{"type":21,"tag":209,"props":18903,"children":18904},{"style":222},[18905],{"type":26,"value":17033},{"type":21,"tag":209,"props":18907,"children":18908},{"style":360},[18909],{"type":26,"value":7636},{"type":21,"tag":209,"props":18911,"children":18912},{"style":222},[18913],{"type":26,"value":368},{"type":21,"tag":209,"props":18915,"children":18916},{"style":233},[18917],{"type":26,"value":17046},{"type":21,"tag":209,"props":18919,"children":18920},{"style":222},[18921],{"type":26,"value":432},{"type":21,"tag":209,"props":18923,"children":18924},{"style":216},[18925],{"type":26,"value":13270},{"type":21,"tag":209,"props":18927,"children":18928},{"style":233},[18929],{"type":26,"value":17059},{"type":21,"tag":209,"props":18931,"children":18932},{"style":222},[18933],{"type":26,"value":2699},{"type":21,"tag":209,"props":18935,"children":18936},{"style":360},[18937],{"type":26,"value":17068},{"type":21,"tag":209,"props":18939,"children":18940},{"style":222},[18941],{"type":26,"value":4123},{"type":21,"tag":209,"props":18943,"children":18944},{"class":211,"line":15090},[18945],{"type":21,"tag":209,"props":18946,"children":18947},{"emptyLinePlaceholder":248},[18948],{"type":26,"value":251},{"type":21,"tag":209,"props":18950,"children":18951},{"class":211,"line":15098},[18952,18957,18961,18965,18969,18973,18977,18981,18985],{"type":21,"tag":209,"props":18953,"children":18954},{"style":222},[18955],{"type":26,"value":18956},"        cres.",{"type":21,"tag":209,"props":18958,"children":18959},{"style":360},[18960],{"type":26,"value":26},{"type":21,"tag":209,"props":18962,"children":18963},{"style":222},[18964],{"type":26,"value":17096},{"type":21,"tag":209,"props":18966,"children":18967},{"style":360},[18968],{"type":26,"value":2704},{"type":21,"tag":209,"props":18970,"children":18971},{"style":222},[18972],{"type":26,"value":2709},{"type":21,"tag":209,"props":18974,"children":18975},{"style":400},[18976],{"type":26,"value":26},{"type":21,"tag":209,"props":18978,"children":18979},{"style":222},[18980],{"type":26,"value":432},{"type":21,"tag":209,"props":18982,"children":18983},{"style":216},[18984],{"type":26,"value":437},{"type":21,"tag":209,"props":18986,"children":18987},{"style":222},[18988],{"type":26,"value":276},{"type":21,"tag":209,"props":18990,"children":18991},{"class":211,"line":15106},[18992,18997],{"type":21,"tag":209,"props":18993,"children":18994},{"style":216},[18995],{"type":26,"value":18996},"            try",{"type":21,"tag":209,"props":18998,"children":18999},{"style":222},[19000],{"type":26,"value":276},{"type":21,"tag":209,"props":19002,"children":19003},{"class":211,"line":15114},[19004,19009,19013],{"type":21,"tag":209,"props":19005,"children":19006},{"style":222},[19007],{"type":26,"value":19008},"                storage.",{"type":21,"tag":209,"props":19010,"children":19011},{"style":360},[19012],{"type":26,"value":17144},{"type":21,"tag":209,"props":19014,"children":19015},{"style":222},[19016],{"type":26,"value":17149},{"type":21,"tag":209,"props":19018,"children":19019},{"class":211,"line":15123},[19020,19024,19028,19032,19036,19040,19044,19048,19052,19056,19060,19064,19068,19072,19076,19080,19084],{"type":21,"tag":209,"props":19021,"children":19022},{"style":222},[19023],{"type":26,"value":19008},{"type":21,"tag":209,"props":19025,"children":19026},{"style":360},[19027],{"type":26,"value":17144},{"type":21,"tag":209,"props":19029,"children":19030},{"style":222},[19031],{"type":26,"value":17165},{"type":21,"tag":209,"props":19033,"children":19034},{"style":216},[19035],{"type":26,"value":17170},{"type":21,"tag":209,"props":19037,"children":19038},{"style":233},[19039],{"type":26,"value":17175},{"type":21,"tag":209,"props":19041,"children":19042},{"style":222},[19043],{"type":26,"value":408},{"type":21,"tag":209,"props":19045,"children":19046},{"style":216},[19047],{"type":26,"value":17184},{"type":21,"tag":209,"props":19049,"children":19050},{"style":360},[19051],{"type":26,"value":17189},{"type":21,"tag":209,"props":19053,"children":19054},{"style":222},[19055],{"type":26,"value":17194},{"type":21,"tag":209,"props":19057,"children":19058},{"style":216},[19059],{"type":26,"value":17170},{"type":21,"tag":209,"props":19061,"children":19062},{"style":263},[19063],{"type":26,"value":17203},{"type":21,"tag":209,"props":19065,"children":19066},{"style":216},[19067],{"type":26,"value":17208},{"type":21,"tag":209,"props":19069,"children":19070},{"style":263},[19071],{"type":26,"value":17213},{"type":21,"tag":209,"props":19073,"children":19074},{"style":216},[19075],{"type":26,"value":17208},{"type":21,"tag":209,"props":19077,"children":19078},{"style":263},[19079],{"type":26,"value":17213},{"type":21,"tag":209,"props":19081,"children":19082},{"style":216},[19083],{"type":26,"value":17208},{"type":21,"tag":209,"props":19085,"children":19086},{"style":222},[19087],{"type":26,"value":17230},{"type":21,"tag":209,"props":19089,"children":19090},{"class":211,"line":15143},[19091,19095,19099,19103,19107,19111],{"type":21,"tag":209,"props":19092,"children":19093},{"style":222},[19094],{"type":26,"value":19008},{"type":21,"tag":209,"props":19096,"children":19097},{"style":360},[19098],{"type":26,"value":17144},{"type":21,"tag":209,"props":19100,"children":19101},{"style":222},[19102],{"type":26,"value":17165},{"type":21,"tag":209,"props":19104,"children":19105},{"style":216},[19106],{"type":26,"value":17170},{"type":21,"tag":209,"props":19108,"children":19109},{"style":233},[19110],{"type":26,"value":17254},{"type":21,"tag":209,"props":19112,"children":19113},{"style":222},[19114],{"type":26,"value":17259},{"type":21,"tag":209,"props":19116,"children":19117},{"class":211,"line":15160},[19118,19123,19127],{"type":21,"tag":209,"props":19119,"children":19120},{"style":222},[19121],{"type":26,"value":19122},"            } ",{"type":21,"tag":209,"props":19124,"children":19125},{"style":216},[19126],{"type":26,"value":5347},{"type":21,"tag":209,"props":19128,"children":19129},{"style":222},[19130],{"type":26,"value":15397},{"type":21,"tag":209,"props":19132,"children":19133},{"class":211,"line":15168},[19134],{"type":21,"tag":209,"props":19135,"children":19136},{"style":448},[19137],{"type":26,"value":19138},"                // Remove any incomplete data that may have been saved before the exception was caught\n",{"type":21,"tag":209,"props":19140,"children":19141},{"class":211,"line":15196},[19142,19147],{"type":21,"tag":209,"props":19143,"children":19144},{"style":360},[19145],{"type":26,"value":19146},"                removeFromStorage",{"type":21,"tag":209,"props":19148,"children":19149},{"style":222},[19150],{"type":26,"value":17295},{"type":21,"tag":209,"props":19152,"children":19153},{"class":211,"line":15219},[19154,19158,19162,19166,19170,19174],{"type":21,"tag":209,"props":19155,"children":19156},{"style":222},[19157],{"type":26,"value":2764},{"type":21,"tag":209,"props":19159,"children":19160},{"style":360},[19161],{"type":26,"value":1059},{"type":21,"tag":209,"props":19163,"children":19164},{"style":222},[19165],{"type":26,"value":368},{"type":21,"tag":209,"props":19167,"children":19168},{"style":233},[19169],{"type":26,"value":17315},{"type":21,"tag":209,"props":19171,"children":19172},{"style":216},[19173],{"type":26,"value":4652},{"type":21,"tag":209,"props":19175,"children":19176},{"style":222},[19177],{"type":26,"value":17324},{"type":21,"tag":209,"props":19179,"children":19180},{"class":211,"line":15240},[19181],{"type":21,"tag":209,"props":19182,"children":19183},{"style":222},[19184],{"type":26,"value":14714},{"type":21,"tag":209,"props":19186,"children":19187},{"class":211,"line":15248},[19188],{"type":21,"tag":209,"props":19189,"children":19190},{"style":222},[19191],{"type":26,"value":13702},{"type":21,"tag":209,"props":19193,"children":19194},{"class":211,"line":15256},[19195],{"type":21,"tag":209,"props":19196,"children":19197},{"emptyLinePlaceholder":248},[19198],{"type":26,"value":251},{"type":21,"tag":209,"props":19200,"children":19201},{"class":211,"line":15284},[19202,19206],{"type":21,"tag":209,"props":19203,"children":19204},{"style":216},[19205],{"type":26,"value":3069},{"type":21,"tag":209,"props":19207,"children":19208},{"style":222},[19209],{"type":26,"value":17357},{"type":21,"tag":209,"props":19211,"children":19212},{"class":211,"line":15317},[19213],{"type":21,"tag":209,"props":19214,"children":19215},{"style":222},[19216],{"type":26,"value":331},{"type":21,"tag":209,"props":19218,"children":19219},{"class":211,"line":15331},[19220],{"type":21,"tag":209,"props":19221,"children":19222},{"emptyLinePlaceholder":248},[19223],{"type":26,"value":251},{"type":21,"tag":209,"props":19225,"children":19226},{"class":211,"line":15339},[19227],{"type":21,"tag":209,"props":19228,"children":19229},{"style":448},[19230],{"type":26,"value":13290},{"type":21,"tag":209,"props":19232,"children":19233},{"class":211,"line":15352},[19234],{"type":21,"tag":209,"props":19235,"children":19236},{"style":448},[19237],{"type":26,"value":19238},"     * Create a new response containing the cached value, and return a promise\n",{"type":21,"tag":209,"props":19240,"children":19241},{"class":211,"line":15382},[19242],{"type":21,"tag":209,"props":19243,"children":19244},{"style":448},[19245],{"type":26,"value":19246},"     * that resolves with this response.\n",{"type":21,"tag":209,"props":19248,"children":19249},{"class":211,"line":15400},[19250],{"type":21,"tag":209,"props":19251,"children":19252},{"style":448},[19253],{"type":26,"value":17907},{"type":21,"tag":209,"props":19255,"children":19256},{"class":211,"line":15409},[19257,19261,19265],{"type":21,"tag":209,"props":19258,"children":19259},{"style":448},[19260],{"type":26,"value":13306},{"type":21,"tag":209,"props":19262,"children":19263},{"style":216},[19264],{"type":26,"value":13311},{"type":21,"tag":209,"props":19266,"children":19267},{"style":222},[19268],{"type":26,"value":17436},{"type":21,"tag":209,"props":19270,"children":19271},{"class":211,"line":15433},[19272,19276,19280],{"type":21,"tag":209,"props":19273,"children":19274},{"style":448},[19275],{"type":26,"value":13306},{"type":21,"tag":209,"props":19277,"children":19278},{"style":216},[19279],{"type":26,"value":13311},{"type":21,"tag":209,"props":19281,"children":19282},{"style":222},[19283],{"type":26,"value":17452},{"type":21,"tag":209,"props":19285,"children":19286},{"class":211,"line":15441},[19287,19291,19295],{"type":21,"tag":209,"props":19288,"children":19289},{"style":448},[19290],{"type":26,"value":13306},{"type":21,"tag":209,"props":19292,"children":19293},{"style":216},[19294],{"type":26,"value":13333},{"type":21,"tag":209,"props":19296,"children":19297},{"style":360},[19298],{"type":26,"value":17468},{"type":21,"tag":209,"props":19300,"children":19301},{"class":211,"line":15449},[19302],{"type":21,"tag":209,"props":19303,"children":19304},{"style":448},[19305],{"type":26,"value":13346},{"type":21,"tag":209,"props":19307,"children":19308},{"class":211,"line":15467},[19309,19313,19317,19321,19325,19329,19333],{"type":21,"tag":209,"props":19310,"children":19311},{"style":216},[19312],{"type":26,"value":2981},{"type":21,"tag":209,"props":19314,"children":19315},{"style":360},[19316],{"type":26,"value":17487},{"type":21,"tag":209,"props":19318,"children":19319},{"style":222},[19320],{"type":26,"value":368},{"type":21,"tag":209,"props":19322,"children":19323},{"style":400},[19324],{"type":26,"value":17496},{"type":21,"tag":209,"props":19326,"children":19327},{"style":222},[19328],{"type":26,"value":408},{"type":21,"tag":209,"props":19330,"children":19331},{"style":400},[19332],{"type":26,"value":17505},{"type":21,"tag":209,"props":19334,"children":19335},{"style":222},[19336],{"type":26,"value":5588},{"type":21,"tag":209,"props":19338,"children":19339},{"class":211,"line":15475},[19340,19344,19348,19352,19356,19360],{"type":21,"tag":209,"props":19341,"children":19342},{"style":216},[19343],{"type":26,"value":14505},{"type":21,"tag":209,"props":19345,"children":19346},{"style":222},[19347],{"type":26,"value":17521},{"type":21,"tag":209,"props":19349,"children":19350},{"style":216},[19351],{"type":26,"value":1432},{"type":21,"tag":209,"props":19353,"children":19354},{"style":216},[19355],{"type":26,"value":6371},{"type":21,"tag":209,"props":19357,"children":19358},{"style":360},[19359],{"type":26,"value":17534},{"type":21,"tag":209,"props":19361,"children":19362},{"style":222},[19363],{"type":26,"value":17539},{"type":21,"tag":209,"props":19365,"children":19366},{"class":211,"line":15487},[19367],{"type":21,"tag":209,"props":19368,"children":19369},{"style":222},[19370],{"type":26,"value":19371},"            value,\n",{"type":21,"tag":209,"props":19373,"children":19374},{"class":211,"line":15495},[19375],{"type":21,"tag":209,"props":19376,"children":19377},{"style":222},[19378],{"type":26,"value":19379},"            {\n",{"type":21,"tag":209,"props":19381,"children":19382},{"class":211,"line":15503},[19383,19388,19392],{"type":21,"tag":209,"props":19384,"children":19385},{"style":222},[19386],{"type":26,"value":19387},"                status: ",{"type":21,"tag":209,"props":19389,"children":19390},{"style":263},[19391],{"type":26,"value":10921},{"type":21,"tag":209,"props":19393,"children":19394},{"style":222},[19395],{"type":26,"value":304},{"type":21,"tag":209,"props":19397,"children":19398},{"class":211,"line":15511},[19399,19404,19408],{"type":21,"tag":209,"props":19400,"children":19401},{"style":222},[19402],{"type":26,"value":19403},"                statusText: ",{"type":21,"tag":209,"props":19405,"children":19406},{"style":233},[19407],{"type":26,"value":17584},{"type":21,"tag":209,"props":19409,"children":19410},{"style":222},[19411],{"type":26,"value":304},{"type":21,"tag":209,"props":19413,"children":19414},{"class":211,"line":15520},[19415],{"type":21,"tag":209,"props":19416,"children":19417},{"style":222},[19418],{"type":26,"value":19419},"                headers: {\n",{"type":21,"tag":209,"props":19421,"children":19422},{"class":211,"line":15529},[19423,19428],{"type":21,"tag":209,"props":19424,"children":19425},{"style":233},[19426],{"type":26,"value":19427},"                    'Content-Type'",{"type":21,"tag":209,"props":19429,"children":19430},{"style":222},[19431],{"type":26,"value":17609},{"type":21,"tag":209,"props":19433,"children":19434},{"class":211,"line":15545},[19435],{"type":21,"tag":209,"props":19436,"children":19437},{"style":222},[19438],{"type":26,"value":19439},"                }\n",{"type":21,"tag":209,"props":19441,"children":19442},{"class":211,"line":15561},[19443],{"type":21,"tag":209,"props":19444,"children":19445},{"style":222},[19446],{"type":26,"value":14714},{"type":21,"tag":209,"props":19448,"children":19449},{"class":211,"line":15569},[19450],{"type":21,"tag":209,"props":19451,"children":19452},{"style":222},[19453],{"type":26,"value":19454},"        );\n",{"type":21,"tag":209,"props":19456,"children":19457},{"class":211,"line":15593},[19458],{"type":21,"tag":209,"props":19459,"children":19460},{"emptyLinePlaceholder":248},[19461],{"type":26,"value":251},{"type":21,"tag":209,"props":19463,"children":19464},{"class":211,"line":15634},[19465,19469,19473,19477,19481,19485,19489,19493,19497,19501],{"type":21,"tag":209,"props":19466,"children":19467},{"style":216},[19468],{"type":26,"value":3069},{"type":21,"tag":209,"props":19470,"children":19471},{"style":216},[19472],{"type":26,"value":6371},{"type":21,"tag":209,"props":19474,"children":19475},{"style":263},[19476],{"type":26,"value":14164},{"type":21,"tag":209,"props":19478,"children":19479},{"style":222},[19480],{"type":26,"value":368},{"type":21,"tag":209,"props":19482,"children":19483},{"style":216},[19484],{"type":26,"value":4622},{"type":21,"tag":209,"props":19486,"children":19487},{"style":222},[19488],{"type":26,"value":5569},{"type":21,"tag":209,"props":19490,"children":19491},{"style":400},[19492],{"type":26,"value":14173},{"type":21,"tag":209,"props":19494,"children":19495},{"style":222},[19496],{"type":26,"value":408},{"type":21,"tag":209,"props":19498,"children":19499},{"style":400},[19500],{"type":26,"value":14182},{"type":21,"tag":209,"props":19502,"children":19503},{"style":222},[19504],{"type":26,"value":5588},{"type":21,"tag":209,"props":19506,"children":19507},{"class":211,"line":15662},[19508,19513],{"type":21,"tag":209,"props":19509,"children":19510},{"style":360},[19511],{"type":26,"value":19512},"            resolve",{"type":21,"tag":209,"props":19514,"children":19515},{"style":222},[19516],{"type":26,"value":17694},{"type":21,"tag":209,"props":19518,"children":19519},{"class":211,"line":15678},[19520],{"type":21,"tag":209,"props":19521,"children":19522},{"style":222},[19523],{"type":26,"value":13702},{"type":21,"tag":209,"props":19525,"children":19526},{"class":211,"line":15694},[19527],{"type":21,"tag":209,"props":19528,"children":19529},{"style":222},[19530],{"type":26,"value":331},{"type":21,"tag":209,"props":19532,"children":19533},{"class":211,"line":15710},[19534],{"type":21,"tag":209,"props":19535,"children":19536},{"emptyLinePlaceholder":248},[19537],{"type":26,"value":251},{"type":21,"tag":209,"props":19539,"children":19540},{"class":211,"line":15718},[19541],{"type":21,"tag":209,"props":19542,"children":19543},{"style":448},[19544],{"type":26,"value":13290},{"type":21,"tag":209,"props":19546,"children":19547},{"class":211,"line":15730},[19548],{"type":21,"tag":209,"props":19549,"children":19550},{"style":448},[19551],{"type":26,"value":19552},"     * Override fetch on the global context, so that we can intercept\n",{"type":21,"tag":209,"props":19554,"children":19555},{"class":211,"line":15738},[19556],{"type":21,"tag":209,"props":19557,"children":19558},{"style":448},[19559],{"type":26,"value":19560},"     * fetch calls and respond with locally cached content, if available.\n",{"type":21,"tag":209,"props":19562,"children":19563},{"class":211,"line":15746},[19564],{"type":21,"tag":209,"props":19565,"children":19566},{"style":448},[19567],{"type":26,"value":19568},"     * New parameters available on the call to fetch:\n",{"type":21,"tag":209,"props":19570,"children":19571},{"class":211,"line":15754},[19572,19577],{"type":21,"tag":209,"props":19573,"children":19574},{"style":448},[19575],{"type":26,"value":19576},"     * localCache   : true",{"type":21,"tag":209,"props":19578,"children":19579},{"style":448},[19580],{"type":26,"value":19581}," // required - either a boolean (if true, localStorage is used,\n",{"type":21,"tag":209,"props":19583,"children":19584},{"class":211,"line":15767},[19585],{"type":21,"tag":209,"props":19586,"children":19587},{"style":448},[19588],{"type":26,"value":19589},"     * if false request is not cached or returned from cache), or an object implementing the\n",{"type":21,"tag":209,"props":19591,"children":19593},{"class":211,"line":19592},120,[19594],{"type":21,"tag":209,"props":19595,"children":19596},{"style":448},[19597],{"type":26,"value":19598},"     * Storage interface, in which case that object is used instead.\n",{"type":21,"tag":209,"props":19600,"children":19602},{"class":211,"line":19601},121,[19603,19608],{"type":21,"tag":209,"props":19604,"children":19605},{"style":448},[19606],{"type":26,"value":19607},"     * cacheTTL     : 5,",{"type":21,"tag":209,"props":19609,"children":19610},{"style":448},[19611],{"type":26,"value":19612}," // optional, cache time in hours, default is 5. Use float numbers for\n",{"type":21,"tag":209,"props":19614,"children":19616},{"class":211,"line":19615},122,[19617],{"type":21,"tag":209,"props":19618,"children":19619},{"style":448},[19620],{"type":26,"value":19621},"     * values less than a full hour (e.g. 0.5 for 1/2 hour).\n",{"type":21,"tag":209,"props":19623,"children":19625},{"class":211,"line":19624},123,[19626,19631],{"type":21,"tag":209,"props":19627,"children":19628},{"style":448},[19629],{"type":26,"value":19630},"     * cacheKey     : 'post',",{"type":21,"tag":209,"props":19632,"children":19633},{"style":448},[19634],{"type":26,"value":19635}," // optional - key under which cached string will be stored.\n",{"type":21,"tag":209,"props":19637,"children":19639},{"class":211,"line":19638},124,[19640,19645],{"type":21,"tag":209,"props":19641,"children":19642},{"style":448},[19643],{"type":26,"value":19644},"     * isCacheValid : function",{"type":21,"tag":209,"props":19646,"children":19647},{"style":448},[19648],{"type":26,"value":19649},"  // optional - return true for valid, false for invalid.\n",{"type":21,"tag":209,"props":19651,"children":19653},{"class":211,"line":19652},125,[19654],{"type":21,"tag":209,"props":19655,"children":19656},{"style":448},[19657],{"type":26,"value":13346},{"type":21,"tag":209,"props":19659,"children":19661},{"class":211,"line":19660},126,[19662,19667,19671,19675,19679,19683,19687,19691,19695],{"type":21,"tag":209,"props":19663,"children":19664},{"style":222},[19665],{"type":26,"value":19666},"    self.",{"type":21,"tag":209,"props":19668,"children":19669},{"style":360},[19670],{"type":26,"value":17821},{"type":21,"tag":209,"props":19672,"children":19673},{"style":216},[19674],{"type":26,"value":271},{"type":21,"tag":209,"props":19676,"children":19677},{"style":216},[19678],{"type":26,"value":4789},{"type":21,"tag":209,"props":19680,"children":19681},{"style":222},[19682],{"type":26,"value":5569},{"type":21,"tag":209,"props":19684,"children":19685},{"style":400},[19686],{"type":26,"value":17951},{"type":21,"tag":209,"props":19688,"children":19689},{"style":222},[19690],{"type":26,"value":408},{"type":21,"tag":209,"props":19692,"children":19693},{"style":400},[19694],{"type":26,"value":17960},{"type":21,"tag":209,"props":19696,"children":19697},{"style":222},[19698],{"type":26,"value":5588},{"type":21,"tag":209,"props":19700,"children":19702},{"class":211,"line":19701},127,[19703,19707,19711,19715,19719],{"type":21,"tag":209,"props":19704,"children":19705},{"style":216},[19706],{"type":26,"value":14505},{"type":21,"tag":209,"props":19708,"children":19709},{"style":222},[19710],{"type":26,"value":18328},{"type":21,"tag":209,"props":19712,"children":19713},{"style":216},[19714],{"type":26,"value":1432},{"type":21,"tag":209,"props":19716,"children":19717},{"style":360},[19718],{"type":26,"value":18231},{"type":21,"tag":209,"props":19720,"children":19721},{"style":222},[19722],{"type":26,"value":19723},"(settings.localCache),\n",{"type":21,"tag":209,"props":19725,"children":19727},{"class":211,"line":19726},128,[19728,19733,19737,19742,19746,19751],{"type":21,"tag":209,"props":19729,"children":19730},{"style":222},[19731],{"type":26,"value":19732},"            hourstl ",{"type":21,"tag":209,"props":19734,"children":19735},{"style":216},[19736],{"type":26,"value":1432},{"type":21,"tag":209,"props":19738,"children":19739},{"style":222},[19740],{"type":26,"value":19741}," settings.cacheTTL ",{"type":21,"tag":209,"props":19743,"children":19744},{"style":216},[19745],{"type":26,"value":13270},{"type":21,"tag":209,"props":19747,"children":19748},{"style":263},[19749],{"type":26,"value":19750}," 5",{"type":21,"tag":209,"props":19752,"children":19753},{"style":222},[19754],{"type":26,"value":304},{"type":21,"tag":209,"props":19756,"children":19758},{"class":211,"line":19757},129,[19759,19764,19768,19772],{"type":21,"tag":209,"props":19760,"children":19761},{"style":222},[19762],{"type":26,"value":19763},"            cacheKey ",{"type":21,"tag":209,"props":19765,"children":19766},{"style":216},[19767],{"type":26,"value":1432},{"type":21,"tag":209,"props":19769,"children":19770},{"style":360},[19771],{"type":26,"value":17942},{"type":21,"tag":209,"props":19773,"children":19774},{"style":222},[19775],{"type":26,"value":19776},"(url, settings),\n",{"type":21,"tag":209,"props":19778,"children":19780},{"class":211,"line":19779},130,[19781,19786,19790],{"type":21,"tag":209,"props":19782,"children":19783},{"style":222},[19784],{"type":26,"value":19785},"            cacheValid ",{"type":21,"tag":209,"props":19787,"children":19788},{"style":216},[19789],{"type":26,"value":1432},{"type":21,"tag":209,"props":19791,"children":19792},{"style":222},[19793],{"type":26,"value":19794}," settings.isCacheValid,\n",{"type":21,"tag":209,"props":19796,"children":19798},{"class":211,"line":19797},131,[19799],{"type":21,"tag":209,"props":19800,"children":19801},{"style":222},[19802],{"type":26,"value":19803},"            ttl,\n",{"type":21,"tag":209,"props":19805,"children":19807},{"class":211,"line":19806},132,[19808],{"type":21,"tag":209,"props":19809,"children":19810},{"style":222},[19811],{"type":26,"value":19371},{"type":21,"tag":209,"props":19813,"children":19815},{"class":211,"line":19814},133,[19816],{"type":21,"tag":209,"props":19817,"children":19818},{"style":222},[19819],{"type":26,"value":19820},"            dataType;\n",{"type":21,"tag":209,"props":19822,"children":19824},{"class":211,"line":19823},134,[19825],{"type":21,"tag":209,"props":19826,"children":19827},{"emptyLinePlaceholder":248},[19828],{"type":26,"value":251},{"type":21,"tag":209,"props":19830,"children":19832},{"class":211,"line":19831},135,[19833,19837,19841,19845,19849,19853,19857],{"type":21,"tag":209,"props":19834,"children":19835},{"style":216},[19836],{"type":26,"value":6334},{"type":21,"tag":209,"props":19838,"children":19839},{"style":222},[19840],{"type":26,"value":5569},{"type":21,"tag":209,"props":19842,"children":19843},{"style":216},[19844],{"type":26,"value":6455},{"type":21,"tag":209,"props":19846,"children":19847},{"style":222},[19848],{"type":26,"value":18263},{"type":21,"tag":209,"props":19850,"children":19851},{"style":216},[19852],{"type":26,"value":8982},{"type":21,"tag":209,"props":19854,"children":19855},{"style":360},[19856],{"type":26,"value":13401},{"type":21,"tag":209,"props":19858,"children":19859},{"style":222},[19860],{"type":26,"value":19861},"(url, settings);\n",{"type":21,"tag":209,"props":19863,"children":19865},{"class":211,"line":19864},136,[19866],{"type":21,"tag":209,"props":19867,"children":19868},{"emptyLinePlaceholder":248},[19869],{"type":26,"value":251},{"type":21,"tag":209,"props":19871,"children":19873},{"class":211,"line":19872},137,[19874,19879,19883,19888,19893,19897,19901,19905],{"type":21,"tag":209,"props":19875,"children":19876},{"style":222},[19877],{"type":26,"value":19878},"        ttl ",{"type":21,"tag":209,"props":19880,"children":19881},{"style":216},[19882],{"type":26,"value":1432},{"type":21,"tag":209,"props":19884,"children":19885},{"style":222},[19886],{"type":26,"value":19887}," storage.",{"type":21,"tag":209,"props":19889,"children":19890},{"style":360},[19891],{"type":26,"value":19892},"getItem",{"type":21,"tag":209,"props":19894,"children":19895},{"style":222},[19896],{"type":26,"value":17165},{"type":21,"tag":209,"props":19898,"children":19899},{"style":216},[19900],{"type":26,"value":17170},{"type":21,"tag":209,"props":19902,"children":19903},{"style":233},[19904],{"type":26,"value":17175},{"type":21,"tag":209,"props":19906,"children":19907},{"style":222},[19908],{"type":26,"value":2608},{"type":21,"tag":209,"props":19910,"children":19912},{"class":211,"line":19911},138,[19913],{"type":21,"tag":209,"props":19914,"children":19915},{"emptyLinePlaceholder":248},[19916],{"type":26,"value":251},{"type":21,"tag":209,"props":19918,"children":19920},{"class":211,"line":19919},139,[19921,19925,19930,19934,19939,19944,19948,19952,19956,19961,19966],{"type":21,"tag":209,"props":19922,"children":19923},{"style":216},[19924],{"type":26,"value":6334},{"type":21,"tag":209,"props":19926,"children":19927},{"style":222},[19928],{"type":26,"value":19929}," (cacheValid ",{"type":21,"tag":209,"props":19931,"children":19932},{"style":216},[19933],{"type":26,"value":18381},{"type":21,"tag":209,"props":19935,"children":19936},{"style":216},[19937],{"type":26,"value":19938}," typeof",{"type":21,"tag":209,"props":19940,"children":19941},{"style":222},[19942],{"type":26,"value":19943}," cacheValid ",{"type":21,"tag":209,"props":19945,"children":19946},{"style":216},[19947],{"type":26,"value":14680},{"type":21,"tag":209,"props":19949,"children":19950},{"style":233},[19951],{"type":26,"value":14685},{"type":21,"tag":209,"props":19953,"children":19954},{"style":216},[19955],{"type":26,"value":18342},{"type":21,"tag":209,"props":19957,"children":19958},{"style":216},[19959],{"type":26,"value":19960}," !",{"type":21,"tag":209,"props":19962,"children":19963},{"style":360},[19964],{"type":26,"value":19965},"cacheValid",{"type":21,"tag":209,"props":19967,"children":19968},{"style":222},[19969],{"type":26,"value":19970},"()) {\n",{"type":21,"tag":209,"props":19972,"children":19974},{"class":211,"line":19973},140,[19975,19979],{"type":21,"tag":209,"props":19976,"children":19977},{"style":360},[19978],{"type":26,"value":17290},{"type":21,"tag":209,"props":19980,"children":19981},{"style":222},[19982],{"type":26,"value":17295},{"type":21,"tag":209,"props":19984,"children":19986},{"class":211,"line":19985},141,[19987,19992,19996,20000],{"type":21,"tag":209,"props":19988,"children":19989},{"style":222},[19990],{"type":26,"value":19991},"            ttl ",{"type":21,"tag":209,"props":19993,"children":19994},{"style":216},[19995],{"type":26,"value":1432},{"type":21,"tag":209,"props":19997,"children":19998},{"style":263},[19999],{"type":26,"value":8009},{"type":21,"tag":209,"props":20001,"children":20002},{"style":222},[20003],{"type":26,"value":241},{"type":21,"tag":209,"props":20005,"children":20007},{"class":211,"line":20006},142,[20008],{"type":21,"tag":209,"props":20009,"children":20010},{"style":222},[20011],{"type":26,"value":2235},{"type":21,"tag":209,"props":20013,"children":20015},{"class":211,"line":20014},143,[20016],{"type":21,"tag":209,"props":20017,"children":20018},{"emptyLinePlaceholder":248},[20019],{"type":26,"value":251},{"type":21,"tag":209,"props":20021,"children":20023},{"class":211,"line":20022},144,[20024,20028,20033,20037,20042,20046,20051,20055],{"type":21,"tag":209,"props":20025,"children":20026},{"style":216},[20027],{"type":26,"value":6334},{"type":21,"tag":209,"props":20029,"children":20030},{"style":222},[20031],{"type":26,"value":20032}," (ttl ",{"type":21,"tag":209,"props":20034,"children":20035},{"style":216},[20036],{"type":26,"value":18381},{"type":21,"tag":209,"props":20038,"children":20039},{"style":222},[20040],{"type":26,"value":20041}," ttl ",{"type":21,"tag":209,"props":20043,"children":20044},{"style":216},[20045],{"type":26,"value":1985},{"type":21,"tag":209,"props":20047,"children":20048},{"style":216},[20049],{"type":26,"value":20050}," +new",{"type":21,"tag":209,"props":20052,"children":20053},{"style":360},[20054],{"type":26,"value":17189},{"type":21,"tag":209,"props":20056,"children":20057},{"style":222},[20058],{"type":26,"value":19970},{"type":21,"tag":209,"props":20060,"children":20062},{"class":211,"line":20061},145,[20063,20067],{"type":21,"tag":209,"props":20064,"children":20065},{"style":360},[20066],{"type":26,"value":17290},{"type":21,"tag":209,"props":20068,"children":20069},{"style":222},[20070],{"type":26,"value":17295},{"type":21,"tag":209,"props":20072,"children":20074},{"class":211,"line":20073},146,[20075],{"type":21,"tag":209,"props":20076,"children":20077},{"style":222},[20078],{"type":26,"value":2235},{"type":21,"tag":209,"props":20080,"children":20082},{"class":211,"line":20081},147,[20083],{"type":21,"tag":209,"props":20084,"children":20085},{"emptyLinePlaceholder":248},[20086],{"type":26,"value":251},{"type":21,"tag":209,"props":20088,"children":20090},{"class":211,"line":20089},148,[20091,20096,20100,20104,20108],{"type":21,"tag":209,"props":20092,"children":20093},{"style":222},[20094],{"type":26,"value":20095},"        value ",{"type":21,"tag":209,"props":20097,"children":20098},{"style":216},[20099],{"type":26,"value":1432},{"type":21,"tag":209,"props":20101,"children":20102},{"style":222},[20103],{"type":26,"value":19887},{"type":21,"tag":209,"props":20105,"children":20106},{"style":360},[20107],{"type":26,"value":19892},{"type":21,"tag":209,"props":20109,"children":20110},{"style":222},[20111],{"type":26,"value":18590},{"type":21,"tag":209,"props":20113,"children":20115},{"class":211,"line":20114},149,[20116],{"type":21,"tag":209,"props":20117,"children":20118},{"emptyLinePlaceholder":248},[20119],{"type":26,"value":251},{"type":21,"tag":209,"props":20121,"children":20123},{"class":211,"line":20122},150,[20124,20128,20132,20136],{"type":21,"tag":209,"props":20125,"children":20126},{"style":216},[20127],{"type":26,"value":6334},{"type":21,"tag":209,"props":20129,"children":20130},{"style":222},[20131],{"type":26,"value":5569},{"type":21,"tag":209,"props":20133,"children":20134},{"style":216},[20135],{"type":26,"value":6455},{"type":21,"tag":209,"props":20137,"children":20138},{"style":222},[20139],{"type":26,"value":20140},"value) {\n",{"type":21,"tag":209,"props":20142,"children":20144},{"class":211,"line":20143},151,[20145],{"type":21,"tag":209,"props":20146,"children":20147},{"style":448},[20148],{"type":26,"value":20149},"            /* If not cached, we'll make the request and add a then block to the resulting promise,\n",{"type":21,"tag":209,"props":20151,"children":20153},{"class":211,"line":20152},152,[20154],{"type":21,"tag":209,"props":20155,"children":20156},{"style":448},[20157],{"type":26,"value":20158},"             in which we'll cache the result. */\n",{"type":21,"tag":209,"props":20160,"children":20162},{"class":211,"line":20161},153,[20163,20167,20171,20176,20180,20185,20190,20194,20199],{"type":21,"tag":209,"props":20164,"children":20165},{"style":216},[20166],{"type":26,"value":13689},{"type":21,"tag":209,"props":20168,"children":20169},{"style":360},[20170],{"type":26,"value":13401},{"type":21,"tag":209,"props":20172,"children":20173},{"style":222},[20174],{"type":26,"value":20175},"(url, settings).",{"type":21,"tag":209,"props":20177,"children":20178},{"style":360},[20179],{"type":26,"value":2704},{"type":21,"tag":209,"props":20181,"children":20182},{"style":222},[20183],{"type":26,"value":20184},"(cacheResponse.",{"type":21,"tag":209,"props":20186,"children":20187},{"style":360},[20188],{"type":26,"value":20189},"bind",{"type":21,"tag":209,"props":20191,"children":20192},{"style":222},[20193],{"type":26,"value":368},{"type":21,"tag":209,"props":20195,"children":20196},{"style":263},[20197],{"type":26,"value":20198},"null",{"type":21,"tag":209,"props":20200,"children":20201},{"style":222},[20202],{"type":26,"value":20203},", cacheKey, storage, hourstl));\n",{"type":21,"tag":209,"props":20205,"children":20207},{"class":211,"line":20206},154,[20208],{"type":21,"tag":209,"props":20209,"children":20210},{"style":222},[20211],{"type":26,"value":2235},{"type":21,"tag":209,"props":20213,"children":20215},{"class":211,"line":20214},155,[20216],{"type":21,"tag":209,"props":20217,"children":20218},{"emptyLinePlaceholder":248},[20219],{"type":26,"value":251},{"type":21,"tag":209,"props":20221,"children":20223},{"class":211,"line":20222},156,[20224],{"type":21,"tag":209,"props":20225,"children":20226},{"style":448},[20227],{"type":26,"value":20228},"        /* Value is cached, so we'll simply create and respond with a promise of our own,\n",{"type":21,"tag":209,"props":20230,"children":20232},{"class":211,"line":20231},157,[20233],{"type":21,"tag":209,"props":20234,"children":20235},{"style":448},[20236],{"type":26,"value":20237},"         and provide a response object. */\n",{"type":21,"tag":209,"props":20239,"children":20241},{"class":211,"line":20240},158,[20242,20246,20250,20254,20258,20262,20266,20270,20274,20278,20282],{"type":21,"tag":209,"props":20243,"children":20244},{"style":222},[20245],{"type":26,"value":17024},{"type":21,"tag":209,"props":20247,"children":20248},{"style":216},[20249],{"type":26,"value":1432},{"type":21,"tag":209,"props":20251,"children":20252},{"style":222},[20253],{"type":26,"value":19887},{"type":21,"tag":209,"props":20255,"children":20256},{"style":360},[20257],{"type":26,"value":19892},{"type":21,"tag":209,"props":20259,"children":20260},{"style":222},[20261],{"type":26,"value":17165},{"type":21,"tag":209,"props":20263,"children":20264},{"style":216},[20265],{"type":26,"value":17170},{"type":21,"tag":209,"props":20267,"children":20268},{"style":233},[20269],{"type":26,"value":17254},{"type":21,"tag":209,"props":20271,"children":20272},{"style":222},[20273],{"type":26,"value":432},{"type":21,"tag":209,"props":20275,"children":20276},{"style":216},[20277],{"type":26,"value":13270},{"type":21,"tag":209,"props":20279,"children":20280},{"style":233},[20281],{"type":26,"value":17059},{"type":21,"tag":209,"props":20283,"children":20284},{"style":222},[20285],{"type":26,"value":241},{"type":21,"tag":209,"props":20287,"children":20289},{"class":211,"line":20288},159,[20290,20294,20298],{"type":21,"tag":209,"props":20291,"children":20292},{"style":216},[20293],{"type":26,"value":3069},{"type":21,"tag":209,"props":20295,"children":20296},{"style":360},[20297],{"type":26,"value":17487},{"type":21,"tag":209,"props":20299,"children":20300},{"style":222},[20301],{"type":26,"value":20302},"(value, dataType);\n",{"type":21,"tag":209,"props":20304,"children":20306},{"class":211,"line":20305},160,[20307],{"type":21,"tag":209,"props":20308,"children":20309},{"style":222},[20310],{"type":26,"value":13439},{"type":21,"tag":209,"props":20312,"children":20314},{"class":211,"line":20313},161,[20315],{"type":21,"tag":209,"props":20316,"children":20317},{"style":222},[20318],{"type":26,"value":20319},"})(self.fetch);\n",{"type":21,"tag":3490,"props":20321,"children":20322},{},[20323],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":20325},[20326,20327,20328,20329,20330],{"id":16616,"depth":254,"text":16619},{"id":16635,"depth":254,"text":16638},{"id":16699,"depth":254,"text":16702},{"id":16719,"depth":254,"text":16722},{"id":17724,"depth":254,"text":17727},"content:ckeefer:2016-7:goFetch2.md","ckeefer/2016-7/goFetch2.md","ckeefer/2016-7/goFetch2",{"user":3518,"name":3519},{"_path":20336,"_dir":20337,"_draft":7,"_partial":7,"_locale":8,"title":20338,"description":20339,"publishDate":20340,"tags":20341,"excerpt":20339,"body":20342,"_type":3511,"_id":21707,"_source":3513,"_file":21708,"_stem":21709,"_extension":3516,"author":21710},"/ckeefer/2016-6/gofetch1","2016-6","Go Fetch! (JavaScript Fetch API)","Long ago, we briefly brushed upon the topic of what has made jQuery such a valuable part of the web developer's toolset for such a long time - namely, a cleaner interface for interacting with the DOM, and the $.ajax abstraction over XMLHttpRequest.","2016-10-03",[12,16600,3527],{"type":18,"children":20343,"toc":21699},[20344,20355,20383,20388,20394,20399,20406,20726,20759,20764,20947,20959,20963,21161,21183,21188,21194,21247,21252,21258,21292,21298,21303,21611,21624,21637,21642,21647,21653,21658,21664,21695],{"type":21,"tag":22,"props":20345,"children":20346},{},[20347,20353],{"type":21,"tag":29,"props":20348,"children":20350},{"href":20349},"/search/jquery/ajax/blobs/user:ckeefer",[20351],{"type":26,"value":20352},"Long ago",{"type":26,"value":20354},", we briefly brushed upon the topic of what has made jQuery such a valuable part of the web developer's toolset for such a long time - namely, a cleaner interface for interacting with the DOM, and the $.ajax abstraction over XMLHttpRequest.",{"type":21,"tag":22,"props":20356,"children":20357},{},[20358,20360,20366,20367,20373,20375,20382],{"type":26,"value":20359},"These days, I would go a step farther and discuss how it has positively influenced browser APIs. jQuery offered a way to find elements using their css selectors, and this eventually gave us ",{"type":21,"tag":63,"props":20361,"children":20363},{"className":20362},[],[20364],{"type":26,"value":20365},"document.querySelector",{"type":26,"value":5997},{"type":21,"tag":63,"props":20368,"children":20370},{"className":20369},[],[20371],{"type":26,"value":20372},"document.querySelectorAll",{"type":26,"value":20374},". More recently, browser developers have taken another page from jQuery's playbook and introduced a new, Promise-based API for making asynchronous requests, and so much more - ",{"type":21,"tag":29,"props":20376,"children":20379},{"href":20377,"rel":20378},"https://developer.mozilla.org/en/docs/Web/API/Fetch_API",[93],[20380],{"type":26,"value":20381},"Fetch",{"type":26,"value":378},{"type":21,"tag":22,"props":20384,"children":20385},{},[20386],{"type":26,"value":20387},"Why go Fetch? Let's take a look.",{"type":21,"tag":51,"props":20389,"children":20391},{"id":20390},"a-comparison",[20392],{"type":26,"value":20393},"A Comparison",{"type":21,"tag":22,"props":20395,"children":20396},{},[20397],{"type":26,"value":20398},"First, let's take a look at what a simple request using three different APIs might look like - first, our old friend XMLHttpRequest, then jQuery's ajax, and then Fetch.",{"type":21,"tag":20400,"props":20401,"children":20403},"h5",{"id":20402},"xmlhttprequest",[20404],{"type":26,"value":20405},"XMLHttpRequest",{"type":21,"tag":200,"props":20407,"children":20409},{"className":16138,"code":20408,"language":16140,"meta":8,"style":8},"var xhr = new XMLHttpRequest();\n\nxhr.addEventListener('load', function(){\n    var json = this.response || JSON.parse(this.responseText);\n    console.log(json);\n});\n\nxhr.addEventListener('error', function(err){\n    console.log(\"Oh dear, something went wrong: \", err);\n});\n\nxhr.responseType = 'json';\nxhr.open('get', '//jsonplaceholder.typicode.com/users', true);\nxhr.send();\n",[20410],{"type":21,"tag":63,"props":20411,"children":20412},{"__ignoreMap":8},[20413,20442,20449,20482,20539,20555,20562,20569,20609,20634,20641,20648,20669,20711],{"type":21,"tag":209,"props":20414,"children":20415},{"class":211,"line":212},[20416,20420,20425,20429,20433,20438],{"type":21,"tag":209,"props":20417,"children":20418},{"style":216},[20419],{"type":26,"value":3909},{"type":21,"tag":209,"props":20421,"children":20422},{"style":222},[20423],{"type":26,"value":20424}," xhr ",{"type":21,"tag":209,"props":20426,"children":20427},{"style":216},[20428],{"type":26,"value":1432},{"type":21,"tag":209,"props":20430,"children":20431},{"style":216},[20432],{"type":26,"value":6371},{"type":21,"tag":209,"props":20434,"children":20435},{"style":360},[20436],{"type":26,"value":20437}," XMLHttpRequest",{"type":21,"tag":209,"props":20439,"children":20440},{"style":222},[20441],{"type":26,"value":4123},{"type":21,"tag":209,"props":20443,"children":20444},{"class":211,"line":244},[20445],{"type":21,"tag":209,"props":20446,"children":20447},{"emptyLinePlaceholder":248},[20448],{"type":26,"value":251},{"type":21,"tag":209,"props":20450,"children":20451},{"class":211,"line":254},[20452,20457,20461,20465,20470,20474,20478],{"type":21,"tag":209,"props":20453,"children":20454},{"style":222},[20455],{"type":26,"value":20456},"xhr.",{"type":21,"tag":209,"props":20458,"children":20459},{"style":360},[20460],{"type":26,"value":14995},{"type":21,"tag":209,"props":20462,"children":20463},{"style":222},[20464],{"type":26,"value":368},{"type":21,"tag":209,"props":20466,"children":20467},{"style":233},[20468],{"type":26,"value":20469},"'load'",{"type":21,"tag":209,"props":20471,"children":20472},{"style":222},[20473],{"type":26,"value":408},{"type":21,"tag":209,"props":20475,"children":20476},{"style":216},[20477],{"type":26,"value":4622},{"type":21,"tag":209,"props":20479,"children":20480},{"style":222},[20481],{"type":26,"value":2561},{"type":21,"tag":209,"props":20483,"children":20484},{"class":211,"line":279},[20485,20489,20494,20498,20503,20508,20512,20517,20521,20526,20530,20534],{"type":21,"tag":209,"props":20486,"children":20487},{"style":216},[20488],{"type":26,"value":16994},{"type":21,"tag":209,"props":20490,"children":20491},{"style":222},[20492],{"type":26,"value":20493}," json ",{"type":21,"tag":209,"props":20495,"children":20496},{"style":216},[20497],{"type":26,"value":1432},{"type":21,"tag":209,"props":20499,"children":20500},{"style":263},[20501],{"type":26,"value":20502}," this",{"type":21,"tag":209,"props":20504,"children":20505},{"style":222},[20506],{"type":26,"value":20507},".response ",{"type":21,"tag":209,"props":20509,"children":20510},{"style":216},[20511],{"type":26,"value":13270},{"type":21,"tag":209,"props":20513,"children":20514},{"style":263},[20515],{"type":26,"value":20516}," JSON",{"type":21,"tag":209,"props":20518,"children":20519},{"style":222},[20520],{"type":26,"value":378},{"type":21,"tag":209,"props":20522,"children":20523},{"style":360},[20524],{"type":26,"value":20525},"parse",{"type":21,"tag":209,"props":20527,"children":20528},{"style":222},[20529],{"type":26,"value":368},{"type":21,"tag":209,"props":20531,"children":20532},{"style":263},[20533],{"type":26,"value":2508},{"type":21,"tag":209,"props":20535,"children":20536},{"style":222},[20537],{"type":26,"value":20538},".responseText);\n",{"type":21,"tag":209,"props":20540,"children":20541},{"class":211,"line":288},[20542,20546,20550],{"type":21,"tag":209,"props":20543,"children":20544},{"style":222},[20545],{"type":26,"value":1054},{"type":21,"tag":209,"props":20547,"children":20548},{"style":360},[20549],{"type":26,"value":1059},{"type":21,"tag":209,"props":20551,"children":20552},{"style":222},[20553],{"type":26,"value":20554},"(json);\n",{"type":21,"tag":209,"props":20556,"children":20557},{"class":211,"line":307},[20558],{"type":21,"tag":209,"props":20559,"children":20560},{"style":222},[20561],{"type":26,"value":469},{"type":21,"tag":209,"props":20563,"children":20564},{"class":211,"line":325},[20565],{"type":21,"tag":209,"props":20566,"children":20567},{"emptyLinePlaceholder":248},[20568],{"type":26,"value":251},{"type":21,"tag":209,"props":20570,"children":20571},{"class":211,"line":334},[20572,20576,20580,20584,20589,20593,20597,20601,20605],{"type":21,"tag":209,"props":20573,"children":20574},{"style":222},[20575],{"type":26,"value":20456},{"type":21,"tag":209,"props":20577,"children":20578},{"style":360},[20579],{"type":26,"value":14995},{"type":21,"tag":209,"props":20581,"children":20582},{"style":222},[20583],{"type":26,"value":368},{"type":21,"tag":209,"props":20585,"children":20586},{"style":233},[20587],{"type":26,"value":20588},"'error'",{"type":21,"tag":209,"props":20590,"children":20591},{"style":222},[20592],{"type":26,"value":408},{"type":21,"tag":209,"props":20594,"children":20595},{"style":216},[20596],{"type":26,"value":4622},{"type":21,"tag":209,"props":20598,"children":20599},{"style":222},[20600],{"type":26,"value":368},{"type":21,"tag":209,"props":20602,"children":20603},{"style":400},[20604],{"type":26,"value":14259},{"type":21,"tag":209,"props":20606,"children":20607},{"style":222},[20608],{"type":26,"value":2369},{"type":21,"tag":209,"props":20610,"children":20611},{"class":211,"line":343},[20612,20616,20620,20624,20629],{"type":21,"tag":209,"props":20613,"children":20614},{"style":222},[20615],{"type":26,"value":1054},{"type":21,"tag":209,"props":20617,"children":20618},{"style":360},[20619],{"type":26,"value":1059},{"type":21,"tag":209,"props":20621,"children":20622},{"style":222},[20623],{"type":26,"value":368},{"type":21,"tag":209,"props":20625,"children":20626},{"style":233},[20627],{"type":26,"value":20628},"\"Oh dear, something went wrong: \"",{"type":21,"tag":209,"props":20630,"children":20631},{"style":222},[20632],{"type":26,"value":20633},", err);\n",{"type":21,"tag":209,"props":20635,"children":20636},{"class":211,"line":351},[20637],{"type":21,"tag":209,"props":20638,"children":20639},{"style":222},[20640],{"type":26,"value":469},{"type":21,"tag":209,"props":20642,"children":20643},{"class":211,"line":444},[20644],{"type":21,"tag":209,"props":20645,"children":20646},{"emptyLinePlaceholder":248},[20647],{"type":26,"value":251},{"type":21,"tag":209,"props":20649,"children":20650},{"class":211,"line":454},[20651,20656,20660,20665],{"type":21,"tag":209,"props":20652,"children":20653},{"style":222},[20654],{"type":26,"value":20655},"xhr.responseType ",{"type":21,"tag":209,"props":20657,"children":20658},{"style":216},[20659],{"type":26,"value":1432},{"type":21,"tag":209,"props":20661,"children":20662},{"style":233},[20663],{"type":26,"value":20664}," 'json'",{"type":21,"tag":209,"props":20666,"children":20667},{"style":222},[20668],{"type":26,"value":241},{"type":21,"tag":209,"props":20670,"children":20671},{"class":211,"line":463},[20672,20676,20681,20685,20690,20694,20699,20703,20707],{"type":21,"tag":209,"props":20673,"children":20674},{"style":222},[20675],{"type":26,"value":20456},{"type":21,"tag":209,"props":20677,"children":20678},{"style":360},[20679],{"type":26,"value":20680},"open",{"type":21,"tag":209,"props":20682,"children":20683},{"style":222},[20684],{"type":26,"value":368},{"type":21,"tag":209,"props":20686,"children":20687},{"style":233},[20688],{"type":26,"value":20689},"'get'",{"type":21,"tag":209,"props":20691,"children":20692},{"style":222},[20693],{"type":26,"value":408},{"type":21,"tag":209,"props":20695,"children":20696},{"style":233},[20697],{"type":26,"value":20698},"'//jsonplaceholder.typicode.com/users'",{"type":21,"tag":209,"props":20700,"children":20701},{"style":222},[20702],{"type":26,"value":408},{"type":21,"tag":209,"props":20704,"children":20705},{"style":263},[20706],{"type":26,"value":2223},{"type":21,"tag":209,"props":20708,"children":20709},{"style":222},[20710],{"type":26,"value":2608},{"type":21,"tag":209,"props":20712,"children":20713},{"class":211,"line":472},[20714,20718,20722],{"type":21,"tag":209,"props":20715,"children":20716},{"style":222},[20717],{"type":26,"value":20456},{"type":21,"tag":209,"props":20719,"children":20720},{"style":360},[20721],{"type":26,"value":6696},{"type":21,"tag":209,"props":20723,"children":20724},{"style":222},[20725],{"type":26,"value":4123},{"type":21,"tag":22,"props":20727,"children":20728},{},[20729,20731,20736,20738,20743,20744,20750,20752,20757],{"type":26,"value":20730},"Not terrible, of course, but a little more verbose than we might like, and we don't get the nice, logical progression of ",{"type":21,"tag":1084,"props":20732,"children":20733},{},[20734],{"type":26,"value":20735},"this-then-that",{"type":26,"value":20737}," in our code, since we have to assign our ",{"type":21,"tag":63,"props":20739,"children":20741},{"className":20740},[],[20742],{"type":26,"value":13777},{"type":26,"value":5997},{"type":21,"tag":63,"props":20745,"children":20747},{"className":20746},[],[20748],{"type":26,"value":20749},"error",{"type":26,"value":20751}," event handlers before we make the ",{"type":21,"tag":63,"props":20753,"children":20755},{"className":20754},[],[20756],{"type":26,"value":6696},{"type":26,"value":20758}," call.",{"type":21,"tag":20400,"props":20760,"children":20761},{"id":16600},[20762],{"type":26,"value":20763},"jQuery",{"type":21,"tag":200,"props":20765,"children":20767},{"className":16138,"code":20766,"language":16140,"meta":8,"style":8},"$.ajax({\n    type:'GET',\n    url:'//jsonplaceholder.typicode.com/users',\n    dataType:'json'\n}).done(function(data){ \n    console.log(data); \n}).fail(function(jqXHR){\n    console.log(\"Oh dear, something went wrong: \", jqXHR.status, jqXHR.responseText);\n});\n",[20768],{"type":21,"tag":63,"props":20769,"children":20770},{"__ignoreMap":8},[20771,20788,20804,20820,20833,20867,20883,20916,20940],{"type":21,"tag":209,"props":20772,"children":20773},{"class":211,"line":212},[20774,20779,20784],{"type":21,"tag":209,"props":20775,"children":20776},{"style":222},[20777],{"type":26,"value":20778},"$.",{"type":21,"tag":209,"props":20780,"children":20781},{"style":360},[20782],{"type":26,"value":20783},"ajax",{"type":21,"tag":209,"props":20785,"children":20786},{"style":222},[20787],{"type":26,"value":7767},{"type":21,"tag":209,"props":20789,"children":20790},{"class":211,"line":244},[20791,20796,20800],{"type":21,"tag":209,"props":20792,"children":20793},{"style":222},[20794],{"type":26,"value":20795},"    type:",{"type":21,"tag":209,"props":20797,"children":20798},{"style":233},[20799],{"type":26,"value":7780},{"type":21,"tag":209,"props":20801,"children":20802},{"style":222},[20803],{"type":26,"value":304},{"type":21,"tag":209,"props":20805,"children":20806},{"class":211,"line":254},[20807,20812,20816],{"type":21,"tag":209,"props":20808,"children":20809},{"style":222},[20810],{"type":26,"value":20811},"    url:",{"type":21,"tag":209,"props":20813,"children":20814},{"style":233},[20815],{"type":26,"value":20698},{"type":21,"tag":209,"props":20817,"children":20818},{"style":222},[20819],{"type":26,"value":304},{"type":21,"tag":209,"props":20821,"children":20822},{"class":211,"line":279},[20823,20828],{"type":21,"tag":209,"props":20824,"children":20825},{"style":222},[20826],{"type":26,"value":20827},"    dataType:",{"type":21,"tag":209,"props":20829,"children":20830},{"style":233},[20831],{"type":26,"value":20832},"'json'\n",{"type":21,"tag":209,"props":20834,"children":20835},{"class":211,"line":288},[20836,20841,20846,20850,20854,20858,20862],{"type":21,"tag":209,"props":20837,"children":20838},{"style":222},[20839],{"type":26,"value":20840},"}).",{"type":21,"tag":209,"props":20842,"children":20843},{"style":360},[20844],{"type":26,"value":20845},"done",{"type":21,"tag":209,"props":20847,"children":20848},{"style":222},[20849],{"type":26,"value":368},{"type":21,"tag":209,"props":20851,"children":20852},{"style":216},[20853],{"type":26,"value":4622},{"type":21,"tag":209,"props":20855,"children":20856},{"style":222},[20857],{"type":26,"value":368},{"type":21,"tag":209,"props":20859,"children":20860},{"style":400},[20861],{"type":26,"value":2863},{"type":21,"tag":209,"props":20863,"children":20864},{"style":222},[20865],{"type":26,"value":20866},"){ \n",{"type":21,"tag":209,"props":20868,"children":20869},{"class":211,"line":307},[20870,20874,20878],{"type":21,"tag":209,"props":20871,"children":20872},{"style":222},[20873],{"type":26,"value":1054},{"type":21,"tag":209,"props":20875,"children":20876},{"style":360},[20877],{"type":26,"value":1059},{"type":21,"tag":209,"props":20879,"children":20880},{"style":222},[20881],{"type":26,"value":20882},"(data); \n",{"type":21,"tag":209,"props":20884,"children":20885},{"class":211,"line":325},[20886,20890,20895,20899,20903,20907,20912],{"type":21,"tag":209,"props":20887,"children":20888},{"style":222},[20889],{"type":26,"value":20840},{"type":21,"tag":209,"props":20891,"children":20892},{"style":360},[20893],{"type":26,"value":20894},"fail",{"type":21,"tag":209,"props":20896,"children":20897},{"style":222},[20898],{"type":26,"value":368},{"type":21,"tag":209,"props":20900,"children":20901},{"style":216},[20902],{"type":26,"value":4622},{"type":21,"tag":209,"props":20904,"children":20905},{"style":222},[20906],{"type":26,"value":368},{"type":21,"tag":209,"props":20908,"children":20909},{"style":400},[20910],{"type":26,"value":20911},"jqXHR",{"type":21,"tag":209,"props":20913,"children":20914},{"style":222},[20915],{"type":26,"value":2369},{"type":21,"tag":209,"props":20917,"children":20918},{"class":211,"line":334},[20919,20923,20927,20931,20935],{"type":21,"tag":209,"props":20920,"children":20921},{"style":222},[20922],{"type":26,"value":1054},{"type":21,"tag":209,"props":20924,"children":20925},{"style":360},[20926],{"type":26,"value":1059},{"type":21,"tag":209,"props":20928,"children":20929},{"style":222},[20930],{"type":26,"value":368},{"type":21,"tag":209,"props":20932,"children":20933},{"style":233},[20934],{"type":26,"value":20628},{"type":21,"tag":209,"props":20936,"children":20937},{"style":222},[20938],{"type":26,"value":20939},", jqXHR.status, jqXHR.responseText);\n",{"type":21,"tag":209,"props":20941,"children":20942},{"class":211,"line":343},[20943],{"type":21,"tag":209,"props":20944,"children":20945},{"style":222},[20946],{"type":26,"value":469},{"type":21,"tag":22,"props":20948,"children":20949},{},[20950,20952,20957],{"type":26,"value":20951},"Ah, much nicer - we can specify all the parameters to the ajax call within a single settings object, and with Deferred support baked in since v1.4, we can dangle a ",{"type":21,"tag":63,"props":20953,"children":20955},{"className":20954},[],[20956],{"type":26,"value":20845},{"type":26,"value":20958}," block after our call, keeping the logic more compact and readable.",{"type":21,"tag":20400,"props":20960,"children":20961},{"id":17821},[20962],{"type":26,"value":20381},{"type":21,"tag":200,"props":20964,"children":20966},{"className":16138,"code":20965,"language":16140,"meta":8,"style":8},"fetch('//jsonplaceholder.typicode.com/users', {\n    method:'GET'\n}).then((response) => {\n    return response.json();\n}).then((json) => {\n    console.log(json);\n}).catch((err) => {\n    console.log(\"Oh dear, something went wrong: \", err);\n});;\n",[20967],{"type":21,"tag":63,"props":20968,"children":20969},{"__ignoreMap":8},[20970,20990,21003,21034,21053,21084,21099,21130,21153],{"type":21,"tag":209,"props":20971,"children":20972},{"class":211,"line":212},[20973,20977,20981,20985],{"type":21,"tag":209,"props":20974,"children":20975},{"style":360},[20976],{"type":26,"value":17821},{"type":21,"tag":209,"props":20978,"children":20979},{"style":222},[20980],{"type":26,"value":368},{"type":21,"tag":209,"props":20982,"children":20983},{"style":233},[20984],{"type":26,"value":20698},{"type":21,"tag":209,"props":20986,"children":20987},{"style":222},[20988],{"type":26,"value":20989},", {\n",{"type":21,"tag":209,"props":20991,"children":20992},{"class":211,"line":244},[20993,20998],{"type":21,"tag":209,"props":20994,"children":20995},{"style":222},[20996],{"type":26,"value":20997},"    method:",{"type":21,"tag":209,"props":20999,"children":21000},{"style":233},[21001],{"type":26,"value":21002},"'GET'\n",{"type":21,"tag":209,"props":21004,"children":21005},{"class":211,"line":254},[21006,21010,21014,21018,21022,21026,21030],{"type":21,"tag":209,"props":21007,"children":21008},{"style":222},[21009],{"type":26,"value":20840},{"type":21,"tag":209,"props":21011,"children":21012},{"style":360},[21013],{"type":26,"value":2704},{"type":21,"tag":209,"props":21015,"children":21016},{"style":222},[21017],{"type":26,"value":2709},{"type":21,"tag":209,"props":21019,"children":21020},{"style":400},[21021],{"type":26,"value":16982},{"type":21,"tag":209,"props":21023,"children":21024},{"style":222},[21025],{"type":26,"value":432},{"type":21,"tag":209,"props":21027,"children":21028},{"style":216},[21029],{"type":26,"value":437},{"type":21,"tag":209,"props":21031,"children":21032},{"style":222},[21033],{"type":26,"value":276},{"type":21,"tag":209,"props":21035,"children":21036},{"class":211,"line":279},[21037,21041,21045,21049],{"type":21,"tag":209,"props":21038,"children":21039},{"style":216},[21040],{"type":26,"value":1298},{"type":21,"tag":209,"props":21042,"children":21043},{"style":222},[21044],{"type":26,"value":10956},{"type":21,"tag":209,"props":21046,"children":21047},{"style":360},[21048],{"type":26,"value":4268},{"type":21,"tag":209,"props":21050,"children":21051},{"style":222},[21052],{"type":26,"value":4123},{"type":21,"tag":209,"props":21054,"children":21055},{"class":211,"line":288},[21056,21060,21064,21068,21072,21076,21080],{"type":21,"tag":209,"props":21057,"children":21058},{"style":222},[21059],{"type":26,"value":20840},{"type":21,"tag":209,"props":21061,"children":21062},{"style":360},[21063],{"type":26,"value":2704},{"type":21,"tag":209,"props":21065,"children":21066},{"style":222},[21067],{"type":26,"value":2709},{"type":21,"tag":209,"props":21069,"children":21070},{"style":400},[21071],{"type":26,"value":4268},{"type":21,"tag":209,"props":21073,"children":21074},{"style":222},[21075],{"type":26,"value":432},{"type":21,"tag":209,"props":21077,"children":21078},{"style":216},[21079],{"type":26,"value":437},{"type":21,"tag":209,"props":21081,"children":21082},{"style":222},[21083],{"type":26,"value":276},{"type":21,"tag":209,"props":21085,"children":21086},{"class":211,"line":307},[21087,21091,21095],{"type":21,"tag":209,"props":21088,"children":21089},{"style":222},[21090],{"type":26,"value":1054},{"type":21,"tag":209,"props":21092,"children":21093},{"style":360},[21094],{"type":26,"value":1059},{"type":21,"tag":209,"props":21096,"children":21097},{"style":222},[21098],{"type":26,"value":20554},{"type":21,"tag":209,"props":21100,"children":21101},{"class":211,"line":325},[21102,21106,21110,21114,21118,21122,21126],{"type":21,"tag":209,"props":21103,"children":21104},{"style":222},[21105],{"type":26,"value":20840},{"type":21,"tag":209,"props":21107,"children":21108},{"style":360},[21109],{"type":26,"value":5347},{"type":21,"tag":209,"props":21111,"children":21112},{"style":222},[21113],{"type":26,"value":2709},{"type":21,"tag":209,"props":21115,"children":21116},{"style":400},[21117],{"type":26,"value":14259},{"type":21,"tag":209,"props":21119,"children":21120},{"style":222},[21121],{"type":26,"value":432},{"type":21,"tag":209,"props":21123,"children":21124},{"style":216},[21125],{"type":26,"value":437},{"type":21,"tag":209,"props":21127,"children":21128},{"style":222},[21129],{"type":26,"value":276},{"type":21,"tag":209,"props":21131,"children":21132},{"class":211,"line":334},[21133,21137,21141,21145,21149],{"type":21,"tag":209,"props":21134,"children":21135},{"style":222},[21136],{"type":26,"value":1054},{"type":21,"tag":209,"props":21138,"children":21139},{"style":360},[21140],{"type":26,"value":1059},{"type":21,"tag":209,"props":21142,"children":21143},{"style":222},[21144],{"type":26,"value":368},{"type":21,"tag":209,"props":21146,"children":21147},{"style":233},[21148],{"type":26,"value":20628},{"type":21,"tag":209,"props":21150,"children":21151},{"style":222},[21152],{"type":26,"value":20633},{"type":21,"tag":209,"props":21154,"children":21155},{"class":211,"line":343},[21156],{"type":21,"tag":209,"props":21157,"children":21158},{"style":222},[21159],{"type":26,"value":21160},"});;\n",{"type":21,"tag":22,"props":21162,"children":21163},{},[21164,21166,21173,21174,21181],{"type":26,"value":21165},"You can see the similarities to the $.ajax example, but the fetch API manages to be both a tad more compact - in part thanks to ",{"type":21,"tag":29,"props":21167,"children":21170},{"href":21168,"rel":21169},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",[93],[21171],{"type":26,"value":21172},"Promises",{"type":26,"value":5997},{"type":21,"tag":29,"props":21175,"children":21178},{"href":21176,"rel":21177},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions",[93],[21179],{"type":26,"value":21180},"Arrow Functions",{"type":26,"value":21182}," - and more powerful in a variety of ways.",{"type":21,"tag":22,"props":21184,"children":21185},{},[21186],{"type":26,"value":21187},"For instance, let's talk a little about the Response readers, and the Response and Request objects.",{"type":21,"tag":51,"props":21189,"children":21191},{"id":21190},"response-readers",[21192],{"type":26,"value":21193},"Response Readers",{"type":21,"tag":22,"props":21195,"children":21196},{},[21197,21199,21204,21206,21212,21214,21219,21220,21225,21226,21232,21233,21239,21240,21245],{"type":26,"value":21198},"You'll notice in the example above that our initial ",{"type":21,"tag":63,"props":21200,"children":21202},{"className":21201},[],[21203],{"type":26,"value":2704},{"type":26,"value":21205}," block returns a call to .json() on the response. What's happening here is that the response is presented to us as a stream. We could read this stream manually if we wanted to, via ",{"type":21,"tag":63,"props":21207,"children":21209},{"className":21208},[],[21210],{"type":26,"value":21211},"response.body.getReader()",{"type":26,"value":21213},", but for most purposes, we can rely on one of the built in readers: ",{"type":21,"tag":63,"props":21215,"children":21217},{"className":21216},[],[21218],{"type":26,"value":26},{"type":26,"value":408},{"type":21,"tag":63,"props":21221,"children":21223},{"className":21222},[],[21224],{"type":26,"value":4268},{"type":26,"value":408},{"type":21,"tag":63,"props":21227,"children":21229},{"className":21228},[],[21230],{"type":26,"value":21231},"formData",{"type":26,"value":408},{"type":21,"tag":63,"props":21234,"children":21236},{"className":21235},[],[21237],{"type":26,"value":21238},"blob",{"type":26,"value":5997},{"type":21,"tag":63,"props":21241,"children":21243},{"className":21242},[],[21244],{"type":26,"value":13427},{"type":26,"value":21246},". These readers drain the stream and return the value decoded as one might expect in the form of the specified reader - i.e. using the blob reader on the stream will return its value decoded as a blob object.",{"type":21,"tag":22,"props":21248,"children":21249},{},[21250],{"type":26,"value":21251},"This is neat, because it offers us the opportunity to consider how we want to decode any given return - no hacks on top of responseText here. One gotcha to be mindful of, though, is that the readers do 'drain the stream', as I noted above, so if you were to return the response to a future then block, and attempt to read again, that read would fail. We'll talk more about this point next time.",{"type":21,"tag":51,"props":21253,"children":21255},{"id":21254},"response-request",[21256],{"type":26,"value":21257},"Response & Request",{"type":21,"tag":22,"props":21259,"children":21260},{},[21261,21263,21268,21269,21275,21277,21283,21284,21290],{"type":26,"value":21262},"Another nicety of the Fetch api is that we finally gain access to the ",{"type":21,"tag":63,"props":21264,"children":21266},{"className":21265},[],[21267],{"type":26,"value":17719},{"type":26,"value":5997},{"type":21,"tag":63,"props":21270,"children":21272},{"className":21271},[],[21273],{"type":26,"value":21274},"Request",{"type":26,"value":21276}," primitives that underlie these requests, allowing us to form our own ",{"type":21,"tag":29,"props":21278,"children":21281},{"href":21279,"rel":21280},"https://developer.mozilla.org/en-US/docs/Web/API/Response",[93],[21282],{"type":26,"value":17719},{"type":26,"value":5997},{"type":21,"tag":29,"props":21285,"children":21288},{"href":21286,"rel":21287},"https://developer.mozilla.org/en-US/docs/Web/API/Request",[93],[21289],{"type":26,"value":21274},{"type":26,"value":21291}," objects. This isn't likely to come up very often (especially outside of the context of a web worker), but we'll also be taking a look at how we can use the Response object to produce our own streamable response from cached values next time.",{"type":21,"tag":51,"props":21293,"children":21295},{"id":21294},"gotchas",[21296],{"type":26,"value":21297},"Gotchas",{"type":21,"tag":22,"props":21299,"children":21300},{},[21301],{"type":26,"value":21302},"One of the differences between XMLHttpRequest (and thus $.ajax), and fetch is that network returns that indicate failure, like a 400 or 500 response, won't be considered errors by your fetch promise - if you want them to be errors that are handled in the catch block, you'll want to check for them and throw them yourself:",{"type":21,"tag":200,"props":21304,"children":21306},{"className":16138,"code":21305,"language":16140,"meta":8,"style":8},"fetch('//jsonplaceholder.typicode.com/users', {\n    method:'GET',\n    credentials:'omit',\n    headers:{\n        'Content-Type': 'application/json'\n    },\n    mode:'cors',\n    cache:'no-cache',\n    referrer:'no-referrer'\n}).then((response) => {\n    let status = response.status;\n\n    if (status \u003C 200 || status > 299) throw new Error(status);\n\n}).catch((error) => {\n    // Catch our network error here\n});\n",[21307],{"type":21,"tag":63,"props":21308,"children":21309},{"__ignoreMap":8},[21310,21329,21344,21361,21369,21385,21392,21408,21425,21438,21469,21490,21497,21558,21565,21596,21604],{"type":21,"tag":209,"props":21311,"children":21312},{"class":211,"line":212},[21313,21317,21321,21325],{"type":21,"tag":209,"props":21314,"children":21315},{"style":360},[21316],{"type":26,"value":17821},{"type":21,"tag":209,"props":21318,"children":21319},{"style":222},[21320],{"type":26,"value":368},{"type":21,"tag":209,"props":21322,"children":21323},{"style":233},[21324],{"type":26,"value":20698},{"type":21,"tag":209,"props":21326,"children":21327},{"style":222},[21328],{"type":26,"value":20989},{"type":21,"tag":209,"props":21330,"children":21331},{"class":211,"line":244},[21332,21336,21340],{"type":21,"tag":209,"props":21333,"children":21334},{"style":222},[21335],{"type":26,"value":20997},{"type":21,"tag":209,"props":21337,"children":21338},{"style":233},[21339],{"type":26,"value":7780},{"type":21,"tag":209,"props":21341,"children":21342},{"style":222},[21343],{"type":26,"value":304},{"type":21,"tag":209,"props":21345,"children":21346},{"class":211,"line":254},[21347,21352,21357],{"type":21,"tag":209,"props":21348,"children":21349},{"style":222},[21350],{"type":26,"value":21351},"    credentials:",{"type":21,"tag":209,"props":21353,"children":21354},{"style":233},[21355],{"type":26,"value":21356},"'omit'",{"type":21,"tag":209,"props":21358,"children":21359},{"style":222},[21360],{"type":26,"value":304},{"type":21,"tag":209,"props":21362,"children":21363},{"class":211,"line":279},[21364],{"type":21,"tag":209,"props":21365,"children":21366},{"style":222},[21367],{"type":26,"value":21368},"    headers:{\n",{"type":21,"tag":209,"props":21370,"children":21371},{"class":211,"line":288},[21372,21376,21380],{"type":21,"tag":209,"props":21373,"children":21374},{"style":233},[21375],{"type":26,"value":10745},{"type":21,"tag":209,"props":21377,"children":21378},{"style":222},[21379],{"type":26,"value":7821},{"type":21,"tag":209,"props":21381,"children":21382},{"style":233},[21383],{"type":26,"value":21384},"'application/json'\n",{"type":21,"tag":209,"props":21386,"children":21387},{"class":211,"line":307},[21388],{"type":21,"tag":209,"props":21389,"children":21390},{"style":222},[21391],{"type":26,"value":2251},{"type":21,"tag":209,"props":21393,"children":21394},{"class":211,"line":325},[21395,21400,21404],{"type":21,"tag":209,"props":21396,"children":21397},{"style":222},[21398],{"type":26,"value":21399},"    mode:",{"type":21,"tag":209,"props":21401,"children":21402},{"style":233},[21403],{"type":26,"value":3998},{"type":21,"tag":209,"props":21405,"children":21406},{"style":222},[21407],{"type":26,"value":304},{"type":21,"tag":209,"props":21409,"children":21410},{"class":211,"line":334},[21411,21416,21421],{"type":21,"tag":209,"props":21412,"children":21413},{"style":222},[21414],{"type":26,"value":21415},"    cache:",{"type":21,"tag":209,"props":21417,"children":21418},{"style":233},[21419],{"type":26,"value":21420},"'no-cache'",{"type":21,"tag":209,"props":21422,"children":21423},{"style":222},[21424],{"type":26,"value":304},{"type":21,"tag":209,"props":21426,"children":21427},{"class":211,"line":343},[21428,21433],{"type":21,"tag":209,"props":21429,"children":21430},{"style":222},[21431],{"type":26,"value":21432},"    referrer:",{"type":21,"tag":209,"props":21434,"children":21435},{"style":233},[21436],{"type":26,"value":21437},"'no-referrer'\n",{"type":21,"tag":209,"props":21439,"children":21440},{"class":211,"line":351},[21441,21445,21449,21453,21457,21461,21465],{"type":21,"tag":209,"props":21442,"children":21443},{"style":222},[21444],{"type":26,"value":20840},{"type":21,"tag":209,"props":21446,"children":21447},{"style":360},[21448],{"type":26,"value":2704},{"type":21,"tag":209,"props":21450,"children":21451},{"style":222},[21452],{"type":26,"value":2709},{"type":21,"tag":209,"props":21454,"children":21455},{"style":400},[21456],{"type":26,"value":16982},{"type":21,"tag":209,"props":21458,"children":21459},{"style":222},[21460],{"type":26,"value":432},{"type":21,"tag":209,"props":21462,"children":21463},{"style":216},[21464],{"type":26,"value":437},{"type":21,"tag":209,"props":21466,"children":21467},{"style":222},[21468],{"type":26,"value":276},{"type":21,"tag":209,"props":21470,"children":21471},{"class":211,"line":444},[21472,21476,21481,21485],{"type":21,"tag":209,"props":21473,"children":21474},{"style":216},[21475],{"type":26,"value":14024},{"type":21,"tag":209,"props":21477,"children":21478},{"style":222},[21479],{"type":26,"value":21480}," status ",{"type":21,"tag":209,"props":21482,"children":21483},{"style":216},[21484],{"type":26,"value":1432},{"type":21,"tag":209,"props":21486,"children":21487},{"style":222},[21488],{"type":26,"value":21489}," response.status;\n",{"type":21,"tag":209,"props":21491,"children":21492},{"class":211,"line":454},[21493],{"type":21,"tag":209,"props":21494,"children":21495},{"emptyLinePlaceholder":248},[21496],{"type":26,"value":251},{"type":21,"tag":209,"props":21498,"children":21499},{"class":211,"line":463},[21500,21504,21509,21513,21518,21522,21526,21530,21535,21539,21544,21548,21553],{"type":21,"tag":209,"props":21501,"children":21502},{"style":216},[21503],{"type":26,"value":9249},{"type":21,"tag":209,"props":21505,"children":21506},{"style":222},[21507],{"type":26,"value":21508}," (status ",{"type":21,"tag":209,"props":21510,"children":21511},{"style":216},[21512],{"type":26,"value":1985},{"type":21,"tag":209,"props":21514,"children":21515},{"style":263},[21516],{"type":26,"value":21517}," 200",{"type":21,"tag":209,"props":21519,"children":21520},{"style":216},[21521],{"type":26,"value":4608},{"type":21,"tag":209,"props":21523,"children":21524},{"style":222},[21525],{"type":26,"value":21480},{"type":21,"tag":209,"props":21527,"children":21528},{"style":216},[21529],{"type":26,"value":2014},{"type":21,"tag":209,"props":21531,"children":21532},{"style":263},[21533],{"type":26,"value":21534}," 299",{"type":21,"tag":209,"props":21536,"children":21537},{"style":222},[21538],{"type":26,"value":432},{"type":21,"tag":209,"props":21540,"children":21541},{"style":216},[21542],{"type":26,"value":21543},"throw",{"type":21,"tag":209,"props":21545,"children":21546},{"style":216},[21547],{"type":26,"value":6371},{"type":21,"tag":209,"props":21549,"children":21550},{"style":360},[21551],{"type":26,"value":21552}," Error",{"type":21,"tag":209,"props":21554,"children":21555},{"style":222},[21556],{"type":26,"value":21557},"(status);\n",{"type":21,"tag":209,"props":21559,"children":21560},{"class":211,"line":472},[21561],{"type":21,"tag":209,"props":21562,"children":21563},{"emptyLinePlaceholder":248},[21564],{"type":26,"value":251},{"type":21,"tag":209,"props":21566,"children":21567},{"class":211,"line":480},[21568,21572,21576,21580,21584,21588,21592],{"type":21,"tag":209,"props":21569,"children":21570},{"style":222},[21571],{"type":26,"value":20840},{"type":21,"tag":209,"props":21573,"children":21574},{"style":360},[21575],{"type":26,"value":5347},{"type":21,"tag":209,"props":21577,"children":21578},{"style":222},[21579],{"type":26,"value":2709},{"type":21,"tag":209,"props":21581,"children":21582},{"style":400},[21583],{"type":26,"value":20749},{"type":21,"tag":209,"props":21585,"children":21586},{"style":222},[21587],{"type":26,"value":432},{"type":21,"tag":209,"props":21589,"children":21590},{"style":216},[21591],{"type":26,"value":437},{"type":21,"tag":209,"props":21593,"children":21594},{"style":222},[21595],{"type":26,"value":276},{"type":21,"tag":209,"props":21597,"children":21598},{"class":211,"line":489},[21599],{"type":21,"tag":209,"props":21600,"children":21601},{"style":448},[21602],{"type":26,"value":21603},"    // Catch our network error here\n",{"type":21,"tag":209,"props":21605,"children":21606},{"class":211,"line":847},[21607],{"type":21,"tag":209,"props":21608,"children":21609},{"style":222},[21610],{"type":26,"value":469},{"type":21,"tag":22,"props":21612,"children":21613},{},[21614,21616,21622],{"type":26,"value":21615},"You'll notice I also included a more comprehensive settings object this time. For the details on all the possible settings, I suggest checking out the links in the further reading section, below. For now, the one we really need to talk about is the ",{"type":21,"tag":63,"props":21617,"children":21619},{"className":21618},[],[21620],{"type":26,"value":21621},"credentials",{"type":26,"value":21623}," property.",{"type":21,"tag":22,"props":21625,"children":21626},{},[21627,21629,21635],{"type":26,"value":21628},"By default, XMLHttpRequest will send credentials to requests on the same-origin. Not so for fetch - 'omit' is the default value for credentials, so if you need to send cookies up to your server to authenticate a request, for instance, you'll need to be sure to specify ",{"type":21,"tag":63,"props":21630,"children":21632},{"className":21631},[],[21633],{"type":26,"value":21634},"credentials:'include'",{"type":26,"value":21636}," instead.",{"type":21,"tag":22,"props":21638,"children":21639},{},[21640],{"type":26,"value":21641},"Finally, at the moment there's no way to cancel a fetch request (this is in the works, and will probably coincide with being able to cancel a Promise), there's no progress events as there are in the XHR2 spec (although you can build your own, should you be so inclined), and there's no option for synchronous requests (which is good, and sync requests are deprecated and going to disappear in XHR at some future point as well).",{"type":21,"tag":22,"props":21643,"children":21644},{},[21645],{"type":26,"value":21646},"These potential gotchas are the usual cost of being on the sharp edge of emerging tech, and many will likely be smoothed over by browser developers or libraries that wrap the fetch functionality.",{"type":21,"tag":51,"props":21648,"children":21650},{"id":21649},"next-time",[21651],{"type":26,"value":21652},"Next Time",{"type":21,"tag":22,"props":21654,"children":21655},{},[21656],{"type":26,"value":21657},"Speaking of libraries that wrap the Fetch functionality, as I've been hinting, next time we'll take a deeper look into actually using the Fetch API, and present and dissect a library that will allow us to cache responses we've retrieved with fetch for bandwidth savings and offline usage. Stay tuned.",{"type":21,"tag":51,"props":21659,"children":21661},{"id":21660},"further-reading",[21662],{"type":26,"value":21663},"Further Reading",{"type":21,"tag":3679,"props":21665,"children":21666},{},[21667,21675,21685],{"type":21,"tag":3630,"props":21668,"children":21669},{},[21670],{"type":21,"tag":29,"props":21671,"children":21673},{"href":20377,"rel":21672},[93],[21674],{"type":26,"value":13786},{"type":21,"tag":3630,"props":21676,"children":21677},{},[21678],{"type":21,"tag":29,"props":21679,"children":21682},{"href":21680,"rel":21681},"https://developers.google.com/web/updates/2015/03/introduction-to-fetch?hl=en",[93],[21683],{"type":26,"value":21684},"Introduction to fetch",{"type":21,"tag":3630,"props":21686,"children":21687},{},[21688],{"type":21,"tag":29,"props":21689,"children":21692},{"href":21690,"rel":21691},"https://jakearchibald.com/2015/thats-so-fetch/",[93],[21693],{"type":26,"value":21694},"That's so fetch",{"type":21,"tag":3490,"props":21696,"children":21697},{},[21698],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":21700},[21701,21702,21703,21704,21705,21706],{"id":20390,"depth":254,"text":20393},{"id":21190,"depth":254,"text":21193},{"id":21254,"depth":254,"text":21257},{"id":21294,"depth":254,"text":21297},{"id":21649,"depth":254,"text":21652},{"id":21660,"depth":254,"text":21663},"content:ckeefer:2016-6:goFetch1.md","ckeefer/2016-6/goFetch1.md","ckeefer/2016-6/goFetch1",{"user":3518,"name":3519},{"_path":21712,"_dir":21713,"_draft":7,"_partial":7,"_locale":8,"title":21714,"description":21715,"publishDate":21716,"tags":21717,"excerpt":21715,"body":21720,"_type":3511,"_id":25027,"_source":3513,"_file":25028,"_stem":25029,"_extension":3516,"author":25030},"/ckeefer/2016-2/paymentprocessing","2016-2","Payment Processing with Braintree","You've built the web application of the century, and the users have rightly flooded to it. Cat pictures for everyone!","2016-05-11",[21718,12,16600,21719],"django","python",{"type":18,"children":21721,"toc":25020},[21722,21726,21731,21743,21755,21769,21809,21814,21820,21838,21843,21849,21888,21893,22040,22054,22296,22316,22321,22550,22556,22588,22610,22933,22938,22951,23124,23129,23134,23142,23148,23170,23913,23919,23932,24962,24968,24973,24985,24997,25002,25016],{"type":21,"tag":22,"props":21723,"children":21724},{},[21725],{"type":26,"value":21715},{"type":21,"tag":22,"props":21727,"children":21728},{},[21729],{"type":26,"value":21730},"But alas, while your users indulge in cat-induced bliss, the cold hard reality of server costs cannot help but harsh your mellow. What is to be done?",{"type":21,"tag":22,"props":21732,"children":21733},{},[21734,21736,21741],{"type":26,"value":21735},"Maybe, you could get the users to... ",{"type":21,"tag":1084,"props":21737,"children":21738},{},[21739],{"type":26,"value":21740},"pay",{"type":26,"value":21742}," for access to your incredible web application in all its multivarious splendour?",{"type":21,"tag":22,"props":21744,"children":21745},{},[21746,21753],{"type":21,"tag":29,"props":21747,"children":21750},{"href":21748,"rel":21749},"https://www.braintreepayments.com/",[93],[21751],{"type":26,"value":21752},"Braintree",{"type":26,"value":21754}," is a payment processor (now a subsidiary of PayPal), which boasts of a \"simple, robust way to accept payments\", and with features like a drop-in payment ui and libraries for various programming languages enabling fairly easy integration, is a solid choice for accepting payments via credit card or PayPal.",{"type":21,"tag":22,"props":21756,"children":21757},{},[21758,21760,21767],{"type":26,"value":21759},"While Braintree's ",{"type":21,"tag":29,"props":21761,"children":21764},{"href":21762,"rel":21763},"https://developers.braintreepayments.com/",[93],[21765],{"type":26,"value":21766},"developer documentation",{"type":26,"value":21768}," is blessedly detailed, it's possessed of a potentially confusing bevy of options, and its various implementation examples are spread out amongst a number of pages and platforms. So today, rather than reiterate any particular section of the docs, we're going to take a look at an end-to-end example of a specific, straightforward scenario - accepting and processing a one-time, immediately settled payment in a web application.",{"type":21,"tag":22,"props":21770,"children":21771},{},[21772,21774,21781,21783,21790,21792,21799,21800,21807],{"type":26,"value":21773},"Our languages of choice for today will be ",{"type":21,"tag":29,"props":21775,"children":21778},{"href":21776,"rel":21777},"https://developers.braintreepayments.com/start/hello-server/python",[93],[21779],{"type":26,"value":21780},"Python",{"type":26,"value":21782}," for the backend and, of course, ",{"type":21,"tag":29,"props":21784,"children":21787},{"href":21785,"rel":21786},"https://developers.braintreepayments.com/start/hello-client/javascript",[93],[21788],{"type":26,"value":21789},"JavaScript",{"type":26,"value":21791}," for the frontend, with the additional assumption of jQuery for the ease of $.ajax. The general logic for the backend will be portable to the other languages for which Braintree has released an SDK, e.g. ",{"type":21,"tag":29,"props":21793,"children":21796},{"href":21794,"rel":21795},"https://developers.braintreepayments.com/start/hello-server/ruby",[93],[21797],{"type":26,"value":21798},"Ruby",{"type":26,"value":408},{"type":21,"tag":29,"props":21801,"children":21804},{"href":21802,"rel":21803},"https://developers.braintreepayments.com/start/hello-server/php",[93],[21805],{"type":26,"value":21806},"PHP",{"type":26,"value":21808},", etc., and the frontend logic could certainly be implemented without jQuery.",{"type":21,"tag":22,"props":21810,"children":21811},{},[21812],{"type":26,"value":21813},"We're also going to assume the existence of a database for storing and retrieving item and transaction details. We're also going to assume the use of Django as our web framework in the following examples, but the general concepts are portable to other frameworks.",{"type":21,"tag":20400,"props":21815,"children":21817},{"id":21816},"not-production-ready",[21818],{"type":26,"value":21819},"Not Production Ready",{"type":21,"tag":22,"props":21821,"children":21822},{},[21823,21825,21829,21831,21836],{"type":26,"value":21824},"One more important note before we get started - the code below should ",{"type":21,"tag":11881,"props":21826,"children":21827},{},[21828],{"type":26,"value":11871},{"type":26,"value":21830}," be considered production ready. It is example-quality, meant for instructional purposes only! While it should go without saying that copy-pasting code is always a bad idea, copy-pasting example code for business critical purposes like payment processing is a big enough no-no to warrant an extra paragraph warning everyone against it. ",{"type":21,"tag":1084,"props":21832,"children":21833},{},[21834],{"type":26,"value":21835},"This is that paragraph.",{"type":26,"value":21837}," Copy-pasting == bad. Using this tutorial to learn == good.",{"type":21,"tag":22,"props":21839,"children":21840},{},[21841],{"type":26,"value":21842},"With that established, let's get started.",{"type":21,"tag":3596,"props":21844,"children":21846},{"id":21845},"server-setup-and-token-generation",[21847],{"type":26,"value":21848},"Server Setup and Token Generation",{"type":21,"tag":22,"props":21850,"children":21851},{},[21852,21854,21861,21863,21870,21871,21877,21879,21886],{"type":26,"value":21853},"After ",{"type":21,"tag":29,"props":21855,"children":21858},{"href":21856,"rel":21857},"https://www.braintreepayments.com/get-started",[93],[21859],{"type":26,"value":21860},"signing up for a sandbox account",{"type":26,"value":21862}," and doing some basic setup in the ",{"type":21,"tag":29,"props":21864,"children":21867},{"href":21865,"rel":21866},"https://articles.braintreepayments.com/control-panel/basics/overview",[93],[21868],{"type":26,"value":21869},"braintree control panel",{"type":26,"value":408},{"type":21,"tag":29,"props":21872,"children":21874},{"href":21776,"rel":21873},[93],[21875],{"type":26,"value":21876},"our first step",{"type":26,"value":21878}," is to install the ",{"type":21,"tag":29,"props":21880,"children":21883},{"href":21881,"rel":21882},"https://pypi.python.org/pypi/braintree/3.25.0",[93],[21884],{"type":26,"value":21885},"Braintree Python Library",{"type":26,"value":21887},", manually or via pip.",{"type":21,"tag":22,"props":21889,"children":21890},{},[21891],{"type":26,"value":21892},"That done, we'll want to store our configuration details somewhere. In Django we might perform our configuration in settings.py:",{"type":21,"tag":200,"props":21894,"children":21897},{"className":21895,"code":21896,"language":21719,"meta":8,"style":8},"language-python shiki shiki-themes github-light github-dark","import os\nimport braintree\n\nbraintree.Configuration.configure(\n    os.environ.get('BT_ENVIRONMENT', braintree.Environment.Sandbox),\n    os.environ.get('BT_MERCHANT_ID', 'your_sandbox_merchant_id'),\n    os.environ.get('BT_PUBLIC_KEY', 'your_sandbox_public_key'),\n    os.environ.get('BT_PRIVATE_KEY', 'your_sandbox_private_key')\n)\n",[21898],{"type":21,"tag":63,"props":21899,"children":21900},{"__ignoreMap":8},[21901,21913,21925,21932,21940,21958,21983,22008,22033],{"type":21,"tag":209,"props":21902,"children":21903},{"class":211,"line":212},[21904,21908],{"type":21,"tag":209,"props":21905,"children":21906},{"style":216},[21907],{"type":26,"value":219},{"type":21,"tag":209,"props":21909,"children":21910},{"style":222},[21911],{"type":26,"value":21912}," os\n",{"type":21,"tag":209,"props":21914,"children":21915},{"class":211,"line":244},[21916,21920],{"type":21,"tag":209,"props":21917,"children":21918},{"style":216},[21919],{"type":26,"value":219},{"type":21,"tag":209,"props":21921,"children":21922},{"style":222},[21923],{"type":26,"value":21924}," braintree\n",{"type":21,"tag":209,"props":21926,"children":21927},{"class":211,"line":254},[21928],{"type":21,"tag":209,"props":21929,"children":21930},{"emptyLinePlaceholder":248},[21931],{"type":26,"value":251},{"type":21,"tag":209,"props":21933,"children":21934},{"class":211,"line":279},[21935],{"type":21,"tag":209,"props":21936,"children":21937},{"style":222},[21938],{"type":26,"value":21939},"braintree.Configuration.configure(\n",{"type":21,"tag":209,"props":21941,"children":21942},{"class":211,"line":288},[21943,21948,21953],{"type":21,"tag":209,"props":21944,"children":21945},{"style":222},[21946],{"type":26,"value":21947},"    os.environ.get(",{"type":21,"tag":209,"props":21949,"children":21950},{"style":233},[21951],{"type":26,"value":21952},"'BT_ENVIRONMENT'",{"type":21,"tag":209,"props":21954,"children":21955},{"style":222},[21956],{"type":26,"value":21957},", braintree.Environment.Sandbox),\n",{"type":21,"tag":209,"props":21959,"children":21960},{"class":211,"line":307},[21961,21965,21970,21974,21979],{"type":21,"tag":209,"props":21962,"children":21963},{"style":222},[21964],{"type":26,"value":21947},{"type":21,"tag":209,"props":21966,"children":21967},{"style":233},[21968],{"type":26,"value":21969},"'BT_MERCHANT_ID'",{"type":21,"tag":209,"props":21971,"children":21972},{"style":222},[21973],{"type":26,"value":408},{"type":21,"tag":209,"props":21975,"children":21976},{"style":233},[21977],{"type":26,"value":21978},"'your_sandbox_merchant_id'",{"type":21,"tag":209,"props":21980,"children":21981},{"style":222},[21982],{"type":26,"value":5404},{"type":21,"tag":209,"props":21984,"children":21985},{"class":211,"line":325},[21986,21990,21995,21999,22004],{"type":21,"tag":209,"props":21987,"children":21988},{"style":222},[21989],{"type":26,"value":21947},{"type":21,"tag":209,"props":21991,"children":21992},{"style":233},[21993],{"type":26,"value":21994},"'BT_PUBLIC_KEY'",{"type":21,"tag":209,"props":21996,"children":21997},{"style":222},[21998],{"type":26,"value":408},{"type":21,"tag":209,"props":22000,"children":22001},{"style":233},[22002],{"type":26,"value":22003},"'your_sandbox_public_key'",{"type":21,"tag":209,"props":22005,"children":22006},{"style":222},[22007],{"type":26,"value":5404},{"type":21,"tag":209,"props":22009,"children":22010},{"class":211,"line":334},[22011,22015,22020,22024,22029],{"type":21,"tag":209,"props":22012,"children":22013},{"style":222},[22014],{"type":26,"value":21947},{"type":21,"tag":209,"props":22016,"children":22017},{"style":233},[22018],{"type":26,"value":22019},"'BT_PRIVATE_KEY'",{"type":21,"tag":209,"props":22021,"children":22022},{"style":222},[22023],{"type":26,"value":408},{"type":21,"tag":209,"props":22025,"children":22026},{"style":233},[22027],{"type":26,"value":22028},"'your_sandbox_private_key'",{"type":21,"tag":209,"props":22030,"children":22031},{"style":222},[22032],{"type":26,"value":8924},{"type":21,"tag":209,"props":22034,"children":22035},{"class":211,"line":343},[22036],{"type":21,"tag":209,"props":22037,"children":22038},{"style":222},[22039],{"type":26,"value":8924},{"type":21,"tag":22,"props":22041,"children":22042},{},[22043,22045,22052],{"type":26,"value":22044},"Next, we need to setup an endpoint for the client to request a ",{"type":21,"tag":29,"props":22046,"children":22049},{"href":22047,"rel":22048},"https://developers.braintreepayments.com/start/hello-server/python#generate-a-client-token",[93],[22050],{"type":26,"value":22051},"client token",{"type":26,"value":22053}," from:",{"type":21,"tag":200,"props":22055,"children":22057},{"className":21895,"code":22056,"language":21719,"meta":8,"style":8},"import braintree\nfrom django.http import JsonResponse\nfrom django.views.decorators.http import require_http_methods\n\n@require_http_methods(['GET'])\ndef get_braintree_client_token(request):\n    \"\"\"\n    Generate and return client token.\n    \"\"\"\n    try:\n        client_token = braintree.ClientToken.generate()\n    except ValueError as e:\n        return JsonResponse({\"error\": e.message}, status=500)\n    return JsonResponse({\"token\": client_token})\n",[22058],{"type":21,"tag":63,"props":22059,"children":22060},{"__ignoreMap":8},[22061,22072,22093,22114,22121,22143,22161,22169,22177,22184,22195,22212,22235,22275],{"type":21,"tag":209,"props":22062,"children":22063},{"class":211,"line":212},[22064,22068],{"type":21,"tag":209,"props":22065,"children":22066},{"style":216},[22067],{"type":26,"value":219},{"type":21,"tag":209,"props":22069,"children":22070},{"style":222},[22071],{"type":26,"value":21924},{"type":21,"tag":209,"props":22073,"children":22074},{"class":211,"line":244},[22075,22079,22084,22088],{"type":21,"tag":209,"props":22076,"children":22077},{"style":216},[22078],{"type":26,"value":230},{"type":21,"tag":209,"props":22080,"children":22081},{"style":222},[22082],{"type":26,"value":22083}," django.http ",{"type":21,"tag":209,"props":22085,"children":22086},{"style":216},[22087],{"type":26,"value":219},{"type":21,"tag":209,"props":22089,"children":22090},{"style":222},[22091],{"type":26,"value":22092}," JsonResponse\n",{"type":21,"tag":209,"props":22094,"children":22095},{"class":211,"line":254},[22096,22100,22105,22109],{"type":21,"tag":209,"props":22097,"children":22098},{"style":216},[22099],{"type":26,"value":230},{"type":21,"tag":209,"props":22101,"children":22102},{"style":222},[22103],{"type":26,"value":22104}," django.views.decorators.http ",{"type":21,"tag":209,"props":22106,"children":22107},{"style":216},[22108],{"type":26,"value":219},{"type":21,"tag":209,"props":22110,"children":22111},{"style":222},[22112],{"type":26,"value":22113}," require_http_methods\n",{"type":21,"tag":209,"props":22115,"children":22116},{"class":211,"line":279},[22117],{"type":21,"tag":209,"props":22118,"children":22119},{"emptyLinePlaceholder":248},[22120],{"type":26,"value":251},{"type":21,"tag":209,"props":22122,"children":22123},{"class":211,"line":288},[22124,22129,22134,22138],{"type":21,"tag":209,"props":22125,"children":22126},{"style":360},[22127],{"type":26,"value":22128},"@require_http_methods",{"type":21,"tag":209,"props":22130,"children":22131},{"style":222},[22132],{"type":26,"value":22133},"([",{"type":21,"tag":209,"props":22135,"children":22136},{"style":233},[22137],{"type":26,"value":7780},{"type":21,"tag":209,"props":22139,"children":22140},{"style":222},[22141],{"type":26,"value":22142},"])\n",{"type":21,"tag":209,"props":22144,"children":22145},{"class":211,"line":307},[22146,22151,22156],{"type":21,"tag":209,"props":22147,"children":22148},{"style":216},[22149],{"type":26,"value":22150},"def",{"type":21,"tag":209,"props":22152,"children":22153},{"style":360},[22154],{"type":26,"value":22155}," get_braintree_client_token",{"type":21,"tag":209,"props":22157,"children":22158},{"style":222},[22159],{"type":26,"value":22160},"(request):\n",{"type":21,"tag":209,"props":22162,"children":22163},{"class":211,"line":325},[22164],{"type":21,"tag":209,"props":22165,"children":22166},{"style":233},[22167],{"type":26,"value":22168},"    \"\"\"\n",{"type":21,"tag":209,"props":22170,"children":22171},{"class":211,"line":334},[22172],{"type":21,"tag":209,"props":22173,"children":22174},{"style":233},[22175],{"type":26,"value":22176},"    Generate and return client token.\n",{"type":21,"tag":209,"props":22178,"children":22179},{"class":211,"line":343},[22180],{"type":21,"tag":209,"props":22181,"children":22182},{"style":233},[22183],{"type":26,"value":22168},{"type":21,"tag":209,"props":22185,"children":22186},{"class":211,"line":351},[22187,22191],{"type":21,"tag":209,"props":22188,"children":22189},{"style":216},[22190],{"type":26,"value":6640},{"type":21,"tag":209,"props":22192,"children":22193},{"style":222},[22194],{"type":26,"value":844},{"type":21,"tag":209,"props":22196,"children":22197},{"class":211,"line":444},[22198,22203,22207],{"type":21,"tag":209,"props":22199,"children":22200},{"style":222},[22201],{"type":26,"value":22202},"        client_token ",{"type":21,"tag":209,"props":22204,"children":22205},{"style":216},[22206],{"type":26,"value":1432},{"type":21,"tag":209,"props":22208,"children":22209},{"style":222},[22210],{"type":26,"value":22211}," braintree.ClientToken.generate()\n",{"type":21,"tag":209,"props":22213,"children":22214},{"class":211,"line":454},[22215,22220,22225,22230],{"type":21,"tag":209,"props":22216,"children":22217},{"style":216},[22218],{"type":26,"value":22219},"    except",{"type":21,"tag":209,"props":22221,"children":22222},{"style":263},[22223],{"type":26,"value":22224}," ValueError",{"type":21,"tag":209,"props":22226,"children":22227},{"style":216},[22228],{"type":26,"value":22229}," as",{"type":21,"tag":209,"props":22231,"children":22232},{"style":222},[22233],{"type":26,"value":22234}," e:\n",{"type":21,"tag":209,"props":22236,"children":22237},{"class":211,"line":463},[22238,22242,22247,22252,22257,22262,22266,22271],{"type":21,"tag":209,"props":22239,"children":22240},{"style":216},[22241],{"type":26,"value":3069},{"type":21,"tag":209,"props":22243,"children":22244},{"style":222},[22245],{"type":26,"value":22246}," JsonResponse({",{"type":21,"tag":209,"props":22248,"children":22249},{"style":233},[22250],{"type":26,"value":22251},"\"error\"",{"type":21,"tag":209,"props":22253,"children":22254},{"style":222},[22255],{"type":26,"value":22256},": e.message}, ",{"type":21,"tag":209,"props":22258,"children":22259},{"style":400},[22260],{"type":26,"value":22261},"status",{"type":21,"tag":209,"props":22263,"children":22264},{"style":216},[22265],{"type":26,"value":1432},{"type":21,"tag":209,"props":22267,"children":22268},{"style":263},[22269],{"type":26,"value":22270},"500",{"type":21,"tag":209,"props":22272,"children":22273},{"style":222},[22274],{"type":26,"value":8924},{"type":21,"tag":209,"props":22276,"children":22277},{"class":211,"line":472},[22278,22282,22286,22291],{"type":21,"tag":209,"props":22279,"children":22280},{"style":216},[22281],{"type":26,"value":1298},{"type":21,"tag":209,"props":22283,"children":22284},{"style":222},[22285],{"type":26,"value":22246},{"type":21,"tag":209,"props":22287,"children":22288},{"style":233},[22289],{"type":26,"value":22290},"\"token\"",{"type":21,"tag":209,"props":22292,"children":22293},{"style":222},[22294],{"type":26,"value":22295},": client_token})\n",{"type":21,"tag":22,"props":22297,"children":22298},{},[22299,22301,22307,22309,22315],{"type":26,"value":22300},"For Django, we can add this to a reasonable route in our ",{"type":21,"tag":63,"props":22302,"children":22304},{"className":22303},[],[22305],{"type":26,"value":22306},"urls.py",{"type":26,"value":22308}," file, and then make ajax requests against this route to generate and return the client token that the javascript braintree library requires. For the purpose of this tutorial, we'll assume we've bound it to ",{"type":21,"tag":63,"props":22310,"children":22312},{"className":22311},[],[22313],{"type":26,"value":22314},"/payment/token/",{"type":26,"value":378},{"type":21,"tag":22,"props":22317,"children":22318},{},[22319],{"type":26,"value":22320},"As an aside, we could also generate this token as part of the view and pass it into the context if we knew we were going to need it immediately, or if there were some other reason why an ajax roundtrip is undesirable. This could be as simple as:",{"type":21,"tag":200,"props":22322,"children":22324},{"className":21895,"code":22323,"language":21719,"meta":8,"style":8},"import braintree\nfrom django.shortcuts import render\nfrom django.http import HttpResponse\n\ndef start_payment_view(request, template_name=\"start_payment.html\"):\n    \"\"\"\n    Generate client token and pass it in the view context.\n    \"\"\"\n    try:\n        client_token = braintree.ClientToken.generate()\n    except ValueError as e:\n        return HttpResponse(\"Failed to generate Braintree client token\", status=500)\n\n    return render(request, template_name, {\"bt_client_token\": client_token})\n",[22325],{"type":21,"tag":63,"props":22326,"children":22327},{"__ignoreMap":8},[22328,22339,22360,22380,22387,22418,22425,22433,22440,22451,22466,22485,22522,22529],{"type":21,"tag":209,"props":22329,"children":22330},{"class":211,"line":212},[22331,22335],{"type":21,"tag":209,"props":22332,"children":22333},{"style":216},[22334],{"type":26,"value":219},{"type":21,"tag":209,"props":22336,"children":22337},{"style":222},[22338],{"type":26,"value":21924},{"type":21,"tag":209,"props":22340,"children":22341},{"class":211,"line":244},[22342,22346,22351,22355],{"type":21,"tag":209,"props":22343,"children":22344},{"style":216},[22345],{"type":26,"value":230},{"type":21,"tag":209,"props":22347,"children":22348},{"style":222},[22349],{"type":26,"value":22350}," django.shortcuts ",{"type":21,"tag":209,"props":22352,"children":22353},{"style":216},[22354],{"type":26,"value":219},{"type":21,"tag":209,"props":22356,"children":22357},{"style":222},[22358],{"type":26,"value":22359}," render\n",{"type":21,"tag":209,"props":22361,"children":22362},{"class":211,"line":254},[22363,22367,22371,22375],{"type":21,"tag":209,"props":22364,"children":22365},{"style":216},[22366],{"type":26,"value":230},{"type":21,"tag":209,"props":22368,"children":22369},{"style":222},[22370],{"type":26,"value":22083},{"type":21,"tag":209,"props":22372,"children":22373},{"style":216},[22374],{"type":26,"value":219},{"type":21,"tag":209,"props":22376,"children":22377},{"style":222},[22378],{"type":26,"value":22379}," HttpResponse\n",{"type":21,"tag":209,"props":22381,"children":22382},{"class":211,"line":279},[22383],{"type":21,"tag":209,"props":22384,"children":22385},{"emptyLinePlaceholder":248},[22386],{"type":26,"value":251},{"type":21,"tag":209,"props":22388,"children":22389},{"class":211,"line":288},[22390,22394,22399,22404,22408,22413],{"type":21,"tag":209,"props":22391,"children":22392},{"style":216},[22393],{"type":26,"value":22150},{"type":21,"tag":209,"props":22395,"children":22396},{"style":360},[22397],{"type":26,"value":22398}," start_payment_view",{"type":21,"tag":209,"props":22400,"children":22401},{"style":222},[22402],{"type":26,"value":22403},"(request, template_name",{"type":21,"tag":209,"props":22405,"children":22406},{"style":216},[22407],{"type":26,"value":1432},{"type":21,"tag":209,"props":22409,"children":22410},{"style":233},[22411],{"type":26,"value":22412},"\"start_payment.html\"",{"type":21,"tag":209,"props":22414,"children":22415},{"style":222},[22416],{"type":26,"value":22417},"):\n",{"type":21,"tag":209,"props":22419,"children":22420},{"class":211,"line":307},[22421],{"type":21,"tag":209,"props":22422,"children":22423},{"style":233},[22424],{"type":26,"value":22168},{"type":21,"tag":209,"props":22426,"children":22427},{"class":211,"line":325},[22428],{"type":21,"tag":209,"props":22429,"children":22430},{"style":233},[22431],{"type":26,"value":22432},"    Generate client token and pass it in the view context.\n",{"type":21,"tag":209,"props":22434,"children":22435},{"class":211,"line":334},[22436],{"type":21,"tag":209,"props":22437,"children":22438},{"style":233},[22439],{"type":26,"value":22168},{"type":21,"tag":209,"props":22441,"children":22442},{"class":211,"line":343},[22443,22447],{"type":21,"tag":209,"props":22444,"children":22445},{"style":216},[22446],{"type":26,"value":6640},{"type":21,"tag":209,"props":22448,"children":22449},{"style":222},[22450],{"type":26,"value":844},{"type":21,"tag":209,"props":22452,"children":22453},{"class":211,"line":351},[22454,22458,22462],{"type":21,"tag":209,"props":22455,"children":22456},{"style":222},[22457],{"type":26,"value":22202},{"type":21,"tag":209,"props":22459,"children":22460},{"style":216},[22461],{"type":26,"value":1432},{"type":21,"tag":209,"props":22463,"children":22464},{"style":222},[22465],{"type":26,"value":22211},{"type":21,"tag":209,"props":22467,"children":22468},{"class":211,"line":444},[22469,22473,22477,22481],{"type":21,"tag":209,"props":22470,"children":22471},{"style":216},[22472],{"type":26,"value":22219},{"type":21,"tag":209,"props":22474,"children":22475},{"style":263},[22476],{"type":26,"value":22224},{"type":21,"tag":209,"props":22478,"children":22479},{"style":216},[22480],{"type":26,"value":22229},{"type":21,"tag":209,"props":22482,"children":22483},{"style":222},[22484],{"type":26,"value":22234},{"type":21,"tag":209,"props":22486,"children":22487},{"class":211,"line":454},[22488,22492,22497,22502,22506,22510,22514,22518],{"type":21,"tag":209,"props":22489,"children":22490},{"style":216},[22491],{"type":26,"value":3069},{"type":21,"tag":209,"props":22493,"children":22494},{"style":222},[22495],{"type":26,"value":22496}," HttpResponse(",{"type":21,"tag":209,"props":22498,"children":22499},{"style":233},[22500],{"type":26,"value":22501},"\"Failed to generate Braintree client token\"",{"type":21,"tag":209,"props":22503,"children":22504},{"style":222},[22505],{"type":26,"value":408},{"type":21,"tag":209,"props":22507,"children":22508},{"style":400},[22509],{"type":26,"value":22261},{"type":21,"tag":209,"props":22511,"children":22512},{"style":216},[22513],{"type":26,"value":1432},{"type":21,"tag":209,"props":22515,"children":22516},{"style":263},[22517],{"type":26,"value":22270},{"type":21,"tag":209,"props":22519,"children":22520},{"style":222},[22521],{"type":26,"value":8924},{"type":21,"tag":209,"props":22523,"children":22524},{"class":211,"line":463},[22525],{"type":21,"tag":209,"props":22526,"children":22527},{"emptyLinePlaceholder":248},[22528],{"type":26,"value":251},{"type":21,"tag":209,"props":22530,"children":22531},{"class":211,"line":472},[22532,22536,22541,22546],{"type":21,"tag":209,"props":22533,"children":22534},{"style":216},[22535],{"type":26,"value":1298},{"type":21,"tag":209,"props":22537,"children":22538},{"style":222},[22539],{"type":26,"value":22540}," render(request, template_name, {",{"type":21,"tag":209,"props":22542,"children":22543},{"style":233},[22544],{"type":26,"value":22545},"\"bt_client_token\"",{"type":21,"tag":209,"props":22547,"children":22548},{"style":222},[22549],{"type":26,"value":22295},{"type":21,"tag":3596,"props":22551,"children":22553},{"id":22552},"client-setup",[22554],{"type":26,"value":22555},"Client Setup",{"type":21,"tag":22,"props":22557,"children":22558},{},[22559,22561,22568,22570,22577,22579,22586],{"type":26,"value":22560},"Now for ",{"type":21,"tag":29,"props":22562,"children":22565},{"href":22563,"rel":22564},"https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration",[93],[22566],{"type":26,"value":22567},"client side configuration",{"type":26,"value":22569},". On the client side, we're going to assume we want to use the ",{"type":21,"tag":29,"props":22571,"children":22574},{"href":22572,"rel":22573},"https://developers.braintreepayments.com/guides/drop-in/javascript/v2",[93],[22575],{"type":26,"value":22576},"'Drop-in'",{"type":26,"value":22578}," integration. This generates an iframe hosted by Braintree, allowing our application to qualify for the lowest-effort level of ",{"type":21,"tag":29,"props":22580,"children":22583},{"href":22581,"rel":22582},"https://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard",[93],[22584],{"type":26,"value":22585},"PCI Compliance",{"type":26,"value":22587},", while still allowing for a fair amount of customizability, some of which we'll explore shortly.",{"type":21,"tag":22,"props":22589,"children":22590},{},[22591,22593,22600,22602,22608],{"type":26,"value":22592},"Braintree offers a ",{"type":21,"tag":29,"props":22594,"children":22597},{"href":22595,"rel":22596},"https://developers.braintreepayments.com/guides/client-sdk/setup/javascript/v2#install-it-with-npm",[93],[22598],{"type":26,"value":22599},"variety of options",{"type":26,"value":22601}," for integrating the library with your application. For the below, we assume we have a ",{"type":21,"tag":63,"props":22603,"children":22605},{"className":22604},[],[22606],{"type":26,"value":22607},"braintree",{"type":26,"value":22609}," object in global scope:",{"type":21,"tag":200,"props":22611,"children":22613},{"className":16138,"code":22612,"language":16140,"meta":8,"style":8},"        /**\n         * Request client token and initialize braintree payment library.\n         */\n    setupBraintree:function(){\n        $.ajax({\n            type:'GET',\n            dataType:'json',\n            url:'/payment/token/'\n        }).done(function(res){\n            braintree.setup(res.token, \"dropin\", {\n                container:$('#braintreeContainer')[0],\n                onReady:paymentMethodReady,\n                onPaymentMethodReceived:paymentMethodReceived,\n                onError:paymentMethodError\n            });\n        }.bind(this)).fail(function(jqXHR){\n            console.log(jqXHR, jqXHR.responseJSON || jqXHR.responseText);\n        });\n    }\n",[22614],{"type":21,"tag":63,"props":22615,"children":22616},{"__ignoreMap":8},[22617,22624,22632,22639,22659,22675,22691,22708,22721,22753,22779,22814,22822,22830,22838,22845,22894,22919,22926],{"type":21,"tag":209,"props":22618,"children":22619},{"class":211,"line":212},[22620],{"type":21,"tag":209,"props":22621,"children":22622},{"style":448},[22623],{"type":26,"value":2412},{"type":21,"tag":209,"props":22625,"children":22626},{"class":211,"line":244},[22627],{"type":21,"tag":209,"props":22628,"children":22629},{"style":448},[22630],{"type":26,"value":22631},"         * Request client token and initialize braintree payment library.\n",{"type":21,"tag":209,"props":22633,"children":22634},{"class":211,"line":254},[22635],{"type":21,"tag":209,"props":22636,"children":22637},{"style":448},[22638],{"type":26,"value":2439},{"type":21,"tag":209,"props":22640,"children":22641},{"class":211,"line":279},[22642,22647,22651,22655],{"type":21,"tag":209,"props":22643,"children":22644},{"style":360},[22645],{"type":26,"value":22646},"    setupBraintree",{"type":21,"tag":209,"props":22648,"children":22649},{"style":222},[22650],{"type":26,"value":191},{"type":21,"tag":209,"props":22652,"children":22653},{"style":216},[22654],{"type":26,"value":4622},{"type":21,"tag":209,"props":22656,"children":22657},{"style":222},[22658],{"type":26,"value":2561},{"type":21,"tag":209,"props":22660,"children":22661},{"class":211,"line":288},[22662,22667,22671],{"type":21,"tag":209,"props":22663,"children":22664},{"style":222},[22665],{"type":26,"value":22666},"        $.",{"type":21,"tag":209,"props":22668,"children":22669},{"style":360},[22670],{"type":26,"value":20783},{"type":21,"tag":209,"props":22672,"children":22673},{"style":222},[22674],{"type":26,"value":7767},{"type":21,"tag":209,"props":22676,"children":22677},{"class":211,"line":307},[22678,22683,22687],{"type":21,"tag":209,"props":22679,"children":22680},{"style":222},[22681],{"type":26,"value":22682},"            type:",{"type":21,"tag":209,"props":22684,"children":22685},{"style":233},[22686],{"type":26,"value":7780},{"type":21,"tag":209,"props":22688,"children":22689},{"style":222},[22690],{"type":26,"value":304},{"type":21,"tag":209,"props":22692,"children":22693},{"class":211,"line":325},[22694,22699,22704],{"type":21,"tag":209,"props":22695,"children":22696},{"style":222},[22697],{"type":26,"value":22698},"            dataType:",{"type":21,"tag":209,"props":22700,"children":22701},{"style":233},[22702],{"type":26,"value":22703},"'json'",{"type":21,"tag":209,"props":22705,"children":22706},{"style":222},[22707],{"type":26,"value":304},{"type":21,"tag":209,"props":22709,"children":22710},{"class":211,"line":334},[22711,22716],{"type":21,"tag":209,"props":22712,"children":22713},{"style":222},[22714],{"type":26,"value":22715},"            url:",{"type":21,"tag":209,"props":22717,"children":22718},{"style":233},[22719],{"type":26,"value":22720},"'/payment/token/'\n",{"type":21,"tag":209,"props":22722,"children":22723},{"class":211,"line":343},[22724,22729,22733,22737,22741,22745,22749],{"type":21,"tag":209,"props":22725,"children":22726},{"style":222},[22727],{"type":26,"value":22728},"        }).",{"type":21,"tag":209,"props":22730,"children":22731},{"style":360},[22732],{"type":26,"value":20845},{"type":21,"tag":209,"props":22734,"children":22735},{"style":222},[22736],{"type":26,"value":368},{"type":21,"tag":209,"props":22738,"children":22739},{"style":216},[22740],{"type":26,"value":4622},{"type":21,"tag":209,"props":22742,"children":22743},{"style":222},[22744],{"type":26,"value":368},{"type":21,"tag":209,"props":22746,"children":22747},{"style":400},[22748],{"type":26,"value":1385},{"type":21,"tag":209,"props":22750,"children":22751},{"style":222},[22752],{"type":26,"value":2369},{"type":21,"tag":209,"props":22754,"children":22755},{"class":211,"line":351},[22756,22761,22765,22770,22775],{"type":21,"tag":209,"props":22757,"children":22758},{"style":222},[22759],{"type":26,"value":22760},"            braintree.",{"type":21,"tag":209,"props":22762,"children":22763},{"style":360},[22764],{"type":26,"value":2887},{"type":21,"tag":209,"props":22766,"children":22767},{"style":222},[22768],{"type":26,"value":22769},"(res.token, ",{"type":21,"tag":209,"props":22771,"children":22772},{"style":233},[22773],{"type":26,"value":22774},"\"dropin\"",{"type":21,"tag":209,"props":22776,"children":22777},{"style":222},[22778],{"type":26,"value":20989},{"type":21,"tag":209,"props":22780,"children":22781},{"class":211,"line":444},[22782,22787,22791,22795,22800,22805,22809],{"type":21,"tag":209,"props":22783,"children":22784},{"style":222},[22785],{"type":26,"value":22786},"                container:",{"type":21,"tag":209,"props":22788,"children":22789},{"style":360},[22790],{"type":26,"value":6476},{"type":21,"tag":209,"props":22792,"children":22793},{"style":222},[22794],{"type":26,"value":368},{"type":21,"tag":209,"props":22796,"children":22797},{"style":233},[22798],{"type":26,"value":22799},"'#braintreeContainer'",{"type":21,"tag":209,"props":22801,"children":22802},{"style":222},[22803],{"type":26,"value":22804},")[",{"type":21,"tag":209,"props":22806,"children":22807},{"style":263},[22808],{"type":26,"value":8554},{"type":21,"tag":209,"props":22810,"children":22811},{"style":222},[22812],{"type":26,"value":22813},"],\n",{"type":21,"tag":209,"props":22815,"children":22816},{"class":211,"line":454},[22817],{"type":21,"tag":209,"props":22818,"children":22819},{"style":222},[22820],{"type":26,"value":22821},"                onReady:paymentMethodReady,\n",{"type":21,"tag":209,"props":22823,"children":22824},{"class":211,"line":463},[22825],{"type":21,"tag":209,"props":22826,"children":22827},{"style":222},[22828],{"type":26,"value":22829},"                onPaymentMethodReceived:paymentMethodReceived,\n",{"type":21,"tag":209,"props":22831,"children":22832},{"class":211,"line":472},[22833],{"type":21,"tag":209,"props":22834,"children":22835},{"style":222},[22836],{"type":26,"value":22837},"                onError:paymentMethodError\n",{"type":21,"tag":209,"props":22839,"children":22840},{"class":211,"line":480},[22841],{"type":21,"tag":209,"props":22842,"children":22843},{"style":222},[22844],{"type":26,"value":2782},{"type":21,"tag":209,"props":22846,"children":22847},{"class":211,"line":489},[22848,22853,22857,22861,22865,22870,22874,22878,22882,22886,22890],{"type":21,"tag":209,"props":22849,"children":22850},{"style":222},[22851],{"type":26,"value":22852},"        }.",{"type":21,"tag":209,"props":22854,"children":22855},{"style":360},[22856],{"type":26,"value":20189},{"type":21,"tag":209,"props":22858,"children":22859},{"style":222},[22860],{"type":26,"value":368},{"type":21,"tag":209,"props":22862,"children":22863},{"style":263},[22864],{"type":26,"value":2508},{"type":21,"tag":209,"props":22866,"children":22867},{"style":222},[22868],{"type":26,"value":22869},")).",{"type":21,"tag":209,"props":22871,"children":22872},{"style":360},[22873],{"type":26,"value":20894},{"type":21,"tag":209,"props":22875,"children":22876},{"style":222},[22877],{"type":26,"value":368},{"type":21,"tag":209,"props":22879,"children":22880},{"style":216},[22881],{"type":26,"value":4622},{"type":21,"tag":209,"props":22883,"children":22884},{"style":222},[22885],{"type":26,"value":368},{"type":21,"tag":209,"props":22887,"children":22888},{"style":400},[22889],{"type":26,"value":20911},{"type":21,"tag":209,"props":22891,"children":22892},{"style":222},[22893],{"type":26,"value":2369},{"type":21,"tag":209,"props":22895,"children":22896},{"class":211,"line":847},[22897,22901,22905,22910,22914],{"type":21,"tag":209,"props":22898,"children":22899},{"style":222},[22900],{"type":26,"value":2495},{"type":21,"tag":209,"props":22902,"children":22903},{"style":360},[22904],{"type":26,"value":1059},{"type":21,"tag":209,"props":22906,"children":22907},{"style":222},[22908],{"type":26,"value":22909},"(jqXHR, jqXHR.responseJSON ",{"type":21,"tag":209,"props":22911,"children":22912},{"style":216},[22913],{"type":26,"value":13270},{"type":21,"tag":209,"props":22915,"children":22916},{"style":222},[22917],{"type":26,"value":22918}," jqXHR.responseText);\n",{"type":21,"tag":209,"props":22920,"children":22921},{"class":211,"line":860},[22922],{"type":21,"tag":209,"props":22923,"children":22924},{"style":222},[22925],{"type":26,"value":13702},{"type":21,"tag":209,"props":22927,"children":22928},{"class":211,"line":877},[22929],{"type":21,"tag":209,"props":22930,"children":22931},{"style":222},[22932],{"type":26,"value":331},{"type":21,"tag":22,"props":22934,"children":22935},{},[22936],{"type":26,"value":22937},"Here, we request the client token and, as soon as we've received it from the server, initialize the braintree library, telling it where to place the 'dropin' iframe, and specifying a number of other options, which we'll return to shortly.",{"type":21,"tag":22,"props":22939,"children":22940},{},[22941,22943,22949],{"type":26,"value":22942},"As we need a node for the braintree iframe to live in, which you'll notice in the above code we've given the id of ",{"type":21,"tag":63,"props":22944,"children":22946},{"className":22945},[],[22947],{"type":26,"value":22948},"braintreeContainer",{"type":26,"value":22950},", a sparse example of the markup might look like:",{"type":21,"tag":200,"props":22952,"children":22956},{"className":22953,"code":22954,"language":22955,"meta":8,"style":8},"language-html shiki shiki-themes github-light github-dark","    \u003Cbody>\n\n        \u003Cform>\n            \u003Cdiv id=\"braintreeContainer\">\u003C/div>\n\n            \u003Cbutton type=\"submit\">Pay Now\u003C/button>\n        \u003C/form>\n\n    \u003C/body>\n","html",[22957],{"type":21,"tag":63,"props":22958,"children":22959},{"__ignoreMap":8},[22960,22976,22983,23000,23039,23046,23085,23101,23108],{"type":21,"tag":209,"props":22961,"children":22962},{"class":211,"line":212},[22963,22967,22972],{"type":21,"tag":209,"props":22964,"children":22965},{"style":222},[22966],{"type":26,"value":2004},{"type":21,"tag":209,"props":22968,"children":22969},{"style":1988},[22970],{"type":26,"value":22971},"body",{"type":21,"tag":209,"props":22973,"children":22974},{"style":222},[22975],{"type":26,"value":1996},{"type":21,"tag":209,"props":22977,"children":22978},{"class":211,"line":244},[22979],{"type":21,"tag":209,"props":22980,"children":22981},{"emptyLinePlaceholder":248},[22982],{"type":26,"value":251},{"type":21,"tag":209,"props":22984,"children":22985},{"class":211,"line":254},[22986,22991,22996],{"type":21,"tag":209,"props":22987,"children":22988},{"style":222},[22989],{"type":26,"value":22990},"        \u003C",{"type":21,"tag":209,"props":22992,"children":22993},{"style":1988},[22994],{"type":26,"value":22995},"form",{"type":21,"tag":209,"props":22997,"children":22998},{"style":222},[22999],{"type":26,"value":1996},{"type":21,"tag":209,"props":23001,"children":23002},{"class":211,"line":279},[23003,23008,23012,23017,23021,23026,23031,23035],{"type":21,"tag":209,"props":23004,"children":23005},{"style":222},[23006],{"type":26,"value":23007},"            \u003C",{"type":21,"tag":209,"props":23009,"children":23010},{"style":1988},[23011],{"type":26,"value":2009},{"type":21,"tag":209,"props":23013,"children":23014},{"style":360},[23015],{"type":26,"value":23016}," id",{"type":21,"tag":209,"props":23018,"children":23019},{"style":222},[23020],{"type":26,"value":1432},{"type":21,"tag":209,"props":23022,"children":23023},{"style":233},[23024],{"type":26,"value":23025},"\"braintreeContainer\"",{"type":21,"tag":209,"props":23027,"children":23028},{"style":222},[23029],{"type":26,"value":23030},">\u003C/",{"type":21,"tag":209,"props":23032,"children":23033},{"style":1988},[23034],{"type":26,"value":2009},{"type":21,"tag":209,"props":23036,"children":23037},{"style":222},[23038],{"type":26,"value":1996},{"type":21,"tag":209,"props":23040,"children":23041},{"class":211,"line":288},[23042],{"type":21,"tag":209,"props":23043,"children":23044},{"emptyLinePlaceholder":248},[23045],{"type":26,"value":251},{"type":21,"tag":209,"props":23047,"children":23048},{"class":211,"line":307},[23049,23053,23058,23063,23067,23072,23077,23081],{"type":21,"tag":209,"props":23050,"children":23051},{"style":222},[23052],{"type":26,"value":23007},{"type":21,"tag":209,"props":23054,"children":23055},{"style":1988},[23056],{"type":26,"value":23057},"button",{"type":21,"tag":209,"props":23059,"children":23060},{"style":360},[23061],{"type":26,"value":23062}," type",{"type":21,"tag":209,"props":23064,"children":23065},{"style":222},[23066],{"type":26,"value":1432},{"type":21,"tag":209,"props":23068,"children":23069},{"style":233},[23070],{"type":26,"value":23071},"\"submit\"",{"type":21,"tag":209,"props":23073,"children":23074},{"style":222},[23075],{"type":26,"value":23076},">Pay Now\u003C/",{"type":21,"tag":209,"props":23078,"children":23079},{"style":1988},[23080],{"type":26,"value":23057},{"type":21,"tag":209,"props":23082,"children":23083},{"style":222},[23084],{"type":26,"value":1996},{"type":21,"tag":209,"props":23086,"children":23087},{"class":211,"line":325},[23088,23093,23097],{"type":21,"tag":209,"props":23089,"children":23090},{"style":222},[23091],{"type":26,"value":23092},"        \u003C/",{"type":21,"tag":209,"props":23094,"children":23095},{"style":1988},[23096],{"type":26,"value":22995},{"type":21,"tag":209,"props":23098,"children":23099},{"style":222},[23100],{"type":26,"value":1996},{"type":21,"tag":209,"props":23102,"children":23103},{"class":211,"line":334},[23104],{"type":21,"tag":209,"props":23105,"children":23106},{"emptyLinePlaceholder":248},[23107],{"type":26,"value":251},{"type":21,"tag":209,"props":23109,"children":23110},{"class":211,"line":343},[23111,23116,23120],{"type":21,"tag":209,"props":23112,"children":23113},{"style":222},[23114],{"type":26,"value":23115},"    \u003C/",{"type":21,"tag":209,"props":23117,"children":23118},{"style":1988},[23119],{"type":26,"value":22971},{"type":21,"tag":209,"props":23121,"children":23122},{"style":222},[23123],{"type":26,"value":1996},{"type":21,"tag":22,"props":23125,"children":23126},{},[23127],{"type":26,"value":23128},"Notice the 'Pay Now' button - we'll need to use it to trigger submission of the containing form (which in turn will trigger submission/processing of the input within the braintree iframe). Notice also that we don't specify any form action - we'll be submitting our payment details by ajax, but we could instead specify an action, and send needed details via hidden fields in the form.",{"type":21,"tag":22,"props":23130,"children":23131},{},[23132],{"type":26,"value":23133},"At this point, if those additional options in the braintree.setup pointed to real functions, we would see something like:",{"type":21,"tag":22,"props":23135,"children":23136},{},[23137],{"type":21,"tag":16015,"props":23138,"children":23141},{"alt":23139,"src":23140},"braintree client example","assets/images/bt_ex_1.jpg",[],{"type":21,"tag":3596,"props":23143,"children":23145},{"id":23144},"client-options",[23146],{"type":26,"value":23147},"Client Options",{"type":21,"tag":22,"props":23149,"children":23150},{},[23151,23153,23160,23162,23168],{"type":26,"value":23152},"Let's take a closer look at those ",{"type":21,"tag":29,"props":23154,"children":23157},{"href":23155,"rel":23156},"https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration#setup-method-options",[93],[23158],{"type":26,"value":23159},"setup options",{"type":26,"value":23161},", then. Besides the obvious ",{"type":21,"tag":63,"props":23163,"children":23165},{"className":23164},[],[23166],{"type":26,"value":23167},"container",{"type":26,"value":23169}," option, we have three more: onReady, onPaymentMethodReceived, and onError, which we supply with callback functions. The Braintree documentation adequately explains each of them (and a number of others we aren't taking a look at today, such as an option to enable CORS requests), so let's instead take at what other things might do in the specified functions.",{"type":21,"tag":200,"props":23171,"children":23173},{"className":16138,"code":23172,"language":16140,"meta":8,"style":8},"    /**\n     * As this function informs us that the braintree setup is complete, if we were hiding the braintree container node\n     * or displaying some other dialog while it loaded, we could now safely reveal it to the user.\n     * @param {object} integration An object containing the teardown, paypal and deviceData objects, as noted\n     * in the braintree docs.\n     */\n    paymentMethodReady:function(integration){\n        // e.g.\n        $('#braintreeContainer').show();\n    }\n    /**\n     * Called by the braintree js SDK once the payment method has been received - that is, once the user has selected\n     * their paypal account or entered their credit card details.\n     * @param {object} recv Contains the following:\n     * nonce: The payment method nonce.\n     * type: A string representing the type of payment method generated; either 'CreditCard' or 'PayPalAccount'.\n     * details: Additional details. See https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration#onpaymentmethodreceived-details-object\n     */\n    paymentMethodReceived:function(recv){\n        // We could be submitting information to our server via the form, and add information we need submitted as hidden\n        // fields on the form, but we can also submit the information we want to the server within this callback via ajax.\n        var details = {otherDetails:{/* object containing any other info we want to send up */, payment:recv};\n\n        $.ajax({\n            url:'/payment/process/',\n            type:'POST',\n            dataType:'json',\n            contentType:'application/json',\n            data:JSON.stringify(details)\n        }).done(function(res){\n            // Do something with the response from your server.\n        }.bind(this)).fail(function(jqXHR){\n            var res = jqXHR.responseJSON || jqXHR.responseText;\n            console.log(res);\n        }\n    }\n\n    /**\n     * On payment method error, this callback will receive a detail object, as noted in the setup options\n     * documentation, which gives us some idea as to what error occurred, allowing us to choose how to \n     * respond to it or inform the client about it.\n     * @param {object} detail\n     */\n    paymentMethodError:function(detail){\n        console.log(detail);\n\n        if (detail.type == \"VALIDATION\"){\n            // Potentially display a notification to your user that validation failed.\n            return;\n        }\n\n        // Potentially display or log that another type of error occurred.\n    }\n",[23174],{"type":21,"tag":63,"props":23175,"children":23176},{"__ignoreMap":8},[23177,23184,23192,23200,23226,23234,23241,23270,23278,23307,23314,23321,23329,23337,23362,23370,23378,23386,23393,23422,23430,23438,23469,23476,23491,23507,23522,23537,23553,23580,23611,23619,23666,23696,23712,23719,23726,23733,23740,23748,23756,23764,23784,23791,23816,23832,23839,23865,23873,23884,23891,23898,23906],{"type":21,"tag":209,"props":23178,"children":23179},{"class":211,"line":212},[23180],{"type":21,"tag":209,"props":23181,"children":23182},{"style":448},[23183],{"type":26,"value":13290},{"type":21,"tag":209,"props":23185,"children":23186},{"class":211,"line":244},[23187],{"type":21,"tag":209,"props":23188,"children":23189},{"style":448},[23190],{"type":26,"value":23191},"     * As this function informs us that the braintree setup is complete, if we were hiding the braintree container node\n",{"type":21,"tag":209,"props":23193,"children":23194},{"class":211,"line":254},[23195],{"type":21,"tag":209,"props":23196,"children":23197},{"style":448},[23198],{"type":26,"value":23199},"     * or displaying some other dialog while it loaded, we could now safely reveal it to the user.\n",{"type":21,"tag":209,"props":23201,"children":23202},{"class":211,"line":279},[23203,23207,23211,23216,23221],{"type":21,"tag":209,"props":23204,"children":23205},{"style":448},[23206],{"type":26,"value":13306},{"type":21,"tag":209,"props":23208,"children":23209},{"style":216},[23210],{"type":26,"value":13311},{"type":21,"tag":209,"props":23212,"children":23213},{"style":360},[23214],{"type":26,"value":23215}," {object}",{"type":21,"tag":209,"props":23217,"children":23218},{"style":222},[23219],{"type":26,"value":23220}," integration",{"type":21,"tag":209,"props":23222,"children":23223},{"style":448},[23224],{"type":26,"value":23225}," An object containing the teardown, paypal and deviceData objects, as noted\n",{"type":21,"tag":209,"props":23227,"children":23228},{"class":211,"line":288},[23229],{"type":21,"tag":209,"props":23230,"children":23231},{"style":448},[23232],{"type":26,"value":23233},"     * in the braintree docs.\n",{"type":21,"tag":209,"props":23235,"children":23236},{"class":211,"line":307},[23237],{"type":21,"tag":209,"props":23238,"children":23239},{"style":448},[23240],{"type":26,"value":13346},{"type":21,"tag":209,"props":23242,"children":23243},{"class":211,"line":325},[23244,23249,23253,23257,23261,23266],{"type":21,"tag":209,"props":23245,"children":23246},{"style":360},[23247],{"type":26,"value":23248},"    paymentMethodReady",{"type":21,"tag":209,"props":23250,"children":23251},{"style":222},[23252],{"type":26,"value":191},{"type":21,"tag":209,"props":23254,"children":23255},{"style":216},[23256],{"type":26,"value":4622},{"type":21,"tag":209,"props":23258,"children":23259},{"style":222},[23260],{"type":26,"value":368},{"type":21,"tag":209,"props":23262,"children":23263},{"style":400},[23264],{"type":26,"value":23265},"integration",{"type":21,"tag":209,"props":23267,"children":23268},{"style":222},[23269],{"type":26,"value":2369},{"type":21,"tag":209,"props":23271,"children":23272},{"class":211,"line":334},[23273],{"type":21,"tag":209,"props":23274,"children":23275},{"style":448},[23276],{"type":26,"value":23277},"        // e.g.\n",{"type":21,"tag":209,"props":23279,"children":23280},{"class":211,"line":343},[23281,23286,23290,23294,23298,23303],{"type":21,"tag":209,"props":23282,"children":23283},{"style":360},[23284],{"type":26,"value":23285},"        $",{"type":21,"tag":209,"props":23287,"children":23288},{"style":222},[23289],{"type":26,"value":368},{"type":21,"tag":209,"props":23291,"children":23292},{"style":233},[23293],{"type":26,"value":22799},{"type":21,"tag":209,"props":23295,"children":23296},{"style":222},[23297],{"type":26,"value":2699},{"type":21,"tag":209,"props":23299,"children":23300},{"style":360},[23301],{"type":26,"value":23302},"show",{"type":21,"tag":209,"props":23304,"children":23305},{"style":222},[23306],{"type":26,"value":4123},{"type":21,"tag":209,"props":23308,"children":23309},{"class":211,"line":351},[23310],{"type":21,"tag":209,"props":23311,"children":23312},{"style":222},[23313],{"type":26,"value":331},{"type":21,"tag":209,"props":23315,"children":23316},{"class":211,"line":444},[23317],{"type":21,"tag":209,"props":23318,"children":23319},{"style":448},[23320],{"type":26,"value":13290},{"type":21,"tag":209,"props":23322,"children":23323},{"class":211,"line":454},[23324],{"type":21,"tag":209,"props":23325,"children":23326},{"style":448},[23327],{"type":26,"value":23328},"     * Called by the braintree js SDK once the payment method has been received - that is, once the user has selected\n",{"type":21,"tag":209,"props":23330,"children":23331},{"class":211,"line":463},[23332],{"type":21,"tag":209,"props":23333,"children":23334},{"style":448},[23335],{"type":26,"value":23336},"     * their paypal account or entered their credit card details.\n",{"type":21,"tag":209,"props":23338,"children":23339},{"class":211,"line":472},[23340,23344,23348,23352,23357],{"type":21,"tag":209,"props":23341,"children":23342},{"style":448},[23343],{"type":26,"value":13306},{"type":21,"tag":209,"props":23345,"children":23346},{"style":216},[23347],{"type":26,"value":13311},{"type":21,"tag":209,"props":23349,"children":23350},{"style":360},[23351],{"type":26,"value":23215},{"type":21,"tag":209,"props":23353,"children":23354},{"style":222},[23355],{"type":26,"value":23356}," recv",{"type":21,"tag":209,"props":23358,"children":23359},{"style":448},[23360],{"type":26,"value":23361}," Contains the following:\n",{"type":21,"tag":209,"props":23363,"children":23364},{"class":211,"line":480},[23365],{"type":21,"tag":209,"props":23366,"children":23367},{"style":448},[23368],{"type":26,"value":23369},"     * nonce: The payment method nonce.\n",{"type":21,"tag":209,"props":23371,"children":23372},{"class":211,"line":489},[23373],{"type":21,"tag":209,"props":23374,"children":23375},{"style":448},[23376],{"type":26,"value":23377},"     * type: A string representing the type of payment method generated; either 'CreditCard' or 'PayPalAccount'.\n",{"type":21,"tag":209,"props":23379,"children":23380},{"class":211,"line":847},[23381],{"type":21,"tag":209,"props":23382,"children":23383},{"style":448},[23384],{"type":26,"value":23385},"     * details: Additional details. See https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration#onpaymentmethodreceived-details-object\n",{"type":21,"tag":209,"props":23387,"children":23388},{"class":211,"line":860},[23389],{"type":21,"tag":209,"props":23390,"children":23391},{"style":448},[23392],{"type":26,"value":13346},{"type":21,"tag":209,"props":23394,"children":23395},{"class":211,"line":877},[23396,23401,23405,23409,23413,23418],{"type":21,"tag":209,"props":23397,"children":23398},{"style":360},[23399],{"type":26,"value":23400},"    paymentMethodReceived",{"type":21,"tag":209,"props":23402,"children":23403},{"style":222},[23404],{"type":26,"value":191},{"type":21,"tag":209,"props":23406,"children":23407},{"style":216},[23408],{"type":26,"value":4622},{"type":21,"tag":209,"props":23410,"children":23411},{"style":222},[23412],{"type":26,"value":368},{"type":21,"tag":209,"props":23414,"children":23415},{"style":400},[23416],{"type":26,"value":23417},"recv",{"type":21,"tag":209,"props":23419,"children":23420},{"style":222},[23421],{"type":26,"value":2369},{"type":21,"tag":209,"props":23423,"children":23424},{"class":211,"line":889},[23425],{"type":21,"tag":209,"props":23426,"children":23427},{"style":448},[23428],{"type":26,"value":23429},"        // We could be submitting information to our server via the form, and add information we need submitted as hidden\n",{"type":21,"tag":209,"props":23431,"children":23432},{"class":211,"line":902},[23433],{"type":21,"tag":209,"props":23434,"children":23435},{"style":448},[23436],{"type":26,"value":23437},"        // fields on the form, but we can also submit the information we want to the server within this callback via ajax.\n",{"type":21,"tag":209,"props":23439,"children":23440},{"class":211,"line":914},[23441,23445,23450,23454,23459,23464],{"type":21,"tag":209,"props":23442,"children":23443},{"style":216},[23444],{"type":26,"value":14505},{"type":21,"tag":209,"props":23446,"children":23447},{"style":222},[23448],{"type":26,"value":23449}," details ",{"type":21,"tag":209,"props":23451,"children":23452},{"style":216},[23453],{"type":26,"value":1432},{"type":21,"tag":209,"props":23455,"children":23456},{"style":222},[23457],{"type":26,"value":23458}," {otherDetails:{",{"type":21,"tag":209,"props":23460,"children":23461},{"style":448},[23462],{"type":26,"value":23463},"/* object containing any other info we want to send up */",{"type":21,"tag":209,"props":23465,"children":23466},{"style":222},[23467],{"type":26,"value":23468},", payment:recv};\n",{"type":21,"tag":209,"props":23470,"children":23471},{"class":211,"line":922},[23472],{"type":21,"tag":209,"props":23473,"children":23474},{"emptyLinePlaceholder":248},[23475],{"type":26,"value":251},{"type":21,"tag":209,"props":23477,"children":23478},{"class":211,"line":2312},[23479,23483,23487],{"type":21,"tag":209,"props":23480,"children":23481},{"style":222},[23482],{"type":26,"value":22666},{"type":21,"tag":209,"props":23484,"children":23485},{"style":360},[23486],{"type":26,"value":20783},{"type":21,"tag":209,"props":23488,"children":23489},{"style":222},[23490],{"type":26,"value":7767},{"type":21,"tag":209,"props":23492,"children":23493},{"class":211,"line":2321},[23494,23498,23503],{"type":21,"tag":209,"props":23495,"children":23496},{"style":222},[23497],{"type":26,"value":22715},{"type":21,"tag":209,"props":23499,"children":23500},{"style":233},[23501],{"type":26,"value":23502},"'/payment/process/'",{"type":21,"tag":209,"props":23504,"children":23505},{"style":222},[23506],{"type":26,"value":304},{"type":21,"tag":209,"props":23508,"children":23509},{"class":211,"line":2372},[23510,23514,23518],{"type":21,"tag":209,"props":23511,"children":23512},{"style":222},[23513],{"type":26,"value":22682},{"type":21,"tag":209,"props":23515,"children":23516},{"style":233},[23517],{"type":26,"value":10708},{"type":21,"tag":209,"props":23519,"children":23520},{"style":222},[23521],{"type":26,"value":304},{"type":21,"tag":209,"props":23523,"children":23524},{"class":211,"line":2381},[23525,23529,23533],{"type":21,"tag":209,"props":23526,"children":23527},{"style":222},[23528],{"type":26,"value":22698},{"type":21,"tag":209,"props":23530,"children":23531},{"style":233},[23532],{"type":26,"value":22703},{"type":21,"tag":209,"props":23534,"children":23535},{"style":222},[23536],{"type":26,"value":304},{"type":21,"tag":209,"props":23538,"children":23539},{"class":211,"line":2389},[23540,23545,23549],{"type":21,"tag":209,"props":23541,"children":23542},{"style":222},[23543],{"type":26,"value":23544},"            contentType:",{"type":21,"tag":209,"props":23546,"children":23547},{"style":233},[23548],{"type":26,"value":10754},{"type":21,"tag":209,"props":23550,"children":23551},{"style":222},[23552],{"type":26,"value":304},{"type":21,"tag":209,"props":23554,"children":23555},{"class":211,"line":2397},[23556,23561,23566,23570,23575],{"type":21,"tag":209,"props":23557,"children":23558},{"style":222},[23559],{"type":26,"value":23560},"            data:",{"type":21,"tag":209,"props":23562,"children":23563},{"style":263},[23564],{"type":26,"value":23565},"JSON",{"type":21,"tag":209,"props":23567,"children":23568},{"style":222},[23569],{"type":26,"value":378},{"type":21,"tag":209,"props":23571,"children":23572},{"style":360},[23573],{"type":26,"value":23574},"stringify",{"type":21,"tag":209,"props":23576,"children":23577},{"style":222},[23578],{"type":26,"value":23579},"(details)\n",{"type":21,"tag":209,"props":23581,"children":23582},{"class":211,"line":2406},[23583,23587,23591,23595,23599,23603,23607],{"type":21,"tag":209,"props":23584,"children":23585},{"style":222},[23586],{"type":26,"value":22728},{"type":21,"tag":209,"props":23588,"children":23589},{"style":360},[23590],{"type":26,"value":20845},{"type":21,"tag":209,"props":23592,"children":23593},{"style":222},[23594],{"type":26,"value":368},{"type":21,"tag":209,"props":23596,"children":23597},{"style":216},[23598],{"type":26,"value":4622},{"type":21,"tag":209,"props":23600,"children":23601},{"style":222},[23602],{"type":26,"value":368},{"type":21,"tag":209,"props":23604,"children":23605},{"style":400},[23606],{"type":26,"value":1385},{"type":21,"tag":209,"props":23608,"children":23609},{"style":222},[23610],{"type":26,"value":2369},{"type":21,"tag":209,"props":23612,"children":23613},{"class":211,"line":2415},[23614],{"type":21,"tag":209,"props":23615,"children":23616},{"style":448},[23617],{"type":26,"value":23618},"            // Do something with the response from your server.\n",{"type":21,"tag":209,"props":23620,"children":23621},{"class":211,"line":2424},[23622,23626,23630,23634,23638,23642,23646,23650,23654,23658,23662],{"type":21,"tag":209,"props":23623,"children":23624},{"style":222},[23625],{"type":26,"value":22852},{"type":21,"tag":209,"props":23627,"children":23628},{"style":360},[23629],{"type":26,"value":20189},{"type":21,"tag":209,"props":23631,"children":23632},{"style":222},[23633],{"type":26,"value":368},{"type":21,"tag":209,"props":23635,"children":23636},{"style":263},[23637],{"type":26,"value":2508},{"type":21,"tag":209,"props":23639,"children":23640},{"style":222},[23641],{"type":26,"value":22869},{"type":21,"tag":209,"props":23643,"children":23644},{"style":360},[23645],{"type":26,"value":20894},{"type":21,"tag":209,"props":23647,"children":23648},{"style":222},[23649],{"type":26,"value":368},{"type":21,"tag":209,"props":23651,"children":23652},{"style":216},[23653],{"type":26,"value":4622},{"type":21,"tag":209,"props":23655,"children":23656},{"style":222},[23657],{"type":26,"value":368},{"type":21,"tag":209,"props":23659,"children":23660},{"style":400},[23661],{"type":26,"value":20911},{"type":21,"tag":209,"props":23663,"children":23664},{"style":222},[23665],{"type":26,"value":2369},{"type":21,"tag":209,"props":23667,"children":23668},{"class":211,"line":2433},[23669,23673,23678,23682,23687,23691],{"type":21,"tag":209,"props":23670,"children":23671},{"style":216},[23672],{"type":26,"value":14539},{"type":21,"tag":209,"props":23674,"children":23675},{"style":222},[23676],{"type":26,"value":23677}," res ",{"type":21,"tag":209,"props":23679,"children":23680},{"style":216},[23681],{"type":26,"value":1432},{"type":21,"tag":209,"props":23683,"children":23684},{"style":222},[23685],{"type":26,"value":23686}," jqXHR.responseJSON ",{"type":21,"tag":209,"props":23688,"children":23689},{"style":216},[23690],{"type":26,"value":13270},{"type":21,"tag":209,"props":23692,"children":23693},{"style":222},[23694],{"type":26,"value":23695}," jqXHR.responseText;\n",{"type":21,"tag":209,"props":23697,"children":23698},{"class":211,"line":2442},[23699,23703,23707],{"type":21,"tag":209,"props":23700,"children":23701},{"style":222},[23702],{"type":26,"value":2495},{"type":21,"tag":209,"props":23704,"children":23705},{"style":360},[23706],{"type":26,"value":1059},{"type":21,"tag":209,"props":23708,"children":23709},{"style":222},[23710],{"type":26,"value":23711},"(res);\n",{"type":21,"tag":209,"props":23713,"children":23714},{"class":211,"line":2471},[23715],{"type":21,"tag":209,"props":23716,"children":23717},{"style":222},[23718],{"type":26,"value":2235},{"type":21,"tag":209,"props":23720,"children":23721},{"class":211,"line":2480},[23722],{"type":21,"tag":209,"props":23723,"children":23724},{"style":222},[23725],{"type":26,"value":331},{"type":21,"tag":209,"props":23727,"children":23728},{"class":211,"line":2489},[23729],{"type":21,"tag":209,"props":23730,"children":23731},{"emptyLinePlaceholder":248},[23732],{"type":26,"value":251},{"type":21,"tag":209,"props":23734,"children":23735},{"class":211,"line":2516},[23736],{"type":21,"tag":209,"props":23737,"children":23738},{"style":448},[23739],{"type":26,"value":13290},{"type":21,"tag":209,"props":23741,"children":23742},{"class":211,"line":2525},[23743],{"type":21,"tag":209,"props":23744,"children":23745},{"style":448},[23746],{"type":26,"value":23747},"     * On payment method error, this callback will receive a detail object, as noted in the setup options\n",{"type":21,"tag":209,"props":23749,"children":23750},{"class":211,"line":2533},[23751],{"type":21,"tag":209,"props":23752,"children":23753},{"style":448},[23754],{"type":26,"value":23755},"     * documentation, which gives us some idea as to what error occurred, allowing us to choose how to \n",{"type":21,"tag":209,"props":23757,"children":23758},{"class":211,"line":2542},[23759],{"type":21,"tag":209,"props":23760,"children":23761},{"style":448},[23762],{"type":26,"value":23763},"     * respond to it or inform the client about it.\n",{"type":21,"tag":209,"props":23765,"children":23766},{"class":211,"line":2550},[23767,23771,23775,23779],{"type":21,"tag":209,"props":23768,"children":23769},{"style":448},[23770],{"type":26,"value":13306},{"type":21,"tag":209,"props":23772,"children":23773},{"style":216},[23774],{"type":26,"value":13311},{"type":21,"tag":209,"props":23776,"children":23777},{"style":360},[23778],{"type":26,"value":23215},{"type":21,"tag":209,"props":23780,"children":23781},{"style":222},[23782],{"type":26,"value":23783}," detail\n",{"type":21,"tag":209,"props":23785,"children":23786},{"class":211,"line":2564},[23787],{"type":21,"tag":209,"props":23788,"children":23789},{"style":448},[23790],{"type":26,"value":13346},{"type":21,"tag":209,"props":23792,"children":23793},{"class":211,"line":2611},[23794,23799,23803,23807,23812],{"type":21,"tag":209,"props":23795,"children":23796},{"style":222},[23797],{"type":26,"value":23798},"    paymentMethodError:",{"type":21,"tag":209,"props":23800,"children":23801},{"style":216},[23802],{"type":26,"value":4622},{"type":21,"tag":209,"props":23804,"children":23805},{"style":222},[23806],{"type":26,"value":368},{"type":21,"tag":209,"props":23808,"children":23809},{"style":400},[23810],{"type":26,"value":23811},"detail",{"type":21,"tag":209,"props":23813,"children":23814},{"style":222},[23815],{"type":26,"value":2369},{"type":21,"tag":209,"props":23817,"children":23818},{"class":211,"line":2619},[23819,23823,23827],{"type":21,"tag":209,"props":23820,"children":23821},{"style":222},[23822],{"type":26,"value":3374},{"type":21,"tag":209,"props":23824,"children":23825},{"style":360},[23826],{"type":26,"value":1059},{"type":21,"tag":209,"props":23828,"children":23829},{"style":222},[23830],{"type":26,"value":23831},"(detail);\n",{"type":21,"tag":209,"props":23833,"children":23834},{"class":211,"line":2627},[23835],{"type":21,"tag":209,"props":23836,"children":23837},{"emptyLinePlaceholder":248},[23838],{"type":26,"value":251},{"type":21,"tag":209,"props":23840,"children":23841},{"class":211,"line":2636},[23842,23846,23851,23856,23861],{"type":21,"tag":209,"props":23843,"children":23844},{"style":216},[23845],{"type":26,"value":6334},{"type":21,"tag":209,"props":23847,"children":23848},{"style":222},[23849],{"type":26,"value":23850}," (detail.type ",{"type":21,"tag":209,"props":23852,"children":23853},{"style":216},[23854],{"type":26,"value":23855},"==",{"type":21,"tag":209,"props":23857,"children":23858},{"style":233},[23859],{"type":26,"value":23860}," \"VALIDATION\"",{"type":21,"tag":209,"props":23862,"children":23863},{"style":222},[23864],{"type":26,"value":2369},{"type":21,"tag":209,"props":23866,"children":23867},{"class":211,"line":2644},[23868],{"type":21,"tag":209,"props":23869,"children":23870},{"style":448},[23871],{"type":26,"value":23872},"            // Potentially display a notification to your user that validation failed.\n",{"type":21,"tag":209,"props":23874,"children":23875},{"class":211,"line":2657},[23876,23880],{"type":21,"tag":209,"props":23877,"children":23878},{"style":216},[23879],{"type":26,"value":13689},{"type":21,"tag":209,"props":23881,"children":23882},{"style":222},[23883],{"type":26,"value":241},{"type":21,"tag":209,"props":23885,"children":23886},{"class":211,"line":2728},[23887],{"type":21,"tag":209,"props":23888,"children":23889},{"style":222},[23890],{"type":26,"value":2235},{"type":21,"tag":209,"props":23892,"children":23893},{"class":211,"line":2758},[23894],{"type":21,"tag":209,"props":23895,"children":23896},{"emptyLinePlaceholder":248},[23897],{"type":26,"value":251},{"type":21,"tag":209,"props":23899,"children":23900},{"class":211,"line":2776},[23901],{"type":21,"tag":209,"props":23902,"children":23903},{"style":448},[23904],{"type":26,"value":23905},"        // Potentially display or log that another type of error occurred.\n",{"type":21,"tag":209,"props":23907,"children":23908},{"class":211,"line":2785},[23909],{"type":21,"tag":209,"props":23910,"children":23911},{"style":222},[23912],{"type":26,"value":331},{"type":21,"tag":3596,"props":23914,"children":23916},{"id":23915},"perform-transaction",[23917],{"type":26,"value":23918},"Perform Transaction",{"type":21,"tag":22,"props":23920,"children":23921},{},[23922,23924,23930],{"type":26,"value":23923},"You'll notice that we specified an endpoint of ",{"type":21,"tag":63,"props":23925,"children":23927},{"className":23926},[],[23928],{"type":26,"value":23929},"/payment/process/",{"type":26,"value":23931}," in the paymentMethodReceived callback on the client-side. So, on the server side, let's define this endpoint and finally process our payment.",{"type":21,"tag":200,"props":23933,"children":23935},{"className":21895,"code":23934,"language":21719,"meta":8,"style":8},"import braintree\nimport json\n\nfrom django.views.decorators.http import require_http_methods\nfrom django.http import JsonResponse\n\n#from yourapp.models import SaleItem, TransactionRecord\n\n@require_http_methods(['POST'])\ndef perform_braintree_simple_sale(request):\n    \"\"\"\n    Perform one-time, immediate settlement sale transaction using\n    the payment nonce sent to us by the client.\n    On failure, return the failure details to the client.\n    \"\"\"\n    try:\n        details = json.loads(request.body)\n    except ValueError:\n        # Handle the error case where you fail to parse the request body\n        return JsonResponse(status=400)\n\n    payment_details = details['payment']\n\n    # Note that we get the value of the transaction from a database row - generally speaking,\n    # it's a bad idea to trust the client to define the transaction amount - otherwise, the client\n    # may alter the request to say, have themselves charged $1 for something you want to charge $100\n    # for, and if you don't validate this, you're out $99. Allowing the client to specify what 'item' \n    # they'd like to purchase is safer, however, as long as the server remains in control of setting and\n    # confirming the price.\n    item = SaleItem.objects.get(type=\"your-sale-item\")\n    sale = {\n        \"amount\": str(item.amount),\n        \"payment_method_nonce\": payment_details['nonce'],\n        \"descriptor\": {\"name\": \"BIZ*NAME\"},\n        \"options\": {\n            \"paypal\": {\"description\": \"BizName (bizname.foo)\"},\n            # Note that setting this to true indicates we want both authorization and immediate settlement of this charge\n            \"submit_for_settlement\": True \n        }\n    }\n\n    # Perform transaction, making the remote request to braintree\n    payment_result = braintree.Transaction.sale(sale)\n\n    if payment_result.is_success is not True:\n        if not hasattr(payment_result, 'transation'):\n            \"\"\"\n            If the transaction was not successfully processed by braintree,\n            the list of possible errors is staggeringly long:\n            @see https://developers.braintreepayments.com/reference/general/validation-errors/all/python#transaction\n            You'll likely want to iterate through the deep_errors list and handle them appropriately.\n            \"\"\"\n            return JsonResponse(status=500)\n        else:\n            \"\"\"\n            If the transacation was successfully processed by braintree, but was rejected by\n            the payment processor, you'll want to handle this rejection appropriately.\n            @see https://developers.braintreepayments.com/reference/general/processor-responses/settlement-responses\n            \"\"\"\n            return JsonResponse(status=500)\n\n    transaction = payment_result.transaction\n    if transaction.amount \u003C item.amount:\n        # Confirm you actually were paid as much as your item costs! If you don't submit for settlement,\n        # or only submit for partial settlement, you should skip this check.\n        return JsonResponse(status=500)\n\n    # Transaction successful - you can now proceed to create a new user, produce a download link for an item,\n    # or whatever else it is you need payment processing for.\n    # You can also now create a local reference for the transaction, in case you ever need to look it up for refund\n    # purposes, for example.\n    TransactionRecord.objects.create(item=item, amount=transaction.amount,\n                                     transaction_id=transaction.id, type=transaction.payment_instrument_type)\n\n    return JsonResponse(status=200)\n",[23936],{"type":21,"tag":63,"props":23937,"children":23938},{"__ignoreMap":8},[23939,23950,23962,23969,23988,24007,24014,24022,24029,24048,24064,24071,24079,24087,24095,24102,24113,24130,24145,24153,24182,24189,24216,24223,24231,24239,24247,24255,24263,24271,24306,24322,24344,24366,24397,24410,24440,24448,24470,24477,24484,24491,24499,24516,24523,24554,24584,24592,24600,24608,24616,24624,24631,24658,24670,24677,24685,24693,24701,24708,24735,24742,24759,24780,24788,24796,24823,24830,24838,24846,24854,24862,24898,24928,24935],{"type":21,"tag":209,"props":23940,"children":23941},{"class":211,"line":212},[23942,23946],{"type":21,"tag":209,"props":23943,"children":23944},{"style":216},[23945],{"type":26,"value":219},{"type":21,"tag":209,"props":23947,"children":23948},{"style":222},[23949],{"type":26,"value":21924},{"type":21,"tag":209,"props":23951,"children":23952},{"class":211,"line":244},[23953,23957],{"type":21,"tag":209,"props":23954,"children":23955},{"style":216},[23956],{"type":26,"value":219},{"type":21,"tag":209,"props":23958,"children":23959},{"style":222},[23960],{"type":26,"value":23961}," json\n",{"type":21,"tag":209,"props":23963,"children":23964},{"class":211,"line":254},[23965],{"type":21,"tag":209,"props":23966,"children":23967},{"emptyLinePlaceholder":248},[23968],{"type":26,"value":251},{"type":21,"tag":209,"props":23970,"children":23971},{"class":211,"line":279},[23972,23976,23980,23984],{"type":21,"tag":209,"props":23973,"children":23974},{"style":216},[23975],{"type":26,"value":230},{"type":21,"tag":209,"props":23977,"children":23978},{"style":222},[23979],{"type":26,"value":22104},{"type":21,"tag":209,"props":23981,"children":23982},{"style":216},[23983],{"type":26,"value":219},{"type":21,"tag":209,"props":23985,"children":23986},{"style":222},[23987],{"type":26,"value":22113},{"type":21,"tag":209,"props":23989,"children":23990},{"class":211,"line":288},[23991,23995,23999,24003],{"type":21,"tag":209,"props":23992,"children":23993},{"style":216},[23994],{"type":26,"value":230},{"type":21,"tag":209,"props":23996,"children":23997},{"style":222},[23998],{"type":26,"value":22083},{"type":21,"tag":209,"props":24000,"children":24001},{"style":216},[24002],{"type":26,"value":219},{"type":21,"tag":209,"props":24004,"children":24005},{"style":222},[24006],{"type":26,"value":22092},{"type":21,"tag":209,"props":24008,"children":24009},{"class":211,"line":307},[24010],{"type":21,"tag":209,"props":24011,"children":24012},{"emptyLinePlaceholder":248},[24013],{"type":26,"value":251},{"type":21,"tag":209,"props":24015,"children":24016},{"class":211,"line":325},[24017],{"type":21,"tag":209,"props":24018,"children":24019},{"style":448},[24020],{"type":26,"value":24021},"#from yourapp.models import SaleItem, TransactionRecord\n",{"type":21,"tag":209,"props":24023,"children":24024},{"class":211,"line":334},[24025],{"type":21,"tag":209,"props":24026,"children":24027},{"emptyLinePlaceholder":248},[24028],{"type":26,"value":251},{"type":21,"tag":209,"props":24030,"children":24031},{"class":211,"line":343},[24032,24036,24040,24044],{"type":21,"tag":209,"props":24033,"children":24034},{"style":360},[24035],{"type":26,"value":22128},{"type":21,"tag":209,"props":24037,"children":24038},{"style":222},[24039],{"type":26,"value":22133},{"type":21,"tag":209,"props":24041,"children":24042},{"style":233},[24043],{"type":26,"value":10708},{"type":21,"tag":209,"props":24045,"children":24046},{"style":222},[24047],{"type":26,"value":22142},{"type":21,"tag":209,"props":24049,"children":24050},{"class":211,"line":351},[24051,24055,24060],{"type":21,"tag":209,"props":24052,"children":24053},{"style":216},[24054],{"type":26,"value":22150},{"type":21,"tag":209,"props":24056,"children":24057},{"style":360},[24058],{"type":26,"value":24059}," perform_braintree_simple_sale",{"type":21,"tag":209,"props":24061,"children":24062},{"style":222},[24063],{"type":26,"value":22160},{"type":21,"tag":209,"props":24065,"children":24066},{"class":211,"line":444},[24067],{"type":21,"tag":209,"props":24068,"children":24069},{"style":233},[24070],{"type":26,"value":22168},{"type":21,"tag":209,"props":24072,"children":24073},{"class":211,"line":454},[24074],{"type":21,"tag":209,"props":24075,"children":24076},{"style":233},[24077],{"type":26,"value":24078},"    Perform one-time, immediate settlement sale transaction using\n",{"type":21,"tag":209,"props":24080,"children":24081},{"class":211,"line":463},[24082],{"type":21,"tag":209,"props":24083,"children":24084},{"style":233},[24085],{"type":26,"value":24086},"    the payment nonce sent to us by the client.\n",{"type":21,"tag":209,"props":24088,"children":24089},{"class":211,"line":472},[24090],{"type":21,"tag":209,"props":24091,"children":24092},{"style":233},[24093],{"type":26,"value":24094},"    On failure, return the failure details to the client.\n",{"type":21,"tag":209,"props":24096,"children":24097},{"class":211,"line":480},[24098],{"type":21,"tag":209,"props":24099,"children":24100},{"style":233},[24101],{"type":26,"value":22168},{"type":21,"tag":209,"props":24103,"children":24104},{"class":211,"line":489},[24105,24109],{"type":21,"tag":209,"props":24106,"children":24107},{"style":216},[24108],{"type":26,"value":6640},{"type":21,"tag":209,"props":24110,"children":24111},{"style":222},[24112],{"type":26,"value":844},{"type":21,"tag":209,"props":24114,"children":24115},{"class":211,"line":847},[24116,24121,24125],{"type":21,"tag":209,"props":24117,"children":24118},{"style":222},[24119],{"type":26,"value":24120},"        details ",{"type":21,"tag":209,"props":24122,"children":24123},{"style":216},[24124],{"type":26,"value":1432},{"type":21,"tag":209,"props":24126,"children":24127},{"style":222},[24128],{"type":26,"value":24129}," json.loads(request.body)\n",{"type":21,"tag":209,"props":24131,"children":24132},{"class":211,"line":860},[24133,24137,24141],{"type":21,"tag":209,"props":24134,"children":24135},{"style":216},[24136],{"type":26,"value":22219},{"type":21,"tag":209,"props":24138,"children":24139},{"style":263},[24140],{"type":26,"value":22224},{"type":21,"tag":209,"props":24142,"children":24143},{"style":222},[24144],{"type":26,"value":844},{"type":21,"tag":209,"props":24146,"children":24147},{"class":211,"line":877},[24148],{"type":21,"tag":209,"props":24149,"children":24150},{"style":448},[24151],{"type":26,"value":24152},"        # Handle the error case where you fail to parse the request body\n",{"type":21,"tag":209,"props":24154,"children":24155},{"class":211,"line":889},[24156,24160,24165,24169,24173,24178],{"type":21,"tag":209,"props":24157,"children":24158},{"style":216},[24159],{"type":26,"value":3069},{"type":21,"tag":209,"props":24161,"children":24162},{"style":222},[24163],{"type":26,"value":24164}," JsonResponse(",{"type":21,"tag":209,"props":24166,"children":24167},{"style":400},[24168],{"type":26,"value":22261},{"type":21,"tag":209,"props":24170,"children":24171},{"style":216},[24172],{"type":26,"value":1432},{"type":21,"tag":209,"props":24174,"children":24175},{"style":263},[24176],{"type":26,"value":24177},"400",{"type":21,"tag":209,"props":24179,"children":24180},{"style":222},[24181],{"type":26,"value":8924},{"type":21,"tag":209,"props":24183,"children":24184},{"class":211,"line":902},[24185],{"type":21,"tag":209,"props":24186,"children":24187},{"emptyLinePlaceholder":248},[24188],{"type":26,"value":251},{"type":21,"tag":209,"props":24190,"children":24191},{"class":211,"line":914},[24192,24197,24201,24206,24211],{"type":21,"tag":209,"props":24193,"children":24194},{"style":222},[24195],{"type":26,"value":24196},"    payment_details ",{"type":21,"tag":209,"props":24198,"children":24199},{"style":216},[24200],{"type":26,"value":1432},{"type":21,"tag":209,"props":24202,"children":24203},{"style":222},[24204],{"type":26,"value":24205}," details[",{"type":21,"tag":209,"props":24207,"children":24208},{"style":233},[24209],{"type":26,"value":24210},"'payment'",{"type":21,"tag":209,"props":24212,"children":24213},{"style":222},[24214],{"type":26,"value":24215},"]\n",{"type":21,"tag":209,"props":24217,"children":24218},{"class":211,"line":922},[24219],{"type":21,"tag":209,"props":24220,"children":24221},{"emptyLinePlaceholder":248},[24222],{"type":26,"value":251},{"type":21,"tag":209,"props":24224,"children":24225},{"class":211,"line":2312},[24226],{"type":21,"tag":209,"props":24227,"children":24228},{"style":448},[24229],{"type":26,"value":24230},"    # Note that we get the value of the transaction from a database row - generally speaking,\n",{"type":21,"tag":209,"props":24232,"children":24233},{"class":211,"line":2321},[24234],{"type":21,"tag":209,"props":24235,"children":24236},{"style":448},[24237],{"type":26,"value":24238},"    # it's a bad idea to trust the client to define the transaction amount - otherwise, the client\n",{"type":21,"tag":209,"props":24240,"children":24241},{"class":211,"line":2372},[24242],{"type":21,"tag":209,"props":24243,"children":24244},{"style":448},[24245],{"type":26,"value":24246},"    # may alter the request to say, have themselves charged $1 for something you want to charge $100\n",{"type":21,"tag":209,"props":24248,"children":24249},{"class":211,"line":2381},[24250],{"type":21,"tag":209,"props":24251,"children":24252},{"style":448},[24253],{"type":26,"value":24254},"    # for, and if you don't validate this, you're out $99. Allowing the client to specify what 'item' \n",{"type":21,"tag":209,"props":24256,"children":24257},{"class":211,"line":2389},[24258],{"type":21,"tag":209,"props":24259,"children":24260},{"style":448},[24261],{"type":26,"value":24262},"    # they'd like to purchase is safer, however, as long as the server remains in control of setting and\n",{"type":21,"tag":209,"props":24264,"children":24265},{"class":211,"line":2397},[24266],{"type":21,"tag":209,"props":24267,"children":24268},{"style":448},[24269],{"type":26,"value":24270},"    # confirming the price.\n",{"type":21,"tag":209,"props":24272,"children":24273},{"class":211,"line":2406},[24274,24279,24283,24288,24293,24297,24302],{"type":21,"tag":209,"props":24275,"children":24276},{"style":222},[24277],{"type":26,"value":24278},"    item ",{"type":21,"tag":209,"props":24280,"children":24281},{"style":216},[24282],{"type":26,"value":1432},{"type":21,"tag":209,"props":24284,"children":24285},{"style":222},[24286],{"type":26,"value":24287}," SaleItem.objects.get(",{"type":21,"tag":209,"props":24289,"children":24290},{"style":400},[24291],{"type":26,"value":24292},"type",{"type":21,"tag":209,"props":24294,"children":24295},{"style":216},[24296],{"type":26,"value":1432},{"type":21,"tag":209,"props":24298,"children":24299},{"style":233},[24300],{"type":26,"value":24301},"\"your-sale-item\"",{"type":21,"tag":209,"props":24303,"children":24304},{"style":222},[24305],{"type":26,"value":8924},{"type":21,"tag":209,"props":24307,"children":24308},{"class":211,"line":2415},[24309,24314,24318],{"type":21,"tag":209,"props":24310,"children":24311},{"style":222},[24312],{"type":26,"value":24313},"    sale ",{"type":21,"tag":209,"props":24315,"children":24316},{"style":216},[24317],{"type":26,"value":1432},{"type":21,"tag":209,"props":24319,"children":24320},{"style":222},[24321],{"type":26,"value":276},{"type":21,"tag":209,"props":24323,"children":24324},{"class":211,"line":2424},[24325,24330,24334,24339],{"type":21,"tag":209,"props":24326,"children":24327},{"style":233},[24328],{"type":26,"value":24329},"        \"amount\"",{"type":21,"tag":209,"props":24331,"children":24332},{"style":222},[24333],{"type":26,"value":7821},{"type":21,"tag":209,"props":24335,"children":24336},{"style":263},[24337],{"type":26,"value":24338},"str",{"type":21,"tag":209,"props":24340,"children":24341},{"style":222},[24342],{"type":26,"value":24343},"(item.amount),\n",{"type":21,"tag":209,"props":24345,"children":24346},{"class":211,"line":2433},[24347,24352,24357,24362],{"type":21,"tag":209,"props":24348,"children":24349},{"style":233},[24350],{"type":26,"value":24351},"        \"payment_method_nonce\"",{"type":21,"tag":209,"props":24353,"children":24354},{"style":222},[24355],{"type":26,"value":24356},": payment_details[",{"type":21,"tag":209,"props":24358,"children":24359},{"style":233},[24360],{"type":26,"value":24361},"'nonce'",{"type":21,"tag":209,"props":24363,"children":24364},{"style":222},[24365],{"type":26,"value":22813},{"type":21,"tag":209,"props":24367,"children":24368},{"class":211,"line":2442},[24369,24374,24379,24384,24388,24393],{"type":21,"tag":209,"props":24370,"children":24371},{"style":233},[24372],{"type":26,"value":24373},"        \"descriptor\"",{"type":21,"tag":209,"props":24375,"children":24376},{"style":222},[24377],{"type":26,"value":24378},": {",{"type":21,"tag":209,"props":24380,"children":24381},{"style":233},[24382],{"type":26,"value":24383},"\"name\"",{"type":21,"tag":209,"props":24385,"children":24386},{"style":222},[24387],{"type":26,"value":7821},{"type":21,"tag":209,"props":24389,"children":24390},{"style":233},[24391],{"type":26,"value":24392},"\"BIZ*NAME\"",{"type":21,"tag":209,"props":24394,"children":24395},{"style":222},[24396],{"type":26,"value":8533},{"type":21,"tag":209,"props":24398,"children":24399},{"class":211,"line":2471},[24400,24405],{"type":21,"tag":209,"props":24401,"children":24402},{"style":233},[24403],{"type":26,"value":24404},"        \"options\"",{"type":21,"tag":209,"props":24406,"children":24407},{"style":222},[24408],{"type":26,"value":24409},": {\n",{"type":21,"tag":209,"props":24411,"children":24412},{"class":211,"line":2480},[24413,24418,24422,24427,24431,24436],{"type":21,"tag":209,"props":24414,"children":24415},{"style":233},[24416],{"type":26,"value":24417},"            \"paypal\"",{"type":21,"tag":209,"props":24419,"children":24420},{"style":222},[24421],{"type":26,"value":24378},{"type":21,"tag":209,"props":24423,"children":24424},{"style":233},[24425],{"type":26,"value":24426},"\"description\"",{"type":21,"tag":209,"props":24428,"children":24429},{"style":222},[24430],{"type":26,"value":7821},{"type":21,"tag":209,"props":24432,"children":24433},{"style":233},[24434],{"type":26,"value":24435},"\"BizName (bizname.foo)\"",{"type":21,"tag":209,"props":24437,"children":24438},{"style":222},[24439],{"type":26,"value":8533},{"type":21,"tag":209,"props":24441,"children":24442},{"class":211,"line":2489},[24443],{"type":21,"tag":209,"props":24444,"children":24445},{"style":448},[24446],{"type":26,"value":24447},"            # Note that setting this to true indicates we want both authorization and immediate settlement of this charge\n",{"type":21,"tag":209,"props":24449,"children":24450},{"class":211,"line":2516},[24451,24456,24460,24465],{"type":21,"tag":209,"props":24452,"children":24453},{"style":233},[24454],{"type":26,"value":24455},"            \"submit_for_settlement\"",{"type":21,"tag":209,"props":24457,"children":24458},{"style":222},[24459],{"type":26,"value":7821},{"type":21,"tag":209,"props":24461,"children":24462},{"style":263},[24463],{"type":26,"value":24464},"True",{"type":21,"tag":209,"props":24466,"children":24467},{"style":222},[24468],{"type":26,"value":24469}," \n",{"type":21,"tag":209,"props":24471,"children":24472},{"class":211,"line":2525},[24473],{"type":21,"tag":209,"props":24474,"children":24475},{"style":222},[24476],{"type":26,"value":2235},{"type":21,"tag":209,"props":24478,"children":24479},{"class":211,"line":2533},[24480],{"type":21,"tag":209,"props":24481,"children":24482},{"style":222},[24483],{"type":26,"value":331},{"type":21,"tag":209,"props":24485,"children":24486},{"class":211,"line":2542},[24487],{"type":21,"tag":209,"props":24488,"children":24489},{"emptyLinePlaceholder":248},[24490],{"type":26,"value":251},{"type":21,"tag":209,"props":24492,"children":24493},{"class":211,"line":2550},[24494],{"type":21,"tag":209,"props":24495,"children":24496},{"style":448},[24497],{"type":26,"value":24498},"    # Perform transaction, making the remote request to braintree\n",{"type":21,"tag":209,"props":24500,"children":24501},{"class":211,"line":2564},[24502,24507,24511],{"type":21,"tag":209,"props":24503,"children":24504},{"style":222},[24505],{"type":26,"value":24506},"    payment_result ",{"type":21,"tag":209,"props":24508,"children":24509},{"style":216},[24510],{"type":26,"value":1432},{"type":21,"tag":209,"props":24512,"children":24513},{"style":222},[24514],{"type":26,"value":24515}," braintree.Transaction.sale(sale)\n",{"type":21,"tag":209,"props":24517,"children":24518},{"class":211,"line":2611},[24519],{"type":21,"tag":209,"props":24520,"children":24521},{"emptyLinePlaceholder":248},[24522],{"type":26,"value":251},{"type":21,"tag":209,"props":24524,"children":24525},{"class":211,"line":2619},[24526,24530,24535,24540,24545,24550],{"type":21,"tag":209,"props":24527,"children":24528},{"style":216},[24529],{"type":26,"value":9249},{"type":21,"tag":209,"props":24531,"children":24532},{"style":222},[24533],{"type":26,"value":24534}," payment_result.is_success ",{"type":21,"tag":209,"props":24536,"children":24537},{"style":216},[24538],{"type":26,"value":24539},"is",{"type":21,"tag":209,"props":24541,"children":24542},{"style":216},[24543],{"type":26,"value":24544}," not",{"type":21,"tag":209,"props":24546,"children":24547},{"style":263},[24548],{"type":26,"value":24549}," True",{"type":21,"tag":209,"props":24551,"children":24552},{"style":222},[24553],{"type":26,"value":844},{"type":21,"tag":209,"props":24555,"children":24556},{"class":211,"line":2627},[24557,24561,24565,24570,24575,24580],{"type":21,"tag":209,"props":24558,"children":24559},{"style":216},[24560],{"type":26,"value":6334},{"type":21,"tag":209,"props":24562,"children":24563},{"style":216},[24564],{"type":26,"value":24544},{"type":21,"tag":209,"props":24566,"children":24567},{"style":263},[24568],{"type":26,"value":24569}," hasattr",{"type":21,"tag":209,"props":24571,"children":24572},{"style":222},[24573],{"type":26,"value":24574},"(payment_result, ",{"type":21,"tag":209,"props":24576,"children":24577},{"style":233},[24578],{"type":26,"value":24579},"'transation'",{"type":21,"tag":209,"props":24581,"children":24582},{"style":222},[24583],{"type":26,"value":22417},{"type":21,"tag":209,"props":24585,"children":24586},{"class":211,"line":2636},[24587],{"type":21,"tag":209,"props":24588,"children":24589},{"style":233},[24590],{"type":26,"value":24591},"            \"\"\"\n",{"type":21,"tag":209,"props":24593,"children":24594},{"class":211,"line":2644},[24595],{"type":21,"tag":209,"props":24596,"children":24597},{"style":233},[24598],{"type":26,"value":24599},"            If the transaction was not successfully processed by braintree,\n",{"type":21,"tag":209,"props":24601,"children":24602},{"class":211,"line":2657},[24603],{"type":21,"tag":209,"props":24604,"children":24605},{"style":233},[24606],{"type":26,"value":24607},"            the list of possible errors is staggeringly long:\n",{"type":21,"tag":209,"props":24609,"children":24610},{"class":211,"line":2728},[24611],{"type":21,"tag":209,"props":24612,"children":24613},{"style":233},[24614],{"type":26,"value":24615},"            @see https://developers.braintreepayments.com/reference/general/validation-errors/all/python#transaction\n",{"type":21,"tag":209,"props":24617,"children":24618},{"class":211,"line":2758},[24619],{"type":21,"tag":209,"props":24620,"children":24621},{"style":233},[24622],{"type":26,"value":24623},"            You'll likely want to iterate through the deep_errors list and handle them appropriately.\n",{"type":21,"tag":209,"props":24625,"children":24626},{"class":211,"line":2776},[24627],{"type":21,"tag":209,"props":24628,"children":24629},{"style":233},[24630],{"type":26,"value":24591},{"type":21,"tag":209,"props":24632,"children":24633},{"class":211,"line":2785},[24634,24638,24642,24646,24650,24654],{"type":21,"tag":209,"props":24635,"children":24636},{"style":216},[24637],{"type":26,"value":13689},{"type":21,"tag":209,"props":24639,"children":24640},{"style":222},[24641],{"type":26,"value":24164},{"type":21,"tag":209,"props":24643,"children":24644},{"style":400},[24645],{"type":26,"value":22261},{"type":21,"tag":209,"props":24647,"children":24648},{"style":216},[24649],{"type":26,"value":1432},{"type":21,"tag":209,"props":24651,"children":24652},{"style":263},[24653],{"type":26,"value":22270},{"type":21,"tag":209,"props":24655,"children":24656},{"style":222},[24657],{"type":26,"value":8924},{"type":21,"tag":209,"props":24659,"children":24660},{"class":211,"line":2793},[24661,24666],{"type":21,"tag":209,"props":24662,"children":24663},{"style":216},[24664],{"type":26,"value":24665},"        else",{"type":21,"tag":209,"props":24667,"children":24668},{"style":222},[24669],{"type":26,"value":844},{"type":21,"tag":209,"props":24671,"children":24672},{"class":211,"line":2801},[24673],{"type":21,"tag":209,"props":24674,"children":24675},{"style":233},[24676],{"type":26,"value":24591},{"type":21,"tag":209,"props":24678,"children":24679},{"class":211,"line":2809},[24680],{"type":21,"tag":209,"props":24681,"children":24682},{"style":233},[24683],{"type":26,"value":24684},"            If the transacation was successfully processed by braintree, but was rejected by\n",{"type":21,"tag":209,"props":24686,"children":24687},{"class":211,"line":10937},[24688],{"type":21,"tag":209,"props":24689,"children":24690},{"style":233},[24691],{"type":26,"value":24692},"            the payment processor, you'll want to handle this rejection appropriately.\n",{"type":21,"tag":209,"props":24694,"children":24695},{"class":211,"line":10967},[24696],{"type":21,"tag":209,"props":24697,"children":24698},{"style":233},[24699],{"type":26,"value":24700},"            @see https://developers.braintreepayments.com/reference/general/processor-responses/settlement-responses\n",{"type":21,"tag":209,"props":24702,"children":24703},{"class":211,"line":11003},[24704],{"type":21,"tag":209,"props":24705,"children":24706},{"style":233},[24707],{"type":26,"value":24591},{"type":21,"tag":209,"props":24709,"children":24710},{"class":211,"line":11038},[24711,24715,24719,24723,24727,24731],{"type":21,"tag":209,"props":24712,"children":24713},{"style":216},[24714],{"type":26,"value":13689},{"type":21,"tag":209,"props":24716,"children":24717},{"style":222},[24718],{"type":26,"value":24164},{"type":21,"tag":209,"props":24720,"children":24721},{"style":400},[24722],{"type":26,"value":22261},{"type":21,"tag":209,"props":24724,"children":24725},{"style":216},[24726],{"type":26,"value":1432},{"type":21,"tag":209,"props":24728,"children":24729},{"style":263},[24730],{"type":26,"value":22270},{"type":21,"tag":209,"props":24732,"children":24733},{"style":222},[24734],{"type":26,"value":8924},{"type":21,"tag":209,"props":24736,"children":24737},{"class":211,"line":11072},[24738],{"type":21,"tag":209,"props":24739,"children":24740},{"emptyLinePlaceholder":248},[24741],{"type":26,"value":251},{"type":21,"tag":209,"props":24743,"children":24744},{"class":211,"line":11106},[24745,24750,24754],{"type":21,"tag":209,"props":24746,"children":24747},{"style":222},[24748],{"type":26,"value":24749},"    transaction ",{"type":21,"tag":209,"props":24751,"children":24752},{"style":216},[24753],{"type":26,"value":1432},{"type":21,"tag":209,"props":24755,"children":24756},{"style":222},[24757],{"type":26,"value":24758}," payment_result.transaction\n",{"type":21,"tag":209,"props":24760,"children":24761},{"class":211,"line":11114},[24762,24766,24771,24775],{"type":21,"tag":209,"props":24763,"children":24764},{"style":216},[24765],{"type":26,"value":9249},{"type":21,"tag":209,"props":24767,"children":24768},{"style":222},[24769],{"type":26,"value":24770}," transaction.amount ",{"type":21,"tag":209,"props":24772,"children":24773},{"style":216},[24774],{"type":26,"value":1985},{"type":21,"tag":209,"props":24776,"children":24777},{"style":222},[24778],{"type":26,"value":24779}," item.amount:\n",{"type":21,"tag":209,"props":24781,"children":24782},{"class":211,"line":14940},[24783],{"type":21,"tag":209,"props":24784,"children":24785},{"style":448},[24786],{"type":26,"value":24787},"        # Confirm you actually were paid as much as your item costs! If you don't submit for settlement,\n",{"type":21,"tag":209,"props":24789,"children":24790},{"class":211,"line":14949},[24791],{"type":21,"tag":209,"props":24792,"children":24793},{"style":448},[24794],{"type":26,"value":24795},"        # or only submit for partial settlement, you should skip this check.\n",{"type":21,"tag":209,"props":24797,"children":24798},{"class":211,"line":14958},[24799,24803,24807,24811,24815,24819],{"type":21,"tag":209,"props":24800,"children":24801},{"style":216},[24802],{"type":26,"value":3069},{"type":21,"tag":209,"props":24804,"children":24805},{"style":222},[24806],{"type":26,"value":24164},{"type":21,"tag":209,"props":24808,"children":24809},{"style":400},[24810],{"type":26,"value":22261},{"type":21,"tag":209,"props":24812,"children":24813},{"style":216},[24814],{"type":26,"value":1432},{"type":21,"tag":209,"props":24816,"children":24817},{"style":263},[24818],{"type":26,"value":22270},{"type":21,"tag":209,"props":24820,"children":24821},{"style":222},[24822],{"type":26,"value":8924},{"type":21,"tag":209,"props":24824,"children":24825},{"class":211,"line":14966},[24826],{"type":21,"tag":209,"props":24827,"children":24828},{"emptyLinePlaceholder":248},[24829],{"type":26,"value":251},{"type":21,"tag":209,"props":24831,"children":24832},{"class":211,"line":14975},[24833],{"type":21,"tag":209,"props":24834,"children":24835},{"style":448},[24836],{"type":26,"value":24837},"    # Transaction successful - you can now proceed to create a new user, produce a download link for an item,\n",{"type":21,"tag":209,"props":24839,"children":24840},{"class":211,"line":14984},[24841],{"type":21,"tag":209,"props":24842,"children":24843},{"style":448},[24844],{"type":26,"value":24845},"    # or whatever else it is you need payment processing for.\n",{"type":21,"tag":209,"props":24847,"children":24848},{"class":211,"line":15018},[24849],{"type":21,"tag":209,"props":24850,"children":24851},{"style":448},[24852],{"type":26,"value":24853},"    # You can also now create a local reference for the transaction, in case you ever need to look it up for refund\n",{"type":21,"tag":209,"props":24855,"children":24856},{"class":211,"line":15050},[24857],{"type":21,"tag":209,"props":24858,"children":24859},{"style":448},[24860],{"type":26,"value":24861},"    # purposes, for example.\n",{"type":21,"tag":209,"props":24863,"children":24864},{"class":211,"line":15082},[24865,24870,24875,24879,24884,24889,24893],{"type":21,"tag":209,"props":24866,"children":24867},{"style":222},[24868],{"type":26,"value":24869},"    TransactionRecord.objects.create(",{"type":21,"tag":209,"props":24871,"children":24872},{"style":400},[24873],{"type":26,"value":24874},"item",{"type":21,"tag":209,"props":24876,"children":24877},{"style":216},[24878],{"type":26,"value":1432},{"type":21,"tag":209,"props":24880,"children":24881},{"style":222},[24882],{"type":26,"value":24883},"item, ",{"type":21,"tag":209,"props":24885,"children":24886},{"style":400},[24887],{"type":26,"value":24888},"amount",{"type":21,"tag":209,"props":24890,"children":24891},{"style":216},[24892],{"type":26,"value":1432},{"type":21,"tag":209,"props":24894,"children":24895},{"style":222},[24896],{"type":26,"value":24897},"transaction.amount,\n",{"type":21,"tag":209,"props":24899,"children":24900},{"class":211,"line":15090},[24901,24906,24910,24915,24919,24923],{"type":21,"tag":209,"props":24902,"children":24903},{"style":400},[24904],{"type":26,"value":24905},"                                     transaction_id",{"type":21,"tag":209,"props":24907,"children":24908},{"style":216},[24909],{"type":26,"value":1432},{"type":21,"tag":209,"props":24911,"children":24912},{"style":222},[24913],{"type":26,"value":24914},"transaction.id, ",{"type":21,"tag":209,"props":24916,"children":24917},{"style":400},[24918],{"type":26,"value":24292},{"type":21,"tag":209,"props":24920,"children":24921},{"style":216},[24922],{"type":26,"value":1432},{"type":21,"tag":209,"props":24924,"children":24925},{"style":222},[24926],{"type":26,"value":24927},"transaction.payment_instrument_type)\n",{"type":21,"tag":209,"props":24929,"children":24930},{"class":211,"line":15098},[24931],{"type":21,"tag":209,"props":24932,"children":24933},{"emptyLinePlaceholder":248},[24934],{"type":26,"value":251},{"type":21,"tag":209,"props":24936,"children":24937},{"class":211,"line":15106},[24938,24942,24946,24950,24954,24958],{"type":21,"tag":209,"props":24939,"children":24940},{"style":216},[24941],{"type":26,"value":1298},{"type":21,"tag":209,"props":24943,"children":24944},{"style":222},[24945],{"type":26,"value":24164},{"type":21,"tag":209,"props":24947,"children":24948},{"style":400},[24949],{"type":26,"value":22261},{"type":21,"tag":209,"props":24951,"children":24952},{"style":216},[24953],{"type":26,"value":1432},{"type":21,"tag":209,"props":24955,"children":24956},{"style":263},[24957],{"type":26,"value":10921},{"type":21,"tag":209,"props":24959,"children":24960},{"style":222},[24961],{"type":26,"value":8924},{"type":21,"tag":3596,"props":24963,"children":24965},{"id":24964},"some-assembly-required",[24966],{"type":26,"value":24967},"Some Assembly Required",{"type":21,"tag":22,"props":24969,"children":24970},{},[24971],{"type":26,"value":24972},"And there, we're done!",{"type":21,"tag":22,"props":24974,"children":24975},{},[24976,24978,24983],{"type":26,"value":24977},"... for a given value of done. Although we now have something approaching the ",{"type":21,"tag":1084,"props":24979,"children":24980},{},[24981],{"type":26,"value":24982},"bare minimum",{"type":26,"value":24984}," for processing a transaction, what we have doesn't account for recurring subscriptions, storing customer information in the braintree 'vault', sub-merchants, handling refunds, performing authorizations and settling at a future time...",{"type":21,"tag":22,"props":24986,"children":24987},{},[24988,24990,24995],{"type":26,"value":24989},"For more information, I direct you once again to braintree's well-written ",{"type":21,"tag":29,"props":24991,"children":24993},{"href":21762,"rel":24992},[93],[24994],{"type":26,"value":21766},{"type":26,"value":24996},", and I would suggest directing any questions you may have to StackOverflow, where I've noted braintree developers to be fairly quick to respond with assistance.",{"type":21,"tag":22,"props":24998,"children":24999},{},[25000],{"type":26,"value":25001},"At this point, however, you should have the beginnings of a working implementation. Soon, your users will be happily trading in their useless monetary units for the happiness and lasting contentment that only cat pictures can provide. Cheers!",{"type":21,"tag":22,"props":25003,"children":25004},{},[25005],{"type":21,"tag":1084,"props":25006,"children":25007},{},[25008,25010],{"type":26,"value":25009},"Cat image: CC-BY licensed, via ",{"type":21,"tag":29,"props":25011,"children":25014},{"href":25012,"rel":25013},"https://www.flickr.com/photos/53911972@N03/",[93],[25015],{"type":26,"value":25012},{"type":21,"tag":3490,"props":25017,"children":25018},{},[25019],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":25021},[25022,25023,25024,25025,25026],{"id":21845,"depth":244,"text":21848},{"id":22552,"depth":244,"text":22555},{"id":23144,"depth":244,"text":23147},{"id":23915,"depth":244,"text":23918},{"id":24964,"depth":244,"text":24967},"content:ckeefer:2016-2:paymentprocessing.md","ckeefer/2016-2/paymentprocessing.md","ckeefer/2016-2/paymentprocessing",{"user":3518,"name":3519},{"_path":25032,"_dir":25033,"_draft":7,"_partial":7,"_locale":8,"title":25034,"description":25035,"publishDate":25036,"tags":25037,"excerpt":25035,"body":25038,"_type":3511,"_id":31093,"_source":3513,"_file":31094,"_stem":31095,"_extension":3516,"author":31096},"/ckeefer/2016-1/ajaxbinarycaching","2016-1","Caching Binary Data With jQuery Ajax and IndexedDB","After long, grueling months (years? or does it only feel like years?), your web application nears completion. It is tightly coded, well documented, works across all modern browsers, and is well received by your beta testers. It's nearly time to go live, and a smile of pure relief plays upon your lips... and freezes into a rictus grin when your client turns to you, and asks, \"so, hey, can we speed up the dynamic cat pic loading? Especially when I close the browser and come back to it later. I think that's really key to the whole application.\"","2016-04-25",[12,16600],{"type":18,"children":25039,"toc":31086},[25040,25044,25079,25084,25096,25102,25108,25149,25163,25174,25179,25217,25223,25263,25291,25297,25309,25338,25351,28204,28214,28219,28233,31032,31045,31051,31070,31082],{"type":21,"tag":22,"props":25041,"children":25042},{},[25043],{"type":26,"value":25035},{"type":21,"tag":22,"props":25045,"children":25046},{},[25047,25053,25055,25061,25063,25070,25072,25078],{"type":21,"tag":29,"props":25048,"children":25050},{"href":25049},"/search/ajax/upload/user:ckeefer",[25051],{"type":26,"value":25052},"Long, long ago",{"type":26,"value":25054}," we discussed our ",{"type":21,"tag":29,"props":25056,"children":25058},{"href":16710,"rel":25057},[93],[25059],{"type":26,"value":25060},"jQuery plugin",{"type":26,"value":25062}," that will allow you to cache responses of ajax queries in ",{"type":21,"tag":29,"props":25064,"children":25067},{"href":25065,"rel":25066},"https://developer.mozilla.org/en/docs/Web/API/Window/localStorage",[93],[25068],{"type":26,"value":25069},"Local Storage",{"type":26,"value":25071},", so long as they're strings, or something that can be coerced to a string (objects as JSON, numbers). We also previously discussed adding an ajax transport to allow us to handle ",{"type":21,"tag":29,"props":25073,"children":25075},{"href":25074},"/search/user:ckeefer/ajax/blobs",[25076],{"type":26,"value":25077},"sending and receiving binary blobs and array buffers via jQuery ajax",{"type":26,"value":378},{"type":21,"tag":22,"props":25080,"children":25081},{},[25082],{"type":26,"value":25083},"But what if we need to cache binary blobs or arraybuffers? Say, we need those cat pics on the double - we could convert them to and from base64, but not only is that slow, but we're certain to run up against the 5MB limit of local storage in short order. No, what we need is some way to cache binary data in some sort of client-side database...",{"type":21,"tag":22,"props":25085,"children":25086},{},[25087,25094],{"type":21,"tag":29,"props":25088,"children":25091},{"href":25089,"rel":25090},"https://github.com/SaneMethod/jalic",[93],[25092],{"type":26,"value":25093},"Want to get straight to the goods? Here's the link to the Github repo",{"type":26,"value":25095}," - keep reading for the details.",{"type":21,"tag":51,"props":25097,"children":25099},{"id":25098},"picking-the-appropriate-tool-for-the-job",[25100],{"type":26,"value":25101},"Picking the appropriate tool for the job",{"type":21,"tag":20400,"props":25103,"children":25105},{"id":25104},"or-any-tool-really",[25106],{"type":26,"value":25107},"Or any tool, really",{"type":21,"tag":22,"props":25109,"children":25110},{},[25111,25113,25120,25122,25129,25131,25138,25140,25147],{"type":26,"value":25112},"There are a number of candidates that could (or once could have) provided our solution. If we knew exactly what resources would be needed on first visit (and, as an added bonus, wanted at least some part of the web application available offline), we could have used ",{"type":21,"tag":29,"props":25114,"children":25117},{"href":25115,"rel":25116},"https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache",[93],[25118],{"type":26,"value":25119},"Application Cache",{"type":26,"value":25121},". I say could have, because ",{"type":21,"tag":29,"props":25123,"children":25126},{"href":25124,"rel":25125},"http://caniuse.com/#feat=offline-apps",[93],[25127],{"type":26,"value":25128},"Application Cache is dead",{"type":26,"value":25130}," (long live ",{"type":21,"tag":29,"props":25132,"children":25135},{"href":25133,"rel":25134},"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers",[93],[25136],{"type":26,"value":25137},"Service Workers",{"type":26,"value":25139},"). Its replacement, Service Workers, ",{"type":21,"tag":29,"props":25141,"children":25144},{"href":25142,"rel":25143},"http://caniuse.com/#feat=serviceworkers",[93],[25145],{"type":26,"value":25146},"isn't widely supported yet",{"type":26,"value":25148},", and this doesn't really fit our use case that well anyways.",{"type":21,"tag":22,"props":25150,"children":25151},{},[25152,25154,25161],{"type":26,"value":25153},"Well, what we really need is on-demand file storage. Hey, I remember reading about a ",{"type":21,"tag":29,"props":25155,"children":25158},{"href":25156,"rel":25157},"https://developer.mozilla.org/en-US/docs/Web/API/File_System_API",[93],[25159],{"type":26,"value":25160},"File System API",{"type":26,"value":25162}," once, whatever happened to that?",{"type":21,"tag":22,"props":25164,"children":25165},{},[25166,25173],{"type":21,"tag":29,"props":25167,"children":25170},{"href":25168,"rel":25169},"http://caniuse.com/#feat=filesystem",[93],[25171],{"type":26,"value":25172},"Also dead",{"type":26,"value":378},{"type":21,"tag":22,"props":25175,"children":25176},{},[25177],{"type":26,"value":25178},"Our options are looking a little thinner on the ground, now. But wait! If you're also familiar with the server-side of web development, you're probably thinking (a little guiltily) of the last time you couldn't use the file system but needed to store files. If we can't use the file system - how about the database?",{"type":21,"tag":22,"props":25180,"children":25181},{},[25182,25189,25191,25198,25200,25207,25209,25216],{"type":21,"tag":29,"props":25183,"children":25186},{"href":25184,"rel":25185},"https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API",[93],[25187],{"type":26,"value":25188},"IndexedDB",{"type":26,"value":25190}," to the rescue! (Not WebSQL, that's ",{"type":21,"tag":29,"props":25192,"children":25195},{"href":25193,"rel":25194},"http://caniuse.com/#feat=sql-storage",[93],[25196],{"type":26,"value":25197},"also dead",{"type":26,"value":25199},".) IndexedDB is fairly ",{"type":21,"tag":29,"props":25201,"children":25204},{"href":25202,"rel":25203},"http://caniuse.com/#feat=indexeddb",[93],[25205],{"type":26,"value":25206},"widely-supported by modern browsers",{"type":26,"value":25208},", and we can definitely ",{"type":21,"tag":29,"props":25210,"children":25213},{"href":25211,"rel":25212},"https://msdn.microsoft.com/en-us/library/hh779017%28v=vs.85%29.aspx",[93],[25214],{"type":26,"value":25215},"store binary data in an IndexedDB database",{"type":26,"value":378},{"type":21,"tag":193,"props":25218,"children":25220},{"id":25219},"if-you-pretend-complexity-and-async-operations-arent-there-they-go-away-on-their-own",[25221],{"type":26,"value":25222},"If you pretend complexity and async operations aren't there, they go away on their own",{"type":21,"tag":22,"props":25224,"children":25225},{},[25226,25228,25235,25237,25244,25246,25253,25254,25261],{"type":26,"value":25227},"One issue is that IndexedDB has a reputation for being ",{"type":21,"tag":29,"props":25229,"children":25232},{"href":25230,"rel":25231},"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB",[93],[25233],{"type":26,"value":25234},"fairly complex",{"type":26,"value":25236},". No worries, some helpful ",{"type":21,"tag":29,"props":25238,"children":25241},{"href":25239,"rel":25240},"https://github.com/SaneMethod",[93],[25242],{"type":26,"value":25243},"open source author",{"type":26,"value":25245}," will help abstract that away for you (see also the excellent ",{"type":21,"tag":29,"props":25247,"children":25250},{"href":25248,"rel":25249},"https://github.com/mozilla/localForage",[93],[25251],{"type":26,"value":25252},"localForage",{"type":26,"value":5997},{"type":21,"tag":29,"props":25255,"children":25258},{"href":25256,"rel":25257},"http://dexie.org/",[93],[25259],{"type":26,"value":25260},"Dexie",{"type":26,"value":25262}," projects if you intend to use IndexedDB for any purpose other than caching ajax requests in your application).",{"type":21,"tag":22,"props":25264,"children":25265},{},[25266,25268,25274,25276,25282,25284,25289],{"type":26,"value":25267},"The other concern for the purpose of our ajax caching is that IndexedDB operates asynchronously (like an XHR - no, I don't want to hear about sync XHR, that's ",{"type":21,"tag":29,"props":25269,"children":25272},{"href":25270,"rel":25271},"https://developers.google.com/web/updates/2012/01/Getting-Rid-of-Synchronous-XHRs?hl=en",[93],[25273],{"type":26,"value":25197},{"type":26,"value":25275},", and good riddance). Our ",{"type":21,"tag":29,"props":25277,"children":25279},{"href":16710,"rel":25278},[93],[25280],{"type":26,"value":25281},"Jalc plugin",{"type":26,"value":25283}," that allows us to cache jquery ajax responses, relies on the ability to specify an ajax transport for a given request - and it needs to respond with a value ",{"type":21,"tag":1084,"props":25285,"children":25286},{},[25287],{"type":26,"value":25288},"synchronously",{"type":26,"value":25290}," if it's going to handle the request instead of simply passing it on to the next transport factory.",{"type":21,"tag":51,"props":25292,"children":25294},{"id":25293},"two-for-the-price-of-one",[25295],{"type":26,"value":25296},"Two for the price of one",{"type":21,"tag":22,"props":25298,"children":25299},{},[25300,25302,25307],{"type":26,"value":25301},"So, what we need to do is store and retrieve a cached value asychronously, but know whether the value ",{"type":21,"tag":1084,"props":25303,"children":25304},{},[25305],{"type":26,"value":25306},"exists",{"type":26,"value":25308}," sychronously. Thus, the solution - use both LocalStorage and IndexedDB. So, we extend our JALC plugin - first, we add the ability to send and receive binary data in the form of blobs and array buffers, and then we set up an indexeddb database for storing our values.",{"type":21,"tag":22,"props":25310,"children":25311},{},[25312,25314,25321,25323,25329,25331,25336],{"type":26,"value":25313},"I'll skip over the code for the binary sending and receiving, since we've mostly seen it before (you can ",{"type":21,"tag":29,"props":25315,"children":25318},{"href":25316,"rel":25317},"https://github.com/SaneMethod/jalic/blob/master/jquery-ajax-binary-patch.js",[93],[25319],{"type":26,"value":25320},"view it in the Github repo",{"type":26,"value":25322},", however). You'll require such a patch, as adding support for binary requests in jQuery is ",{"type":21,"tag":29,"props":25324,"children":25327},{"href":25325,"rel":25326},"https://github.com/jquery/jquery/pull/1525",[93],[25328],{"type":26,"value":25197},{"type":26,"value":25330},", and $.xhr and the ",{"type":21,"tag":29,"props":25332,"children":25334},{"href":20377,"rel":25333},[93],[25335],{"type":26,"value":13786},{"type":26,"value":25337}," isn't ready for prime-time yet.",{"type":21,"tag":22,"props":25339,"children":25340},{},[25341,25343,25350],{"type":26,"value":25342},"Let's take a quick walk through what we're doing to support IndexedDB, however (",{"type":21,"tag":29,"props":25344,"children":25347},{"href":25345,"rel":25346},"https://github.com/SaneMethod/jalic/blob/master/indexeddb-setup.js",[93],[25348],{"type":26,"value":25349},"see the up-to-date version on Github",{"type":26,"value":2699},{"type":21,"tag":200,"props":25352,"children":25354},{"className":16138,"code":25353,"language":16140,"meta":8,"style":8},"(function($, window){\n    var idb = window.indexedDB,\n        dbReady = $.Deferred(),\n        db;\n\n    /**\n     * At this point, we'll only support unprefixed, non-experimental versions of IndexedDB, to simplify our\n     * lives - there are a number of differences we would need to account for if we were to attempt to support\n     * early attempts at IndexedDB implementations, some of which you can read about in the excellent MDN\n     * documentation at\n     * https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API and\n     * https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB.\n     */\n    if (!window.indexedDB) throw new Error(\"Expecting unprefixed IndexedDB support on window object.\");\n\n    /**\n     * Create the 'jalic' IndexedDB db.\n     * For now, we handle errors merely by logging them and rejecting the associated Deferred object with the\n     * error event. This should be replaced by something more robust in the future...\n     *\n     * @param idb\n     * @returns {*}\n     */\n    function createDatabase(idb){\n        var dbreq = idb.open(\"jalic\", 1);\n\n        /**\n         * Something went wrong when opening our db. This could range from the user refusing the\n         * request to allow this site to store data, to the current version of the db being higher\n         * than the one we requested, to storage issues or lacking implementation.\n         * @param event\n         */\n        dbreq.onerror = function(event){\n            console.log(event);\n            dbReady.reject(event);\n        };\n\n        /**\n         * The on upgrade needed event is called whenever we're opening a database with a version number\n         * higher than the currently existing version number, which includes when the database doesn't\n         * currently exist. Within this function we define the structure of the db.\n         * @param event\n         */\n        dbreq.onupgradeneeded = function(event){\n            var objectStore;\n\n            db = event.target.result;\n            db.onerror = function(event){\n                console.log(event);\n            };\n\n            objectStore = db.createObjectStore(\"jalicData\", {keyPath:\"jdName\"});\n            objectStore.createIndex(\"storedAt\", \"storedAt\", {unique:false});\n\n            objectStore.transaction.oncomplete = function(event){\n                dbReady.resolve();\n            };\n        };\n\n        /**\n         * DB was opened successfully, with no upgrade needed.\n         * @param event\n         */\n        dbreq.onsuccess = function(event){\n            db = event.target.result;\n            dbReady.resolve();\n        };\n\n        return dbReady.promise();\n    }\n\n    createDatabase(idb);\n\n    /**\n     * Define a simple interface mimicking the Storage interface on the jQuery object, with the major difference being\n     * everything executes asynchronously, and returns a $.Deferred object to account for that.\n     */\n    $.jidb = {\n        /**\n         * Set an item within the jalicData objectStore, using the given jdName and data, with optionally\n         * a dataType parameter to store alongside the data. If dataType is not provided, it is the result of\n         * typeof data.\n         * Notice that we 'put' data, rather than add it - that means we will always overwrite data with an\n         * identical key (jdName), if it already exists.\n         * @param jdName\n         * @param data\n         * @param dataType\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with an empty body on success,\n         * or else resolves with the transaction or request error on failure.\n         */\n        setItem:function(jdName, data, dataType){\n            var defer = $.Deferred(),\n                transaction = db.transaction([\"jalicData\"], \"readwrite\"),\n                objectStore = transaction.objectStore(\"jalicData\"),\n                request;\n\n            dataType = dataType || typeof data;\n\n            transaction.oncomplete = function(){\n                return defer.resolve();\n            };\n\n            transaction.onerror = function(event){\n                console.log(event);\n                return defer.reject(event);\n            };\n\n            request = objectStore.put({jdName:jdName, storedAt:+new Date(), dataType:dataType, data:data});\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            return defer.promise();\n        },\n        /**\n         * Retrieve an item from the jalicData objectStore, using the given jdName as the key.\n         * @param jdName\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with the request result as an object\n         * on success, or else resolves with the transaction or request error on failure.\n         */\n        getItem:function(jdName){\n            var defer = $.Deferred(),\n                transaction = db.transaction([\"jalicData\"], \"readonly\"),\n                objectStore = transaction.objectStore(\"jalicData\"),\n                request = objectStore.get(jdName);\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            request.onsuccess = function(event){\n                defer.resolve(request.result);\n            };\n\n            return defer.promise();\n        },\n        /**\n         * Remove an item from the jalicData objectStore, using the given jdName as the key.\n         * @param jdName\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with an empty body on success,\n         * or else resolves with the transaction or request error on failure.\n         */\n        removeItem:function(jdName){\n            var defer = $.Deferred(),\n                transaction = db.transaction([\"jalicData\"], \"readwrite\"),\n                objectStore = transaction.objectStore(\"jalicData\"),\n                request = objectStore.delete(jdName);\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            request.onsuccess = function(){\n                defer.resolve();\n            };\n\n            return defer.promise();\n        },\n        /**\n         * Delete the jalic database and recreate it.\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with an empty body on success,\n         * or else resolves with the transaction or request error on failure.\n         */\n        clear:function(){\n            var defer = $.Deferred(),\n                request = idb.deleteDatabase(\"jalic\");\n\n            dbReady = $.Deferred();\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            request.onsuccess = function(){\n                dbReady.done(function(){\n                    defer.resolve();\n                });\n\n                createDatabase(idb);\n            };\n\n            return defer.promise();\n        }\n    };\n})(jQuery, window);\n",[25355],{"type":21,"tag":63,"props":25356,"children":25357},{"__ignoreMap":8},[25358,25390,25411,25437,25445,25452,25459,25467,25475,25483,25491,25499,25507,25514,25559,25566,25573,25581,25589,25597,25604,25620,25636,25643,25668,25714,25721,25728,25736,25744,25752,25769,25776,25810,25826,25842,25849,25856,25863,25871,25879,25887,25902,25909,25941,25953,25960,25977,26009,26024,26031,26038,26083,26126,26133,26166,26182,26189,26196,26203,26210,26218,26233,26240,26272,26287,26302,26309,26316,26337,26344,26351,26364,26371,26378,26386,26394,26401,26417,26424,26432,26440,26448,26456,26464,26480,26496,26511,26532,26540,26547,26592,26620,26663,26697,26705,26712,26740,26747,26771,26791,26798,26805,26836,26851,26870,26877,26884,26924,26931,26963,26978,26994,27001,27008,27027,27034,27041,27049,27064,27084,27092,27099,27127,27154,27194,27225,27250,27257,27288,27303,27318,27325,27332,27363,27379,27386,27393,27412,27419,27426,27434,27449,27468,27475,27482,27510,27537,27576,27607,27631,27638,27669,27684,27699,27706,27713,27736,27751,27758,27765,27784,27792,27800,27809,27829,27837,27845,27866,27894,27927,27935,27960,27968,28000,28016,28032,28040,28048,28072,28096,28113,28122,28130,28143,28151,28159,28179,28187,28195],{"type":21,"tag":209,"props":25359,"children":25360},{"class":211,"line":212},[25361,25365,25369,25373,25377,25381,25386],{"type":21,"tag":209,"props":25362,"children":25363},{"style":222},[25364],{"type":26,"value":368},{"type":21,"tag":209,"props":25366,"children":25367},{"style":216},[25368],{"type":26,"value":4622},{"type":21,"tag":209,"props":25370,"children":25371},{"style":222},[25372],{"type":26,"value":368},{"type":21,"tag":209,"props":25374,"children":25375},{"style":400},[25376],{"type":26,"value":6476},{"type":21,"tag":209,"props":25378,"children":25379},{"style":222},[25380],{"type":26,"value":408},{"type":21,"tag":209,"props":25382,"children":25383},{"style":400},[25384],{"type":26,"value":25385},"window",{"type":21,"tag":209,"props":25387,"children":25388},{"style":222},[25389],{"type":26,"value":2369},{"type":21,"tag":209,"props":25391,"children":25392},{"class":211,"line":244},[25393,25397,25402,25406],{"type":21,"tag":209,"props":25394,"children":25395},{"style":216},[25396],{"type":26,"value":16994},{"type":21,"tag":209,"props":25398,"children":25399},{"style":222},[25400],{"type":26,"value":25401}," idb ",{"type":21,"tag":209,"props":25403,"children":25404},{"style":216},[25405],{"type":26,"value":1432},{"type":21,"tag":209,"props":25407,"children":25408},{"style":222},[25409],{"type":26,"value":25410}," window.indexedDB,\n",{"type":21,"tag":209,"props":25412,"children":25413},{"class":211,"line":254},[25414,25419,25423,25428,25433],{"type":21,"tag":209,"props":25415,"children":25416},{"style":222},[25417],{"type":26,"value":25418},"        dbReady ",{"type":21,"tag":209,"props":25420,"children":25421},{"style":216},[25422],{"type":26,"value":1432},{"type":21,"tag":209,"props":25424,"children":25425},{"style":222},[25426],{"type":26,"value":25427}," $.",{"type":21,"tag":209,"props":25429,"children":25430},{"style":360},[25431],{"type":26,"value":25432},"Deferred",{"type":21,"tag":209,"props":25434,"children":25435},{"style":222},[25436],{"type":26,"value":13988},{"type":21,"tag":209,"props":25438,"children":25439},{"class":211,"line":279},[25440],{"type":21,"tag":209,"props":25441,"children":25442},{"style":222},[25443],{"type":26,"value":25444},"        db;\n",{"type":21,"tag":209,"props":25446,"children":25447},{"class":211,"line":288},[25448],{"type":21,"tag":209,"props":25449,"children":25450},{"emptyLinePlaceholder":248},[25451],{"type":26,"value":251},{"type":21,"tag":209,"props":25453,"children":25454},{"class":211,"line":307},[25455],{"type":21,"tag":209,"props":25456,"children":25457},{"style":448},[25458],{"type":26,"value":13290},{"type":21,"tag":209,"props":25460,"children":25461},{"class":211,"line":325},[25462],{"type":21,"tag":209,"props":25463,"children":25464},{"style":448},[25465],{"type":26,"value":25466},"     * At this point, we'll only support unprefixed, non-experimental versions of IndexedDB, to simplify our\n",{"type":21,"tag":209,"props":25468,"children":25469},{"class":211,"line":334},[25470],{"type":21,"tag":209,"props":25471,"children":25472},{"style":448},[25473],{"type":26,"value":25474},"     * lives - there are a number of differences we would need to account for if we were to attempt to support\n",{"type":21,"tag":209,"props":25476,"children":25477},{"class":211,"line":343},[25478],{"type":21,"tag":209,"props":25479,"children":25480},{"style":448},[25481],{"type":26,"value":25482},"     * early attempts at IndexedDB implementations, some of which you can read about in the excellent MDN\n",{"type":21,"tag":209,"props":25484,"children":25485},{"class":211,"line":351},[25486],{"type":21,"tag":209,"props":25487,"children":25488},{"style":448},[25489],{"type":26,"value":25490},"     * documentation at\n",{"type":21,"tag":209,"props":25492,"children":25493},{"class":211,"line":444},[25494],{"type":21,"tag":209,"props":25495,"children":25496},{"style":448},[25497],{"type":26,"value":25498},"     * https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API and\n",{"type":21,"tag":209,"props":25500,"children":25501},{"class":211,"line":454},[25502],{"type":21,"tag":209,"props":25503,"children":25504},{"style":448},[25505],{"type":26,"value":25506},"     * https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB.\n",{"type":21,"tag":209,"props":25508,"children":25509},{"class":211,"line":463},[25510],{"type":21,"tag":209,"props":25511,"children":25512},{"style":448},[25513],{"type":26,"value":13346},{"type":21,"tag":209,"props":25515,"children":25516},{"class":211,"line":472},[25517,25521,25525,25529,25534,25538,25542,25546,25550,25555],{"type":21,"tag":209,"props":25518,"children":25519},{"style":216},[25520],{"type":26,"value":9249},{"type":21,"tag":209,"props":25522,"children":25523},{"style":222},[25524],{"type":26,"value":5569},{"type":21,"tag":209,"props":25526,"children":25527},{"style":216},[25528],{"type":26,"value":6455},{"type":21,"tag":209,"props":25530,"children":25531},{"style":222},[25532],{"type":26,"value":25533},"window.indexedDB) ",{"type":21,"tag":209,"props":25535,"children":25536},{"style":216},[25537],{"type":26,"value":21543},{"type":21,"tag":209,"props":25539,"children":25540},{"style":216},[25541],{"type":26,"value":6371},{"type":21,"tag":209,"props":25543,"children":25544},{"style":360},[25545],{"type":26,"value":21552},{"type":21,"tag":209,"props":25547,"children":25548},{"style":222},[25549],{"type":26,"value":368},{"type":21,"tag":209,"props":25551,"children":25552},{"style":233},[25553],{"type":26,"value":25554},"\"Expecting unprefixed IndexedDB support on window object.\"",{"type":21,"tag":209,"props":25556,"children":25557},{"style":222},[25558],{"type":26,"value":2608},{"type":21,"tag":209,"props":25560,"children":25561},{"class":211,"line":480},[25562],{"type":21,"tag":209,"props":25563,"children":25564},{"emptyLinePlaceholder":248},[25565],{"type":26,"value":251},{"type":21,"tag":209,"props":25567,"children":25568},{"class":211,"line":489},[25569],{"type":21,"tag":209,"props":25570,"children":25571},{"style":448},[25572],{"type":26,"value":13290},{"type":21,"tag":209,"props":25574,"children":25575},{"class":211,"line":847},[25576],{"type":21,"tag":209,"props":25577,"children":25578},{"style":448},[25579],{"type":26,"value":25580},"     * Create the 'jalic' IndexedDB db.\n",{"type":21,"tag":209,"props":25582,"children":25583},{"class":211,"line":860},[25584],{"type":21,"tag":209,"props":25585,"children":25586},{"style":448},[25587],{"type":26,"value":25588},"     * For now, we handle errors merely by logging them and rejecting the associated Deferred object with the\n",{"type":21,"tag":209,"props":25590,"children":25591},{"class":211,"line":877},[25592],{"type":21,"tag":209,"props":25593,"children":25594},{"style":448},[25595],{"type":26,"value":25596},"     * error event. This should be replaced by something more robust in the future...\n",{"type":21,"tag":209,"props":25598,"children":25599},{"class":211,"line":889},[25600],{"type":21,"tag":209,"props":25601,"children":25602},{"style":448},[25603],{"type":26,"value":17907},{"type":21,"tag":209,"props":25605,"children":25606},{"class":211,"line":902},[25607,25611,25615],{"type":21,"tag":209,"props":25608,"children":25609},{"style":448},[25610],{"type":26,"value":13306},{"type":21,"tag":209,"props":25612,"children":25613},{"style":216},[25614],{"type":26,"value":13311},{"type":21,"tag":209,"props":25616,"children":25617},{"style":222},[25618],{"type":26,"value":25619}," idb\n",{"type":21,"tag":209,"props":25621,"children":25622},{"class":211,"line":914},[25623,25627,25631],{"type":21,"tag":209,"props":25624,"children":25625},{"style":448},[25626],{"type":26,"value":13306},{"type":21,"tag":209,"props":25628,"children":25629},{"style":216},[25630],{"type":26,"value":13333},{"type":21,"tag":209,"props":25632,"children":25633},{"style":360},[25634],{"type":26,"value":25635}," {*}\n",{"type":21,"tag":209,"props":25637,"children":25638},{"class":211,"line":922},[25639],{"type":21,"tag":209,"props":25640,"children":25641},{"style":448},[25642],{"type":26,"value":13346},{"type":21,"tag":209,"props":25644,"children":25645},{"class":211,"line":2312},[25646,25650,25655,25659,25664],{"type":21,"tag":209,"props":25647,"children":25648},{"style":216},[25649],{"type":26,"value":2981},{"type":21,"tag":209,"props":25651,"children":25652},{"style":360},[25653],{"type":26,"value":25654}," createDatabase",{"type":21,"tag":209,"props":25656,"children":25657},{"style":222},[25658],{"type":26,"value":368},{"type":21,"tag":209,"props":25660,"children":25661},{"style":400},[25662],{"type":26,"value":25663},"idb",{"type":21,"tag":209,"props":25665,"children":25666},{"style":222},[25667],{"type":26,"value":2369},{"type":21,"tag":209,"props":25669,"children":25670},{"class":211,"line":2321},[25671,25675,25680,25684,25689,25693,25697,25702,25706,25710],{"type":21,"tag":209,"props":25672,"children":25673},{"style":216},[25674],{"type":26,"value":14505},{"type":21,"tag":209,"props":25676,"children":25677},{"style":222},[25678],{"type":26,"value":25679}," dbreq ",{"type":21,"tag":209,"props":25681,"children":25682},{"style":216},[25683],{"type":26,"value":1432},{"type":21,"tag":209,"props":25685,"children":25686},{"style":222},[25687],{"type":26,"value":25688}," idb.",{"type":21,"tag":209,"props":25690,"children":25691},{"style":360},[25692],{"type":26,"value":20680},{"type":21,"tag":209,"props":25694,"children":25695},{"style":222},[25696],{"type":26,"value":368},{"type":21,"tag":209,"props":25698,"children":25699},{"style":233},[25700],{"type":26,"value":25701},"\"jalic\"",{"type":21,"tag":209,"props":25703,"children":25704},{"style":222},[25705],{"type":26,"value":408},{"type":21,"tag":209,"props":25707,"children":25708},{"style":263},[25709],{"type":26,"value":3224},{"type":21,"tag":209,"props":25711,"children":25712},{"style":222},[25713],{"type":26,"value":2608},{"type":21,"tag":209,"props":25715,"children":25716},{"class":211,"line":2372},[25717],{"type":21,"tag":209,"props":25718,"children":25719},{"emptyLinePlaceholder":248},[25720],{"type":26,"value":251},{"type":21,"tag":209,"props":25722,"children":25723},{"class":211,"line":2381},[25724],{"type":21,"tag":209,"props":25725,"children":25726},{"style":448},[25727],{"type":26,"value":2412},{"type":21,"tag":209,"props":25729,"children":25730},{"class":211,"line":2389},[25731],{"type":21,"tag":209,"props":25732,"children":25733},{"style":448},[25734],{"type":26,"value":25735},"         * Something went wrong when opening our db. This could range from the user refusing the\n",{"type":21,"tag":209,"props":25737,"children":25738},{"class":211,"line":2397},[25739],{"type":21,"tag":209,"props":25740,"children":25741},{"style":448},[25742],{"type":26,"value":25743},"         * request to allow this site to store data, to the current version of the db being higher\n",{"type":21,"tag":209,"props":25745,"children":25746},{"class":211,"line":2406},[25747],{"type":21,"tag":209,"props":25748,"children":25749},{"style":448},[25750],{"type":26,"value":25751},"         * than the one we requested, to storage issues or lacking implementation.\n",{"type":21,"tag":209,"props":25753,"children":25754},{"class":211,"line":2415},[25755,25760,25764],{"type":21,"tag":209,"props":25756,"children":25757},{"style":448},[25758],{"type":26,"value":25759},"         * ",{"type":21,"tag":209,"props":25761,"children":25762},{"style":216},[25763],{"type":26,"value":13311},{"type":21,"tag":209,"props":25765,"children":25766},{"style":222},[25767],{"type":26,"value":25768}," event\n",{"type":21,"tag":209,"props":25770,"children":25771},{"class":211,"line":2424},[25772],{"type":21,"tag":209,"props":25773,"children":25774},{"style":448},[25775],{"type":26,"value":2439},{"type":21,"tag":209,"props":25777,"children":25778},{"class":211,"line":2433},[25779,25784,25789,25793,25797,25801,25806],{"type":21,"tag":209,"props":25780,"children":25781},{"style":222},[25782],{"type":26,"value":25783},"        dbreq.",{"type":21,"tag":209,"props":25785,"children":25786},{"style":360},[25787],{"type":26,"value":25788},"onerror",{"type":21,"tag":209,"props":25790,"children":25791},{"style":216},[25792],{"type":26,"value":271},{"type":21,"tag":209,"props":25794,"children":25795},{"style":216},[25796],{"type":26,"value":4789},{"type":21,"tag":209,"props":25798,"children":25799},{"style":222},[25800],{"type":26,"value":368},{"type":21,"tag":209,"props":25802,"children":25803},{"style":400},[25804],{"type":26,"value":25805},"event",{"type":21,"tag":209,"props":25807,"children":25808},{"style":222},[25809],{"type":26,"value":2369},{"type":21,"tag":209,"props":25811,"children":25812},{"class":211,"line":2442},[25813,25817,25821],{"type":21,"tag":209,"props":25814,"children":25815},{"style":222},[25816],{"type":26,"value":2495},{"type":21,"tag":209,"props":25818,"children":25819},{"style":360},[25820],{"type":26,"value":1059},{"type":21,"tag":209,"props":25822,"children":25823},{"style":222},[25824],{"type":26,"value":25825},"(event);\n",{"type":21,"tag":209,"props":25827,"children":25828},{"class":211,"line":2471},[25829,25834,25838],{"type":21,"tag":209,"props":25830,"children":25831},{"style":222},[25832],{"type":26,"value":25833},"            dbReady.",{"type":21,"tag":209,"props":25835,"children":25836},{"style":360},[25837],{"type":26,"value":14182},{"type":21,"tag":209,"props":25839,"children":25840},{"style":222},[25841],{"type":26,"value":25825},{"type":21,"tag":209,"props":25843,"children":25844},{"class":211,"line":2480},[25845],{"type":21,"tag":209,"props":25846,"children":25847},{"style":222},[25848],{"type":26,"value":14955},{"type":21,"tag":209,"props":25850,"children":25851},{"class":211,"line":2489},[25852],{"type":21,"tag":209,"props":25853,"children":25854},{"emptyLinePlaceholder":248},[25855],{"type":26,"value":251},{"type":21,"tag":209,"props":25857,"children":25858},{"class":211,"line":2516},[25859],{"type":21,"tag":209,"props":25860,"children":25861},{"style":448},[25862],{"type":26,"value":2412},{"type":21,"tag":209,"props":25864,"children":25865},{"class":211,"line":2525},[25866],{"type":21,"tag":209,"props":25867,"children":25868},{"style":448},[25869],{"type":26,"value":25870},"         * The on upgrade needed event is called whenever we're opening a database with a version number\n",{"type":21,"tag":209,"props":25872,"children":25873},{"class":211,"line":2533},[25874],{"type":21,"tag":209,"props":25875,"children":25876},{"style":448},[25877],{"type":26,"value":25878},"         * higher than the currently existing version number, which includes when the database doesn't\n",{"type":21,"tag":209,"props":25880,"children":25881},{"class":211,"line":2542},[25882],{"type":21,"tag":209,"props":25883,"children":25884},{"style":448},[25885],{"type":26,"value":25886},"         * currently exist. Within this function we define the structure of the db.\n",{"type":21,"tag":209,"props":25888,"children":25889},{"class":211,"line":2550},[25890,25894,25898],{"type":21,"tag":209,"props":25891,"children":25892},{"style":448},[25893],{"type":26,"value":25759},{"type":21,"tag":209,"props":25895,"children":25896},{"style":216},[25897],{"type":26,"value":13311},{"type":21,"tag":209,"props":25899,"children":25900},{"style":222},[25901],{"type":26,"value":25768},{"type":21,"tag":209,"props":25903,"children":25904},{"class":211,"line":2564},[25905],{"type":21,"tag":209,"props":25906,"children":25907},{"style":448},[25908],{"type":26,"value":2439},{"type":21,"tag":209,"props":25910,"children":25911},{"class":211,"line":2611},[25912,25916,25921,25925,25929,25933,25937],{"type":21,"tag":209,"props":25913,"children":25914},{"style":222},[25915],{"type":26,"value":25783},{"type":21,"tag":209,"props":25917,"children":25918},{"style":360},[25919],{"type":26,"value":25920},"onupgradeneeded",{"type":21,"tag":209,"props":25922,"children":25923},{"style":216},[25924],{"type":26,"value":271},{"type":21,"tag":209,"props":25926,"children":25927},{"style":216},[25928],{"type":26,"value":4789},{"type":21,"tag":209,"props":25930,"children":25931},{"style":222},[25932],{"type":26,"value":368},{"type":21,"tag":209,"props":25934,"children":25935},{"style":400},[25936],{"type":26,"value":25805},{"type":21,"tag":209,"props":25938,"children":25939},{"style":222},[25940],{"type":26,"value":2369},{"type":21,"tag":209,"props":25942,"children":25943},{"class":211,"line":2619},[25944,25948],{"type":21,"tag":209,"props":25945,"children":25946},{"style":216},[25947],{"type":26,"value":14539},{"type":21,"tag":209,"props":25949,"children":25950},{"style":222},[25951],{"type":26,"value":25952}," objectStore;\n",{"type":21,"tag":209,"props":25954,"children":25955},{"class":211,"line":2627},[25956],{"type":21,"tag":209,"props":25957,"children":25958},{"emptyLinePlaceholder":248},[25959],{"type":26,"value":251},{"type":21,"tag":209,"props":25961,"children":25962},{"class":211,"line":2636},[25963,25968,25972],{"type":21,"tag":209,"props":25964,"children":25965},{"style":222},[25966],{"type":26,"value":25967},"            db ",{"type":21,"tag":209,"props":25969,"children":25970},{"style":216},[25971],{"type":26,"value":1432},{"type":21,"tag":209,"props":25973,"children":25974},{"style":222},[25975],{"type":26,"value":25976}," event.target.result;\n",{"type":21,"tag":209,"props":25978,"children":25979},{"class":211,"line":2644},[25980,25985,25989,25993,25997,26001,26005],{"type":21,"tag":209,"props":25981,"children":25982},{"style":222},[25983],{"type":26,"value":25984},"            db.",{"type":21,"tag":209,"props":25986,"children":25987},{"style":360},[25988],{"type":26,"value":25788},{"type":21,"tag":209,"props":25990,"children":25991},{"style":216},[25992],{"type":26,"value":271},{"type":21,"tag":209,"props":25994,"children":25995},{"style":216},[25996],{"type":26,"value":4789},{"type":21,"tag":209,"props":25998,"children":25999},{"style":222},[26000],{"type":26,"value":368},{"type":21,"tag":209,"props":26002,"children":26003},{"style":400},[26004],{"type":26,"value":25805},{"type":21,"tag":209,"props":26006,"children":26007},{"style":222},[26008],{"type":26,"value":2369},{"type":21,"tag":209,"props":26010,"children":26011},{"class":211,"line":2657},[26012,26016,26020],{"type":21,"tag":209,"props":26013,"children":26014},{"style":222},[26015],{"type":26,"value":2764},{"type":21,"tag":209,"props":26017,"children":26018},{"style":360},[26019],{"type":26,"value":1059},{"type":21,"tag":209,"props":26021,"children":26022},{"style":222},[26023],{"type":26,"value":25825},{"type":21,"tag":209,"props":26025,"children":26026},{"class":211,"line":2728},[26027],{"type":21,"tag":209,"props":26028,"children":26029},{"style":222},[26030],{"type":26,"value":14946},{"type":21,"tag":209,"props":26032,"children":26033},{"class":211,"line":2758},[26034],{"type":21,"tag":209,"props":26035,"children":26036},{"emptyLinePlaceholder":248},[26037],{"type":26,"value":251},{"type":21,"tag":209,"props":26039,"children":26040},{"class":211,"line":2776},[26041,26046,26050,26055,26060,26064,26069,26074,26079],{"type":21,"tag":209,"props":26042,"children":26043},{"style":222},[26044],{"type":26,"value":26045},"            objectStore ",{"type":21,"tag":209,"props":26047,"children":26048},{"style":216},[26049],{"type":26,"value":1432},{"type":21,"tag":209,"props":26051,"children":26052},{"style":222},[26053],{"type":26,"value":26054}," db.",{"type":21,"tag":209,"props":26056,"children":26057},{"style":360},[26058],{"type":26,"value":26059},"createObjectStore",{"type":21,"tag":209,"props":26061,"children":26062},{"style":222},[26063],{"type":26,"value":368},{"type":21,"tag":209,"props":26065,"children":26066},{"style":233},[26067],{"type":26,"value":26068},"\"jalicData\"",{"type":21,"tag":209,"props":26070,"children":26071},{"style":222},[26072],{"type":26,"value":26073},", {keyPath:",{"type":21,"tag":209,"props":26075,"children":26076},{"style":233},[26077],{"type":26,"value":26078},"\"jdName\"",{"type":21,"tag":209,"props":26080,"children":26081},{"style":222},[26082],{"type":26,"value":469},{"type":21,"tag":209,"props":26084,"children":26085},{"class":211,"line":2785},[26086,26091,26096,26100,26105,26109,26113,26118,26122],{"type":21,"tag":209,"props":26087,"children":26088},{"style":222},[26089],{"type":26,"value":26090},"            objectStore.",{"type":21,"tag":209,"props":26092,"children":26093},{"style":360},[26094],{"type":26,"value":26095},"createIndex",{"type":21,"tag":209,"props":26097,"children":26098},{"style":222},[26099],{"type":26,"value":368},{"type":21,"tag":209,"props":26101,"children":26102},{"style":233},[26103],{"type":26,"value":26104},"\"storedAt\"",{"type":21,"tag":209,"props":26106,"children":26107},{"style":222},[26108],{"type":26,"value":408},{"type":21,"tag":209,"props":26110,"children":26111},{"style":233},[26112],{"type":26,"value":26104},{"type":21,"tag":209,"props":26114,"children":26115},{"style":222},[26116],{"type":26,"value":26117},", {unique:",{"type":21,"tag":209,"props":26119,"children":26120},{"style":263},[26121],{"type":26,"value":4243},{"type":21,"tag":209,"props":26123,"children":26124},{"style":222},[26125],{"type":26,"value":469},{"type":21,"tag":209,"props":26127,"children":26128},{"class":211,"line":2793},[26129],{"type":21,"tag":209,"props":26130,"children":26131},{"emptyLinePlaceholder":248},[26132],{"type":26,"value":251},{"type":21,"tag":209,"props":26134,"children":26135},{"class":211,"line":2801},[26136,26141,26146,26150,26154,26158,26162],{"type":21,"tag":209,"props":26137,"children":26138},{"style":222},[26139],{"type":26,"value":26140},"            objectStore.transaction.",{"type":21,"tag":209,"props":26142,"children":26143},{"style":360},[26144],{"type":26,"value":26145},"oncomplete",{"type":21,"tag":209,"props":26147,"children":26148},{"style":216},[26149],{"type":26,"value":271},{"type":21,"tag":209,"props":26151,"children":26152},{"style":216},[26153],{"type":26,"value":4789},{"type":21,"tag":209,"props":26155,"children":26156},{"style":222},[26157],{"type":26,"value":368},{"type":21,"tag":209,"props":26159,"children":26160},{"style":400},[26161],{"type":26,"value":25805},{"type":21,"tag":209,"props":26163,"children":26164},{"style":222},[26165],{"type":26,"value":2369},{"type":21,"tag":209,"props":26167,"children":26168},{"class":211,"line":2809},[26169,26174,26178],{"type":21,"tag":209,"props":26170,"children":26171},{"style":222},[26172],{"type":26,"value":26173},"                dbReady.",{"type":21,"tag":209,"props":26175,"children":26176},{"style":360},[26177],{"type":26,"value":14173},{"type":21,"tag":209,"props":26179,"children":26180},{"style":222},[26181],{"type":26,"value":4123},{"type":21,"tag":209,"props":26183,"children":26184},{"class":211,"line":10937},[26185],{"type":21,"tag":209,"props":26186,"children":26187},{"style":222},[26188],{"type":26,"value":14946},{"type":21,"tag":209,"props":26190,"children":26191},{"class":211,"line":10967},[26192],{"type":21,"tag":209,"props":26193,"children":26194},{"style":222},[26195],{"type":26,"value":14955},{"type":21,"tag":209,"props":26197,"children":26198},{"class":211,"line":11003},[26199],{"type":21,"tag":209,"props":26200,"children":26201},{"emptyLinePlaceholder":248},[26202],{"type":26,"value":251},{"type":21,"tag":209,"props":26204,"children":26205},{"class":211,"line":11038},[26206],{"type":21,"tag":209,"props":26207,"children":26208},{"style":448},[26209],{"type":26,"value":2412},{"type":21,"tag":209,"props":26211,"children":26212},{"class":211,"line":11072},[26213],{"type":21,"tag":209,"props":26214,"children":26215},{"style":448},[26216],{"type":26,"value":26217},"         * DB was opened successfully, with no upgrade needed.\n",{"type":21,"tag":209,"props":26219,"children":26220},{"class":211,"line":11106},[26221,26225,26229],{"type":21,"tag":209,"props":26222,"children":26223},{"style":448},[26224],{"type":26,"value":25759},{"type":21,"tag":209,"props":26226,"children":26227},{"style":216},[26228],{"type":26,"value":13311},{"type":21,"tag":209,"props":26230,"children":26231},{"style":222},[26232],{"type":26,"value":25768},{"type":21,"tag":209,"props":26234,"children":26235},{"class":211,"line":11114},[26236],{"type":21,"tag":209,"props":26237,"children":26238},{"style":448},[26239],{"type":26,"value":2439},{"type":21,"tag":209,"props":26241,"children":26242},{"class":211,"line":14940},[26243,26247,26252,26256,26260,26264,26268],{"type":21,"tag":209,"props":26244,"children":26245},{"style":222},[26246],{"type":26,"value":25783},{"type":21,"tag":209,"props":26248,"children":26249},{"style":360},[26250],{"type":26,"value":26251},"onsuccess",{"type":21,"tag":209,"props":26253,"children":26254},{"style":216},[26255],{"type":26,"value":271},{"type":21,"tag":209,"props":26257,"children":26258},{"style":216},[26259],{"type":26,"value":4789},{"type":21,"tag":209,"props":26261,"children":26262},{"style":222},[26263],{"type":26,"value":368},{"type":21,"tag":209,"props":26265,"children":26266},{"style":400},[26267],{"type":26,"value":25805},{"type":21,"tag":209,"props":26269,"children":26270},{"style":222},[26271],{"type":26,"value":2369},{"type":21,"tag":209,"props":26273,"children":26274},{"class":211,"line":14949},[26275,26279,26283],{"type":21,"tag":209,"props":26276,"children":26277},{"style":222},[26278],{"type":26,"value":25967},{"type":21,"tag":209,"props":26280,"children":26281},{"style":216},[26282],{"type":26,"value":1432},{"type":21,"tag":209,"props":26284,"children":26285},{"style":222},[26286],{"type":26,"value":25976},{"type":21,"tag":209,"props":26288,"children":26289},{"class":211,"line":14958},[26290,26294,26298],{"type":21,"tag":209,"props":26291,"children":26292},{"style":222},[26293],{"type":26,"value":25833},{"type":21,"tag":209,"props":26295,"children":26296},{"style":360},[26297],{"type":26,"value":14173},{"type":21,"tag":209,"props":26299,"children":26300},{"style":222},[26301],{"type":26,"value":4123},{"type":21,"tag":209,"props":26303,"children":26304},{"class":211,"line":14966},[26305],{"type":21,"tag":209,"props":26306,"children":26307},{"style":222},[26308],{"type":26,"value":14955},{"type":21,"tag":209,"props":26310,"children":26311},{"class":211,"line":14975},[26312],{"type":21,"tag":209,"props":26313,"children":26314},{"emptyLinePlaceholder":248},[26315],{"type":26,"value":251},{"type":21,"tag":209,"props":26317,"children":26318},{"class":211,"line":14984},[26319,26323,26328,26333],{"type":21,"tag":209,"props":26320,"children":26321},{"style":216},[26322],{"type":26,"value":3069},{"type":21,"tag":209,"props":26324,"children":26325},{"style":222},[26326],{"type":26,"value":26327}," dbReady.",{"type":21,"tag":209,"props":26329,"children":26330},{"style":360},[26331],{"type":26,"value":26332},"promise",{"type":21,"tag":209,"props":26334,"children":26335},{"style":222},[26336],{"type":26,"value":4123},{"type":21,"tag":209,"props":26338,"children":26339},{"class":211,"line":15018},[26340],{"type":21,"tag":209,"props":26341,"children":26342},{"style":222},[26343],{"type":26,"value":331},{"type":21,"tag":209,"props":26345,"children":26346},{"class":211,"line":15050},[26347],{"type":21,"tag":209,"props":26348,"children":26349},{"emptyLinePlaceholder":248},[26350],{"type":26,"value":251},{"type":21,"tag":209,"props":26352,"children":26353},{"class":211,"line":15082},[26354,26359],{"type":21,"tag":209,"props":26355,"children":26356},{"style":360},[26357],{"type":26,"value":26358},"    createDatabase",{"type":21,"tag":209,"props":26360,"children":26361},{"style":222},[26362],{"type":26,"value":26363},"(idb);\n",{"type":21,"tag":209,"props":26365,"children":26366},{"class":211,"line":15090},[26367],{"type":21,"tag":209,"props":26368,"children":26369},{"emptyLinePlaceholder":248},[26370],{"type":26,"value":251},{"type":21,"tag":209,"props":26372,"children":26373},{"class":211,"line":15098},[26374],{"type":21,"tag":209,"props":26375,"children":26376},{"style":448},[26377],{"type":26,"value":13290},{"type":21,"tag":209,"props":26379,"children":26380},{"class":211,"line":15106},[26381],{"type":21,"tag":209,"props":26382,"children":26383},{"style":448},[26384],{"type":26,"value":26385},"     * Define a simple interface mimicking the Storage interface on the jQuery object, with the major difference being\n",{"type":21,"tag":209,"props":26387,"children":26388},{"class":211,"line":15114},[26389],{"type":21,"tag":209,"props":26390,"children":26391},{"style":448},[26392],{"type":26,"value":26393},"     * everything executes asynchronously, and returns a $.Deferred object to account for that.\n",{"type":21,"tag":209,"props":26395,"children":26396},{"class":211,"line":15123},[26397],{"type":21,"tag":209,"props":26398,"children":26399},{"style":448},[26400],{"type":26,"value":13346},{"type":21,"tag":209,"props":26402,"children":26403},{"class":211,"line":15143},[26404,26409,26413],{"type":21,"tag":209,"props":26405,"children":26406},{"style":222},[26407],{"type":26,"value":26408},"    $.jidb ",{"type":21,"tag":209,"props":26410,"children":26411},{"style":216},[26412],{"type":26,"value":1432},{"type":21,"tag":209,"props":26414,"children":26415},{"style":222},[26416],{"type":26,"value":276},{"type":21,"tag":209,"props":26418,"children":26419},{"class":211,"line":15160},[26420],{"type":21,"tag":209,"props":26421,"children":26422},{"style":448},[26423],{"type":26,"value":2412},{"type":21,"tag":209,"props":26425,"children":26426},{"class":211,"line":15168},[26427],{"type":21,"tag":209,"props":26428,"children":26429},{"style":448},[26430],{"type":26,"value":26431},"         * Set an item within the jalicData objectStore, using the given jdName and data, with optionally\n",{"type":21,"tag":209,"props":26433,"children":26434},{"class":211,"line":15196},[26435],{"type":21,"tag":209,"props":26436,"children":26437},{"style":448},[26438],{"type":26,"value":26439},"         * a dataType parameter to store alongside the data. If dataType is not provided, it is the result of\n",{"type":21,"tag":209,"props":26441,"children":26442},{"class":211,"line":15219},[26443],{"type":21,"tag":209,"props":26444,"children":26445},{"style":448},[26446],{"type":26,"value":26447},"         * typeof data.\n",{"type":21,"tag":209,"props":26449,"children":26450},{"class":211,"line":15240},[26451],{"type":21,"tag":209,"props":26452,"children":26453},{"style":448},[26454],{"type":26,"value":26455},"         * Notice that we 'put' data, rather than add it - that means we will always overwrite data with an\n",{"type":21,"tag":209,"props":26457,"children":26458},{"class":211,"line":15248},[26459],{"type":21,"tag":209,"props":26460,"children":26461},{"style":448},[26462],{"type":26,"value":26463},"         * identical key (jdName), if it already exists.\n",{"type":21,"tag":209,"props":26465,"children":26466},{"class":211,"line":15256},[26467,26471,26475],{"type":21,"tag":209,"props":26468,"children":26469},{"style":448},[26470],{"type":26,"value":25759},{"type":21,"tag":209,"props":26472,"children":26473},{"style":216},[26474],{"type":26,"value":13311},{"type":21,"tag":209,"props":26476,"children":26477},{"style":222},[26478],{"type":26,"value":26479}," jdName\n",{"type":21,"tag":209,"props":26481,"children":26482},{"class":211,"line":15284},[26483,26487,26491],{"type":21,"tag":209,"props":26484,"children":26485},{"style":448},[26486],{"type":26,"value":25759},{"type":21,"tag":209,"props":26488,"children":26489},{"style":216},[26490],{"type":26,"value":13311},{"type":21,"tag":209,"props":26492,"children":26493},{"style":222},[26494],{"type":26,"value":26495}," data\n",{"type":21,"tag":209,"props":26497,"children":26498},{"class":211,"line":15317},[26499,26503,26507],{"type":21,"tag":209,"props":26500,"children":26501},{"style":448},[26502],{"type":26,"value":25759},{"type":21,"tag":209,"props":26504,"children":26505},{"style":216},[26506],{"type":26,"value":13311},{"type":21,"tag":209,"props":26508,"children":26509},{"style":222},[26510],{"type":26,"value":17452},{"type":21,"tag":209,"props":26512,"children":26513},{"class":211,"line":15331},[26514,26518,26522,26527],{"type":21,"tag":209,"props":26515,"children":26516},{"style":448},[26517],{"type":26,"value":25759},{"type":21,"tag":209,"props":26519,"children":26520},{"style":216},[26521],{"type":26,"value":13333},{"type":21,"tag":209,"props":26523,"children":26524},{"style":360},[26525],{"type":26,"value":26526}," {$.Deferred}",{"type":21,"tag":209,"props":26528,"children":26529},{"style":448},[26530],{"type":26,"value":26531}," Returns a jQuery Deferred object, which resolves with an empty body on success,\n",{"type":21,"tag":209,"props":26533,"children":26534},{"class":211,"line":15339},[26535],{"type":21,"tag":209,"props":26536,"children":26537},{"style":448},[26538],{"type":26,"value":26539},"         * or else resolves with the transaction or request error on failure.\n",{"type":21,"tag":209,"props":26541,"children":26542},{"class":211,"line":15352},[26543],{"type":21,"tag":209,"props":26544,"children":26545},{"style":448},[26546],{"type":26,"value":2439},{"type":21,"tag":209,"props":26548,"children":26549},{"class":211,"line":15382},[26550,26555,26559,26563,26567,26572,26576,26580,26584,26588],{"type":21,"tag":209,"props":26551,"children":26552},{"style":360},[26553],{"type":26,"value":26554},"        setItem",{"type":21,"tag":209,"props":26556,"children":26557},{"style":222},[26558],{"type":26,"value":191},{"type":21,"tag":209,"props":26560,"children":26561},{"style":216},[26562],{"type":26,"value":4622},{"type":21,"tag":209,"props":26564,"children":26565},{"style":222},[26566],{"type":26,"value":368},{"type":21,"tag":209,"props":26568,"children":26569},{"style":400},[26570],{"type":26,"value":26571},"jdName",{"type":21,"tag":209,"props":26573,"children":26574},{"style":222},[26575],{"type":26,"value":408},{"type":21,"tag":209,"props":26577,"children":26578},{"style":400},[26579],{"type":26,"value":2863},{"type":21,"tag":209,"props":26581,"children":26582},{"style":222},[26583],{"type":26,"value":408},{"type":21,"tag":209,"props":26585,"children":26586},{"style":400},[26587],{"type":26,"value":17505},{"type":21,"tag":209,"props":26589,"children":26590},{"style":222},[26591],{"type":26,"value":2369},{"type":21,"tag":209,"props":26593,"children":26594},{"class":211,"line":15400},[26595,26599,26604,26608,26612,26616],{"type":21,"tag":209,"props":26596,"children":26597},{"style":216},[26598],{"type":26,"value":14539},{"type":21,"tag":209,"props":26600,"children":26601},{"style":222},[26602],{"type":26,"value":26603}," defer ",{"type":21,"tag":209,"props":26605,"children":26606},{"style":216},[26607],{"type":26,"value":1432},{"type":21,"tag":209,"props":26609,"children":26610},{"style":222},[26611],{"type":26,"value":25427},{"type":21,"tag":209,"props":26613,"children":26614},{"style":360},[26615],{"type":26,"value":25432},{"type":21,"tag":209,"props":26617,"children":26618},{"style":222},[26619],{"type":26,"value":13988},{"type":21,"tag":209,"props":26621,"children":26622},{"class":211,"line":15409},[26623,26628,26632,26636,26641,26645,26649,26654,26659],{"type":21,"tag":209,"props":26624,"children":26625},{"style":222},[26626],{"type":26,"value":26627},"                transaction ",{"type":21,"tag":209,"props":26629,"children":26630},{"style":216},[26631],{"type":26,"value":1432},{"type":21,"tag":209,"props":26633,"children":26634},{"style":222},[26635],{"type":26,"value":26054},{"type":21,"tag":209,"props":26637,"children":26638},{"style":360},[26639],{"type":26,"value":26640},"transaction",{"type":21,"tag":209,"props":26642,"children":26643},{"style":222},[26644],{"type":26,"value":22133},{"type":21,"tag":209,"props":26646,"children":26647},{"style":233},[26648],{"type":26,"value":26068},{"type":21,"tag":209,"props":26650,"children":26651},{"style":222},[26652],{"type":26,"value":26653},"], ",{"type":21,"tag":209,"props":26655,"children":26656},{"style":233},[26657],{"type":26,"value":26658},"\"readwrite\"",{"type":21,"tag":209,"props":26660,"children":26661},{"style":222},[26662],{"type":26,"value":5404},{"type":21,"tag":209,"props":26664,"children":26665},{"class":211,"line":15433},[26666,26671,26675,26680,26685,26689,26693],{"type":21,"tag":209,"props":26667,"children":26668},{"style":222},[26669],{"type":26,"value":26670},"                objectStore ",{"type":21,"tag":209,"props":26672,"children":26673},{"style":216},[26674],{"type":26,"value":1432},{"type":21,"tag":209,"props":26676,"children":26677},{"style":222},[26678],{"type":26,"value":26679}," transaction.",{"type":21,"tag":209,"props":26681,"children":26682},{"style":360},[26683],{"type":26,"value":26684},"objectStore",{"type":21,"tag":209,"props":26686,"children":26687},{"style":222},[26688],{"type":26,"value":368},{"type":21,"tag":209,"props":26690,"children":26691},{"style":233},[26692],{"type":26,"value":26068},{"type":21,"tag":209,"props":26694,"children":26695},{"style":222},[26696],{"type":26,"value":5404},{"type":21,"tag":209,"props":26698,"children":26699},{"class":211,"line":15441},[26700],{"type":21,"tag":209,"props":26701,"children":26702},{"style":222},[26703],{"type":26,"value":26704},"                request;\n",{"type":21,"tag":209,"props":26706,"children":26707},{"class":211,"line":15449},[26708],{"type":21,"tag":209,"props":26709,"children":26710},{"emptyLinePlaceholder":248},[26711],{"type":26,"value":251},{"type":21,"tag":209,"props":26713,"children":26714},{"class":211,"line":15467},[26715,26719,26723,26728,26732,26736],{"type":21,"tag":209,"props":26716,"children":26717},{"style":222},[26718],{"type":26,"value":18897},{"type":21,"tag":209,"props":26720,"children":26721},{"style":216},[26722],{"type":26,"value":1432},{"type":21,"tag":209,"props":26724,"children":26725},{"style":222},[26726],{"type":26,"value":26727}," dataType ",{"type":21,"tag":209,"props":26729,"children":26730},{"style":216},[26731],{"type":26,"value":13270},{"type":21,"tag":209,"props":26733,"children":26734},{"style":216},[26735],{"type":26,"value":19938},{"type":21,"tag":209,"props":26737,"children":26738},{"style":222},[26739],{"type":26,"value":1303},{"type":21,"tag":209,"props":26741,"children":26742},{"class":211,"line":15475},[26743],{"type":21,"tag":209,"props":26744,"children":26745},{"emptyLinePlaceholder":248},[26746],{"type":26,"value":251},{"type":21,"tag":209,"props":26748,"children":26749},{"class":211,"line":15487},[26750,26755,26759,26763,26767],{"type":21,"tag":209,"props":26751,"children":26752},{"style":222},[26753],{"type":26,"value":26754},"            transaction.",{"type":21,"tag":209,"props":26756,"children":26757},{"style":360},[26758],{"type":26,"value":26145},{"type":21,"tag":209,"props":26760,"children":26761},{"style":216},[26762],{"type":26,"value":271},{"type":21,"tag":209,"props":26764,"children":26765},{"style":216},[26766],{"type":26,"value":4789},{"type":21,"tag":209,"props":26768,"children":26769},{"style":222},[26770],{"type":26,"value":2561},{"type":21,"tag":209,"props":26772,"children":26773},{"class":211,"line":15495},[26774,26778,26783,26787],{"type":21,"tag":209,"props":26775,"children":26776},{"style":216},[26777],{"type":26,"value":14236},{"type":21,"tag":209,"props":26779,"children":26780},{"style":222},[26781],{"type":26,"value":26782}," defer.",{"type":21,"tag":209,"props":26784,"children":26785},{"style":360},[26786],{"type":26,"value":14173},{"type":21,"tag":209,"props":26788,"children":26789},{"style":222},[26790],{"type":26,"value":4123},{"type":21,"tag":209,"props":26792,"children":26793},{"class":211,"line":15503},[26794],{"type":21,"tag":209,"props":26795,"children":26796},{"style":222},[26797],{"type":26,"value":14946},{"type":21,"tag":209,"props":26799,"children":26800},{"class":211,"line":15511},[26801],{"type":21,"tag":209,"props":26802,"children":26803},{"emptyLinePlaceholder":248},[26804],{"type":26,"value":251},{"type":21,"tag":209,"props":26806,"children":26807},{"class":211,"line":15520},[26808,26812,26816,26820,26824,26828,26832],{"type":21,"tag":209,"props":26809,"children":26810},{"style":222},[26811],{"type":26,"value":26754},{"type":21,"tag":209,"props":26813,"children":26814},{"style":360},[26815],{"type":26,"value":25788},{"type":21,"tag":209,"props":26817,"children":26818},{"style":216},[26819],{"type":26,"value":271},{"type":21,"tag":209,"props":26821,"children":26822},{"style":216},[26823],{"type":26,"value":4789},{"type":21,"tag":209,"props":26825,"children":26826},{"style":222},[26827],{"type":26,"value":368},{"type":21,"tag":209,"props":26829,"children":26830},{"style":400},[26831],{"type":26,"value":25805},{"type":21,"tag":209,"props":26833,"children":26834},{"style":222},[26835],{"type":26,"value":2369},{"type":21,"tag":209,"props":26837,"children":26838},{"class":211,"line":15529},[26839,26843,26847],{"type":21,"tag":209,"props":26840,"children":26841},{"style":222},[26842],{"type":26,"value":2764},{"type":21,"tag":209,"props":26844,"children":26845},{"style":360},[26846],{"type":26,"value":1059},{"type":21,"tag":209,"props":26848,"children":26849},{"style":222},[26850],{"type":26,"value":25825},{"type":21,"tag":209,"props":26852,"children":26853},{"class":211,"line":15545},[26854,26858,26862,26866],{"type":21,"tag":209,"props":26855,"children":26856},{"style":216},[26857],{"type":26,"value":14236},{"type":21,"tag":209,"props":26859,"children":26860},{"style":222},[26861],{"type":26,"value":26782},{"type":21,"tag":209,"props":26863,"children":26864},{"style":360},[26865],{"type":26,"value":14182},{"type":21,"tag":209,"props":26867,"children":26868},{"style":222},[26869],{"type":26,"value":25825},{"type":21,"tag":209,"props":26871,"children":26872},{"class":211,"line":15561},[26873],{"type":21,"tag":209,"props":26874,"children":26875},{"style":222},[26876],{"type":26,"value":14946},{"type":21,"tag":209,"props":26878,"children":26879},{"class":211,"line":15569},[26880],{"type":21,"tag":209,"props":26881,"children":26882},{"emptyLinePlaceholder":248},[26883],{"type":26,"value":251},{"type":21,"tag":209,"props":26885,"children":26886},{"class":211,"line":15593},[26887,26892,26896,26901,26906,26911,26915,26919],{"type":21,"tag":209,"props":26888,"children":26889},{"style":222},[26890],{"type":26,"value":26891},"            request ",{"type":21,"tag":209,"props":26893,"children":26894},{"style":216},[26895],{"type":26,"value":1432},{"type":21,"tag":209,"props":26897,"children":26898},{"style":222},[26899],{"type":26,"value":26900}," objectStore.",{"type":21,"tag":209,"props":26902,"children":26903},{"style":360},[26904],{"type":26,"value":26905},"put",{"type":21,"tag":209,"props":26907,"children":26908},{"style":222},[26909],{"type":26,"value":26910},"({jdName:jdName, storedAt:",{"type":21,"tag":209,"props":26912,"children":26913},{"style":216},[26914],{"type":26,"value":17184},{"type":21,"tag":209,"props":26916,"children":26917},{"style":360},[26918],{"type":26,"value":17189},{"type":21,"tag":209,"props":26920,"children":26921},{"style":222},[26922],{"type":26,"value":26923},"(), dataType:dataType, data:data});\n",{"type":21,"tag":209,"props":26925,"children":26926},{"class":211,"line":15634},[26927],{"type":21,"tag":209,"props":26928,"children":26929},{"emptyLinePlaceholder":248},[26930],{"type":26,"value":251},{"type":21,"tag":209,"props":26932,"children":26933},{"class":211,"line":15662},[26934,26939,26943,26947,26951,26955,26959],{"type":21,"tag":209,"props":26935,"children":26936},{"style":222},[26937],{"type":26,"value":26938},"            request.",{"type":21,"tag":209,"props":26940,"children":26941},{"style":360},[26942],{"type":26,"value":25788},{"type":21,"tag":209,"props":26944,"children":26945},{"style":216},[26946],{"type":26,"value":271},{"type":21,"tag":209,"props":26948,"children":26949},{"style":216},[26950],{"type":26,"value":4789},{"type":21,"tag":209,"props":26952,"children":26953},{"style":222},[26954],{"type":26,"value":368},{"type":21,"tag":209,"props":26956,"children":26957},{"style":400},[26958],{"type":26,"value":25805},{"type":21,"tag":209,"props":26960,"children":26961},{"style":222},[26962],{"type":26,"value":2369},{"type":21,"tag":209,"props":26964,"children":26965},{"class":211,"line":15678},[26966,26970,26974],{"type":21,"tag":209,"props":26967,"children":26968},{"style":222},[26969],{"type":26,"value":2764},{"type":21,"tag":209,"props":26971,"children":26972},{"style":360},[26973],{"type":26,"value":1059},{"type":21,"tag":209,"props":26975,"children":26976},{"style":222},[26977],{"type":26,"value":25825},{"type":21,"tag":209,"props":26979,"children":26980},{"class":211,"line":15694},[26981,26986,26990],{"type":21,"tag":209,"props":26982,"children":26983},{"style":222},[26984],{"type":26,"value":26985},"                defer.",{"type":21,"tag":209,"props":26987,"children":26988},{"style":360},[26989],{"type":26,"value":14182},{"type":21,"tag":209,"props":26991,"children":26992},{"style":222},[26993],{"type":26,"value":25825},{"type":21,"tag":209,"props":26995,"children":26996},{"class":211,"line":15710},[26997],{"type":21,"tag":209,"props":26998,"children":26999},{"style":222},[27000],{"type":26,"value":14946},{"type":21,"tag":209,"props":27002,"children":27003},{"class":211,"line":15718},[27004],{"type":21,"tag":209,"props":27005,"children":27006},{"emptyLinePlaceholder":248},[27007],{"type":26,"value":251},{"type":21,"tag":209,"props":27009,"children":27010},{"class":211,"line":15730},[27011,27015,27019,27023],{"type":21,"tag":209,"props":27012,"children":27013},{"style":216},[27014],{"type":26,"value":13689},{"type":21,"tag":209,"props":27016,"children":27017},{"style":222},[27018],{"type":26,"value":26782},{"type":21,"tag":209,"props":27020,"children":27021},{"style":360},[27022],{"type":26,"value":26332},{"type":21,"tag":209,"props":27024,"children":27025},{"style":222},[27026],{"type":26,"value":4123},{"type":21,"tag":209,"props":27028,"children":27029},{"class":211,"line":15738},[27030],{"type":21,"tag":209,"props":27031,"children":27032},{"style":222},[27033],{"type":26,"value":2522},{"type":21,"tag":209,"props":27035,"children":27036},{"class":211,"line":15746},[27037],{"type":21,"tag":209,"props":27038,"children":27039},{"style":448},[27040],{"type":26,"value":2412},{"type":21,"tag":209,"props":27042,"children":27043},{"class":211,"line":15754},[27044],{"type":21,"tag":209,"props":27045,"children":27046},{"style":448},[27047],{"type":26,"value":27048},"         * Retrieve an item from the jalicData objectStore, using the given jdName as the key.\n",{"type":21,"tag":209,"props":27050,"children":27051},{"class":211,"line":15767},[27052,27056,27060],{"type":21,"tag":209,"props":27053,"children":27054},{"style":448},[27055],{"type":26,"value":25759},{"type":21,"tag":209,"props":27057,"children":27058},{"style":216},[27059],{"type":26,"value":13311},{"type":21,"tag":209,"props":27061,"children":27062},{"style":222},[27063],{"type":26,"value":26479},{"type":21,"tag":209,"props":27065,"children":27066},{"class":211,"line":19592},[27067,27071,27075,27079],{"type":21,"tag":209,"props":27068,"children":27069},{"style":448},[27070],{"type":26,"value":25759},{"type":21,"tag":209,"props":27072,"children":27073},{"style":216},[27074],{"type":26,"value":13333},{"type":21,"tag":209,"props":27076,"children":27077},{"style":360},[27078],{"type":26,"value":26526},{"type":21,"tag":209,"props":27080,"children":27081},{"style":448},[27082],{"type":26,"value":27083}," Returns a jQuery Deferred object, which resolves with the request result as an object\n",{"type":21,"tag":209,"props":27085,"children":27086},{"class":211,"line":19601},[27087],{"type":21,"tag":209,"props":27088,"children":27089},{"style":448},[27090],{"type":26,"value":27091},"         * on success, or else resolves with the transaction or request error on failure.\n",{"type":21,"tag":209,"props":27093,"children":27094},{"class":211,"line":19615},[27095],{"type":21,"tag":209,"props":27096,"children":27097},{"style":448},[27098],{"type":26,"value":2439},{"type":21,"tag":209,"props":27100,"children":27101},{"class":211,"line":19624},[27102,27107,27111,27115,27119,27123],{"type":21,"tag":209,"props":27103,"children":27104},{"style":360},[27105],{"type":26,"value":27106},"        getItem",{"type":21,"tag":209,"props":27108,"children":27109},{"style":222},[27110],{"type":26,"value":191},{"type":21,"tag":209,"props":27112,"children":27113},{"style":216},[27114],{"type":26,"value":4622},{"type":21,"tag":209,"props":27116,"children":27117},{"style":222},[27118],{"type":26,"value":368},{"type":21,"tag":209,"props":27120,"children":27121},{"style":400},[27122],{"type":26,"value":26571},{"type":21,"tag":209,"props":27124,"children":27125},{"style":222},[27126],{"type":26,"value":2369},{"type":21,"tag":209,"props":27128,"children":27129},{"class":211,"line":19638},[27130,27134,27138,27142,27146,27150],{"type":21,"tag":209,"props":27131,"children":27132},{"style":216},[27133],{"type":26,"value":14539},{"type":21,"tag":209,"props":27135,"children":27136},{"style":222},[27137],{"type":26,"value":26603},{"type":21,"tag":209,"props":27139,"children":27140},{"style":216},[27141],{"type":26,"value":1432},{"type":21,"tag":209,"props":27143,"children":27144},{"style":222},[27145],{"type":26,"value":25427},{"type":21,"tag":209,"props":27147,"children":27148},{"style":360},[27149],{"type":26,"value":25432},{"type":21,"tag":209,"props":27151,"children":27152},{"style":222},[27153],{"type":26,"value":13988},{"type":21,"tag":209,"props":27155,"children":27156},{"class":211,"line":19652},[27157,27161,27165,27169,27173,27177,27181,27185,27190],{"type":21,"tag":209,"props":27158,"children":27159},{"style":222},[27160],{"type":26,"value":26627},{"type":21,"tag":209,"props":27162,"children":27163},{"style":216},[27164],{"type":26,"value":1432},{"type":21,"tag":209,"props":27166,"children":27167},{"style":222},[27168],{"type":26,"value":26054},{"type":21,"tag":209,"props":27170,"children":27171},{"style":360},[27172],{"type":26,"value":26640},{"type":21,"tag":209,"props":27174,"children":27175},{"style":222},[27176],{"type":26,"value":22133},{"type":21,"tag":209,"props":27178,"children":27179},{"style":233},[27180],{"type":26,"value":26068},{"type":21,"tag":209,"props":27182,"children":27183},{"style":222},[27184],{"type":26,"value":26653},{"type":21,"tag":209,"props":27186,"children":27187},{"style":233},[27188],{"type":26,"value":27189},"\"readonly\"",{"type":21,"tag":209,"props":27191,"children":27192},{"style":222},[27193],{"type":26,"value":5404},{"type":21,"tag":209,"props":27195,"children":27196},{"class":211,"line":19660},[27197,27201,27205,27209,27213,27217,27221],{"type":21,"tag":209,"props":27198,"children":27199},{"style":222},[27200],{"type":26,"value":26670},{"type":21,"tag":209,"props":27202,"children":27203},{"style":216},[27204],{"type":26,"value":1432},{"type":21,"tag":209,"props":27206,"children":27207},{"style":222},[27208],{"type":26,"value":26679},{"type":21,"tag":209,"props":27210,"children":27211},{"style":360},[27212],{"type":26,"value":26684},{"type":21,"tag":209,"props":27214,"children":27215},{"style":222},[27216],{"type":26,"value":368},{"type":21,"tag":209,"props":27218,"children":27219},{"style":233},[27220],{"type":26,"value":26068},{"type":21,"tag":209,"props":27222,"children":27223},{"style":222},[27224],{"type":26,"value":5404},{"type":21,"tag":209,"props":27226,"children":27227},{"class":211,"line":19701},[27228,27233,27237,27241,27245],{"type":21,"tag":209,"props":27229,"children":27230},{"style":222},[27231],{"type":26,"value":27232},"                request ",{"type":21,"tag":209,"props":27234,"children":27235},{"style":216},[27236],{"type":26,"value":1432},{"type":21,"tag":209,"props":27238,"children":27239},{"style":222},[27240],{"type":26,"value":26900},{"type":21,"tag":209,"props":27242,"children":27243},{"style":360},[27244],{"type":26,"value":7636},{"type":21,"tag":209,"props":27246,"children":27247},{"style":222},[27248],{"type":26,"value":27249},"(jdName);\n",{"type":21,"tag":209,"props":27251,"children":27252},{"class":211,"line":19726},[27253],{"type":21,"tag":209,"props":27254,"children":27255},{"emptyLinePlaceholder":248},[27256],{"type":26,"value":251},{"type":21,"tag":209,"props":27258,"children":27259},{"class":211,"line":19757},[27260,27264,27268,27272,27276,27280,27284],{"type":21,"tag":209,"props":27261,"children":27262},{"style":222},[27263],{"type":26,"value":26938},{"type":21,"tag":209,"props":27265,"children":27266},{"style":360},[27267],{"type":26,"value":25788},{"type":21,"tag":209,"props":27269,"children":27270},{"style":216},[27271],{"type":26,"value":271},{"type":21,"tag":209,"props":27273,"children":27274},{"style":216},[27275],{"type":26,"value":4789},{"type":21,"tag":209,"props":27277,"children":27278},{"style":222},[27279],{"type":26,"value":368},{"type":21,"tag":209,"props":27281,"children":27282},{"style":400},[27283],{"type":26,"value":25805},{"type":21,"tag":209,"props":27285,"children":27286},{"style":222},[27287],{"type":26,"value":2369},{"type":21,"tag":209,"props":27289,"children":27290},{"class":211,"line":19779},[27291,27295,27299],{"type":21,"tag":209,"props":27292,"children":27293},{"style":222},[27294],{"type":26,"value":2764},{"type":21,"tag":209,"props":27296,"children":27297},{"style":360},[27298],{"type":26,"value":1059},{"type":21,"tag":209,"props":27300,"children":27301},{"style":222},[27302],{"type":26,"value":25825},{"type":21,"tag":209,"props":27304,"children":27305},{"class":211,"line":19797},[27306,27310,27314],{"type":21,"tag":209,"props":27307,"children":27308},{"style":222},[27309],{"type":26,"value":26985},{"type":21,"tag":209,"props":27311,"children":27312},{"style":360},[27313],{"type":26,"value":14182},{"type":21,"tag":209,"props":27315,"children":27316},{"style":222},[27317],{"type":26,"value":25825},{"type":21,"tag":209,"props":27319,"children":27320},{"class":211,"line":19806},[27321],{"type":21,"tag":209,"props":27322,"children":27323},{"style":222},[27324],{"type":26,"value":14946},{"type":21,"tag":209,"props":27326,"children":27327},{"class":211,"line":19814},[27328],{"type":21,"tag":209,"props":27329,"children":27330},{"emptyLinePlaceholder":248},[27331],{"type":26,"value":251},{"type":21,"tag":209,"props":27333,"children":27334},{"class":211,"line":19823},[27335,27339,27343,27347,27351,27355,27359],{"type":21,"tag":209,"props":27336,"children":27337},{"style":222},[27338],{"type":26,"value":26938},{"type":21,"tag":209,"props":27340,"children":27341},{"style":360},[27342],{"type":26,"value":26251},{"type":21,"tag":209,"props":27344,"children":27345},{"style":216},[27346],{"type":26,"value":271},{"type":21,"tag":209,"props":27348,"children":27349},{"style":216},[27350],{"type":26,"value":4789},{"type":21,"tag":209,"props":27352,"children":27353},{"style":222},[27354],{"type":26,"value":368},{"type":21,"tag":209,"props":27356,"children":27357},{"style":400},[27358],{"type":26,"value":25805},{"type":21,"tag":209,"props":27360,"children":27361},{"style":222},[27362],{"type":26,"value":2369},{"type":21,"tag":209,"props":27364,"children":27365},{"class":211,"line":19831},[27366,27370,27374],{"type":21,"tag":209,"props":27367,"children":27368},{"style":222},[27369],{"type":26,"value":26985},{"type":21,"tag":209,"props":27371,"children":27372},{"style":360},[27373],{"type":26,"value":14173},{"type":21,"tag":209,"props":27375,"children":27376},{"style":222},[27377],{"type":26,"value":27378},"(request.result);\n",{"type":21,"tag":209,"props":27380,"children":27381},{"class":211,"line":19864},[27382],{"type":21,"tag":209,"props":27383,"children":27384},{"style":222},[27385],{"type":26,"value":14946},{"type":21,"tag":209,"props":27387,"children":27388},{"class":211,"line":19872},[27389],{"type":21,"tag":209,"props":27390,"children":27391},{"emptyLinePlaceholder":248},[27392],{"type":26,"value":251},{"type":21,"tag":209,"props":27394,"children":27395},{"class":211,"line":19911},[27396,27400,27404,27408],{"type":21,"tag":209,"props":27397,"children":27398},{"style":216},[27399],{"type":26,"value":13689},{"type":21,"tag":209,"props":27401,"children":27402},{"style":222},[27403],{"type":26,"value":26782},{"type":21,"tag":209,"props":27405,"children":27406},{"style":360},[27407],{"type":26,"value":26332},{"type":21,"tag":209,"props":27409,"children":27410},{"style":222},[27411],{"type":26,"value":4123},{"type":21,"tag":209,"props":27413,"children":27414},{"class":211,"line":19919},[27415],{"type":21,"tag":209,"props":27416,"children":27417},{"style":222},[27418],{"type":26,"value":2522},{"type":21,"tag":209,"props":27420,"children":27421},{"class":211,"line":19973},[27422],{"type":21,"tag":209,"props":27423,"children":27424},{"style":448},[27425],{"type":26,"value":2412},{"type":21,"tag":209,"props":27427,"children":27428},{"class":211,"line":19985},[27429],{"type":21,"tag":209,"props":27430,"children":27431},{"style":448},[27432],{"type":26,"value":27433},"         * Remove an item from the jalicData objectStore, using the given jdName as the key.\n",{"type":21,"tag":209,"props":27435,"children":27436},{"class":211,"line":20006},[27437,27441,27445],{"type":21,"tag":209,"props":27438,"children":27439},{"style":448},[27440],{"type":26,"value":25759},{"type":21,"tag":209,"props":27442,"children":27443},{"style":216},[27444],{"type":26,"value":13311},{"type":21,"tag":209,"props":27446,"children":27447},{"style":222},[27448],{"type":26,"value":26479},{"type":21,"tag":209,"props":27450,"children":27451},{"class":211,"line":20014},[27452,27456,27460,27464],{"type":21,"tag":209,"props":27453,"children":27454},{"style":448},[27455],{"type":26,"value":25759},{"type":21,"tag":209,"props":27457,"children":27458},{"style":216},[27459],{"type":26,"value":13333},{"type":21,"tag":209,"props":27461,"children":27462},{"style":360},[27463],{"type":26,"value":26526},{"type":21,"tag":209,"props":27465,"children":27466},{"style":448},[27467],{"type":26,"value":26531},{"type":21,"tag":209,"props":27469,"children":27470},{"class":211,"line":20022},[27471],{"type":21,"tag":209,"props":27472,"children":27473},{"style":448},[27474],{"type":26,"value":26539},{"type":21,"tag":209,"props":27476,"children":27477},{"class":211,"line":20061},[27478],{"type":21,"tag":209,"props":27479,"children":27480},{"style":448},[27481],{"type":26,"value":2439},{"type":21,"tag":209,"props":27483,"children":27484},{"class":211,"line":20073},[27485,27490,27494,27498,27502,27506],{"type":21,"tag":209,"props":27486,"children":27487},{"style":360},[27488],{"type":26,"value":27489},"        removeItem",{"type":21,"tag":209,"props":27491,"children":27492},{"style":222},[27493],{"type":26,"value":191},{"type":21,"tag":209,"props":27495,"children":27496},{"style":216},[27497],{"type":26,"value":4622},{"type":21,"tag":209,"props":27499,"children":27500},{"style":222},[27501],{"type":26,"value":368},{"type":21,"tag":209,"props":27503,"children":27504},{"style":400},[27505],{"type":26,"value":26571},{"type":21,"tag":209,"props":27507,"children":27508},{"style":222},[27509],{"type":26,"value":2369},{"type":21,"tag":209,"props":27511,"children":27512},{"class":211,"line":20081},[27513,27517,27521,27525,27529,27533],{"type":21,"tag":209,"props":27514,"children":27515},{"style":216},[27516],{"type":26,"value":14539},{"type":21,"tag":209,"props":27518,"children":27519},{"style":222},[27520],{"type":26,"value":26603},{"type":21,"tag":209,"props":27522,"children":27523},{"style":216},[27524],{"type":26,"value":1432},{"type":21,"tag":209,"props":27526,"children":27527},{"style":222},[27528],{"type":26,"value":25427},{"type":21,"tag":209,"props":27530,"children":27531},{"style":360},[27532],{"type":26,"value":25432},{"type":21,"tag":209,"props":27534,"children":27535},{"style":222},[27536],{"type":26,"value":13988},{"type":21,"tag":209,"props":27538,"children":27539},{"class":211,"line":20089},[27540,27544,27548,27552,27556,27560,27564,27568,27572],{"type":21,"tag":209,"props":27541,"children":27542},{"style":222},[27543],{"type":26,"value":26627},{"type":21,"tag":209,"props":27545,"children":27546},{"style":216},[27547],{"type":26,"value":1432},{"type":21,"tag":209,"props":27549,"children":27550},{"style":222},[27551],{"type":26,"value":26054},{"type":21,"tag":209,"props":27553,"children":27554},{"style":360},[27555],{"type":26,"value":26640},{"type":21,"tag":209,"props":27557,"children":27558},{"style":222},[27559],{"type":26,"value":22133},{"type":21,"tag":209,"props":27561,"children":27562},{"style":233},[27563],{"type":26,"value":26068},{"type":21,"tag":209,"props":27565,"children":27566},{"style":222},[27567],{"type":26,"value":26653},{"type":21,"tag":209,"props":27569,"children":27570},{"style":233},[27571],{"type":26,"value":26658},{"type":21,"tag":209,"props":27573,"children":27574},{"style":222},[27575],{"type":26,"value":5404},{"type":21,"tag":209,"props":27577,"children":27578},{"class":211,"line":20114},[27579,27583,27587,27591,27595,27599,27603],{"type":21,"tag":209,"props":27580,"children":27581},{"style":222},[27582],{"type":26,"value":26670},{"type":21,"tag":209,"props":27584,"children":27585},{"style":216},[27586],{"type":26,"value":1432},{"type":21,"tag":209,"props":27588,"children":27589},{"style":222},[27590],{"type":26,"value":26679},{"type":21,"tag":209,"props":27592,"children":27593},{"style":360},[27594],{"type":26,"value":26684},{"type":21,"tag":209,"props":27596,"children":27597},{"style":222},[27598],{"type":26,"value":368},{"type":21,"tag":209,"props":27600,"children":27601},{"style":233},[27602],{"type":26,"value":26068},{"type":21,"tag":209,"props":27604,"children":27605},{"style":222},[27606],{"type":26,"value":5404},{"type":21,"tag":209,"props":27608,"children":27609},{"class":211,"line":20122},[27610,27614,27618,27622,27627],{"type":21,"tag":209,"props":27611,"children":27612},{"style":222},[27613],{"type":26,"value":27232},{"type":21,"tag":209,"props":27615,"children":27616},{"style":216},[27617],{"type":26,"value":1432},{"type":21,"tag":209,"props":27619,"children":27620},{"style":222},[27621],{"type":26,"value":26900},{"type":21,"tag":209,"props":27623,"children":27624},{"style":360},[27625],{"type":26,"value":27626},"delete",{"type":21,"tag":209,"props":27628,"children":27629},{"style":222},[27630],{"type":26,"value":27249},{"type":21,"tag":209,"props":27632,"children":27633},{"class":211,"line":20143},[27634],{"type":21,"tag":209,"props":27635,"children":27636},{"emptyLinePlaceholder":248},[27637],{"type":26,"value":251},{"type":21,"tag":209,"props":27639,"children":27640},{"class":211,"line":20152},[27641,27645,27649,27653,27657,27661,27665],{"type":21,"tag":209,"props":27642,"children":27643},{"style":222},[27644],{"type":26,"value":26938},{"type":21,"tag":209,"props":27646,"children":27647},{"style":360},[27648],{"type":26,"value":25788},{"type":21,"tag":209,"props":27650,"children":27651},{"style":216},[27652],{"type":26,"value":271},{"type":21,"tag":209,"props":27654,"children":27655},{"style":216},[27656],{"type":26,"value":4789},{"type":21,"tag":209,"props":27658,"children":27659},{"style":222},[27660],{"type":26,"value":368},{"type":21,"tag":209,"props":27662,"children":27663},{"style":400},[27664],{"type":26,"value":25805},{"type":21,"tag":209,"props":27666,"children":27667},{"style":222},[27668],{"type":26,"value":2369},{"type":21,"tag":209,"props":27670,"children":27671},{"class":211,"line":20161},[27672,27676,27680],{"type":21,"tag":209,"props":27673,"children":27674},{"style":222},[27675],{"type":26,"value":2764},{"type":21,"tag":209,"props":27677,"children":27678},{"style":360},[27679],{"type":26,"value":1059},{"type":21,"tag":209,"props":27681,"children":27682},{"style":222},[27683],{"type":26,"value":25825},{"type":21,"tag":209,"props":27685,"children":27686},{"class":211,"line":20206},[27687,27691,27695],{"type":21,"tag":209,"props":27688,"children":27689},{"style":222},[27690],{"type":26,"value":26985},{"type":21,"tag":209,"props":27692,"children":27693},{"style":360},[27694],{"type":26,"value":14182},{"type":21,"tag":209,"props":27696,"children":27697},{"style":222},[27698],{"type":26,"value":25825},{"type":21,"tag":209,"props":27700,"children":27701},{"class":211,"line":20214},[27702],{"type":21,"tag":209,"props":27703,"children":27704},{"style":222},[27705],{"type":26,"value":14946},{"type":21,"tag":209,"props":27707,"children":27708},{"class":211,"line":20222},[27709],{"type":21,"tag":209,"props":27710,"children":27711},{"emptyLinePlaceholder":248},[27712],{"type":26,"value":251},{"type":21,"tag":209,"props":27714,"children":27715},{"class":211,"line":20231},[27716,27720,27724,27728,27732],{"type":21,"tag":209,"props":27717,"children":27718},{"style":222},[27719],{"type":26,"value":26938},{"type":21,"tag":209,"props":27721,"children":27722},{"style":360},[27723],{"type":26,"value":26251},{"type":21,"tag":209,"props":27725,"children":27726},{"style":216},[27727],{"type":26,"value":271},{"type":21,"tag":209,"props":27729,"children":27730},{"style":216},[27731],{"type":26,"value":4789},{"type":21,"tag":209,"props":27733,"children":27734},{"style":222},[27735],{"type":26,"value":2561},{"type":21,"tag":209,"props":27737,"children":27738},{"class":211,"line":20240},[27739,27743,27747],{"type":21,"tag":209,"props":27740,"children":27741},{"style":222},[27742],{"type":26,"value":26985},{"type":21,"tag":209,"props":27744,"children":27745},{"style":360},[27746],{"type":26,"value":14173},{"type":21,"tag":209,"props":27748,"children":27749},{"style":222},[27750],{"type":26,"value":4123},{"type":21,"tag":209,"props":27752,"children":27753},{"class":211,"line":20288},[27754],{"type":21,"tag":209,"props":27755,"children":27756},{"style":222},[27757],{"type":26,"value":14946},{"type":21,"tag":209,"props":27759,"children":27760},{"class":211,"line":20305},[27761],{"type":21,"tag":209,"props":27762,"children":27763},{"emptyLinePlaceholder":248},[27764],{"type":26,"value":251},{"type":21,"tag":209,"props":27766,"children":27767},{"class":211,"line":20313},[27768,27772,27776,27780],{"type":21,"tag":209,"props":27769,"children":27770},{"style":216},[27771],{"type":26,"value":13689},{"type":21,"tag":209,"props":27773,"children":27774},{"style":222},[27775],{"type":26,"value":26782},{"type":21,"tag":209,"props":27777,"children":27778},{"style":360},[27779],{"type":26,"value":26332},{"type":21,"tag":209,"props":27781,"children":27782},{"style":222},[27783],{"type":26,"value":4123},{"type":21,"tag":209,"props":27785,"children":27787},{"class":211,"line":27786},162,[27788],{"type":21,"tag":209,"props":27789,"children":27790},{"style":222},[27791],{"type":26,"value":2522},{"type":21,"tag":209,"props":27793,"children":27795},{"class":211,"line":27794},163,[27796],{"type":21,"tag":209,"props":27797,"children":27798},{"style":448},[27799],{"type":26,"value":2412},{"type":21,"tag":209,"props":27801,"children":27803},{"class":211,"line":27802},164,[27804],{"type":21,"tag":209,"props":27805,"children":27806},{"style":448},[27807],{"type":26,"value":27808},"         * Delete the jalic database and recreate it.\n",{"type":21,"tag":209,"props":27810,"children":27812},{"class":211,"line":27811},165,[27813,27817,27821,27825],{"type":21,"tag":209,"props":27814,"children":27815},{"style":448},[27816],{"type":26,"value":25759},{"type":21,"tag":209,"props":27818,"children":27819},{"style":216},[27820],{"type":26,"value":13333},{"type":21,"tag":209,"props":27822,"children":27823},{"style":360},[27824],{"type":26,"value":26526},{"type":21,"tag":209,"props":27826,"children":27827},{"style":448},[27828],{"type":26,"value":26531},{"type":21,"tag":209,"props":27830,"children":27832},{"class":211,"line":27831},166,[27833],{"type":21,"tag":209,"props":27834,"children":27835},{"style":448},[27836],{"type":26,"value":26539},{"type":21,"tag":209,"props":27838,"children":27840},{"class":211,"line":27839},167,[27841],{"type":21,"tag":209,"props":27842,"children":27843},{"style":448},[27844],{"type":26,"value":2439},{"type":21,"tag":209,"props":27846,"children":27848},{"class":211,"line":27847},168,[27849,27854,27858,27862],{"type":21,"tag":209,"props":27850,"children":27851},{"style":360},[27852],{"type":26,"value":27853},"        clear",{"type":21,"tag":209,"props":27855,"children":27856},{"style":222},[27857],{"type":26,"value":191},{"type":21,"tag":209,"props":27859,"children":27860},{"style":216},[27861],{"type":26,"value":4622},{"type":21,"tag":209,"props":27863,"children":27864},{"style":222},[27865],{"type":26,"value":2561},{"type":21,"tag":209,"props":27867,"children":27869},{"class":211,"line":27868},169,[27870,27874,27878,27882,27886,27890],{"type":21,"tag":209,"props":27871,"children":27872},{"style":216},[27873],{"type":26,"value":14539},{"type":21,"tag":209,"props":27875,"children":27876},{"style":222},[27877],{"type":26,"value":26603},{"type":21,"tag":209,"props":27879,"children":27880},{"style":216},[27881],{"type":26,"value":1432},{"type":21,"tag":209,"props":27883,"children":27884},{"style":222},[27885],{"type":26,"value":25427},{"type":21,"tag":209,"props":27887,"children":27888},{"style":360},[27889],{"type":26,"value":25432},{"type":21,"tag":209,"props":27891,"children":27892},{"style":222},[27893],{"type":26,"value":13988},{"type":21,"tag":209,"props":27895,"children":27897},{"class":211,"line":27896},170,[27898,27902,27906,27910,27915,27919,27923],{"type":21,"tag":209,"props":27899,"children":27900},{"style":222},[27901],{"type":26,"value":27232},{"type":21,"tag":209,"props":27903,"children":27904},{"style":216},[27905],{"type":26,"value":1432},{"type":21,"tag":209,"props":27907,"children":27908},{"style":222},[27909],{"type":26,"value":25688},{"type":21,"tag":209,"props":27911,"children":27912},{"style":360},[27913],{"type":26,"value":27914},"deleteDatabase",{"type":21,"tag":209,"props":27916,"children":27917},{"style":222},[27918],{"type":26,"value":368},{"type":21,"tag":209,"props":27920,"children":27921},{"style":233},[27922],{"type":26,"value":25701},{"type":21,"tag":209,"props":27924,"children":27925},{"style":222},[27926],{"type":26,"value":2608},{"type":21,"tag":209,"props":27928,"children":27930},{"class":211,"line":27929},171,[27931],{"type":21,"tag":209,"props":27932,"children":27933},{"emptyLinePlaceholder":248},[27934],{"type":26,"value":251},{"type":21,"tag":209,"props":27936,"children":27938},{"class":211,"line":27937},172,[27939,27944,27948,27952,27956],{"type":21,"tag":209,"props":27940,"children":27941},{"style":222},[27942],{"type":26,"value":27943},"            dbReady ",{"type":21,"tag":209,"props":27945,"children":27946},{"style":216},[27947],{"type":26,"value":1432},{"type":21,"tag":209,"props":27949,"children":27950},{"style":222},[27951],{"type":26,"value":25427},{"type":21,"tag":209,"props":27953,"children":27954},{"style":360},[27955],{"type":26,"value":25432},{"type":21,"tag":209,"props":27957,"children":27958},{"style":222},[27959],{"type":26,"value":4123},{"type":21,"tag":209,"props":27961,"children":27963},{"class":211,"line":27962},173,[27964],{"type":21,"tag":209,"props":27965,"children":27966},{"emptyLinePlaceholder":248},[27967],{"type":26,"value":251},{"type":21,"tag":209,"props":27969,"children":27971},{"class":211,"line":27970},174,[27972,27976,27980,27984,27988,27992,27996],{"type":21,"tag":209,"props":27973,"children":27974},{"style":222},[27975],{"type":26,"value":26938},{"type":21,"tag":209,"props":27977,"children":27978},{"style":360},[27979],{"type":26,"value":25788},{"type":21,"tag":209,"props":27981,"children":27982},{"style":216},[27983],{"type":26,"value":271},{"type":21,"tag":209,"props":27985,"children":27986},{"style":216},[27987],{"type":26,"value":4789},{"type":21,"tag":209,"props":27989,"children":27990},{"style":222},[27991],{"type":26,"value":368},{"type":21,"tag":209,"props":27993,"children":27994},{"style":400},[27995],{"type":26,"value":25805},{"type":21,"tag":209,"props":27997,"children":27998},{"style":222},[27999],{"type":26,"value":2369},{"type":21,"tag":209,"props":28001,"children":28003},{"class":211,"line":28002},175,[28004,28008,28012],{"type":21,"tag":209,"props":28005,"children":28006},{"style":222},[28007],{"type":26,"value":2764},{"type":21,"tag":209,"props":28009,"children":28010},{"style":360},[28011],{"type":26,"value":1059},{"type":21,"tag":209,"props":28013,"children":28014},{"style":222},[28015],{"type":26,"value":25825},{"type":21,"tag":209,"props":28017,"children":28019},{"class":211,"line":28018},176,[28020,28024,28028],{"type":21,"tag":209,"props":28021,"children":28022},{"style":222},[28023],{"type":26,"value":26985},{"type":21,"tag":209,"props":28025,"children":28026},{"style":360},[28027],{"type":26,"value":14182},{"type":21,"tag":209,"props":28029,"children":28030},{"style":222},[28031],{"type":26,"value":25825},{"type":21,"tag":209,"props":28033,"children":28035},{"class":211,"line":28034},177,[28036],{"type":21,"tag":209,"props":28037,"children":28038},{"style":222},[28039],{"type":26,"value":14946},{"type":21,"tag":209,"props":28041,"children":28043},{"class":211,"line":28042},178,[28044],{"type":21,"tag":209,"props":28045,"children":28046},{"emptyLinePlaceholder":248},[28047],{"type":26,"value":251},{"type":21,"tag":209,"props":28049,"children":28051},{"class":211,"line":28050},179,[28052,28056,28060,28064,28068],{"type":21,"tag":209,"props":28053,"children":28054},{"style":222},[28055],{"type":26,"value":26938},{"type":21,"tag":209,"props":28057,"children":28058},{"style":360},[28059],{"type":26,"value":26251},{"type":21,"tag":209,"props":28061,"children":28062},{"style":216},[28063],{"type":26,"value":271},{"type":21,"tag":209,"props":28065,"children":28066},{"style":216},[28067],{"type":26,"value":4789},{"type":21,"tag":209,"props":28069,"children":28070},{"style":222},[28071],{"type":26,"value":2561},{"type":21,"tag":209,"props":28073,"children":28075},{"class":211,"line":28074},180,[28076,28080,28084,28088,28092],{"type":21,"tag":209,"props":28077,"children":28078},{"style":222},[28079],{"type":26,"value":26173},{"type":21,"tag":209,"props":28081,"children":28082},{"style":360},[28083],{"type":26,"value":20845},{"type":21,"tag":209,"props":28085,"children":28086},{"style":222},[28087],{"type":26,"value":368},{"type":21,"tag":209,"props":28089,"children":28090},{"style":216},[28091],{"type":26,"value":4622},{"type":21,"tag":209,"props":28093,"children":28094},{"style":222},[28095],{"type":26,"value":2561},{"type":21,"tag":209,"props":28097,"children":28099},{"class":211,"line":28098},181,[28100,28105,28109],{"type":21,"tag":209,"props":28101,"children":28102},{"style":222},[28103],{"type":26,"value":28104},"                    defer.",{"type":21,"tag":209,"props":28106,"children":28107},{"style":360},[28108],{"type":26,"value":14173},{"type":21,"tag":209,"props":28110,"children":28111},{"style":222},[28112],{"type":26,"value":4123},{"type":21,"tag":209,"props":28114,"children":28116},{"class":211,"line":28115},182,[28117],{"type":21,"tag":209,"props":28118,"children":28119},{"style":222},[28120],{"type":26,"value":28121},"                });\n",{"type":21,"tag":209,"props":28123,"children":28125},{"class":211,"line":28124},183,[28126],{"type":21,"tag":209,"props":28127,"children":28128},{"emptyLinePlaceholder":248},[28129],{"type":26,"value":251},{"type":21,"tag":209,"props":28131,"children":28133},{"class":211,"line":28132},184,[28134,28139],{"type":21,"tag":209,"props":28135,"children":28136},{"style":360},[28137],{"type":26,"value":28138},"                createDatabase",{"type":21,"tag":209,"props":28140,"children":28141},{"style":222},[28142],{"type":26,"value":26363},{"type":21,"tag":209,"props":28144,"children":28146},{"class":211,"line":28145},185,[28147],{"type":21,"tag":209,"props":28148,"children":28149},{"style":222},[28150],{"type":26,"value":14946},{"type":21,"tag":209,"props":28152,"children":28154},{"class":211,"line":28153},186,[28155],{"type":21,"tag":209,"props":28156,"children":28157},{"emptyLinePlaceholder":248},[28158],{"type":26,"value":251},{"type":21,"tag":209,"props":28160,"children":28162},{"class":211,"line":28161},187,[28163,28167,28171,28175],{"type":21,"tag":209,"props":28164,"children":28165},{"style":216},[28166],{"type":26,"value":13689},{"type":21,"tag":209,"props":28168,"children":28169},{"style":222},[28170],{"type":26,"value":26782},{"type":21,"tag":209,"props":28172,"children":28173},{"style":360},[28174],{"type":26,"value":26332},{"type":21,"tag":209,"props":28176,"children":28177},{"style":222},[28178],{"type":26,"value":4123},{"type":21,"tag":209,"props":28180,"children":28182},{"class":211,"line":28181},188,[28183],{"type":21,"tag":209,"props":28184,"children":28185},{"style":222},[28186],{"type":26,"value":2235},{"type":21,"tag":209,"props":28188,"children":28190},{"class":211,"line":28189},189,[28191],{"type":21,"tag":209,"props":28192,"children":28193},{"style":222},[28194],{"type":26,"value":13439},{"type":21,"tag":209,"props":28196,"children":28198},{"class":211,"line":28197},190,[28199],{"type":21,"tag":209,"props":28200,"children":28201},{"style":222},[28202],{"type":26,"value":28203},"})(jQuery, window);\n",{"type":21,"tag":22,"props":28205,"children":28206},{},[28207,28209],{"type":26,"value":28208},"The code and comments should give you a fair idea of what we're doing here - unlike the previously mentioned localForage or Dexie, we don't attempt to account for older, experimental versions of IndexedDB, or fallback to something like WebSQL. IndexedDB is the future! Maybe, probably, unless it also gets killed at some point. ",{"type":21,"tag":1084,"props":28210,"children":28211},{},[28212],{"type":26,"value":28213},"Knocks on wood",{"type":21,"tag":22,"props":28215,"children":28216},{},[28217],{"type":26,"value":28218},"We also aren't attempting to wrap everything IndexedDB can do - instead, we have a single database and objectStore into which we'll be shoving everything we intend to cache, and providing a simple wrapper around it that superficially resembles the Storage interface, with the exception that everything is asynchronous and returns a $.Deferred object.",{"type":21,"tag":22,"props":28220,"children":28221},{},[28222,28224,28231],{"type":26,"value":28223},"As a result of this setup, our actual caching logic can remain mostly the same - let's take a look and discuss what's changed (",{"type":21,"tag":29,"props":28225,"children":28228},{"href":28226,"rel":28227},"https://github.com/SaneMethod/jalic/blob/master/jquery-ajax-localstorage-indexeddb-cache.js",[93],[28229],{"type":26,"value":28230},"see the up-to-date code on Github",{"type":26,"value":28232},"):",{"type":21,"tag":200,"props":28234,"children":28236},{"className":16138,"code":28235,"language":16140,"meta":8,"style":8},"/**\n * https://github.com/SaneMethod/jalic\n */\n(function($, window){\n    /**\n     * Generate the cache key under which to store the local data - either the cache key supplied,\n     * or one generated from the url, the type and, if present, the data.\n     */\n    var genCacheKey = function (options) {\n        var url = options.url.replace(/jQuery.*/, '');\n\n        // Strip _={timestamp}, if cache is set to false\n        if (options.cache === false) {\n            url = url.replace(/([?&])_=[^&]*/, '');\n        }\n\n        return options.cacheKey || url + options.type + (options.data || '');\n    };\n\n    /**\n     * Determine whether we're using localStorage or, if the user has specified something other than a boolean\n     * value for options.localCache, whether the value appears to satisfy the plugin's requirements.\n     * Otherwise, throw a new TypeError indicating what type of value we expect.\n     * @param {boolean|object} storage\n     * @returns {boolean|object}\n     */\n    var getStorage = function(storage){\n        if (!storage) return false;\n        if (storage === true) return window.localStorage;\n        if (typeof storage === \"object\" && 'getItem' in storage &&\n            'removeItem' in storage && 'setItem' in storage)\n        {\n            return storage;\n        }\n        throw new TypeError(\"localCache must either be a boolean value, \" +\n            \"or an object which implements the Storage interface.\");\n    };\n\n    /**\n     * Remove the item specified by cacheKey from local storage (but not from the IndexedDB, as in all usages\n     * of this function we expect to overwrite the value with addToStorage shortly).\n     * @param {Storage|object} storage\n     * @param {string} cacheKey\n     */\n    var removeFromStorage = function(storage, cacheKey){\n        storage.removeItem(cacheKey);\n        storage.removeItem(cacheKey + 'cachettl');\n    };\n\n    /**\n     * Add an item to local storage and IndexedDB storage. We use local storage to satisfy our\n     * need to synchronously determine whether we have a value stored for a given key (and whether it is\n     * within the cachettl), and use IndexedDB to store the actual value associated with the key.\n     * @param {Storage|object} storage\n     * @param {string} cacheKey\n     * @param {number} ttl\n     * @param {*} data\n     * @param {string} dataType\n     * @returns {$.Deferred}\n     */\n    var addToStorage = function(storage, cacheKey, ttl, data, dataType){\n        var defer = $.Deferred();\n\n        try{\n            storage.setItem(cacheKey, 1);\n            storage.setItem(cacheKey + 'cachettl', ttl);\n        }catch(e){\n            removeFromStorage(storage, cacheKey);\n            defer.reject(e);\n\n            return defer.promise();\n        }\n\n        return $.jidb.setItem(cacheKey, data, dataType);\n    };\n\n    /**\n     * Prefilter for caching ajax calls.\n     * See also $.ajaxTransport for the elements that make this compatible with jQuery Deferred.\n     * New parameters available on the ajax call:\n     * localCache   : true              - required - either a boolean (in which case localStorage is used),\n     * or an object implementing the Storage interface, in which case that object is used instead.\n     * cacheTTL     : 5,                - optional - cache time in hours, default is 5.\n     * cacheKey     : 'myCacheKey',     - optional - key under which cached string will be stored\n     * isCacheValid : function          - optional - return true for valid, false for invalid\n     * @method $.ajaxPrefilter\n     * @param options {Object} Options for the ajax call, modified with ajax standard settings\n     */\n    $.ajaxPrefilter(function(options){\n        var storage = getStorage(options.localCache),\n            hourstl = +new Date() + 1000 * 60 * 60 * (options.cacheTTL || 5),\n            cacheKey = genCacheKey(options),\n            cacheValid = options.isCacheValid,\n            ttl,\n            value;\n\n        if (!storage) return;\n        ttl = storage.getItem(cacheKey + 'cachettl');\n\n        if (cacheValid && typeof cacheValid === 'function' && !cacheValid()){\n            removeFromStorage(storage, cacheKey);\n            ttl = 0;\n        }\n\n        if (ttl && ttl \u003C +new Date()){\n            removeFromStorage(storage, cacheKey);\n            ttl = 0;\n        }\n\n        value = storage.getItem(cacheKey);\n        if (!value){\n            // If it not in the cache, we store the data, add success callback - normal callback will proceed\n            if (options.success) {\n                options.realsuccess = options.success;\n            }\n            options.success = function(data, status, jqXHR) {\n                var dataType = this.dataType || jqXHR.getResponseHeader('Content-Type');\n\n                // Save the data to storage, catching Storage exception and IndexedDB exceptions alike\n                // and reject the returned promise as a result.\n                addToStorage(storage, cacheKey, hourstl, data, dataType).done(function(){\n                    if (options.realsuccess) options.realsuccess(data, status, jqXHR);\n                }).fail(function(event){\n                    console.log(event);\n                });\n            };\n        }\n    });\n\n    /**\n     * This function performs the fetch from cache portion of the functionality needed to cache ajax\n     * calls and still fulfill the jqXHR Deferred Promise interface.\n     * See also $.ajaxPrefilter\n     * @method $.ajaxTransport\n     * @params options {Object} Options for the ajax call, modified with ajax standard settings\n     */\n    $.ajaxTransport(\"+*\", function(options){\n        if (options.localCache)\n        {\n            var cacheKey = genCacheKey(options),\n                storage = getStorage(options.localCache),\n                value = (storage) ? storage.getItem(cacheKey) : false;\n\n            if (value){\n                /**\n                 * If the key is in the Storage-based cache, indicate that we want to handle this ajax request\n                 * (by returning a value), and use the cache key to retrieve the value from the IndexedDB. Then,\n                 * call the completeCallback with the fetched value.\n                 */\n                return {\n                    send:function(headers, completeCallback) {\n                        $.jidb.getItem(cacheKey).done(function(result){\n                            var response = {};\n                            response[result.dataType] = result.data;\n                            completeCallback(200, 'success', response, '');\n                        }).fail(function(){\n                            completeCallback(500, 'cache failure', void 0, '');\n                        });\n                    },\n                    abort:function() {\n                        console.log(\"Aborted ajax transport for caching.\");\n                    }\n                };\n            }\n        }\n    });\n})(jQuery, window);\n",[28237],{"type":21,"tag":63,"props":28238,"children":28239},{"__ignoreMap":8},[28240,28247,28255,28262,28293,28300,28307,28315,28322,28354,28415,28422,28430,28454,28531,28538,28545,28595,28602,28609,28616,28623,28630,28637,28656,28671,28678,28709,28740,28772,28819,28851,28858,28869,28876,28903,28914,28921,28928,28935,28943,28951,28970,28989,28996,29035,29050,29077,29084,29091,29098,29106,29114,29122,29141,29160,29181,29201,29220,29236,29243,29308,29335,29342,29354,29378,29406,29423,29434,29451,29458,29477,29484,29491,29512,29519,29526,29533,29541,29549,29557,29565,29573,29581,29589,29597,29614,29635,29642,29675,29699,29767,29787,29803,29810,29818,29825,29852,29887,29894,29942,29953,29972,29979,29986,30021,30032,30051,30058,30065,30088,30108,30116,30128,30145,30152,30201,30252,30259,30267,30275,30304,30327,30359,30375,30382,30389,30396,30403,30410,30417,30425,30433,30441,30457,30474,30481,30522,30534,30541,30565,30585,30631,30638,30650,30658,30666,30674,30682,30690,30701,30738,30780,30800,30817,30854,30878,30927,30935,30943,30963,30988,30996,31004,31011,31018,31025],{"type":21,"tag":209,"props":28241,"children":28242},{"class":211,"line":212},[28243],{"type":21,"tag":209,"props":28244,"children":28245},{"style":448},[28246],{"type":26,"value":731},{"type":21,"tag":209,"props":28248,"children":28249},{"class":211,"line":244},[28250],{"type":21,"tag":209,"props":28251,"children":28252},{"style":448},[28253],{"type":26,"value":28254}," * https://github.com/SaneMethod/jalic\n",{"type":21,"tag":209,"props":28256,"children":28257},{"class":211,"line":254},[28258],{"type":21,"tag":209,"props":28259,"children":28260},{"style":448},[28261],{"type":26,"value":755},{"type":21,"tag":209,"props":28263,"children":28264},{"class":211,"line":279},[28265,28269,28273,28277,28281,28285,28289],{"type":21,"tag":209,"props":28266,"children":28267},{"style":222},[28268],{"type":26,"value":368},{"type":21,"tag":209,"props":28270,"children":28271},{"style":216},[28272],{"type":26,"value":4622},{"type":21,"tag":209,"props":28274,"children":28275},{"style":222},[28276],{"type":26,"value":368},{"type":21,"tag":209,"props":28278,"children":28279},{"style":400},[28280],{"type":26,"value":6476},{"type":21,"tag":209,"props":28282,"children":28283},{"style":222},[28284],{"type":26,"value":408},{"type":21,"tag":209,"props":28286,"children":28287},{"style":400},[28288],{"type":26,"value":25385},{"type":21,"tag":209,"props":28290,"children":28291},{"style":222},[28292],{"type":26,"value":2369},{"type":21,"tag":209,"props":28294,"children":28295},{"class":211,"line":288},[28296],{"type":21,"tag":209,"props":28297,"children":28298},{"style":448},[28299],{"type":26,"value":13290},{"type":21,"tag":209,"props":28301,"children":28302},{"class":211,"line":307},[28303],{"type":21,"tag":209,"props":28304,"children":28305},{"style":448},[28306],{"type":26,"value":17891},{"type":21,"tag":209,"props":28308,"children":28309},{"class":211,"line":325},[28310],{"type":21,"tag":209,"props":28311,"children":28312},{"style":448},[28313],{"type":26,"value":28314},"     * or one generated from the url, the type and, if present, the data.\n",{"type":21,"tag":209,"props":28316,"children":28317},{"class":211,"line":334},[28318],{"type":21,"tag":209,"props":28319,"children":28320},{"style":448},[28321],{"type":26,"value":13346},{"type":21,"tag":209,"props":28323,"children":28324},{"class":211,"line":343},[28325,28329,28333,28337,28341,28345,28350],{"type":21,"tag":209,"props":28326,"children":28327},{"style":216},[28328],{"type":26,"value":16994},{"type":21,"tag":209,"props":28330,"children":28331},{"style":360},[28332],{"type":26,"value":17942},{"type":21,"tag":209,"props":28334,"children":28335},{"style":216},[28336],{"type":26,"value":271},{"type":21,"tag":209,"props":28338,"children":28339},{"style":216},[28340],{"type":26,"value":4789},{"type":21,"tag":209,"props":28342,"children":28343},{"style":222},[28344],{"type":26,"value":5569},{"type":21,"tag":209,"props":28346,"children":28347},{"style":400},[28348],{"type":26,"value":28349},"options",{"type":21,"tag":209,"props":28351,"children":28352},{"style":222},[28353],{"type":26,"value":5588},{"type":21,"tag":209,"props":28355,"children":28356},{"class":211,"line":351},[28357,28361,28365,28369,28374,28379,28383,28387,28391,28395,28399,28403,28407,28411],{"type":21,"tag":209,"props":28358,"children":28359},{"style":216},[28360],{"type":26,"value":14505},{"type":21,"tag":209,"props":28362,"children":28363},{"style":222},[28364],{"type":26,"value":18080},{"type":21,"tag":209,"props":28366,"children":28367},{"style":216},[28368],{"type":26,"value":1432},{"type":21,"tag":209,"props":28370,"children":28371},{"style":222},[28372],{"type":26,"value":28373}," options.url.",{"type":21,"tag":209,"props":28375,"children":28376},{"style":360},[28377],{"type":26,"value":28378},"replace",{"type":21,"tag":209,"props":28380,"children":28381},{"style":222},[28382],{"type":26,"value":368},{"type":21,"tag":209,"props":28384,"children":28385},{"style":233},[28386],{"type":26,"value":6460},{"type":21,"tag":209,"props":28388,"children":28389},{"style":6468},[28390],{"type":26,"value":20763},{"type":21,"tag":209,"props":28392,"children":28393},{"style":263},[28394],{"type":26,"value":378},{"type":21,"tag":209,"props":28396,"children":28397},{"style":216},[28398],{"type":26,"value":944},{"type":21,"tag":209,"props":28400,"children":28401},{"style":233},[28402],{"type":26,"value":6460},{"type":21,"tag":209,"props":28404,"children":28405},{"style":222},[28406],{"type":26,"value":408},{"type":21,"tag":209,"props":28408,"children":28409},{"style":233},[28410],{"type":26,"value":10775},{"type":21,"tag":209,"props":28412,"children":28413},{"style":222},[28414],{"type":26,"value":2608},{"type":21,"tag":209,"props":28416,"children":28417},{"class":211,"line":444},[28418],{"type":21,"tag":209,"props":28419,"children":28420},{"emptyLinePlaceholder":248},[28421],{"type":26,"value":251},{"type":21,"tag":209,"props":28423,"children":28424},{"class":211,"line":454},[28425],{"type":21,"tag":209,"props":28426,"children":28427},{"style":448},[28428],{"type":26,"value":28429},"        // Strip _={timestamp}, if cache is set to false\n",{"type":21,"tag":209,"props":28431,"children":28432},{"class":211,"line":463},[28433,28437,28442,28446,28450],{"type":21,"tag":209,"props":28434,"children":28435},{"style":216},[28436],{"type":26,"value":6334},{"type":21,"tag":209,"props":28438,"children":28439},{"style":222},[28440],{"type":26,"value":28441}," (options.cache ",{"type":21,"tag":209,"props":28443,"children":28444},{"style":216},[28445],{"type":26,"value":14680},{"type":21,"tag":209,"props":28447,"children":28448},{"style":263},[28449],{"type":26,"value":14038},{"type":21,"tag":209,"props":28451,"children":28452},{"style":222},[28453],{"type":26,"value":5588},{"type":21,"tag":209,"props":28455,"children":28456},{"class":211,"line":472},[28457,28462,28466,28471,28475,28479,28483,28487,28492,28497,28502,28506,28511,28515,28519,28523,28527],{"type":21,"tag":209,"props":28458,"children":28459},{"style":222},[28460],{"type":26,"value":28461},"            url ",{"type":21,"tag":209,"props":28463,"children":28464},{"style":216},[28465],{"type":26,"value":1432},{"type":21,"tag":209,"props":28467,"children":28468},{"style":222},[28469],{"type":26,"value":28470}," url.",{"type":21,"tag":209,"props":28472,"children":28473},{"style":360},[28474],{"type":26,"value":28378},{"type":21,"tag":209,"props":28476,"children":28477},{"style":222},[28478],{"type":26,"value":368},{"type":21,"tag":209,"props":28480,"children":28481},{"style":233},[28482],{"type":26,"value":6460},{"type":21,"tag":209,"props":28484,"children":28485},{"style":6468},[28486],{"type":26,"value":368},{"type":21,"tag":209,"props":28488,"children":28489},{"style":263},[28490],{"type":26,"value":28491},"[?&]",{"type":21,"tag":209,"props":28493,"children":28494},{"style":6468},[28495],{"type":26,"value":28496},")_=",{"type":21,"tag":209,"props":28498,"children":28499},{"style":263},[28500],{"type":26,"value":28501},"[",{"type":21,"tag":209,"props":28503,"children":28504},{"style":216},[28505],{"type":26,"value":6465},{"type":21,"tag":209,"props":28507,"children":28508},{"style":263},[28509],{"type":26,"value":28510},"&]",{"type":21,"tag":209,"props":28512,"children":28513},{"style":216},[28514],{"type":26,"value":944},{"type":21,"tag":209,"props":28516,"children":28517},{"style":233},[28518],{"type":26,"value":6460},{"type":21,"tag":209,"props":28520,"children":28521},{"style":222},[28522],{"type":26,"value":408},{"type":21,"tag":209,"props":28524,"children":28525},{"style":233},[28526],{"type":26,"value":10775},{"type":21,"tag":209,"props":28528,"children":28529},{"style":222},[28530],{"type":26,"value":2608},{"type":21,"tag":209,"props":28532,"children":28533},{"class":211,"line":480},[28534],{"type":21,"tag":209,"props":28535,"children":28536},{"style":222},[28537],{"type":26,"value":2235},{"type":21,"tag":209,"props":28539,"children":28540},{"class":211,"line":489},[28541],{"type":21,"tag":209,"props":28542,"children":28543},{"emptyLinePlaceholder":248},[28544],{"type":26,"value":251},{"type":21,"tag":209,"props":28546,"children":28547},{"class":211,"line":847},[28548,28552,28557,28561,28565,28569,28574,28578,28583,28587,28591],{"type":21,"tag":209,"props":28549,"children":28550},{"style":216},[28551],{"type":26,"value":3069},{"type":21,"tag":209,"props":28553,"children":28554},{"style":222},[28555],{"type":26,"value":28556}," options.cacheKey ",{"type":21,"tag":209,"props":28558,"children":28559},{"style":216},[28560],{"type":26,"value":13270},{"type":21,"tag":209,"props":28562,"children":28563},{"style":222},[28564],{"type":26,"value":18080},{"type":21,"tag":209,"props":28566,"children":28567},{"style":216},[28568],{"type":26,"value":17170},{"type":21,"tag":209,"props":28570,"children":28571},{"style":222},[28572],{"type":26,"value":28573}," options.type ",{"type":21,"tag":209,"props":28575,"children":28576},{"style":216},[28577],{"type":26,"value":17170},{"type":21,"tag":209,"props":28579,"children":28580},{"style":222},[28581],{"type":26,"value":28582}," (options.data ",{"type":21,"tag":209,"props":28584,"children":28585},{"style":216},[28586],{"type":26,"value":13270},{"type":21,"tag":209,"props":28588,"children":28589},{"style":233},[28590],{"type":26,"value":18098},{"type":21,"tag":209,"props":28592,"children":28593},{"style":222},[28594],{"type":26,"value":2608},{"type":21,"tag":209,"props":28596,"children":28597},{"class":211,"line":860},[28598],{"type":21,"tag":209,"props":28599,"children":28600},{"style":222},[28601],{"type":26,"value":13439},{"type":21,"tag":209,"props":28603,"children":28604},{"class":211,"line":877},[28605],{"type":21,"tag":209,"props":28606,"children":28607},{"emptyLinePlaceholder":248},[28608],{"type":26,"value":251},{"type":21,"tag":209,"props":28610,"children":28611},{"class":211,"line":889},[28612],{"type":21,"tag":209,"props":28613,"children":28614},{"style":448},[28615],{"type":26,"value":13290},{"type":21,"tag":209,"props":28617,"children":28618},{"class":211,"line":902},[28619],{"type":21,"tag":209,"props":28620,"children":28621},{"style":448},[28622],{"type":26,"value":18152},{"type":21,"tag":209,"props":28624,"children":28625},{"class":211,"line":914},[28626],{"type":21,"tag":209,"props":28627,"children":28628},{"style":448},[28629],{"type":26,"value":18160},{"type":21,"tag":209,"props":28631,"children":28632},{"class":211,"line":922},[28633],{"type":21,"tag":209,"props":28634,"children":28635},{"style":448},[28636],{"type":26,"value":18168},{"type":21,"tag":209,"props":28638,"children":28639},{"class":211,"line":2312},[28640,28644,28648,28652],{"type":21,"tag":209,"props":28641,"children":28642},{"style":448},[28643],{"type":26,"value":13306},{"type":21,"tag":209,"props":28645,"children":28646},{"style":216},[28647],{"type":26,"value":13311},{"type":21,"tag":209,"props":28649,"children":28650},{"style":360},[28651],{"type":26,"value":18191},{"type":21,"tag":209,"props":28653,"children":28654},{"style":222},[28655],{"type":26,"value":18196},{"type":21,"tag":209,"props":28657,"children":28658},{"class":211,"line":2321},[28659,28663,28667],{"type":21,"tag":209,"props":28660,"children":28661},{"style":448},[28662],{"type":26,"value":13306},{"type":21,"tag":209,"props":28664,"children":28665},{"style":216},[28666],{"type":26,"value":13333},{"type":21,"tag":209,"props":28668,"children":28669},{"style":360},[28670],{"type":26,"value":18212},{"type":21,"tag":209,"props":28672,"children":28673},{"class":211,"line":2372},[28674],{"type":21,"tag":209,"props":28675,"children":28676},{"style":448},[28677],{"type":26,"value":13346},{"type":21,"tag":209,"props":28679,"children":28680},{"class":211,"line":2381},[28681,28685,28689,28693,28697,28701,28705],{"type":21,"tag":209,"props":28682,"children":28683},{"style":216},[28684],{"type":26,"value":16994},{"type":21,"tag":209,"props":28686,"children":28687},{"style":360},[28688],{"type":26,"value":18231},{"type":21,"tag":209,"props":28690,"children":28691},{"style":216},[28692],{"type":26,"value":271},{"type":21,"tag":209,"props":28694,"children":28695},{"style":216},[28696],{"type":26,"value":4789},{"type":21,"tag":209,"props":28698,"children":28699},{"style":222},[28700],{"type":26,"value":368},{"type":21,"tag":209,"props":28702,"children":28703},{"style":400},[28704],{"type":26,"value":16964},{"type":21,"tag":209,"props":28706,"children":28707},{"style":222},[28708],{"type":26,"value":2369},{"type":21,"tag":209,"props":28710,"children":28711},{"class":211,"line":2389},[28712,28716,28720,28724,28728,28732,28736],{"type":21,"tag":209,"props":28713,"children":28714},{"style":216},[28715],{"type":26,"value":6334},{"type":21,"tag":209,"props":28717,"children":28718},{"style":222},[28719],{"type":26,"value":5569},{"type":21,"tag":209,"props":28721,"children":28722},{"style":216},[28723],{"type":26,"value":6455},{"type":21,"tag":209,"props":28725,"children":28726},{"style":222},[28727],{"type":26,"value":18263},{"type":21,"tag":209,"props":28729,"children":28730},{"style":216},[28731],{"type":26,"value":8982},{"type":21,"tag":209,"props":28733,"children":28734},{"style":263},[28735],{"type":26,"value":14038},{"type":21,"tag":209,"props":28737,"children":28738},{"style":222},[28739],{"type":26,"value":241},{"type":21,"tag":209,"props":28741,"children":28742},{"class":211,"line":2397},[28743,28747,28751,28755,28759,28763,28767],{"type":21,"tag":209,"props":28744,"children":28745},{"style":216},[28746],{"type":26,"value":6334},{"type":21,"tag":209,"props":28748,"children":28749},{"style":222},[28750],{"type":26,"value":18287},{"type":21,"tag":209,"props":28752,"children":28753},{"style":216},[28754],{"type":26,"value":14680},{"type":21,"tag":209,"props":28756,"children":28757},{"style":263},[28758],{"type":26,"value":14819},{"type":21,"tag":209,"props":28760,"children":28761},{"style":222},[28762],{"type":26,"value":432},{"type":21,"tag":209,"props":28764,"children":28765},{"style":216},[28766],{"type":26,"value":8982},{"type":21,"tag":209,"props":28768,"children":28769},{"style":222},[28770],{"type":26,"value":28771}," window.localStorage;\n",{"type":21,"tag":209,"props":28773,"children":28774},{"class":211,"line":2406},[28775,28779,28783,28787,28791,28795,28799,28803,28807,28811,28815],{"type":21,"tag":209,"props":28776,"children":28777},{"style":216},[28778],{"type":26,"value":6334},{"type":21,"tag":209,"props":28780,"children":28781},{"style":222},[28782],{"type":26,"value":5569},{"type":21,"tag":209,"props":28784,"children":28785},{"style":216},[28786],{"type":26,"value":8036},{"type":21,"tag":209,"props":28788,"children":28789},{"style":222},[28790],{"type":26,"value":18328},{"type":21,"tag":209,"props":28792,"children":28793},{"style":216},[28794],{"type":26,"value":14680},{"type":21,"tag":209,"props":28796,"children":28797},{"style":233},[28798],{"type":26,"value":18337},{"type":21,"tag":209,"props":28800,"children":28801},{"style":216},[28802],{"type":26,"value":18342},{"type":21,"tag":209,"props":28804,"children":28805},{"style":233},[28806],{"type":26,"value":18347},{"type":21,"tag":209,"props":28808,"children":28809},{"style":216},[28810],{"type":26,"value":9168},{"type":21,"tag":209,"props":28812,"children":28813},{"style":222},[28814],{"type":26,"value":18328},{"type":21,"tag":209,"props":28816,"children":28817},{"style":216},[28818],{"type":26,"value":18360},{"type":21,"tag":209,"props":28820,"children":28821},{"class":211,"line":2415},[28822,28826,28830,28834,28838,28842,28846],{"type":21,"tag":209,"props":28823,"children":28824},{"style":233},[28825],{"type":26,"value":18368},{"type":21,"tag":209,"props":28827,"children":28828},{"style":216},[28829],{"type":26,"value":9168},{"type":21,"tag":209,"props":28831,"children":28832},{"style":222},[28833],{"type":26,"value":18328},{"type":21,"tag":209,"props":28835,"children":28836},{"style":216},[28837],{"type":26,"value":18381},{"type":21,"tag":209,"props":28839,"children":28840},{"style":233},[28841],{"type":26,"value":18386},{"type":21,"tag":209,"props":28843,"children":28844},{"style":216},[28845],{"type":26,"value":9168},{"type":21,"tag":209,"props":28847,"children":28848},{"style":222},[28849],{"type":26,"value":28850}," storage)\n",{"type":21,"tag":209,"props":28852,"children":28853},{"class":211,"line":2424},[28854],{"type":21,"tag":209,"props":28855,"children":28856},{"style":222},[28857],{"type":26,"value":17555},{"type":21,"tag":209,"props":28859,"children":28860},{"class":211,"line":2433},[28861,28865],{"type":21,"tag":209,"props":28862,"children":28863},{"style":216},[28864],{"type":26,"value":13689},{"type":21,"tag":209,"props":28866,"children":28867},{"style":222},[28868],{"type":26,"value":18407},{"type":21,"tag":209,"props":28870,"children":28871},{"class":211,"line":2442},[28872],{"type":21,"tag":209,"props":28873,"children":28874},{"style":222},[28875],{"type":26,"value":2235},{"type":21,"tag":209,"props":28877,"children":28878},{"class":211,"line":2471},[28879,28883,28887,28891,28895,28899],{"type":21,"tag":209,"props":28880,"children":28881},{"style":216},[28882],{"type":26,"value":18422},{"type":21,"tag":209,"props":28884,"children":28885},{"style":216},[28886],{"type":26,"value":6371},{"type":21,"tag":209,"props":28888,"children":28889},{"style":360},[28890],{"type":26,"value":18431},{"type":21,"tag":209,"props":28892,"children":28893},{"style":222},[28894],{"type":26,"value":368},{"type":21,"tag":209,"props":28896,"children":28897},{"style":233},[28898],{"type":26,"value":18440},{"type":21,"tag":209,"props":28900,"children":28901},{"style":216},[28902],{"type":26,"value":18445},{"type":21,"tag":209,"props":28904,"children":28905},{"class":211,"line":2480},[28906,28910],{"type":21,"tag":209,"props":28907,"children":28908},{"style":233},[28909],{"type":26,"value":18453},{"type":21,"tag":209,"props":28911,"children":28912},{"style":222},[28913],{"type":26,"value":2608},{"type":21,"tag":209,"props":28915,"children":28916},{"class":211,"line":2489},[28917],{"type":21,"tag":209,"props":28918,"children":28919},{"style":222},[28920],{"type":26,"value":13439},{"type":21,"tag":209,"props":28922,"children":28923},{"class":211,"line":2516},[28924],{"type":21,"tag":209,"props":28925,"children":28926},{"emptyLinePlaceholder":248},[28927],{"type":26,"value":251},{"type":21,"tag":209,"props":28929,"children":28930},{"class":211,"line":2525},[28931],{"type":21,"tag":209,"props":28932,"children":28933},{"style":448},[28934],{"type":26,"value":13290},{"type":21,"tag":209,"props":28936,"children":28937},{"class":211,"line":2533},[28938],{"type":21,"tag":209,"props":28939,"children":28940},{"style":448},[28941],{"type":26,"value":28942},"     * Remove the item specified by cacheKey from local storage (but not from the IndexedDB, as in all usages\n",{"type":21,"tag":209,"props":28944,"children":28945},{"class":211,"line":2542},[28946],{"type":21,"tag":209,"props":28947,"children":28948},{"style":448},[28949],{"type":26,"value":28950},"     * of this function we expect to overwrite the value with addToStorage shortly).\n",{"type":21,"tag":209,"props":28952,"children":28953},{"class":211,"line":2550},[28954,28958,28962,28966],{"type":21,"tag":209,"props":28955,"children":28956},{"style":448},[28957],{"type":26,"value":13306},{"type":21,"tag":209,"props":28959,"children":28960},{"style":216},[28961],{"type":26,"value":13311},{"type":21,"tag":209,"props":28963,"children":28964},{"style":360},[28965],{"type":26,"value":18509},{"type":21,"tag":209,"props":28967,"children":28968},{"style":222},[28969],{"type":26,"value":18196},{"type":21,"tag":209,"props":28971,"children":28972},{"class":211,"line":2564},[28973,28977,28981,28985],{"type":21,"tag":209,"props":28974,"children":28975},{"style":448},[28976],{"type":26,"value":13306},{"type":21,"tag":209,"props":28978,"children":28979},{"style":216},[28980],{"type":26,"value":13311},{"type":21,"tag":209,"props":28982,"children":28983},{"style":360},[28984],{"type":26,"value":13316},{"type":21,"tag":209,"props":28986,"children":28987},{"style":222},[28988],{"type":26,"value":18533},{"type":21,"tag":209,"props":28990,"children":28991},{"class":211,"line":2611},[28992],{"type":21,"tag":209,"props":28993,"children":28994},{"style":448},[28995],{"type":26,"value":13346},{"type":21,"tag":209,"props":28997,"children":28998},{"class":211,"line":2619},[28999,29003,29007,29011,29015,29019,29023,29027,29031],{"type":21,"tag":209,"props":29000,"children":29001},{"style":216},[29002],{"type":26,"value":16994},{"type":21,"tag":209,"props":29004,"children":29005},{"style":360},[29006],{"type":26,"value":18552},{"type":21,"tag":209,"props":29008,"children":29009},{"style":216},[29010],{"type":26,"value":271},{"type":21,"tag":209,"props":29012,"children":29013},{"style":216},[29014],{"type":26,"value":4789},{"type":21,"tag":209,"props":29016,"children":29017},{"style":222},[29018],{"type":26,"value":368},{"type":21,"tag":209,"props":29020,"children":29021},{"style":400},[29022],{"type":26,"value":16964},{"type":21,"tag":209,"props":29024,"children":29025},{"style":222},[29026],{"type":26,"value":408},{"type":21,"tag":209,"props":29028,"children":29029},{"style":400},[29030],{"type":26,"value":16955},{"type":21,"tag":209,"props":29032,"children":29033},{"style":222},[29034],{"type":26,"value":2369},{"type":21,"tag":209,"props":29036,"children":29037},{"class":211,"line":2627},[29038,29042,29046],{"type":21,"tag":209,"props":29039,"children":29040},{"style":222},[29041],{"type":26,"value":18580},{"type":21,"tag":209,"props":29043,"children":29044},{"style":360},[29045],{"type":26,"value":18585},{"type":21,"tag":209,"props":29047,"children":29048},{"style":222},[29049],{"type":26,"value":18590},{"type":21,"tag":209,"props":29051,"children":29052},{"class":211,"line":2636},[29053,29057,29061,29065,29069,29073],{"type":21,"tag":209,"props":29054,"children":29055},{"style":222},[29056],{"type":26,"value":18580},{"type":21,"tag":209,"props":29058,"children":29059},{"style":360},[29060],{"type":26,"value":18585},{"type":21,"tag":209,"props":29062,"children":29063},{"style":222},[29064],{"type":26,"value":17165},{"type":21,"tag":209,"props":29066,"children":29067},{"style":216},[29068],{"type":26,"value":17170},{"type":21,"tag":209,"props":29070,"children":29071},{"style":233},[29072],{"type":26,"value":17175},{"type":21,"tag":209,"props":29074,"children":29075},{"style":222},[29076],{"type":26,"value":2608},{"type":21,"tag":209,"props":29078,"children":29079},{"class":211,"line":2644},[29080],{"type":21,"tag":209,"props":29081,"children":29082},{"style":222},[29083],{"type":26,"value":13439},{"type":21,"tag":209,"props":29085,"children":29086},{"class":211,"line":2657},[29087],{"type":21,"tag":209,"props":29088,"children":29089},{"emptyLinePlaceholder":248},[29090],{"type":26,"value":251},{"type":21,"tag":209,"props":29092,"children":29093},{"class":211,"line":2728},[29094],{"type":21,"tag":209,"props":29095,"children":29096},{"style":448},[29097],{"type":26,"value":13290},{"type":21,"tag":209,"props":29099,"children":29100},{"class":211,"line":2758},[29101],{"type":21,"tag":209,"props":29102,"children":29103},{"style":448},[29104],{"type":26,"value":29105},"     * Add an item to local storage and IndexedDB storage. We use local storage to satisfy our\n",{"type":21,"tag":209,"props":29107,"children":29108},{"class":211,"line":2776},[29109],{"type":21,"tag":209,"props":29110,"children":29111},{"style":448},[29112],{"type":26,"value":29113},"     * need to synchronously determine whether we have a value stored for a given key (and whether it is\n",{"type":21,"tag":209,"props":29115,"children":29116},{"class":211,"line":2785},[29117],{"type":21,"tag":209,"props":29118,"children":29119},{"style":448},[29120],{"type":26,"value":29121},"     * within the cachettl), and use IndexedDB to store the actual value associated with the key.\n",{"type":21,"tag":209,"props":29123,"children":29124},{"class":211,"line":2793},[29125,29129,29133,29137],{"type":21,"tag":209,"props":29126,"children":29127},{"style":448},[29128],{"type":26,"value":13306},{"type":21,"tag":209,"props":29130,"children":29131},{"style":216},[29132],{"type":26,"value":13311},{"type":21,"tag":209,"props":29134,"children":29135},{"style":360},[29136],{"type":26,"value":18509},{"type":21,"tag":209,"props":29138,"children":29139},{"style":222},[29140],{"type":26,"value":18196},{"type":21,"tag":209,"props":29142,"children":29143},{"class":211,"line":2801},[29144,29148,29152,29156],{"type":21,"tag":209,"props":29145,"children":29146},{"style":448},[29147],{"type":26,"value":13306},{"type":21,"tag":209,"props":29149,"children":29150},{"style":216},[29151],{"type":26,"value":13311},{"type":21,"tag":209,"props":29153,"children":29154},{"style":360},[29155],{"type":26,"value":13316},{"type":21,"tag":209,"props":29157,"children":29158},{"style":222},[29159],{"type":26,"value":18533},{"type":21,"tag":209,"props":29161,"children":29162},{"class":211,"line":2809},[29163,29167,29171,29176],{"type":21,"tag":209,"props":29164,"children":29165},{"style":448},[29166],{"type":26,"value":13306},{"type":21,"tag":209,"props":29168,"children":29169},{"style":216},[29170],{"type":26,"value":13311},{"type":21,"tag":209,"props":29172,"children":29173},{"style":360},[29174],{"type":26,"value":29175}," {number}",{"type":21,"tag":209,"props":29177,"children":29178},{"style":222},[29179],{"type":26,"value":29180}," ttl\n",{"type":21,"tag":209,"props":29182,"children":29183},{"class":211,"line":10937},[29184,29188,29192,29197],{"type":21,"tag":209,"props":29185,"children":29186},{"style":448},[29187],{"type":26,"value":13306},{"type":21,"tag":209,"props":29189,"children":29190},{"style":216},[29191],{"type":26,"value":13311},{"type":21,"tag":209,"props":29193,"children":29194},{"style":360},[29195],{"type":26,"value":29196}," {*}",{"type":21,"tag":209,"props":29198,"children":29199},{"style":222},[29200],{"type":26,"value":26495},{"type":21,"tag":209,"props":29202,"children":29203},{"class":211,"line":10967},[29204,29208,29212,29216],{"type":21,"tag":209,"props":29205,"children":29206},{"style":448},[29207],{"type":26,"value":13306},{"type":21,"tag":209,"props":29209,"children":29210},{"style":216},[29211],{"type":26,"value":13311},{"type":21,"tag":209,"props":29213,"children":29214},{"style":360},[29215],{"type":26,"value":13316},{"type":21,"tag":209,"props":29217,"children":29218},{"style":222},[29219],{"type":26,"value":17452},{"type":21,"tag":209,"props":29221,"children":29222},{"class":211,"line":11003},[29223,29227,29231],{"type":21,"tag":209,"props":29224,"children":29225},{"style":448},[29226],{"type":26,"value":13306},{"type":21,"tag":209,"props":29228,"children":29229},{"style":216},[29230],{"type":26,"value":13333},{"type":21,"tag":209,"props":29232,"children":29233},{"style":360},[29234],{"type":26,"value":29235}," {$.Deferred}\n",{"type":21,"tag":209,"props":29237,"children":29238},{"class":211,"line":11038},[29239],{"type":21,"tag":209,"props":29240,"children":29241},{"style":448},[29242],{"type":26,"value":13346},{"type":21,"tag":209,"props":29244,"children":29245},{"class":211,"line":11072},[29246,29250,29255,29259,29263,29267,29271,29275,29279,29283,29288,29292,29296,29300,29304],{"type":21,"tag":209,"props":29247,"children":29248},{"style":216},[29249],{"type":26,"value":16994},{"type":21,"tag":209,"props":29251,"children":29252},{"style":360},[29253],{"type":26,"value":29254}," addToStorage",{"type":21,"tag":209,"props":29256,"children":29257},{"style":216},[29258],{"type":26,"value":271},{"type":21,"tag":209,"props":29260,"children":29261},{"style":216},[29262],{"type":26,"value":4789},{"type":21,"tag":209,"props":29264,"children":29265},{"style":222},[29266],{"type":26,"value":368},{"type":21,"tag":209,"props":29268,"children":29269},{"style":400},[29270],{"type":26,"value":16964},{"type":21,"tag":209,"props":29272,"children":29273},{"style":222},[29274],{"type":26,"value":408},{"type":21,"tag":209,"props":29276,"children":29277},{"style":400},[29278],{"type":26,"value":16955},{"type":21,"tag":209,"props":29280,"children":29281},{"style":222},[29282],{"type":26,"value":408},{"type":21,"tag":209,"props":29284,"children":29285},{"style":400},[29286],{"type":26,"value":29287},"ttl",{"type":21,"tag":209,"props":29289,"children":29290},{"style":222},[29291],{"type":26,"value":408},{"type":21,"tag":209,"props":29293,"children":29294},{"style":400},[29295],{"type":26,"value":2863},{"type":21,"tag":209,"props":29297,"children":29298},{"style":222},[29299],{"type":26,"value":408},{"type":21,"tag":209,"props":29301,"children":29302},{"style":400},[29303],{"type":26,"value":17505},{"type":21,"tag":209,"props":29305,"children":29306},{"style":222},[29307],{"type":26,"value":2369},{"type":21,"tag":209,"props":29309,"children":29310},{"class":211,"line":11106},[29311,29315,29319,29323,29327,29331],{"type":21,"tag":209,"props":29312,"children":29313},{"style":216},[29314],{"type":26,"value":14505},{"type":21,"tag":209,"props":29316,"children":29317},{"style":222},[29318],{"type":26,"value":26603},{"type":21,"tag":209,"props":29320,"children":29321},{"style":216},[29322],{"type":26,"value":1432},{"type":21,"tag":209,"props":29324,"children":29325},{"style":222},[29326],{"type":26,"value":25427},{"type":21,"tag":209,"props":29328,"children":29329},{"style":360},[29330],{"type":26,"value":25432},{"type":21,"tag":209,"props":29332,"children":29333},{"style":222},[29334],{"type":26,"value":4123},{"type":21,"tag":209,"props":29336,"children":29337},{"class":211,"line":11114},[29338],{"type":21,"tag":209,"props":29339,"children":29340},{"emptyLinePlaceholder":248},[29341],{"type":26,"value":251},{"type":21,"tag":209,"props":29343,"children":29344},{"class":211,"line":14940},[29345,29349],{"type":21,"tag":209,"props":29346,"children":29347},{"style":216},[29348],{"type":26,"value":15345},{"type":21,"tag":209,"props":29350,"children":29351},{"style":222},[29352],{"type":26,"value":29353},"{\n",{"type":21,"tag":209,"props":29355,"children":29356},{"class":211,"line":14949},[29357,29361,29365,29370,29374],{"type":21,"tag":209,"props":29358,"children":29359},{"style":222},[29360],{"type":26,"value":17139},{"type":21,"tag":209,"props":29362,"children":29363},{"style":360},[29364],{"type":26,"value":17144},{"type":21,"tag":209,"props":29366,"children":29367},{"style":222},[29368],{"type":26,"value":29369},"(cacheKey, ",{"type":21,"tag":209,"props":29371,"children":29372},{"style":263},[29373],{"type":26,"value":3224},{"type":21,"tag":209,"props":29375,"children":29376},{"style":222},[29377],{"type":26,"value":2608},{"type":21,"tag":209,"props":29379,"children":29380},{"class":211,"line":14958},[29381,29385,29389,29393,29397,29401],{"type":21,"tag":209,"props":29382,"children":29383},{"style":222},[29384],{"type":26,"value":17139},{"type":21,"tag":209,"props":29386,"children":29387},{"style":360},[29388],{"type":26,"value":17144},{"type":21,"tag":209,"props":29390,"children":29391},{"style":222},[29392],{"type":26,"value":17165},{"type":21,"tag":209,"props":29394,"children":29395},{"style":216},[29396],{"type":26,"value":17170},{"type":21,"tag":209,"props":29398,"children":29399},{"style":233},[29400],{"type":26,"value":17175},{"type":21,"tag":209,"props":29402,"children":29403},{"style":222},[29404],{"type":26,"value":29405},", ttl);\n",{"type":21,"tag":209,"props":29407,"children":29408},{"class":211,"line":14966},[29409,29414,29418],{"type":21,"tag":209,"props":29410,"children":29411},{"style":222},[29412],{"type":26,"value":29413},"        }",{"type":21,"tag":209,"props":29415,"children":29416},{"style":216},[29417],{"type":26,"value":5347},{"type":21,"tag":209,"props":29419,"children":29420},{"style":222},[29421],{"type":26,"value":29422},"(e){\n",{"type":21,"tag":209,"props":29424,"children":29425},{"class":211,"line":14975},[29426,29430],{"type":21,"tag":209,"props":29427,"children":29428},{"style":360},[29429],{"type":26,"value":17290},{"type":21,"tag":209,"props":29431,"children":29432},{"style":222},[29433],{"type":26,"value":17295},{"type":21,"tag":209,"props":29435,"children":29436},{"class":211,"line":14984},[29437,29442,29446],{"type":21,"tag":209,"props":29438,"children":29439},{"style":222},[29440],{"type":26,"value":29441},"            defer.",{"type":21,"tag":209,"props":29443,"children":29444},{"style":360},[29445],{"type":26,"value":14182},{"type":21,"tag":209,"props":29447,"children":29448},{"style":222},[29449],{"type":26,"value":29450},"(e);\n",{"type":21,"tag":209,"props":29452,"children":29453},{"class":211,"line":15018},[29454],{"type":21,"tag":209,"props":29455,"children":29456},{"emptyLinePlaceholder":248},[29457],{"type":26,"value":251},{"type":21,"tag":209,"props":29459,"children":29460},{"class":211,"line":15050},[29461,29465,29469,29473],{"type":21,"tag":209,"props":29462,"children":29463},{"style":216},[29464],{"type":26,"value":13689},{"type":21,"tag":209,"props":29466,"children":29467},{"style":222},[29468],{"type":26,"value":26782},{"type":21,"tag":209,"props":29470,"children":29471},{"style":360},[29472],{"type":26,"value":26332},{"type":21,"tag":209,"props":29474,"children":29475},{"style":222},[29476],{"type":26,"value":4123},{"type":21,"tag":209,"props":29478,"children":29479},{"class":211,"line":15082},[29480],{"type":21,"tag":209,"props":29481,"children":29482},{"style":222},[29483],{"type":26,"value":2235},{"type":21,"tag":209,"props":29485,"children":29486},{"class":211,"line":15090},[29487],{"type":21,"tag":209,"props":29488,"children":29489},{"emptyLinePlaceholder":248},[29490],{"type":26,"value":251},{"type":21,"tag":209,"props":29492,"children":29493},{"class":211,"line":15098},[29494,29498,29503,29507],{"type":21,"tag":209,"props":29495,"children":29496},{"style":216},[29497],{"type":26,"value":3069},{"type":21,"tag":209,"props":29499,"children":29500},{"style":222},[29501],{"type":26,"value":29502}," $.jidb.",{"type":21,"tag":209,"props":29504,"children":29505},{"style":360},[29506],{"type":26,"value":17144},{"type":21,"tag":209,"props":29508,"children":29509},{"style":222},[29510],{"type":26,"value":29511},"(cacheKey, data, dataType);\n",{"type":21,"tag":209,"props":29513,"children":29514},{"class":211,"line":15106},[29515],{"type":21,"tag":209,"props":29516,"children":29517},{"style":222},[29518],{"type":26,"value":13439},{"type":21,"tag":209,"props":29520,"children":29521},{"class":211,"line":15114},[29522],{"type":21,"tag":209,"props":29523,"children":29524},{"emptyLinePlaceholder":248},[29525],{"type":26,"value":251},{"type":21,"tag":209,"props":29527,"children":29528},{"class":211,"line":15123},[29529],{"type":21,"tag":209,"props":29530,"children":29531},{"style":448},[29532],{"type":26,"value":13290},{"type":21,"tag":209,"props":29534,"children":29535},{"class":211,"line":15143},[29536],{"type":21,"tag":209,"props":29537,"children":29538},{"style":448},[29539],{"type":26,"value":29540},"     * Prefilter for caching ajax calls.\n",{"type":21,"tag":209,"props":29542,"children":29543},{"class":211,"line":15160},[29544],{"type":21,"tag":209,"props":29545,"children":29546},{"style":448},[29547],{"type":26,"value":29548},"     * See also $.ajaxTransport for the elements that make this compatible with jQuery Deferred.\n",{"type":21,"tag":209,"props":29550,"children":29551},{"class":211,"line":15168},[29552],{"type":21,"tag":209,"props":29553,"children":29554},{"style":448},[29555],{"type":26,"value":29556},"     * New parameters available on the ajax call:\n",{"type":21,"tag":209,"props":29558,"children":29559},{"class":211,"line":15196},[29560],{"type":21,"tag":209,"props":29561,"children":29562},{"style":448},[29563],{"type":26,"value":29564},"     * localCache   : true              - required - either a boolean (in which case localStorage is used),\n",{"type":21,"tag":209,"props":29566,"children":29567},{"class":211,"line":15219},[29568],{"type":21,"tag":209,"props":29569,"children":29570},{"style":448},[29571],{"type":26,"value":29572},"     * or an object implementing the Storage interface, in which case that object is used instead.\n",{"type":21,"tag":209,"props":29574,"children":29575},{"class":211,"line":15240},[29576],{"type":21,"tag":209,"props":29577,"children":29578},{"style":448},[29579],{"type":26,"value":29580},"     * cacheTTL     : 5,                - optional - cache time in hours, default is 5.\n",{"type":21,"tag":209,"props":29582,"children":29583},{"class":211,"line":15248},[29584],{"type":21,"tag":209,"props":29585,"children":29586},{"style":448},[29587],{"type":26,"value":29588},"     * cacheKey     : 'myCacheKey',     - optional - key under which cached string will be stored\n",{"type":21,"tag":209,"props":29590,"children":29591},{"class":211,"line":15256},[29592],{"type":21,"tag":209,"props":29593,"children":29594},{"style":448},[29595],{"type":26,"value":29596},"     * isCacheValid : function          - optional - return true for valid, false for invalid\n",{"type":21,"tag":209,"props":29598,"children":29599},{"class":211,"line":15284},[29600,29604,29609],{"type":21,"tag":209,"props":29601,"children":29602},{"style":448},[29603],{"type":26,"value":13306},{"type":21,"tag":209,"props":29605,"children":29606},{"style":216},[29607],{"type":26,"value":29608},"@method",{"type":21,"tag":209,"props":29610,"children":29611},{"style":360},[29612],{"type":26,"value":29613}," $.ajaxPrefilter\n",{"type":21,"tag":209,"props":29615,"children":29616},{"class":211,"line":15317},[29617,29621,29625,29630],{"type":21,"tag":209,"props":29618,"children":29619},{"style":448},[29620],{"type":26,"value":13306},{"type":21,"tag":209,"props":29622,"children":29623},{"style":216},[29624],{"type":26,"value":13311},{"type":21,"tag":209,"props":29626,"children":29627},{"style":222},[29628],{"type":26,"value":29629}," options",{"type":21,"tag":209,"props":29631,"children":29632},{"style":448},[29633],{"type":26,"value":29634}," {Object} Options for the ajax call, modified with ajax standard settings\n",{"type":21,"tag":209,"props":29636,"children":29637},{"class":211,"line":15331},[29638],{"type":21,"tag":209,"props":29639,"children":29640},{"style":448},[29641],{"type":26,"value":13346},{"type":21,"tag":209,"props":29643,"children":29644},{"class":211,"line":15339},[29645,29650,29655,29659,29663,29667,29671],{"type":21,"tag":209,"props":29646,"children":29647},{"style":222},[29648],{"type":26,"value":29649},"    $.",{"type":21,"tag":209,"props":29651,"children":29652},{"style":360},[29653],{"type":26,"value":29654},"ajaxPrefilter",{"type":21,"tag":209,"props":29656,"children":29657},{"style":222},[29658],{"type":26,"value":368},{"type":21,"tag":209,"props":29660,"children":29661},{"style":216},[29662],{"type":26,"value":4622},{"type":21,"tag":209,"props":29664,"children":29665},{"style":222},[29666],{"type":26,"value":368},{"type":21,"tag":209,"props":29668,"children":29669},{"style":400},[29670],{"type":26,"value":28349},{"type":21,"tag":209,"props":29672,"children":29673},{"style":222},[29674],{"type":26,"value":2369},{"type":21,"tag":209,"props":29676,"children":29677},{"class":211,"line":15352},[29678,29682,29686,29690,29694],{"type":21,"tag":209,"props":29679,"children":29680},{"style":216},[29681],{"type":26,"value":14505},{"type":21,"tag":209,"props":29683,"children":29684},{"style":222},[29685],{"type":26,"value":18328},{"type":21,"tag":209,"props":29687,"children":29688},{"style":216},[29689],{"type":26,"value":1432},{"type":21,"tag":209,"props":29691,"children":29692},{"style":360},[29693],{"type":26,"value":18231},{"type":21,"tag":209,"props":29695,"children":29696},{"style":222},[29697],{"type":26,"value":29698},"(options.localCache),\n",{"type":21,"tag":209,"props":29700,"children":29701},{"class":211,"line":15382},[29702,29706,29710,29714,29718,29722,29726,29730,29734,29738,29742,29746,29750,29755,29759,29763],{"type":21,"tag":209,"props":29703,"children":29704},{"style":222},[29705],{"type":26,"value":19732},{"type":21,"tag":209,"props":29707,"children":29708},{"style":216},[29709],{"type":26,"value":1432},{"type":21,"tag":209,"props":29711,"children":29712},{"style":216},[29713],{"type":26,"value":20050},{"type":21,"tag":209,"props":29715,"children":29716},{"style":360},[29717],{"type":26,"value":17189},{"type":21,"tag":209,"props":29719,"children":29720},{"style":222},[29721],{"type":26,"value":17194},{"type":21,"tag":209,"props":29723,"children":29724},{"style":216},[29725],{"type":26,"value":17170},{"type":21,"tag":209,"props":29727,"children":29728},{"style":263},[29729],{"type":26,"value":17203},{"type":21,"tag":209,"props":29731,"children":29732},{"style":216},[29733],{"type":26,"value":17208},{"type":21,"tag":209,"props":29735,"children":29736},{"style":263},[29737],{"type":26,"value":17213},{"type":21,"tag":209,"props":29739,"children":29740},{"style":216},[29741],{"type":26,"value":17208},{"type":21,"tag":209,"props":29743,"children":29744},{"style":263},[29745],{"type":26,"value":17213},{"type":21,"tag":209,"props":29747,"children":29748},{"style":216},[29749],{"type":26,"value":17208},{"type":21,"tag":209,"props":29751,"children":29752},{"style":222},[29753],{"type":26,"value":29754}," (options.cacheTTL ",{"type":21,"tag":209,"props":29756,"children":29757},{"style":216},[29758],{"type":26,"value":13270},{"type":21,"tag":209,"props":29760,"children":29761},{"style":263},[29762],{"type":26,"value":19750},{"type":21,"tag":209,"props":29764,"children":29765},{"style":222},[29766],{"type":26,"value":5404},{"type":21,"tag":209,"props":29768,"children":29769},{"class":211,"line":15400},[29770,29774,29778,29782],{"type":21,"tag":209,"props":29771,"children":29772},{"style":222},[29773],{"type":26,"value":19763},{"type":21,"tag":209,"props":29775,"children":29776},{"style":216},[29777],{"type":26,"value":1432},{"type":21,"tag":209,"props":29779,"children":29780},{"style":360},[29781],{"type":26,"value":17942},{"type":21,"tag":209,"props":29783,"children":29784},{"style":222},[29785],{"type":26,"value":29786},"(options),\n",{"type":21,"tag":209,"props":29788,"children":29789},{"class":211,"line":15409},[29790,29794,29798],{"type":21,"tag":209,"props":29791,"children":29792},{"style":222},[29793],{"type":26,"value":19785},{"type":21,"tag":209,"props":29795,"children":29796},{"style":216},[29797],{"type":26,"value":1432},{"type":21,"tag":209,"props":29799,"children":29800},{"style":222},[29801],{"type":26,"value":29802}," options.isCacheValid,\n",{"type":21,"tag":209,"props":29804,"children":29805},{"class":211,"line":15433},[29806],{"type":21,"tag":209,"props":29807,"children":29808},{"style":222},[29809],{"type":26,"value":19803},{"type":21,"tag":209,"props":29811,"children":29812},{"class":211,"line":15441},[29813],{"type":21,"tag":209,"props":29814,"children":29815},{"style":222},[29816],{"type":26,"value":29817},"            value;\n",{"type":21,"tag":209,"props":29819,"children":29820},{"class":211,"line":15449},[29821],{"type":21,"tag":209,"props":29822,"children":29823},{"emptyLinePlaceholder":248},[29824],{"type":26,"value":251},{"type":21,"tag":209,"props":29826,"children":29827},{"class":211,"line":15467},[29828,29832,29836,29840,29844,29848],{"type":21,"tag":209,"props":29829,"children":29830},{"style":216},[29831],{"type":26,"value":6334},{"type":21,"tag":209,"props":29833,"children":29834},{"style":222},[29835],{"type":26,"value":5569},{"type":21,"tag":209,"props":29837,"children":29838},{"style":216},[29839],{"type":26,"value":6455},{"type":21,"tag":209,"props":29841,"children":29842},{"style":222},[29843],{"type":26,"value":18263},{"type":21,"tag":209,"props":29845,"children":29846},{"style":216},[29847],{"type":26,"value":8982},{"type":21,"tag":209,"props":29849,"children":29850},{"style":222},[29851],{"type":26,"value":241},{"type":21,"tag":209,"props":29853,"children":29854},{"class":211,"line":15475},[29855,29859,29863,29867,29871,29875,29879,29883],{"type":21,"tag":209,"props":29856,"children":29857},{"style":222},[29858],{"type":26,"value":19878},{"type":21,"tag":209,"props":29860,"children":29861},{"style":216},[29862],{"type":26,"value":1432},{"type":21,"tag":209,"props":29864,"children":29865},{"style":222},[29866],{"type":26,"value":19887},{"type":21,"tag":209,"props":29868,"children":29869},{"style":360},[29870],{"type":26,"value":19892},{"type":21,"tag":209,"props":29872,"children":29873},{"style":222},[29874],{"type":26,"value":17165},{"type":21,"tag":209,"props":29876,"children":29877},{"style":216},[29878],{"type":26,"value":17170},{"type":21,"tag":209,"props":29880,"children":29881},{"style":233},[29882],{"type":26,"value":17175},{"type":21,"tag":209,"props":29884,"children":29885},{"style":222},[29886],{"type":26,"value":2608},{"type":21,"tag":209,"props":29888,"children":29889},{"class":211,"line":15487},[29890],{"type":21,"tag":209,"props":29891,"children":29892},{"emptyLinePlaceholder":248},[29893],{"type":26,"value":251},{"type":21,"tag":209,"props":29895,"children":29896},{"class":211,"line":15495},[29897,29901,29905,29909,29913,29917,29921,29925,29929,29933,29937],{"type":21,"tag":209,"props":29898,"children":29899},{"style":216},[29900],{"type":26,"value":6334},{"type":21,"tag":209,"props":29902,"children":29903},{"style":222},[29904],{"type":26,"value":19929},{"type":21,"tag":209,"props":29906,"children":29907},{"style":216},[29908],{"type":26,"value":18381},{"type":21,"tag":209,"props":29910,"children":29911},{"style":216},[29912],{"type":26,"value":19938},{"type":21,"tag":209,"props":29914,"children":29915},{"style":222},[29916],{"type":26,"value":19943},{"type":21,"tag":209,"props":29918,"children":29919},{"style":216},[29920],{"type":26,"value":14680},{"type":21,"tag":209,"props":29922,"children":29923},{"style":233},[29924],{"type":26,"value":14685},{"type":21,"tag":209,"props":29926,"children":29927},{"style":216},[29928],{"type":26,"value":18342},{"type":21,"tag":209,"props":29930,"children":29931},{"style":216},[29932],{"type":26,"value":19960},{"type":21,"tag":209,"props":29934,"children":29935},{"style":360},[29936],{"type":26,"value":19965},{"type":21,"tag":209,"props":29938,"children":29939},{"style":222},[29940],{"type":26,"value":29941},"()){\n",{"type":21,"tag":209,"props":29943,"children":29944},{"class":211,"line":15503},[29945,29949],{"type":21,"tag":209,"props":29946,"children":29947},{"style":360},[29948],{"type":26,"value":17290},{"type":21,"tag":209,"props":29950,"children":29951},{"style":222},[29952],{"type":26,"value":17295},{"type":21,"tag":209,"props":29954,"children":29955},{"class":211,"line":15511},[29956,29960,29964,29968],{"type":21,"tag":209,"props":29957,"children":29958},{"style":222},[29959],{"type":26,"value":19991},{"type":21,"tag":209,"props":29961,"children":29962},{"style":216},[29963],{"type":26,"value":1432},{"type":21,"tag":209,"props":29965,"children":29966},{"style":263},[29967],{"type":26,"value":8009},{"type":21,"tag":209,"props":29969,"children":29970},{"style":222},[29971],{"type":26,"value":241},{"type":21,"tag":209,"props":29973,"children":29974},{"class":211,"line":15520},[29975],{"type":21,"tag":209,"props":29976,"children":29977},{"style":222},[29978],{"type":26,"value":2235},{"type":21,"tag":209,"props":29980,"children":29981},{"class":211,"line":15529},[29982],{"type":21,"tag":209,"props":29983,"children":29984},{"emptyLinePlaceholder":248},[29985],{"type":26,"value":251},{"type":21,"tag":209,"props":29987,"children":29988},{"class":211,"line":15545},[29989,29993,29997,30001,30005,30009,30013,30017],{"type":21,"tag":209,"props":29990,"children":29991},{"style":216},[29992],{"type":26,"value":6334},{"type":21,"tag":209,"props":29994,"children":29995},{"style":222},[29996],{"type":26,"value":20032},{"type":21,"tag":209,"props":29998,"children":29999},{"style":216},[30000],{"type":26,"value":18381},{"type":21,"tag":209,"props":30002,"children":30003},{"style":222},[30004],{"type":26,"value":20041},{"type":21,"tag":209,"props":30006,"children":30007},{"style":216},[30008],{"type":26,"value":1985},{"type":21,"tag":209,"props":30010,"children":30011},{"style":216},[30012],{"type":26,"value":20050},{"type":21,"tag":209,"props":30014,"children":30015},{"style":360},[30016],{"type":26,"value":17189},{"type":21,"tag":209,"props":30018,"children":30019},{"style":222},[30020],{"type":26,"value":29941},{"type":21,"tag":209,"props":30022,"children":30023},{"class":211,"line":15561},[30024,30028],{"type":21,"tag":209,"props":30025,"children":30026},{"style":360},[30027],{"type":26,"value":17290},{"type":21,"tag":209,"props":30029,"children":30030},{"style":222},[30031],{"type":26,"value":17295},{"type":21,"tag":209,"props":30033,"children":30034},{"class":211,"line":15569},[30035,30039,30043,30047],{"type":21,"tag":209,"props":30036,"children":30037},{"style":222},[30038],{"type":26,"value":19991},{"type":21,"tag":209,"props":30040,"children":30041},{"style":216},[30042],{"type":26,"value":1432},{"type":21,"tag":209,"props":30044,"children":30045},{"style":263},[30046],{"type":26,"value":8009},{"type":21,"tag":209,"props":30048,"children":30049},{"style":222},[30050],{"type":26,"value":241},{"type":21,"tag":209,"props":30052,"children":30053},{"class":211,"line":15593},[30054],{"type":21,"tag":209,"props":30055,"children":30056},{"style":222},[30057],{"type":26,"value":2235},{"type":21,"tag":209,"props":30059,"children":30060},{"class":211,"line":15634},[30061],{"type":21,"tag":209,"props":30062,"children":30063},{"emptyLinePlaceholder":248},[30064],{"type":26,"value":251},{"type":21,"tag":209,"props":30066,"children":30067},{"class":211,"line":15662},[30068,30072,30076,30080,30084],{"type":21,"tag":209,"props":30069,"children":30070},{"style":222},[30071],{"type":26,"value":20095},{"type":21,"tag":209,"props":30073,"children":30074},{"style":216},[30075],{"type":26,"value":1432},{"type":21,"tag":209,"props":30077,"children":30078},{"style":222},[30079],{"type":26,"value":19887},{"type":21,"tag":209,"props":30081,"children":30082},{"style":360},[30083],{"type":26,"value":19892},{"type":21,"tag":209,"props":30085,"children":30086},{"style":222},[30087],{"type":26,"value":18590},{"type":21,"tag":209,"props":30089,"children":30090},{"class":211,"line":15678},[30091,30095,30099,30103],{"type":21,"tag":209,"props":30092,"children":30093},{"style":216},[30094],{"type":26,"value":6334},{"type":21,"tag":209,"props":30096,"children":30097},{"style":222},[30098],{"type":26,"value":5569},{"type":21,"tag":209,"props":30100,"children":30101},{"style":216},[30102],{"type":26,"value":6455},{"type":21,"tag":209,"props":30104,"children":30105},{"style":222},[30106],{"type":26,"value":30107},"value){\n",{"type":21,"tag":209,"props":30109,"children":30110},{"class":211,"line":15694},[30111],{"type":21,"tag":209,"props":30112,"children":30113},{"style":448},[30114],{"type":26,"value":30115},"            // If it not in the cache, we store the data, add success callback - normal callback will proceed\n",{"type":21,"tag":209,"props":30117,"children":30118},{"class":211,"line":15710},[30119,30123],{"type":21,"tag":209,"props":30120,"children":30121},{"style":216},[30122],{"type":26,"value":14662},{"type":21,"tag":209,"props":30124,"children":30125},{"style":222},[30126],{"type":26,"value":30127}," (options.success) {\n",{"type":21,"tag":209,"props":30129,"children":30130},{"class":211,"line":15718},[30131,30136,30140],{"type":21,"tag":209,"props":30132,"children":30133},{"style":222},[30134],{"type":26,"value":30135},"                options.realsuccess ",{"type":21,"tag":209,"props":30137,"children":30138},{"style":216},[30139],{"type":26,"value":1432},{"type":21,"tag":209,"props":30141,"children":30142},{"style":222},[30143],{"type":26,"value":30144}," options.success;\n",{"type":21,"tag":209,"props":30146,"children":30147},{"class":211,"line":15730},[30148],{"type":21,"tag":209,"props":30149,"children":30150},{"style":222},[30151],{"type":26,"value":14714},{"type":21,"tag":209,"props":30153,"children":30154},{"class":211,"line":15738},[30155,30160,30165,30169,30173,30177,30181,30185,30189,30193,30197],{"type":21,"tag":209,"props":30156,"children":30157},{"style":222},[30158],{"type":26,"value":30159},"            options.",{"type":21,"tag":209,"props":30161,"children":30162},{"style":360},[30163],{"type":26,"value":30164},"success",{"type":21,"tag":209,"props":30166,"children":30167},{"style":216},[30168],{"type":26,"value":271},{"type":21,"tag":209,"props":30170,"children":30171},{"style":216},[30172],{"type":26,"value":4789},{"type":21,"tag":209,"props":30174,"children":30175},{"style":222},[30176],{"type":26,"value":368},{"type":21,"tag":209,"props":30178,"children":30179},{"style":400},[30180],{"type":26,"value":2863},{"type":21,"tag":209,"props":30182,"children":30183},{"style":222},[30184],{"type":26,"value":408},{"type":21,"tag":209,"props":30186,"children":30187},{"style":400},[30188],{"type":26,"value":22261},{"type":21,"tag":209,"props":30190,"children":30191},{"style":222},[30192],{"type":26,"value":408},{"type":21,"tag":209,"props":30194,"children":30195},{"style":400},[30196],{"type":26,"value":20911},{"type":21,"tag":209,"props":30198,"children":30199},{"style":222},[30200],{"type":26,"value":5588},{"type":21,"tag":209,"props":30202,"children":30203},{"class":211,"line":15746},[30204,30209,30213,30217,30221,30226,30230,30235,30240,30244,30248],{"type":21,"tag":209,"props":30205,"children":30206},{"style":216},[30207],{"type":26,"value":30208},"                var",{"type":21,"tag":209,"props":30210,"children":30211},{"style":222},[30212],{"type":26,"value":26727},{"type":21,"tag":209,"props":30214,"children":30215},{"style":216},[30216],{"type":26,"value":1432},{"type":21,"tag":209,"props":30218,"children":30219},{"style":263},[30220],{"type":26,"value":20502},{"type":21,"tag":209,"props":30222,"children":30223},{"style":222},[30224],{"type":26,"value":30225},".dataType ",{"type":21,"tag":209,"props":30227,"children":30228},{"style":216},[30229],{"type":26,"value":13270},{"type":21,"tag":209,"props":30231,"children":30232},{"style":222},[30233],{"type":26,"value":30234}," jqXHR.",{"type":21,"tag":209,"props":30236,"children":30237},{"style":360},[30238],{"type":26,"value":30239},"getResponseHeader",{"type":21,"tag":209,"props":30241,"children":30242},{"style":222},[30243],{"type":26,"value":368},{"type":21,"tag":209,"props":30245,"children":30246},{"style":233},[30247],{"type":26,"value":17046},{"type":21,"tag":209,"props":30249,"children":30250},{"style":222},[30251],{"type":26,"value":2608},{"type":21,"tag":209,"props":30253,"children":30254},{"class":211,"line":15754},[30255],{"type":21,"tag":209,"props":30256,"children":30257},{"emptyLinePlaceholder":248},[30258],{"type":26,"value":251},{"type":21,"tag":209,"props":30260,"children":30261},{"class":211,"line":15767},[30262],{"type":21,"tag":209,"props":30263,"children":30264},{"style":448},[30265],{"type":26,"value":30266},"                // Save the data to storage, catching Storage exception and IndexedDB exceptions alike\n",{"type":21,"tag":209,"props":30268,"children":30269},{"class":211,"line":19592},[30270],{"type":21,"tag":209,"props":30271,"children":30272},{"style":448},[30273],{"type":26,"value":30274},"                // and reject the returned promise as a result.\n",{"type":21,"tag":209,"props":30276,"children":30277},{"class":211,"line":19601},[30278,30283,30288,30292,30296,30300],{"type":21,"tag":209,"props":30279,"children":30280},{"style":360},[30281],{"type":26,"value":30282},"                addToStorage",{"type":21,"tag":209,"props":30284,"children":30285},{"style":222},[30286],{"type":26,"value":30287},"(storage, cacheKey, hourstl, data, dataType).",{"type":21,"tag":209,"props":30289,"children":30290},{"style":360},[30291],{"type":26,"value":20845},{"type":21,"tag":209,"props":30293,"children":30294},{"style":222},[30295],{"type":26,"value":368},{"type":21,"tag":209,"props":30297,"children":30298},{"style":216},[30299],{"type":26,"value":4622},{"type":21,"tag":209,"props":30301,"children":30302},{"style":222},[30303],{"type":26,"value":2561},{"type":21,"tag":209,"props":30305,"children":30306},{"class":211,"line":19615},[30307,30312,30317,30322],{"type":21,"tag":209,"props":30308,"children":30309},{"style":216},[30310],{"type":26,"value":30311},"                    if",{"type":21,"tag":209,"props":30313,"children":30314},{"style":222},[30315],{"type":26,"value":30316}," (options.realsuccess) options.",{"type":21,"tag":209,"props":30318,"children":30319},{"style":360},[30320],{"type":26,"value":30321},"realsuccess",{"type":21,"tag":209,"props":30323,"children":30324},{"style":222},[30325],{"type":26,"value":30326},"(data, status, jqXHR);\n",{"type":21,"tag":209,"props":30328,"children":30329},{"class":211,"line":19624},[30330,30335,30339,30343,30347,30351,30355],{"type":21,"tag":209,"props":30331,"children":30332},{"style":222},[30333],{"type":26,"value":30334},"                }).",{"type":21,"tag":209,"props":30336,"children":30337},{"style":360},[30338],{"type":26,"value":20894},{"type":21,"tag":209,"props":30340,"children":30341},{"style":222},[30342],{"type":26,"value":368},{"type":21,"tag":209,"props":30344,"children":30345},{"style":216},[30346],{"type":26,"value":4622},{"type":21,"tag":209,"props":30348,"children":30349},{"style":222},[30350],{"type":26,"value":368},{"type":21,"tag":209,"props":30352,"children":30353},{"style":400},[30354],{"type":26,"value":25805},{"type":21,"tag":209,"props":30356,"children":30357},{"style":222},[30358],{"type":26,"value":2369},{"type":21,"tag":209,"props":30360,"children":30361},{"class":211,"line":19638},[30362,30367,30371],{"type":21,"tag":209,"props":30363,"children":30364},{"style":222},[30365],{"type":26,"value":30366},"                    console.",{"type":21,"tag":209,"props":30368,"children":30369},{"style":360},[30370],{"type":26,"value":1059},{"type":21,"tag":209,"props":30372,"children":30373},{"style":222},[30374],{"type":26,"value":25825},{"type":21,"tag":209,"props":30376,"children":30377},{"class":211,"line":19652},[30378],{"type":21,"tag":209,"props":30379,"children":30380},{"style":222},[30381],{"type":26,"value":28121},{"type":21,"tag":209,"props":30383,"children":30384},{"class":211,"line":19660},[30385],{"type":21,"tag":209,"props":30386,"children":30387},{"style":222},[30388],{"type":26,"value":14946},{"type":21,"tag":209,"props":30390,"children":30391},{"class":211,"line":19701},[30392],{"type":21,"tag":209,"props":30393,"children":30394},{"style":222},[30395],{"type":26,"value":2235},{"type":21,"tag":209,"props":30397,"children":30398},{"class":211,"line":19726},[30399],{"type":21,"tag":209,"props":30400,"children":30401},{"style":222},[30402],{"type":26,"value":3391},{"type":21,"tag":209,"props":30404,"children":30405},{"class":211,"line":19757},[30406],{"type":21,"tag":209,"props":30407,"children":30408},{"emptyLinePlaceholder":248},[30409],{"type":26,"value":251},{"type":21,"tag":209,"props":30411,"children":30412},{"class":211,"line":19779},[30413],{"type":21,"tag":209,"props":30414,"children":30415},{"style":448},[30416],{"type":26,"value":13290},{"type":21,"tag":209,"props":30418,"children":30419},{"class":211,"line":19797},[30420],{"type":21,"tag":209,"props":30421,"children":30422},{"style":448},[30423],{"type":26,"value":30424},"     * This function performs the fetch from cache portion of the functionality needed to cache ajax\n",{"type":21,"tag":209,"props":30426,"children":30427},{"class":211,"line":19806},[30428],{"type":21,"tag":209,"props":30429,"children":30430},{"style":448},[30431],{"type":26,"value":30432},"     * calls and still fulfill the jqXHR Deferred Promise interface.\n",{"type":21,"tag":209,"props":30434,"children":30435},{"class":211,"line":19814},[30436],{"type":21,"tag":209,"props":30437,"children":30438},{"style":448},[30439],{"type":26,"value":30440},"     * See also $.ajaxPrefilter\n",{"type":21,"tag":209,"props":30442,"children":30443},{"class":211,"line":19823},[30444,30448,30452],{"type":21,"tag":209,"props":30445,"children":30446},{"style":448},[30447],{"type":26,"value":13306},{"type":21,"tag":209,"props":30449,"children":30450},{"style":216},[30451],{"type":26,"value":29608},{"type":21,"tag":209,"props":30453,"children":30454},{"style":360},[30455],{"type":26,"value":30456}," $.ajaxTransport\n",{"type":21,"tag":209,"props":30458,"children":30459},{"class":211,"line":19831},[30460,30464,30469],{"type":21,"tag":209,"props":30461,"children":30462},{"style":448},[30463],{"type":26,"value":13306},{"type":21,"tag":209,"props":30465,"children":30466},{"style":216},[30467],{"type":26,"value":30468},"@params",{"type":21,"tag":209,"props":30470,"children":30471},{"style":448},[30472],{"type":26,"value":30473}," options {Object} Options for the ajax call, modified with ajax standard settings\n",{"type":21,"tag":209,"props":30475,"children":30476},{"class":211,"line":19864},[30477],{"type":21,"tag":209,"props":30478,"children":30479},{"style":448},[30480],{"type":26,"value":13346},{"type":21,"tag":209,"props":30482,"children":30483},{"class":211,"line":19872},[30484,30488,30493,30497,30502,30506,30510,30514,30518],{"type":21,"tag":209,"props":30485,"children":30486},{"style":222},[30487],{"type":26,"value":29649},{"type":21,"tag":209,"props":30489,"children":30490},{"style":360},[30491],{"type":26,"value":30492},"ajaxTransport",{"type":21,"tag":209,"props":30494,"children":30495},{"style":222},[30496],{"type":26,"value":368},{"type":21,"tag":209,"props":30498,"children":30499},{"style":233},[30500],{"type":26,"value":30501},"\"+*\"",{"type":21,"tag":209,"props":30503,"children":30504},{"style":222},[30505],{"type":26,"value":408},{"type":21,"tag":209,"props":30507,"children":30508},{"style":216},[30509],{"type":26,"value":4622},{"type":21,"tag":209,"props":30511,"children":30512},{"style":222},[30513],{"type":26,"value":368},{"type":21,"tag":209,"props":30515,"children":30516},{"style":400},[30517],{"type":26,"value":28349},{"type":21,"tag":209,"props":30519,"children":30520},{"style":222},[30521],{"type":26,"value":2369},{"type":21,"tag":209,"props":30523,"children":30524},{"class":211,"line":19911},[30525,30529],{"type":21,"tag":209,"props":30526,"children":30527},{"style":216},[30528],{"type":26,"value":6334},{"type":21,"tag":209,"props":30530,"children":30531},{"style":222},[30532],{"type":26,"value":30533}," (options.localCache)\n",{"type":21,"tag":209,"props":30535,"children":30536},{"class":211,"line":19919},[30537],{"type":21,"tag":209,"props":30538,"children":30539},{"style":222},[30540],{"type":26,"value":17555},{"type":21,"tag":209,"props":30542,"children":30543},{"class":211,"line":19973},[30544,30548,30553,30557,30561],{"type":21,"tag":209,"props":30545,"children":30546},{"style":216},[30547],{"type":26,"value":14539},{"type":21,"tag":209,"props":30549,"children":30550},{"style":222},[30551],{"type":26,"value":30552}," cacheKey ",{"type":21,"tag":209,"props":30554,"children":30555},{"style":216},[30556],{"type":26,"value":1432},{"type":21,"tag":209,"props":30558,"children":30559},{"style":360},[30560],{"type":26,"value":17942},{"type":21,"tag":209,"props":30562,"children":30563},{"style":222},[30564],{"type":26,"value":29786},{"type":21,"tag":209,"props":30566,"children":30567},{"class":211,"line":19985},[30568,30573,30577,30581],{"type":21,"tag":209,"props":30569,"children":30570},{"style":222},[30571],{"type":26,"value":30572},"                storage ",{"type":21,"tag":209,"props":30574,"children":30575},{"style":216},[30576],{"type":26,"value":1432},{"type":21,"tag":209,"props":30578,"children":30579},{"style":360},[30580],{"type":26,"value":18231},{"type":21,"tag":209,"props":30582,"children":30583},{"style":222},[30584],{"type":26,"value":29698},{"type":21,"tag":209,"props":30586,"children":30587},{"class":211,"line":20006},[30588,30593,30597,30602,30606,30610,30614,30619,30623,30627],{"type":21,"tag":209,"props":30589,"children":30590},{"style":222},[30591],{"type":26,"value":30592},"                value ",{"type":21,"tag":209,"props":30594,"children":30595},{"style":216},[30596],{"type":26,"value":1432},{"type":21,"tag":209,"props":30598,"children":30599},{"style":222},[30600],{"type":26,"value":30601}," (storage) ",{"type":21,"tag":209,"props":30603,"children":30604},{"style":216},[30605],{"type":26,"value":8258},{"type":21,"tag":209,"props":30607,"children":30608},{"style":222},[30609],{"type":26,"value":19887},{"type":21,"tag":209,"props":30611,"children":30612},{"style":360},[30613],{"type":26,"value":19892},{"type":21,"tag":209,"props":30615,"children":30616},{"style":222},[30617],{"type":26,"value":30618},"(cacheKey) ",{"type":21,"tag":209,"props":30620,"children":30621},{"style":216},[30622],{"type":26,"value":191},{"type":21,"tag":209,"props":30624,"children":30625},{"style":263},[30626],{"type":26,"value":14038},{"type":21,"tag":209,"props":30628,"children":30629},{"style":222},[30630],{"type":26,"value":241},{"type":21,"tag":209,"props":30632,"children":30633},{"class":211,"line":20014},[30634],{"type":21,"tag":209,"props":30635,"children":30636},{"emptyLinePlaceholder":248},[30637],{"type":26,"value":251},{"type":21,"tag":209,"props":30639,"children":30640},{"class":211,"line":20022},[30641,30645],{"type":21,"tag":209,"props":30642,"children":30643},{"style":216},[30644],{"type":26,"value":14662},{"type":21,"tag":209,"props":30646,"children":30647},{"style":222},[30648],{"type":26,"value":30649}," (value){\n",{"type":21,"tag":209,"props":30651,"children":30652},{"class":211,"line":20061},[30653],{"type":21,"tag":209,"props":30654,"children":30655},{"style":448},[30656],{"type":26,"value":30657},"                /**\n",{"type":21,"tag":209,"props":30659,"children":30660},{"class":211,"line":20073},[30661],{"type":21,"tag":209,"props":30662,"children":30663},{"style":448},[30664],{"type":26,"value":30665},"                 * If the key is in the Storage-based cache, indicate that we want to handle this ajax request\n",{"type":21,"tag":209,"props":30667,"children":30668},{"class":211,"line":20081},[30669],{"type":21,"tag":209,"props":30670,"children":30671},{"style":448},[30672],{"type":26,"value":30673},"                 * (by returning a value), and use the cache key to retrieve the value from the IndexedDB. Then,\n",{"type":21,"tag":209,"props":30675,"children":30676},{"class":211,"line":20089},[30677],{"type":21,"tag":209,"props":30678,"children":30679},{"style":448},[30680],{"type":26,"value":30681},"                 * call the completeCallback with the fetched value.\n",{"type":21,"tag":209,"props":30683,"children":30684},{"class":211,"line":20114},[30685],{"type":21,"tag":209,"props":30686,"children":30687},{"style":448},[30688],{"type":26,"value":30689},"                 */\n",{"type":21,"tag":209,"props":30691,"children":30692},{"class":211,"line":20122},[30693,30697],{"type":21,"tag":209,"props":30694,"children":30695},{"style":216},[30696],{"type":26,"value":14236},{"type":21,"tag":209,"props":30698,"children":30699},{"style":222},[30700],{"type":26,"value":276},{"type":21,"tag":209,"props":30702,"children":30703},{"class":211,"line":20143},[30704,30709,30713,30717,30721,30725,30729,30734],{"type":21,"tag":209,"props":30705,"children":30706},{"style":360},[30707],{"type":26,"value":30708},"                    send",{"type":21,"tag":209,"props":30710,"children":30711},{"style":222},[30712],{"type":26,"value":191},{"type":21,"tag":209,"props":30714,"children":30715},{"style":216},[30716],{"type":26,"value":4622},{"type":21,"tag":209,"props":30718,"children":30719},{"style":222},[30720],{"type":26,"value":368},{"type":21,"tag":209,"props":30722,"children":30723},{"style":400},[30724],{"type":26,"value":17980},{"type":21,"tag":209,"props":30726,"children":30727},{"style":222},[30728],{"type":26,"value":408},{"type":21,"tag":209,"props":30730,"children":30731},{"style":400},[30732],{"type":26,"value":30733},"completeCallback",{"type":21,"tag":209,"props":30735,"children":30736},{"style":222},[30737],{"type":26,"value":5588},{"type":21,"tag":209,"props":30739,"children":30740},{"class":211,"line":20152},[30741,30746,30750,30755,30759,30763,30767,30771,30776],{"type":21,"tag":209,"props":30742,"children":30743},{"style":222},[30744],{"type":26,"value":30745},"                        $.jidb.",{"type":21,"tag":209,"props":30747,"children":30748},{"style":360},[30749],{"type":26,"value":19892},{"type":21,"tag":209,"props":30751,"children":30752},{"style":222},[30753],{"type":26,"value":30754},"(cacheKey).",{"type":21,"tag":209,"props":30756,"children":30757},{"style":360},[30758],{"type":26,"value":20845},{"type":21,"tag":209,"props":30760,"children":30761},{"style":222},[30762],{"type":26,"value":368},{"type":21,"tag":209,"props":30764,"children":30765},{"style":216},[30766],{"type":26,"value":4622},{"type":21,"tag":209,"props":30768,"children":30769},{"style":222},[30770],{"type":26,"value":368},{"type":21,"tag":209,"props":30772,"children":30773},{"style":400},[30774],{"type":26,"value":30775},"result",{"type":21,"tag":209,"props":30777,"children":30778},{"style":222},[30779],{"type":26,"value":2369},{"type":21,"tag":209,"props":30781,"children":30782},{"class":211,"line":20161},[30783,30788,30792,30796],{"type":21,"tag":209,"props":30784,"children":30785},{"style":216},[30786],{"type":26,"value":30787},"                            var",{"type":21,"tag":209,"props":30789,"children":30790},{"style":222},[30791],{"type":26,"value":17521},{"type":21,"tag":209,"props":30793,"children":30794},{"style":216},[30795],{"type":26,"value":1432},{"type":21,"tag":209,"props":30797,"children":30798},{"style":222},[30799],{"type":26,"value":7963},{"type":21,"tag":209,"props":30801,"children":30802},{"class":211,"line":20206},[30803,30808,30812],{"type":21,"tag":209,"props":30804,"children":30805},{"style":222},[30806],{"type":26,"value":30807},"                            response[result.dataType] ",{"type":21,"tag":209,"props":30809,"children":30810},{"style":216},[30811],{"type":26,"value":1432},{"type":21,"tag":209,"props":30813,"children":30814},{"style":222},[30815],{"type":26,"value":30816}," result.data;\n",{"type":21,"tag":209,"props":30818,"children":30819},{"class":211,"line":20214},[30820,30825,30829,30833,30837,30841,30846,30850],{"type":21,"tag":209,"props":30821,"children":30822},{"style":360},[30823],{"type":26,"value":30824},"                            completeCallback",{"type":21,"tag":209,"props":30826,"children":30827},{"style":222},[30828],{"type":26,"value":368},{"type":21,"tag":209,"props":30830,"children":30831},{"style":263},[30832],{"type":26,"value":10921},{"type":21,"tag":209,"props":30834,"children":30835},{"style":222},[30836],{"type":26,"value":408},{"type":21,"tag":209,"props":30838,"children":30839},{"style":233},[30840],{"type":26,"value":17584},{"type":21,"tag":209,"props":30842,"children":30843},{"style":222},[30844],{"type":26,"value":30845},", response, ",{"type":21,"tag":209,"props":30847,"children":30848},{"style":233},[30849],{"type":26,"value":10775},{"type":21,"tag":209,"props":30851,"children":30852},{"style":222},[30853],{"type":26,"value":2608},{"type":21,"tag":209,"props":30855,"children":30856},{"class":211,"line":20222},[30857,30862,30866,30870,30874],{"type":21,"tag":209,"props":30858,"children":30859},{"style":222},[30860],{"type":26,"value":30861},"                        }).",{"type":21,"tag":209,"props":30863,"children":30864},{"style":360},[30865],{"type":26,"value":20894},{"type":21,"tag":209,"props":30867,"children":30868},{"style":222},[30869],{"type":26,"value":368},{"type":21,"tag":209,"props":30871,"children":30872},{"style":216},[30873],{"type":26,"value":4622},{"type":21,"tag":209,"props":30875,"children":30876},{"style":222},[30877],{"type":26,"value":2561},{"type":21,"tag":209,"props":30879,"children":30880},{"class":211,"line":20231},[30881,30885,30889,30893,30897,30902,30906,30911,30915,30919,30923],{"type":21,"tag":209,"props":30882,"children":30883},{"style":360},[30884],{"type":26,"value":30824},{"type":21,"tag":209,"props":30886,"children":30887},{"style":222},[30888],{"type":26,"value":368},{"type":21,"tag":209,"props":30890,"children":30891},{"style":263},[30892],{"type":26,"value":22270},{"type":21,"tag":209,"props":30894,"children":30895},{"style":222},[30896],{"type":26,"value":408},{"type":21,"tag":209,"props":30898,"children":30899},{"style":233},[30900],{"type":26,"value":30901},"'cache failure'",{"type":21,"tag":209,"props":30903,"children":30904},{"style":222},[30905],{"type":26,"value":408},{"type":21,"tag":209,"props":30907,"children":30908},{"style":216},[30909],{"type":26,"value":30910},"void",{"type":21,"tag":209,"props":30912,"children":30913},{"style":263},[30914],{"type":26,"value":8009},{"type":21,"tag":209,"props":30916,"children":30917},{"style":222},[30918],{"type":26,"value":408},{"type":21,"tag":209,"props":30920,"children":30921},{"style":233},[30922],{"type":26,"value":10775},{"type":21,"tag":209,"props":30924,"children":30925},{"style":222},[30926],{"type":26,"value":2608},{"type":21,"tag":209,"props":30928,"children":30929},{"class":211,"line":20240},[30930],{"type":21,"tag":209,"props":30931,"children":30932},{"style":222},[30933],{"type":26,"value":30934},"                        });\n",{"type":21,"tag":209,"props":30936,"children":30937},{"class":211,"line":20288},[30938],{"type":21,"tag":209,"props":30939,"children":30940},{"style":222},[30941],{"type":26,"value":30942},"                    },\n",{"type":21,"tag":209,"props":30944,"children":30945},{"class":211,"line":20305},[30946,30951,30955,30959],{"type":21,"tag":209,"props":30947,"children":30948},{"style":360},[30949],{"type":26,"value":30950},"                    abort",{"type":21,"tag":209,"props":30952,"children":30953},{"style":222},[30954],{"type":26,"value":191},{"type":21,"tag":209,"props":30956,"children":30957},{"style":216},[30958],{"type":26,"value":4622},{"type":21,"tag":209,"props":30960,"children":30961},{"style":222},[30962],{"type":26,"value":4799},{"type":21,"tag":209,"props":30964,"children":30965},{"class":211,"line":20313},[30966,30971,30975,30979,30984],{"type":21,"tag":209,"props":30967,"children":30968},{"style":222},[30969],{"type":26,"value":30970},"                        console.",{"type":21,"tag":209,"props":30972,"children":30973},{"style":360},[30974],{"type":26,"value":1059},{"type":21,"tag":209,"props":30976,"children":30977},{"style":222},[30978],{"type":26,"value":368},{"type":21,"tag":209,"props":30980,"children":30981},{"style":233},[30982],{"type":26,"value":30983},"\"Aborted ajax transport for caching.\"",{"type":21,"tag":209,"props":30985,"children":30986},{"style":222},[30987],{"type":26,"value":2608},{"type":21,"tag":209,"props":30989,"children":30990},{"class":211,"line":27786},[30991],{"type":21,"tag":209,"props":30992,"children":30993},{"style":222},[30994],{"type":26,"value":30995},"                    }\n",{"type":21,"tag":209,"props":30997,"children":30998},{"class":211,"line":27794},[30999],{"type":21,"tag":209,"props":31000,"children":31001},{"style":222},[31002],{"type":26,"value":31003},"                };\n",{"type":21,"tag":209,"props":31005,"children":31006},{"class":211,"line":27802},[31007],{"type":21,"tag":209,"props":31008,"children":31009},{"style":222},[31010],{"type":26,"value":14714},{"type":21,"tag":209,"props":31012,"children":31013},{"class":211,"line":27811},[31014],{"type":21,"tag":209,"props":31015,"children":31016},{"style":222},[31017],{"type":26,"value":2235},{"type":21,"tag":209,"props":31019,"children":31020},{"class":211,"line":27831},[31021],{"type":21,"tag":209,"props":31022,"children":31023},{"style":222},[31024],{"type":26,"value":3391},{"type":21,"tag":209,"props":31026,"children":31027},{"class":211,"line":27839},[31028],{"type":21,"tag":209,"props":31029,"children":31030},{"style":222},[31031],{"type":26,"value":28203},{"type":21,"tag":22,"props":31033,"children":31034},{},[31035,31037,31043],{"type":26,"value":31036},"If you're acquainted with the Jalc plugin, this should look familiar. The main changes lie in the ",{"type":21,"tag":63,"props":31038,"children":31040},{"className":31039},[],[31041],{"type":26,"value":31042},"addToStorage",{"type":26,"value":31044}," function, which we call to actual store the values - notice that we need to handle both the case where we've hit an error in local storage (such as exceeding the storage limit), and potential errors responses from our IndexedDB wrapper - and the ajaxTransport we use to deliver the cached response which, as promised, uses our dirty little hack of relying on the synchronous nature of LocalStorage to tell us whether a key exists and, once we've asserted that we'll be delivering the transport for this request, taking our time with the asynchronous operation to actually fetch and return the requested data.",{"type":21,"tag":51,"props":31046,"children":31048},{"id":31047},"thats-it-folks",[31049],{"type":26,"value":31050},"That's it, folks",{"type":21,"tag":22,"props":31052,"children":31053},{},[31054,31056,31061,31063,31068],{"type":26,"value":31055},"This plugin should be considered ",{"type":21,"tag":1084,"props":31057,"children":31058},{},[31059],{"type":26,"value":31060},"experimental",{"type":26,"value":31062},"! It works as a proof of concept, but I wouldn't place it into production if I were you - it doesn't attempt to handle cases like Privacy mode in Firefox (where IndexedDB ",{"type":21,"tag":1084,"props":31064,"children":31065},{},[31066],{"type":26,"value":31067},"says",{"type":26,"value":31069}," it's available, but fails to function), no fallbacks, and weak-to-nonexistant error handling. Want to use it somewhere serious? Pull requests are welcome. :)",{"type":21,"tag":22,"props":31071,"children":31072},{},[31073,31075,31081],{"type":26,"value":31074},"Take a look at the new ",{"type":21,"tag":29,"props":31076,"children":31078},{"href":25089,"rel":31077},[93],[31079],{"type":26,"value":31080},"Jalic plugin on Github",{"type":26,"value":378},{"type":21,"tag":3490,"props":31083,"children":31084},{},[31085],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":31087},[31088,31091,31092],{"id":25098,"depth":254,"text":25101,"children":31089},[31090],{"id":25219,"depth":279,"text":25222},{"id":25293,"depth":254,"text":25296},{"id":31047,"depth":254,"text":31050},"content:ckeefer:2016-1:ajaxBinaryCaching.md","ckeefer/2016-1/ajaxBinaryCaching.md","ckeefer/2016-1/ajaxBinaryCaching",{"user":3518,"name":3519},{"_path":31098,"_dir":31099,"_draft":7,"_partial":7,"_locale":8,"title":31100,"description":31101,"publishDate":31102,"tags":31103,"excerpt":31101,"body":31104,"_type":3511,"_id":31455,"_source":3513,"_file":31456,"_stem":31457,"_extension":3516,"author":31458},"/ckeefer/2015-5/file-reader-chunking","2015-5","FileReader Chunking and Base64 DataURLs","In a hurry? You can now use our HUp jquery plugin to read files in a chunked fashion as data URLs. Hooray!","2015-12-15",[12,16600],{"type":18,"children":31105,"toc":31450},[31106,31120,31125,31148,31154,31159,31209,31230,31238,31243,31248,31254,31259,31283,31310,31322,31327,31400,31405,31411,31416,31421,31433,31446],{"type":21,"tag":22,"props":31107,"children":31108},{},[31109,31111,31118],{"type":26,"value":31110},"In a hurry? You can now use our ",{"type":21,"tag":29,"props":31112,"children":31115},{"href":31113,"rel":31114},"https://github.com/SaneMethod/HUp",[93],[31116],{"type":26,"value":31117},"HUp jquery plugin",{"type":26,"value":31119}," to read files in a chunked fashion as data URLs. Hooray!",{"type":21,"tag":22,"props":31121,"children":31122},{},[31123],{"type":26,"value":31124},"Got a minute or two? Let's talk about file read chunking, data URLs and base 64.",{"type":21,"tag":22,"props":31126,"children":31127},{},[31128,31130,31137,31139,31146],{"type":26,"value":31129},"If you've been looking forward to the ",{"type":21,"tag":29,"props":31131,"children":31134},{"href":31132,"rel":31133},"https://artandlogic.com/2015/11/11029/",[93],[31135],{"type":26,"value":31136},"previously promised discussion",{"type":26,"value":31138}," about file reading/downloading to/uploading from ",{"type":21,"tag":29,"props":31140,"children":31143},{"href":31141,"rel":31142},"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API",[93],[31144],{"type":26,"value":31145},"IndexedDb",{"type":26,"value":31147}," - well, keep looking forward, it's on the way. In the meantime, however, let's take a quick look at a problem and it's quick and easy solution, that emerged out of making file reading chunkable for the HUp plugin.",{"type":21,"tag":51,"props":31149,"children":31151},{"id":31150},"the-problem",[31152],{"type":26,"value":31153},"The Problem",{"type":21,"tag":22,"props":31155,"children":31156},{},[31157],{"type":26,"value":31158},"The HUp plugin has, as one of its goals, sensible defaults - such that a user can just call it against whatever element they want to make into a file reader/uploader drag-and-drop point, and presto! Everything works, and in a reasonable manner.",{"type":21,"tag":22,"props":31160,"children":31161},{},[31162,31164,31169,31171,31176,31178,31185,31187,31191,31193,31199,31201,31207],{"type":26,"value":31163},"When I added the ability to ",{"type":21,"tag":1084,"props":31165,"children":31166},{},[31167],{"type":26,"value":31168},"read",{"type":26,"value":31170}," files in chunks, to mirror and complement our ability to ",{"type":21,"tag":1084,"props":31172,"children":31173},{},[31174],{"type":26,"value":31175},"upload",{"type":26,"value":31177}," files in chunks, we hit a snag in regards to the above goal. Generally speaking, the expectation is that developers using the plugin to read files in will probably want to be able to use said file in the browser in some fashion, and one of the simplest representations that can be used directly in the browser is a base64-encoded ",{"type":21,"tag":29,"props":31179,"children":31182},{"href":31180,"rel":31181},"https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs",[93],[31183],{"type":26,"value":31184},"data URL",{"type":26,"value":31186},". You can expect to be able to pop it into the ",{"type":21,"tag":1084,"props":31188,"children":31189},{},[31190],{"type":26,"value":16007},{"type":26,"value":31192}," attribute of a number of elements in a modern browser, and be able to do something with it right away. So, defaulting our ",{"type":21,"tag":63,"props":31194,"children":31196},{"className":31195},[],[31197],{"type":26,"value":31198},"read_method",{"type":26,"value":31200}," to ",{"type":21,"tag":63,"props":31202,"children":31204},{"className":31203},[],[31205],{"type":26,"value":31206},"readAsDataURL",{"type":26,"value":31208}," makes sense.",{"type":21,"tag":22,"props":31210,"children":31211},{},[31212,31214,31220,31222,31228],{"type":26,"value":31213},"However! Now that we're chunking file reads by default (since it offers benefits, some of which were discussed ",{"type":21,"tag":29,"props":31215,"children":31217},{"href":31132,"rel":31216},[93],[31218],{"type":26,"value":31219},"last time",{"type":26,"value":31221},"), if the file to be read is larger than our ",{"type":21,"tag":63,"props":31223,"children":31225},{"className":31224},[],[31226],{"type":26,"value":31227},"chunk_size",{"type":26,"value":31229}," (which defaults to 1MiB), than it will be read as a number of chunks, which will need to be reassembled to be used in a src attribute as a data URL. Small bit of extra work for the developer, but a little string manipulation and you're done, right?",{"type":21,"tag":22,"props":31231,"children":31232},{},[31233],{"type":21,"tag":11881,"props":31234,"children":31235},{},[31236],{"type":26,"value":31237},"Not quite.",{"type":21,"tag":22,"props":31239,"children":31240},{},[31241],{"type":26,"value":31242},"It's common knowledge that encoding binary data as base64 will result in an overall increase in size of about 33%. This is because, with a total of 26 different values, base64 can encode 6 bits per character (that is, the eight bits composing one character (in, for example, utf-8), are each used to represent 6 bits in the source binary).",{"type":21,"tag":22,"props":31244,"children":31245},{},[31246],{"type":26,"value":31247},"So what's the problem? We can end up with chunks that can't be trivially recombined, and the details we just discussed regarding how many bits per character we get in base64-encoding explains why - if we're not careful about where we slice the file chunks, we end up with each base64 chunk after the first out of alignment from the binary source. Attempting to simply concatenate them and use them will fail.",{"type":21,"tag":51,"props":31249,"children":31251},{"id":31250},"the-workaround",[31252],{"type":26,"value":31253},"The Workaround",{"type":21,"tag":22,"props":31255,"children":31256},{},[31257],{"type":26,"value":31258},"Recently, a user of the plugin brought up an unrelated problem, regarding the mime-type on the produced data URLs. In the process of fixing this, I started thinking about how chunking might affect the data URLs, and a few quick experiments showed me I was correct - chunking the files and encoding them as base64 caused problems. I didn't have the time to fix the issue at that moment, however, so I mentioned a workaround to said user.",{"type":21,"tag":22,"props":31260,"children":31261},{},[31262,31267,31269,31273,31275,31282],{"type":21,"tag":1084,"props":31263,"children":31264},{},[31265],{"type":26,"value":31266},"You",{"type":26,"value":31268},", lucky reader, don't ",{"type":21,"tag":1084,"props":31270,"children":31271},{},[31272],{"type":26,"value":11618},{"type":26,"value":31274}," this workaround, since this issue is now addressed - however, it might be of future interest, particularly if you need/prefer to work with ",{"type":21,"tag":29,"props":31276,"children":31279},{"href":31277,"rel":31278},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer",[93],[31280],{"type":26,"value":31281},"Array Buffers",{"type":26,"value":378},{"type":21,"tag":22,"props":31284,"children":31285},{},[31286,31288,31293,31295,31300,31302,31308],{"type":26,"value":31287},"Since using an Array Buffer means we don't need to worry about base64 encoding a file, we can slice and dice each chunk however we please, and concatenating the resulting array buffers poses no issue. So, instead of using ",{"type":21,"tag":63,"props":31289,"children":31291},{"className":31290},[],[31292],{"type":26,"value":31206},{"type":26,"value":31294}," as our ",{"type":21,"tag":63,"props":31296,"children":31298},{"className":31297},[],[31299],{"type":26,"value":31198},{"type":26,"value":31301},", I suggested this user employ the ",{"type":21,"tag":63,"props":31303,"children":31305},{"className":31304},[],[31306],{"type":26,"value":31307},"readAsArrayBuffer",{"type":26,"value":31309}," method instead.",{"type":21,"tag":22,"props":31311,"children":31312},{},[31313,31315,31320],{"type":26,"value":31314},"What if he wants to be able to display or otherwise use the read-in file in the browser? Well, we could convert the concatenated array buffers into base64, but a much more straightforward method is to create a new ",{"type":21,"tag":29,"props":31316,"children":31318},{"href":15995,"rel":31317},[93],[31319],{"type":26,"value":15999},{"type":26,"value":31321}," from the concatenated array buffers, and get an object url from said blob to display.",{"type":21,"tag":22,"props":31323,"children":31324},{},[31325],{"type":26,"value":31326},"This would look something like the following, assuming for the sake of example that you have three array buffers which we'll creatively name arr1, arr2 and arr3:",{"type":21,"tag":200,"props":31328,"children":31330},{"className":16138,"code":31329,"language":16140,"meta":8,"style":8},"var blob = new Blob([arr1, arr2, arr3], {type:'mime/type'}),\n    url = URL.createObjectURL(blob);\n",[31331],{"type":21,"tag":63,"props":31332,"children":31333},{"__ignoreMap":8},[31334,31372],{"type":21,"tag":209,"props":31335,"children":31336},{"class":211,"line":212},[31337,31341,31345,31349,31353,31357,31362,31367],{"type":21,"tag":209,"props":31338,"children":31339},{"style":216},[31340],{"type":26,"value":3909},{"type":21,"tag":209,"props":31342,"children":31343},{"style":222},[31344],{"type":26,"value":16095},{"type":21,"tag":209,"props":31346,"children":31347},{"style":216},[31348],{"type":26,"value":1432},{"type":21,"tag":209,"props":31350,"children":31351},{"style":216},[31352],{"type":26,"value":6371},{"type":21,"tag":209,"props":31354,"children":31355},{"style":360},[31356],{"type":26,"value":16108},{"type":21,"tag":209,"props":31358,"children":31359},{"style":222},[31360],{"type":26,"value":31361},"([arr1, arr2, arr3], {type:",{"type":21,"tag":209,"props":31363,"children":31364},{"style":233},[31365],{"type":26,"value":31366},"'mime/type'",{"type":21,"tag":209,"props":31368,"children":31369},{"style":222},[31370],{"type":26,"value":31371},"}),\n",{"type":21,"tag":209,"props":31373,"children":31374},{"class":211,"line":244},[31375,31380,31384,31388,31392,31396],{"type":21,"tag":209,"props":31376,"children":31377},{"style":222},[31378],{"type":26,"value":31379},"    url ",{"type":21,"tag":209,"props":31381,"children":31382},{"style":216},[31383],{"type":26,"value":1432},{"type":21,"tag":209,"props":31385,"children":31386},{"style":263},[31387],{"type":26,"value":16219},{"type":21,"tag":209,"props":31389,"children":31390},{"style":222},[31391],{"type":26,"value":378},{"type":21,"tag":209,"props":31393,"children":31394},{"style":360},[31395],{"type":26,"value":16228},{"type":21,"tag":209,"props":31397,"children":31398},{"style":222},[31399],{"type":26,"value":16233},{"type":21,"tag":22,"props":31401,"children":31402},{},[31403],{"type":26,"value":31404},"Pretty easy, right?",{"type":21,"tag":51,"props":31406,"children":31408},{"id":31407},"the-solution",[31409],{"type":26,"value":31410},"The Solution",{"type":21,"tag":22,"props":31412,"children":31413},{},[31414],{"type":26,"value":31415},"I wasn't entirely happy with having to suggest this workaround, however, so when I had an hour or so free to revisit the question, I tried a little experiment. Could it really be as simple, I wondered, as making sure our chunks were aligned to the nearest multiple of 6 (remembering, as mentioned above, that we get 6-bits per character)?",{"type":21,"tag":22,"props":31417,"children":31418},{},[31419],{"type":26,"value":31420},"Yes, yes it could be.",{"type":21,"tag":22,"props":31422,"children":31423},{},[31424,31426,31431],{"type":26,"value":31425},"So, the defaults for HUp can now remain blissfully unchanged, and chunking works just fine - when ",{"type":21,"tag":63,"props":31427,"children":31429},{"className":31428},[],[31430],{"type":26,"value":31206},{"type":26,"value":31432}," is specified as the read_method, the plugin will transparently alter the total size of each chunk to the nearest multiple of 6 until we reach the end of the file, ensuring that the resulting base64 remains aligned with the binary source, and allowing trivial recombination of the data URLs.",{"type":21,"tag":22,"props":31434,"children":31435},{},[31436,31438,31444],{"type":26,"value":31437},"I've also added a small convenience function to handle said recombination - check out the ",{"type":21,"tag":29,"props":31439,"children":31441},{"href":31113,"rel":31440},[93],[31442],{"type":26,"value":31443},"Github Repo",{"type":26,"value":31445}," for the details.",{"type":21,"tag":3490,"props":31447,"children":31448},{},[31449],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":31451},[31452,31453,31454],{"id":31150,"depth":254,"text":31153},{"id":31250,"depth":254,"text":31253},{"id":31407,"depth":254,"text":31410},"content:ckeefer:2015-5:file-reader-chunking.md","ckeefer/2015-5/file-reader-chunking.md","ckeefer/2015-5/file-reader-chunking",{"user":3518,"name":3519},{"_path":31460,"_dir":31461,"_draft":7,"_partial":7,"_locale":8,"title":31462,"description":31463,"publishDate":31464,"tags":31465,"excerpt":31463,"body":31466,"_type":3511,"_id":31617,"_source":3513,"_file":31618,"_stem":31619,"_extension":3516,"author":31620},"/ckeefer/2015-2/js-frameworks","2015-2","The What and Why of Javascript Frameworks","JavaScript has the propensity to be very untidy if you let it be. This isn't a problem unique to JavaScript, of course - many other languages suffer from a lack of native organization, especially for specific tasks.","2015-05-29",[12],{"type":18,"children":31467,"toc":31611},[31468,31472,31477,31483,31488,31493,31498,31503,31509,31514,31519,31524,31529,31535,31540,31552,31557,31562,31567,31573,31578,31583],{"type":21,"tag":22,"props":31469,"children":31470},{},[31471],{"type":26,"value":31463},{"type":21,"tag":22,"props":31473,"children":31474},{},[31475],{"type":26,"value":31476},"It is for this reason that frameworks exist - to give us some structure upon which to build, the foundation for our edifice of code. Let's dig a little deeper into what a JavaScript framework looks like, and why you might want to use one.",{"type":21,"tag":3596,"props":31478,"children":31480},{"id":31479},"what-is-a-javascript-framework",[31481],{"type":26,"value":31482},"What is a JavaScript Framework?",{"type":21,"tag":22,"props":31484,"children":31485},{},[31486],{"type":26,"value":31487},"First off: Let's define, in brief and general terms, a JavaScript framework. Definition varies by the framework, but most follow the pattern familiar to anyone with some experience with server-side frameworks (or Smalltalk-80, for that matter) - that is, some implementation of MV*, ie. MVC (Model-View-Controller), MVP (Model-View-Presenter), etc.",{"type":21,"tag":22,"props":31489,"children":31490},{},[31491],{"type":26,"value":31492},"Models in a JS framework, much like their server-side brethren, represent your application's data (users, photos, blog entries, sales figures, etc.) This data could be drawn from and kept in sync with your server, via a persistence method like ajax or websockets. Or it could exist entirely client-side, either transitory and living in memory, or persisted to client-side mechanisms like localStorage or IndexedDB. Most modern frameworks offer means by which to group models together - that is, to arrange and treat them in a manner analogous to rows within a table.",{"type":21,"tag":22,"props":31494,"children":31495},{},[31496],{"type":26,"value":31497},"Views are a bit more amorphous - depending on the framework, they might be as simple as a set of templates, or possess all the logic, routing and data-binding that might be the role of the Controller in another framework. Either way, the view's role is to maintain the state of a DOM element and it's child nodes.",{"type":21,"tag":22,"props":31499,"children":31500},{},[31501],{"type":26,"value":31502},"Partly because of the flexible definition of what composes a View, MVC often becomes instead MV_, where what the value of_ is depends on the framework - it could be a layer that keeps your views updated with changes to the models and vice versa, it could be here that routing is handled, often times it's here that views are created, grouped, manipulated, bound to different models or collections of models, and so on. Because the views so often contain significant logic about what is being presented and how it should be interacted with, as a consequence of the DOM Events model, the final element of the MV* pattern fulfills different roles in different frameworks.",{"type":21,"tag":3596,"props":31504,"children":31506},{"id":31505},"why-use-a-js-framework",[31507],{"type":26,"value":31508},"Why use a JS framework?",{"type":21,"tag":22,"props":31510,"children":31511},{},[31512],{"type":26,"value":31513},"In general terms, for the same reasons you would use a framework on the server-side: adding organization and structure to your code (especially in a manner well suited for collaboration), separation of concerns as per the above mentioned MV* pattern, abstraction of some low-level details, papering over of implementation differences between platforms, and a bevy of useful built-in functionality. In many cases, the point is simply to avoid having to re-invent the wheel for each project.",{"type":21,"tag":22,"props":31515,"children":31516},{},[31517],{"type":26,"value":31518},"More specifically, a JS framework is particularly helpful for applications where much of the business logic is going to take place on the client-side - routing, templating, first-pass model validation, table building and pagination - pretty much whatever you might have used the server for in the past, but now without the latency and overhead that additional HTTP calls would have incurred.",{"type":21,"tag":22,"props":31520,"children":31521},{},[31522],{"type":26,"value":31523},"It was never good practice to have the server do a bunch of work and spit out a gob of html to insert - this approach is less readable, harder to maintain, and harder to debug then returning just the needed data; and woe to those who include javascript in the chunk of html! Now, there's absolutely no excuse for it, and many good reasons and a lot of functionality to support doing most of the work client-side. A good REST API returning JSON and a JS framework are a natural pair.",{"type":21,"tag":22,"props":31525,"children":31526},{},[31527],{"type":26,"value":31528},"As an example, many JS frameworks include client-side routing, using the history API and/or hash-fragments - making single page apps with identifiable and even uniquely navigable URLs not just possible, but relatively easy (depending on how you go about it). Multi-page applications can also benefit from the routing, of course - there's very few cases these days where a page is likely to remain static throughout it's display lifetime, and using routing to pull in views, which automatically populate some sub-section of the page with a template and bind to a model, is a much cleaner solution than, for instance, a mass of jQuery swapping DOM elements in and out and binding in multiple places to different elements and events.",{"type":21,"tag":3596,"props":31530,"children":31532},{"id":31531},"js-frameworks-vs-jquery-et-al",[31533],{"type":26,"value":31534},"JS Frameworks vs. jQuery (et al.)",{"type":21,"tag":22,"props":31536,"children":31537},{},[31538],{"type":26,"value":31539},"On that topic, why use a framework versus jQuery and it's constellation of plugins, or Prototype, Mootools, and so on?",{"type":21,"tag":22,"props":31541,"children":31542},{},[31543,31545,31550],{"type":26,"value":31544},"The simplest answer is: this is the wrong question. In most cases, you wouldn't use a JS framework instead of jQuery - you might, however, use a JS framework ",{"type":21,"tag":1084,"props":31546,"children":31547},{},[31548],{"type":26,"value":31549},"with",{"type":26,"value":31551}," jQuery. A framework is not a compatibility layer like jQuery - as an example, the framework itself might work in IE8, but it isn't going to give you a polyfill for old IE's non-standard attachEvent method.",{"type":21,"tag":22,"props":31553,"children":31554},{},[31555],{"type":26,"value":31556},"If your project needs to support client-side routing, JS templates, models and collections, data persistence with the server, clean interaction with a REST API, etcetera, you probably want to use a JS framework.",{"type":21,"tag":22,"props":31558,"children":31559},{},[31560],{"type":26,"value":31561},"If you need to support old versions of browsers that may not share an API or support the most recent advances for things like the Selectors API, event listeners, Promises and XMLHTTPRequest, then you probably want to use jQuery.",{"type":21,"tag":22,"props":31563,"children":31564},{},[31565],{"type":26,"value":31566},"If you need both, you probably want to use both. They are (potentially) complementary.",{"type":21,"tag":3596,"props":31568,"children":31570},{"id":31569},"why-not-use-a-framework",[31571],{"type":26,"value":31572},"Why NOT use a framework?",{"type":21,"tag":22,"props":31574,"children":31575},{},[31576],{"type":26,"value":31577},"JS frameworks are not a panacea - they have use-cases for which they are the best solution, and then there are cases where they are unnecessary cruft, slowing down page-load times and obstructing progress.",{"type":21,"tag":22,"props":31579,"children":31580},{},[31581],{"type":26,"value":31582},"When considering whether you should use a JS framework, you should consider the following:",{"type":21,"tag":3626,"props":31584,"children":31585},{},[31586,31591,31596,31601,31606],{"type":21,"tag":3630,"props":31587,"children":31588},{},[31589],{"type":26,"value":31590},"Do I already know a JS framework? Here, the consideration is learning curve. Obviously, learning new things is part of the job (and one of the best parts, at that), but if there's a massive time-crunch to get the project out the door, there may not be the luxury of time needed for learning how to employ a framework to it's best effect. Better to stick to what you know and do it well, then to implement a framework poorly.",{"type":21,"tag":3630,"props":31592,"children":31593},{},[31594],{"type":26,"value":31595},"Is my project big enough? Here, the consideration is the amount of code you expect to need to write for the project - for the same reasons you might eschew a big library like jQuery for a small project, you might want to eschew a framework as well; and if you're expecting only a few source files with a couple hundred lines of code, you can probably do without the organization a framework offers. Of course, none of us are prescient and projects have a tendency to increase in scope, so think hard about this one - it's harder to fit a framework in after the fact than to start with one.",{"type":21,"tag":3630,"props":31597,"children":31598},{},[31599],{"type":26,"value":31600},"Is my project complex enough? Here, the consideration is the complexity of the client-side logic - if all of the work is going to be done server-side and the pages are going to be largely static, a framework isn't going to add much value.",{"type":21,"tag":3630,"props":31602,"children":31603},{},[31604],{"type":26,"value":31605},"Is page-size at a premium? Here, the consideration is the extra kilobytes a gzipped framework library is going to cost to transfer - for the most part, this isn't going to be a concern, especially for single page apps, but if one of the other considerations is borderline and page-size matters, you might decide to do without the framework.",{"type":21,"tag":3630,"props":31607,"children":31608},{},[31609],{"type":26,"value":31610},"Am I familiar with JavaScript? Here, the consideration is how well you know the language and available APIs. This isn't a project-specific consideration, but rather a developer-specific one. If you already know JavaScript inside and out, you'll be able to wring the most out of a framework; if not, you'll need to be careful not to let the framework become a crutch. Reading through the source of some popular frameworks is a great way to become more familiar with the language and some laudable practices.",{"title":8,"searchDepth":254,"depth":254,"links":31612},[31613,31614,31615,31616],{"id":31479,"depth":244,"text":31482},{"id":31505,"depth":244,"text":31508},{"id":31531,"depth":244,"text":31534},{"id":31569,"depth":244,"text":31572},"content:ckeefer:2015-2:js-frameworks.md","ckeefer/2015-2/js-frameworks.md","ckeefer/2015-2/js-frameworks",{"user":3518,"name":3519},{"_path":31622,"_dir":31623,"_draft":7,"_partial":7,"_locale":8,"title":31624,"description":31625,"publishDate":31626,"tags":31627,"image":31628,"excerpt":31625,"body":31629,"_type":3511,"_id":33708,"_source":3513,"_file":33709,"_stem":33710,"_extension":3516,"author":33711},"/ckeefer/2015-1/writeonce","2015-1","Write Once, Debug Everywhere","It's pretty seldom that anyone mentions web pages these days, other than in historical reference to days long gone by (yes, a whole few years ago). Web sites, sure, but not if what is really wanted is to replace something that, not so long ago, would have been some native code for a smartphone (or a little further back still, a desktop computer). Generally speaking, the most common term tripping from client's lips these days is 'web applications' - or webapps, because who has time for spaces and proper spelling, amirite?","2015-02-02",[12],"/ckeefer/2015-1/img/html5java.jpg",{"type":18,"children":31630,"toc":33702},[31631,31637,31641,31646,31651,31656,31668,31673,31679,31684,31689,31694,31708,31722,31728,31741,31746,31769,31790,32755,32760,33649,33672,33677,33683,33688,33693,33698],{"type":21,"tag":3596,"props":31632,"children":31634},{"id":31633},"or-why-we-still-have-to-test-in-every-browser-web-standards-notwithstanding",[31635],{"type":26,"value":31636},"Or Why We Still Have To Test In Every Browser, Web Standards Notwithstanding",{"type":21,"tag":22,"props":31638,"children":31639},{},[31640],{"type":26,"value":31625},{"type":21,"tag":22,"props":31642,"children":31643},{},[31644],{"type":26,"value":31645},"Of course, the client in question is almost certainly not interested in a webapp because they're hoping to take advantage of the unique properties and capabilities of any particular browser (unless they're looking for a line-of-business intranet application in IE8, in which case, you have both my scorn and my pity). Everyone wants their app to have the potential to reach the widest audience possible - and that means supporting all the mainstream browsers.",{"type":21,"tag":22,"props":31647,"children":31648},{},[31649],{"type":26,"value":31650},"Oh, and all of the mainstream mobile devices, and their browsers; and maybe smart TVs, consoles, and I hear they're coming out with, like, iWatches and stuff, can we target those too?",{"type":21,"tag":22,"props":31652,"children":31653},{},[31654],{"type":26,"value":31655},"This is, after all, a major selling point of a web application - the promise of 'write once, run anywhere'. One codebase, shared across all of your supported platforms. Since every project comes complete with a limited budget and timeframe, this can allow you to offer your product across a wider range of platforms than if you had to create a different version for each; and in addition to capturing the mainstream devices, your application may be able to appeal to users on minority platforms (Blackberry or Windows Phone, for example), that you couldn't otherwise afford to support.",{"type":21,"tag":22,"props":31657,"children":31658},{},[31659,31661,31666],{"type":26,"value":31660},"The dark side to this is that often, your client will expect that your webapp ",{"type":21,"tag":1084,"props":31662,"children":31663},{},[31664],{"type":26,"value":31665},"can and will",{"type":26,"value":31667}," support all of these various devices and browsers, and yet fail to understand why this should affect the project's timeframe or cost. \"Hold on,\" they'll say, \"I thought you said this webapp thing could support every browser that ever was, and more screen and device sizes than have been dreamt of in my philosophies?\"",{"type":21,"tag":22,"props":31669,"children":31670},{},[31671],{"type":26,"value":31672},"Well, perhaps I exaggerate; but the difficulties involved in supporting even just recent versions of browsers across many platforms tends to get underestimated by clients - and, sometimes, developers as well.",{"type":21,"tag":3596,"props":31674,"children":31676},{"id":31675},"the-browser-is-the-new-virtual-machine",[31677],{"type":26,"value":31678},"The Browser is the new Virtual Machine",{"type":21,"tag":22,"props":31680,"children":31681},{},[31682],{"type":26,"value":31683},"Of course, the promise of 'write once, run anywhere' has been made before, most famously by Sun Microsystems for its Java language, and the Java Virtual Machine. Developers familiar with the language have an old joke based on the marketing slogan: \"Write once, debug everywhere\"; and the joke applies all the more certainly to web development.",{"type":21,"tag":22,"props":31685,"children":31686},{},[31687],{"type":26,"value":31688},"While all major browsers follow the W3C standards, and carefully feature test against the specifications, their implementations are unique - at least Java developers could expect that the JVM was being made by engineers who, if nothing else, could step across the hallway and ask their fellows about the details of this or that feature implementation.",{"type":21,"tag":22,"props":31690,"children":31691},{},[31692],{"type":26,"value":31693},"The developers for Firefox do their best to offer something like this, by developing entirely in open source; Google and Safari each have their closed components, though (and Blink and Webkit diverge by the day), and the implementation details of Internet Explorer are a mystery. The same challenges that faced developers working with the JVM on differing operating systems and/or hardware - subtle bugs encountered in surprising places, limited subsets of functionality available across all platforms (and sometimes, not available using the same mechanisms, or to the same degree) - are faced by webapp developers today.",{"type":21,"tag":22,"props":31695,"children":31696},{},[31697,31699,31706],{"type":26,"value":31698},"Just look at this sample of the ",{"type":21,"tag":29,"props":31700,"children":31703},{"href":31701,"rel":31702},"https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills",[93],[31704],{"type":26,"value":31705},"polyfills, shims and outright hacks",{"type":26,"value":31707}," collected to try and bridge the feature gaps between browsers, or offer a single sane interface over differing implementations.",{"type":21,"tag":22,"props":31709,"children":31710},{},[31711,31713,31720],{"type":26,"value":31712},"Realistically, when estimating projects and committing to which browsers to support, each browser should be considered a separate platform with its attendant needs for platform-specific code and testing. Moreover, supporting any mobile device and browser greatly increases the chance of needing platform-specific code (not to mention the significant cost of 'responsive design' styling to make a site mobile-friendly). Major versions of said browsers may also qualify for this careful treatment (consider the vast ",{"type":21,"tag":29,"props":31714,"children":31717},{"href":31715,"rel":31716},"http://caniuse.com/#compare=ie%2B8%2Cie%2B9",[93],[31718],{"type":26,"value":31719},"diffference in features between IE8 and IE9",{"type":26,"value":31721},", for example).",{"type":21,"tag":3596,"props":31723,"children":31725},{"id":31724},"an-example-for-the-skeptical",[31726],{"type":26,"value":31727},"An Example for the skeptical",{"type":21,"tag":22,"props":31729,"children":31730},{},[31731,31733,31740],{"type":26,"value":31732},"Any web developer whose had to work with multiple platforms will have horror stories about surprising issues - and not just those who've been working with cutting-edge tech (consider, for instance, the issues encountered when ",{"type":21,"tag":29,"props":31734,"children":31737},{"href":31735,"rel":31736},"http://www.alproduction.local/blog/2014/04/hidden-options-a-workaround/",[93],[31738],{"type":26,"value":31739},"all you want to do is hide options in a select element",{"type":26,"value":2699},{"type":21,"tag":22,"props":31742,"children":31743},{},[31744],{"type":26,"value":31745},"But let's take something both fairly cutting edge, and yet commonly requested, as our example: image manipulation on the client side. To cut this example down to the barebones, this is the scenario: we have the user select an image using a file input, that we the read in using FileReader, let the user decide how they want to crop the image, and perform the crop and create a new image using the Canvas. Fairly involved, but nothing any modern browser shouldn't be able to do.",{"type":21,"tag":22,"props":31747,"children":31748},{},[31749,31751,31758,31760,31767],{"type":26,"value":31750},"Ah, but are we including IE9 in our array of 'modern browsers' that we have to support? We probably are, since IE9 still has a ",{"type":21,"tag":29,"props":31752,"children":31755},{"href":31753,"rel":31754},"https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&qpcustomd=0",[93],[31756],{"type":26,"value":31757},"10% market share",{"type":26,"value":31759}," as of this writing; but ",{"type":21,"tag":29,"props":31761,"children":31764},{"href":31762,"rel":31763},"http://caniuse.com/#feat=filereader",[93],[31765],{"type":26,"value":31766},"IE9 doesn't support FileReader",{"type":26,"value":31768},", so we have to include some complex shim to add the functionality we need (probably Flash or Silverlight based).",{"type":21,"tag":22,"props":31770,"children":31771},{},[31772,31774,31779,31781,31788],{"type":26,"value":31773},"Okay, but IE9 is old news. ",{"type":21,"tag":1084,"props":31775,"children":31776},{},[31777],{"type":26,"value":31778},"Truly",{"type":26,"value":31780}," modern browsers have everything we need. Oh? But what if we need to convert the resulting image into a blob, for sending to the server? On chrome, ",{"type":21,"tag":29,"props":31782,"children":31785},{"href":31783,"rel":31784},"https://code.google.com/p/chromium/issues/detail?id=67587",[93],[31786],{"type":26,"value":31787},"getting a blob from the canvas isn't supported yet",{"type":26,"value":31789},". So, we have to include a polyfill to handle this case manually:",{"type":21,"tag":200,"props":31791,"children":31793},{"className":16138,"code":31792,"language":16140,"meta":8,"style":8},"/**\n * Canvas toBlob shim, adapted with thanks from https://code.google.com/u/105701149099589407503/, \n * from this chrome bug thread: https://code.google.com/p/chromium/issues/detail?id=67587\n */\n(function(){\n    /**\n     * Convert a base64 image dataURL from a canvas element, to a blob.\n     * @param {function} callback\n     * @param {string} type\n     * @param {number} quality\n     * @param {base64=} dataURL The dataURL to use, rather than fetch from the canvas.\n     */\n    function dataURLToBlob(callback, type, quality, dataURL){\n        dataURL = dataURL || this.toDataURL(type, quality);\n        var bin = atob(dataURL.split(',')[1]),\n            len = bin.length,\n            len32 = len >> 2,\n            a8 = new Uint8Array(len),\n            a32 = new Uint32Array(a8.buffer, 0, len32),\n            tailLength = len & 3;\n\n        for(var i=0, j=0; i \u003C len32; i++)\n        {\n            a32[i] = bin.charCodeAt(j++) |\n                bin.charCodeAt(j++) \u003C\u003C 8 |\n                bin.charCodeAt(j++) \u003C\u003C 16 |\n                bin.charCodeAt(j++) \u003C\u003C 24;\n        }\n\n        while(tailLength--)\n        {\n            a8[j] = bin.charCodeAt(j++);\n        }\n\n        callback(new Blob([a8], {'type': type || 'image/png'}));\n    }\n\n    if(HTMLCanvasElement && Object.defineProperty && !HTMLCanvasElement.prototype.toBlob)\n    {\n        Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob',\n        {\n            value:dataURLToBlob\n        });\n    }\n})();\n",[31794],{"type":21,"tag":63,"props":31795,"children":31796},{"__ignoreMap":8},[31797,31804,31812,31820,31827,31842,31849,31857,31878,31898,31918,31944,31951,32002,32041,32093,32118,32148,32174,32209,32239,32246,32311,32318,32357,32396,32432,32468,32475,32482,32504,32511,32543,32550,32557,32607,32614,32621,32668,32676,32718,32725,32733,32740,32747],{"type":21,"tag":209,"props":31798,"children":31799},{"class":211,"line":212},[31800],{"type":21,"tag":209,"props":31801,"children":31802},{"style":448},[31803],{"type":26,"value":731},{"type":21,"tag":209,"props":31805,"children":31806},{"class":211,"line":244},[31807],{"type":21,"tag":209,"props":31808,"children":31809},{"style":448},[31810],{"type":26,"value":31811}," * Canvas toBlob shim, adapted with thanks from https://code.google.com/u/105701149099589407503/, \n",{"type":21,"tag":209,"props":31813,"children":31814},{"class":211,"line":254},[31815],{"type":21,"tag":209,"props":31816,"children":31817},{"style":448},[31818],{"type":26,"value":31819}," * from this chrome bug thread: https://code.google.com/p/chromium/issues/detail?id=67587\n",{"type":21,"tag":209,"props":31821,"children":31822},{"class":211,"line":279},[31823],{"type":21,"tag":209,"props":31824,"children":31825},{"style":448},[31826],{"type":26,"value":755},{"type":21,"tag":209,"props":31828,"children":31829},{"class":211,"line":288},[31830,31834,31838],{"type":21,"tag":209,"props":31831,"children":31832},{"style":222},[31833],{"type":26,"value":368},{"type":21,"tag":209,"props":31835,"children":31836},{"style":216},[31837],{"type":26,"value":4622},{"type":21,"tag":209,"props":31839,"children":31840},{"style":222},[31841],{"type":26,"value":2561},{"type":21,"tag":209,"props":31843,"children":31844},{"class":211,"line":307},[31845],{"type":21,"tag":209,"props":31846,"children":31847},{"style":448},[31848],{"type":26,"value":13290},{"type":21,"tag":209,"props":31850,"children":31851},{"class":211,"line":325},[31852],{"type":21,"tag":209,"props":31853,"children":31854},{"style":448},[31855],{"type":26,"value":31856},"     * Convert a base64 image dataURL from a canvas element, to a blob.\n",{"type":21,"tag":209,"props":31858,"children":31859},{"class":211,"line":334},[31860,31864,31868,31873],{"type":21,"tag":209,"props":31861,"children":31862},{"style":448},[31863],{"type":26,"value":13306},{"type":21,"tag":209,"props":31865,"children":31866},{"style":216},[31867],{"type":26,"value":13311},{"type":21,"tag":209,"props":31869,"children":31870},{"style":360},[31871],{"type":26,"value":31872}," {function}",{"type":21,"tag":209,"props":31874,"children":31875},{"style":222},[31876],{"type":26,"value":31877}," callback\n",{"type":21,"tag":209,"props":31879,"children":31880},{"class":211,"line":343},[31881,31885,31889,31893],{"type":21,"tag":209,"props":31882,"children":31883},{"style":448},[31884],{"type":26,"value":13306},{"type":21,"tag":209,"props":31886,"children":31887},{"style":216},[31888],{"type":26,"value":13311},{"type":21,"tag":209,"props":31890,"children":31891},{"style":360},[31892],{"type":26,"value":13316},{"type":21,"tag":209,"props":31894,"children":31895},{"style":222},[31896],{"type":26,"value":31897}," type\n",{"type":21,"tag":209,"props":31899,"children":31900},{"class":211,"line":351},[31901,31905,31909,31913],{"type":21,"tag":209,"props":31902,"children":31903},{"style":448},[31904],{"type":26,"value":13306},{"type":21,"tag":209,"props":31906,"children":31907},{"style":216},[31908],{"type":26,"value":13311},{"type":21,"tag":209,"props":31910,"children":31911},{"style":360},[31912],{"type":26,"value":29175},{"type":21,"tag":209,"props":31914,"children":31915},{"style":222},[31916],{"type":26,"value":31917}," quality\n",{"type":21,"tag":209,"props":31919,"children":31920},{"class":211,"line":444},[31921,31925,31929,31934,31939],{"type":21,"tag":209,"props":31922,"children":31923},{"style":448},[31924],{"type":26,"value":13306},{"type":21,"tag":209,"props":31926,"children":31927},{"style":216},[31928],{"type":26,"value":13311},{"type":21,"tag":209,"props":31930,"children":31931},{"style":360},[31932],{"type":26,"value":31933}," {base64=}",{"type":21,"tag":209,"props":31935,"children":31936},{"style":222},[31937],{"type":26,"value":31938}," dataURL",{"type":21,"tag":209,"props":31940,"children":31941},{"style":448},[31942],{"type":26,"value":31943}," The dataURL to use, rather than fetch from the canvas.\n",{"type":21,"tag":209,"props":31945,"children":31946},{"class":211,"line":454},[31947],{"type":21,"tag":209,"props":31948,"children":31949},{"style":448},[31950],{"type":26,"value":13346},{"type":21,"tag":209,"props":31952,"children":31953},{"class":211,"line":463},[31954,31958,31963,31967,31972,31976,31980,31984,31989,31993,31998],{"type":21,"tag":209,"props":31955,"children":31956},{"style":216},[31957],{"type":26,"value":2981},{"type":21,"tag":209,"props":31959,"children":31960},{"style":360},[31961],{"type":26,"value":31962}," dataURLToBlob",{"type":21,"tag":209,"props":31964,"children":31965},{"style":222},[31966],{"type":26,"value":368},{"type":21,"tag":209,"props":31968,"children":31969},{"style":400},[31970],{"type":26,"value":31971},"callback",{"type":21,"tag":209,"props":31973,"children":31974},{"style":222},[31975],{"type":26,"value":408},{"type":21,"tag":209,"props":31977,"children":31978},{"style":400},[31979],{"type":26,"value":24292},{"type":21,"tag":209,"props":31981,"children":31982},{"style":222},[31983],{"type":26,"value":408},{"type":21,"tag":209,"props":31985,"children":31986},{"style":400},[31987],{"type":26,"value":31988},"quality",{"type":21,"tag":209,"props":31990,"children":31991},{"style":222},[31992],{"type":26,"value":408},{"type":21,"tag":209,"props":31994,"children":31995},{"style":400},[31996],{"type":26,"value":31997},"dataURL",{"type":21,"tag":209,"props":31999,"children":32000},{"style":222},[32001],{"type":26,"value":2369},{"type":21,"tag":209,"props":32003,"children":32004},{"class":211,"line":472},[32005,32010,32014,32019,32023,32027,32031,32036],{"type":21,"tag":209,"props":32006,"children":32007},{"style":222},[32008],{"type":26,"value":32009},"        dataURL ",{"type":21,"tag":209,"props":32011,"children":32012},{"style":216},[32013],{"type":26,"value":1432},{"type":21,"tag":209,"props":32015,"children":32016},{"style":222},[32017],{"type":26,"value":32018}," dataURL ",{"type":21,"tag":209,"props":32020,"children":32021},{"style":216},[32022],{"type":26,"value":13270},{"type":21,"tag":209,"props":32024,"children":32025},{"style":263},[32026],{"type":26,"value":20502},{"type":21,"tag":209,"props":32028,"children":32029},{"style":222},[32030],{"type":26,"value":378},{"type":21,"tag":209,"props":32032,"children":32033},{"style":360},[32034],{"type":26,"value":32035},"toDataURL",{"type":21,"tag":209,"props":32037,"children":32038},{"style":222},[32039],{"type":26,"value":32040},"(type, quality);\n",{"type":21,"tag":209,"props":32042,"children":32043},{"class":211,"line":480},[32044,32048,32053,32057,32062,32067,32071,32075,32080,32084,32088],{"type":21,"tag":209,"props":32045,"children":32046},{"style":216},[32047],{"type":26,"value":14505},{"type":21,"tag":209,"props":32049,"children":32050},{"style":222},[32051],{"type":26,"value":32052}," bin ",{"type":21,"tag":209,"props":32054,"children":32055},{"style":216},[32056],{"type":26,"value":1432},{"type":21,"tag":209,"props":32058,"children":32059},{"style":360},[32060],{"type":26,"value":32061}," atob",{"type":21,"tag":209,"props":32063,"children":32064},{"style":222},[32065],{"type":26,"value":32066},"(dataURL.",{"type":21,"tag":209,"props":32068,"children":32069},{"style":360},[32070],{"type":26,"value":6313},{"type":21,"tag":209,"props":32072,"children":32073},{"style":222},[32074],{"type":26,"value":368},{"type":21,"tag":209,"props":32076,"children":32077},{"style":233},[32078],{"type":26,"value":32079},"','",{"type":21,"tag":209,"props":32081,"children":32082},{"style":222},[32083],{"type":26,"value":22804},{"type":21,"tag":209,"props":32085,"children":32086},{"style":263},[32087],{"type":26,"value":3224},{"type":21,"tag":209,"props":32089,"children":32090},{"style":222},[32091],{"type":26,"value":32092},"]),\n",{"type":21,"tag":209,"props":32094,"children":32095},{"class":211,"line":489},[32096,32101,32105,32110,32114],{"type":21,"tag":209,"props":32097,"children":32098},{"style":222},[32099],{"type":26,"value":32100},"            len ",{"type":21,"tag":209,"props":32102,"children":32103},{"style":216},[32104],{"type":26,"value":1432},{"type":21,"tag":209,"props":32106,"children":32107},{"style":222},[32108],{"type":26,"value":32109}," bin.",{"type":21,"tag":209,"props":32111,"children":32112},{"style":263},[32113],{"type":26,"value":6344},{"type":21,"tag":209,"props":32115,"children":32116},{"style":222},[32117],{"type":26,"value":304},{"type":21,"tag":209,"props":32119,"children":32120},{"class":211,"line":847},[32121,32126,32130,32135,32140,32144],{"type":21,"tag":209,"props":32122,"children":32123},{"style":222},[32124],{"type":26,"value":32125},"            len32 ",{"type":21,"tag":209,"props":32127,"children":32128},{"style":216},[32129],{"type":26,"value":1432},{"type":21,"tag":209,"props":32131,"children":32132},{"style":222},[32133],{"type":26,"value":32134}," len ",{"type":21,"tag":209,"props":32136,"children":32137},{"style":216},[32138],{"type":26,"value":32139},">>",{"type":21,"tag":209,"props":32141,"children":32142},{"style":263},[32143],{"type":26,"value":6354},{"type":21,"tag":209,"props":32145,"children":32146},{"style":222},[32147],{"type":26,"value":304},{"type":21,"tag":209,"props":32149,"children":32150},{"class":211,"line":860},[32151,32156,32160,32164,32169],{"type":21,"tag":209,"props":32152,"children":32153},{"style":222},[32154],{"type":26,"value":32155},"            a8 ",{"type":21,"tag":209,"props":32157,"children":32158},{"style":216},[32159],{"type":26,"value":1432},{"type":21,"tag":209,"props":32161,"children":32162},{"style":216},[32163],{"type":26,"value":6371},{"type":21,"tag":209,"props":32165,"children":32166},{"style":360},[32167],{"type":26,"value":32168}," Uint8Array",{"type":21,"tag":209,"props":32170,"children":32171},{"style":222},[32172],{"type":26,"value":32173},"(len),\n",{"type":21,"tag":209,"props":32175,"children":32176},{"class":211,"line":877},[32177,32182,32186,32190,32195,32200,32204],{"type":21,"tag":209,"props":32178,"children":32179},{"style":222},[32180],{"type":26,"value":32181},"            a32 ",{"type":21,"tag":209,"props":32183,"children":32184},{"style":216},[32185],{"type":26,"value":1432},{"type":21,"tag":209,"props":32187,"children":32188},{"style":216},[32189],{"type":26,"value":6371},{"type":21,"tag":209,"props":32191,"children":32192},{"style":360},[32193],{"type":26,"value":32194}," Uint32Array",{"type":21,"tag":209,"props":32196,"children":32197},{"style":222},[32198],{"type":26,"value":32199},"(a8.buffer, ",{"type":21,"tag":209,"props":32201,"children":32202},{"style":263},[32203],{"type":26,"value":8554},{"type":21,"tag":209,"props":32205,"children":32206},{"style":222},[32207],{"type":26,"value":32208},", len32),\n",{"type":21,"tag":209,"props":32210,"children":32211},{"class":211,"line":889},[32212,32217,32221,32225,32230,32235],{"type":21,"tag":209,"props":32213,"children":32214},{"style":222},[32215],{"type":26,"value":32216},"            tailLength ",{"type":21,"tag":209,"props":32218,"children":32219},{"style":216},[32220],{"type":26,"value":1432},{"type":21,"tag":209,"props":32222,"children":32223},{"style":222},[32224],{"type":26,"value":32134},{"type":21,"tag":209,"props":32226,"children":32227},{"style":216},[32228],{"type":26,"value":32229},"&",{"type":21,"tag":209,"props":32231,"children":32232},{"style":263},[32233],{"type":26,"value":32234}," 3",{"type":21,"tag":209,"props":32236,"children":32237},{"style":222},[32238],{"type":26,"value":241},{"type":21,"tag":209,"props":32240,"children":32241},{"class":211,"line":902},[32242],{"type":21,"tag":209,"props":32243,"children":32244},{"emptyLinePlaceholder":248},[32245],{"type":26,"value":251},{"type":21,"tag":209,"props":32247,"children":32248},{"class":211,"line":914},[32249,32254,32258,32262,32267,32271,32275,32280,32284,32288,32293,32297,32302,32307],{"type":21,"tag":209,"props":32250,"children":32251},{"style":216},[32252],{"type":26,"value":32253},"        for",{"type":21,"tag":209,"props":32255,"children":32256},{"style":222},[32257],{"type":26,"value":368},{"type":21,"tag":209,"props":32259,"children":32260},{"style":216},[32261],{"type":26,"value":3909},{"type":21,"tag":209,"props":32263,"children":32264},{"style":222},[32265],{"type":26,"value":32266}," i",{"type":21,"tag":209,"props":32268,"children":32269},{"style":216},[32270],{"type":26,"value":1432},{"type":21,"tag":209,"props":32272,"children":32273},{"style":263},[32274],{"type":26,"value":8554},{"type":21,"tag":209,"props":32276,"children":32277},{"style":222},[32278],{"type":26,"value":32279},", j",{"type":21,"tag":209,"props":32281,"children":32282},{"style":216},[32283],{"type":26,"value":1432},{"type":21,"tag":209,"props":32285,"children":32286},{"style":263},[32287],{"type":26,"value":8554},{"type":21,"tag":209,"props":32289,"children":32290},{"style":222},[32291],{"type":26,"value":32292},"; i ",{"type":21,"tag":209,"props":32294,"children":32295},{"style":216},[32296],{"type":26,"value":1985},{"type":21,"tag":209,"props":32298,"children":32299},{"style":222},[32300],{"type":26,"value":32301}," len32; i",{"type":21,"tag":209,"props":32303,"children":32304},{"style":216},[32305],{"type":26,"value":32306},"++",{"type":21,"tag":209,"props":32308,"children":32309},{"style":222},[32310],{"type":26,"value":8924},{"type":21,"tag":209,"props":32312,"children":32313},{"class":211,"line":922},[32314],{"type":21,"tag":209,"props":32315,"children":32316},{"style":222},[32317],{"type":26,"value":17555},{"type":21,"tag":209,"props":32319,"children":32320},{"class":211,"line":2312},[32321,32326,32330,32334,32339,32344,32348,32352],{"type":21,"tag":209,"props":32322,"children":32323},{"style":222},[32324],{"type":26,"value":32325},"            a32[i] ",{"type":21,"tag":209,"props":32327,"children":32328},{"style":216},[32329],{"type":26,"value":1432},{"type":21,"tag":209,"props":32331,"children":32332},{"style":222},[32333],{"type":26,"value":32109},{"type":21,"tag":209,"props":32335,"children":32336},{"style":360},[32337],{"type":26,"value":32338},"charCodeAt",{"type":21,"tag":209,"props":32340,"children":32341},{"style":222},[32342],{"type":26,"value":32343},"(j",{"type":21,"tag":209,"props":32345,"children":32346},{"style":216},[32347],{"type":26,"value":32306},{"type":21,"tag":209,"props":32349,"children":32350},{"style":222},[32351],{"type":26,"value":432},{"type":21,"tag":209,"props":32353,"children":32354},{"style":216},[32355],{"type":26,"value":32356},"|\n",{"type":21,"tag":209,"props":32358,"children":32359},{"class":211,"line":2321},[32360,32365,32369,32373,32377,32381,32386,32391],{"type":21,"tag":209,"props":32361,"children":32362},{"style":222},[32363],{"type":26,"value":32364},"                bin.",{"type":21,"tag":209,"props":32366,"children":32367},{"style":360},[32368],{"type":26,"value":32338},{"type":21,"tag":209,"props":32370,"children":32371},{"style":222},[32372],{"type":26,"value":32343},{"type":21,"tag":209,"props":32374,"children":32375},{"style":216},[32376],{"type":26,"value":32306},{"type":21,"tag":209,"props":32378,"children":32379},{"style":222},[32380],{"type":26,"value":432},{"type":21,"tag":209,"props":32382,"children":32383},{"style":216},[32384],{"type":26,"value":32385},"\u003C\u003C",{"type":21,"tag":209,"props":32387,"children":32388},{"style":263},[32389],{"type":26,"value":32390}," 8",{"type":21,"tag":209,"props":32392,"children":32393},{"style":216},[32394],{"type":26,"value":32395}," |\n",{"type":21,"tag":209,"props":32397,"children":32398},{"class":211,"line":2372},[32399,32403,32407,32411,32415,32419,32423,32428],{"type":21,"tag":209,"props":32400,"children":32401},{"style":222},[32402],{"type":26,"value":32364},{"type":21,"tag":209,"props":32404,"children":32405},{"style":360},[32406],{"type":26,"value":32338},{"type":21,"tag":209,"props":32408,"children":32409},{"style":222},[32410],{"type":26,"value":32343},{"type":21,"tag":209,"props":32412,"children":32413},{"style":216},[32414],{"type":26,"value":32306},{"type":21,"tag":209,"props":32416,"children":32417},{"style":222},[32418],{"type":26,"value":432},{"type":21,"tag":209,"props":32420,"children":32421},{"style":216},[32422],{"type":26,"value":32385},{"type":21,"tag":209,"props":32424,"children":32425},{"style":263},[32426],{"type":26,"value":32427}," 16",{"type":21,"tag":209,"props":32429,"children":32430},{"style":216},[32431],{"type":26,"value":32395},{"type":21,"tag":209,"props":32433,"children":32434},{"class":211,"line":2381},[32435,32439,32443,32447,32451,32455,32459,32464],{"type":21,"tag":209,"props":32436,"children":32437},{"style":222},[32438],{"type":26,"value":32364},{"type":21,"tag":209,"props":32440,"children":32441},{"style":360},[32442],{"type":26,"value":32338},{"type":21,"tag":209,"props":32444,"children":32445},{"style":222},[32446],{"type":26,"value":32343},{"type":21,"tag":209,"props":32448,"children":32449},{"style":216},[32450],{"type":26,"value":32306},{"type":21,"tag":209,"props":32452,"children":32453},{"style":222},[32454],{"type":26,"value":432},{"type":21,"tag":209,"props":32456,"children":32457},{"style":216},[32458],{"type":26,"value":32385},{"type":21,"tag":209,"props":32460,"children":32461},{"style":263},[32462],{"type":26,"value":32463}," 24",{"type":21,"tag":209,"props":32465,"children":32466},{"style":222},[32467],{"type":26,"value":241},{"type":21,"tag":209,"props":32469,"children":32470},{"class":211,"line":2389},[32471],{"type":21,"tag":209,"props":32472,"children":32473},{"style":222},[32474],{"type":26,"value":2235},{"type":21,"tag":209,"props":32476,"children":32477},{"class":211,"line":2397},[32478],{"type":21,"tag":209,"props":32479,"children":32480},{"emptyLinePlaceholder":248},[32481],{"type":26,"value":251},{"type":21,"tag":209,"props":32483,"children":32484},{"class":211,"line":2406},[32485,32490,32495,32500],{"type":21,"tag":209,"props":32486,"children":32487},{"style":216},[32488],{"type":26,"value":32489},"        while",{"type":21,"tag":209,"props":32491,"children":32492},{"style":222},[32493],{"type":26,"value":32494},"(tailLength",{"type":21,"tag":209,"props":32496,"children":32497},{"style":216},[32498],{"type":26,"value":32499},"--",{"type":21,"tag":209,"props":32501,"children":32502},{"style":222},[32503],{"type":26,"value":8924},{"type":21,"tag":209,"props":32505,"children":32506},{"class":211,"line":2415},[32507],{"type":21,"tag":209,"props":32508,"children":32509},{"style":222},[32510],{"type":26,"value":17555},{"type":21,"tag":209,"props":32512,"children":32513},{"class":211,"line":2424},[32514,32519,32523,32527,32531,32535,32539],{"type":21,"tag":209,"props":32515,"children":32516},{"style":222},[32517],{"type":26,"value":32518},"            a8[j] ",{"type":21,"tag":209,"props":32520,"children":32521},{"style":216},[32522],{"type":26,"value":1432},{"type":21,"tag":209,"props":32524,"children":32525},{"style":222},[32526],{"type":26,"value":32109},{"type":21,"tag":209,"props":32528,"children":32529},{"style":360},[32530],{"type":26,"value":32338},{"type":21,"tag":209,"props":32532,"children":32533},{"style":222},[32534],{"type":26,"value":32343},{"type":21,"tag":209,"props":32536,"children":32537},{"style":216},[32538],{"type":26,"value":32306},{"type":21,"tag":209,"props":32540,"children":32541},{"style":222},[32542],{"type":26,"value":2608},{"type":21,"tag":209,"props":32544,"children":32545},{"class":211,"line":2433},[32546],{"type":21,"tag":209,"props":32547,"children":32548},{"style":222},[32549],{"type":26,"value":2235},{"type":21,"tag":209,"props":32551,"children":32552},{"class":211,"line":2442},[32553],{"type":21,"tag":209,"props":32554,"children":32555},{"emptyLinePlaceholder":248},[32556],{"type":26,"value":251},{"type":21,"tag":209,"props":32558,"children":32559},{"class":211,"line":2471},[32560,32565,32569,32574,32578,32583,32588,32593,32597,32602],{"type":21,"tag":209,"props":32561,"children":32562},{"style":360},[32563],{"type":26,"value":32564},"        callback",{"type":21,"tag":209,"props":32566,"children":32567},{"style":222},[32568],{"type":26,"value":368},{"type":21,"tag":209,"props":32570,"children":32571},{"style":216},[32572],{"type":26,"value":32573},"new",{"type":21,"tag":209,"props":32575,"children":32576},{"style":360},[32577],{"type":26,"value":16108},{"type":21,"tag":209,"props":32579,"children":32580},{"style":222},[32581],{"type":26,"value":32582},"([a8], {",{"type":21,"tag":209,"props":32584,"children":32585},{"style":233},[32586],{"type":26,"value":32587},"'type'",{"type":21,"tag":209,"props":32589,"children":32590},{"style":222},[32591],{"type":26,"value":32592},": type ",{"type":21,"tag":209,"props":32594,"children":32595},{"style":216},[32596],{"type":26,"value":13270},{"type":21,"tag":209,"props":32598,"children":32599},{"style":233},[32600],{"type":26,"value":32601}," 'image/png'",{"type":21,"tag":209,"props":32603,"children":32604},{"style":222},[32605],{"type":26,"value":32606},"}));\n",{"type":21,"tag":209,"props":32608,"children":32609},{"class":211,"line":2480},[32610],{"type":21,"tag":209,"props":32611,"children":32612},{"style":222},[32613],{"type":26,"value":331},{"type":21,"tag":209,"props":32615,"children":32616},{"class":211,"line":2489},[32617],{"type":21,"tag":209,"props":32618,"children":32619},{"emptyLinePlaceholder":248},[32620],{"type":26,"value":251},{"type":21,"tag":209,"props":32622,"children":32623},{"class":211,"line":2516},[32624,32628,32633,32637,32642,32646,32650,32654,32658,32663],{"type":21,"tag":209,"props":32625,"children":32626},{"style":216},[32627],{"type":26,"value":9249},{"type":21,"tag":209,"props":32629,"children":32630},{"style":222},[32631],{"type":26,"value":32632},"(HTMLCanvasElement ",{"type":21,"tag":209,"props":32634,"children":32635},{"style":216},[32636],{"type":26,"value":18381},{"type":21,"tag":209,"props":32638,"children":32639},{"style":222},[32640],{"type":26,"value":32641}," Object.defineProperty ",{"type":21,"tag":209,"props":32643,"children":32644},{"style":216},[32645],{"type":26,"value":18381},{"type":21,"tag":209,"props":32647,"children":32648},{"style":216},[32649],{"type":26,"value":19960},{"type":21,"tag":209,"props":32651,"children":32652},{"style":263},[32653],{"type":26,"value":16052},{"type":21,"tag":209,"props":32655,"children":32656},{"style":222},[32657],{"type":26,"value":378},{"type":21,"tag":209,"props":32659,"children":32660},{"style":263},[32661],{"type":26,"value":32662},"prototype",{"type":21,"tag":209,"props":32664,"children":32665},{"style":222},[32666],{"type":26,"value":32667},".toBlob)\n",{"type":21,"tag":209,"props":32669,"children":32670},{"class":211,"line":2525},[32671],{"type":21,"tag":209,"props":32672,"children":32673},{"style":222},[32674],{"type":26,"value":32675},"    {\n",{"type":21,"tag":209,"props":32677,"children":32678},{"class":211,"line":2533},[32679,32684,32689,32693,32697,32701,32705,32709,32714],{"type":21,"tag":209,"props":32680,"children":32681},{"style":222},[32682],{"type":26,"value":32683},"        Object.",{"type":21,"tag":209,"props":32685,"children":32686},{"style":360},[32687],{"type":26,"value":32688},"defineProperty",{"type":21,"tag":209,"props":32690,"children":32691},{"style":222},[32692],{"type":26,"value":368},{"type":21,"tag":209,"props":32694,"children":32695},{"style":263},[32696],{"type":26,"value":16052},{"type":21,"tag":209,"props":32698,"children":32699},{"style":222},[32700],{"type":26,"value":378},{"type":21,"tag":209,"props":32702,"children":32703},{"style":263},[32704],{"type":26,"value":32662},{"type":21,"tag":209,"props":32706,"children":32707},{"style":222},[32708],{"type":26,"value":408},{"type":21,"tag":209,"props":32710,"children":32711},{"style":233},[32712],{"type":26,"value":32713},"'toBlob'",{"type":21,"tag":209,"props":32715,"children":32716},{"style":222},[32717],{"type":26,"value":304},{"type":21,"tag":209,"props":32719,"children":32720},{"class":211,"line":2542},[32721],{"type":21,"tag":209,"props":32722,"children":32723},{"style":222},[32724],{"type":26,"value":17555},{"type":21,"tag":209,"props":32726,"children":32727},{"class":211,"line":2550},[32728],{"type":21,"tag":209,"props":32729,"children":32730},{"style":222},[32731],{"type":26,"value":32732},"            value:dataURLToBlob\n",{"type":21,"tag":209,"props":32734,"children":32735},{"class":211,"line":2564},[32736],{"type":21,"tag":209,"props":32737,"children":32738},{"style":222},[32739],{"type":26,"value":13702},{"type":21,"tag":209,"props":32741,"children":32742},{"class":211,"line":2611},[32743],{"type":21,"tag":209,"props":32744,"children":32745},{"style":222},[32746],{"type":26,"value":331},{"type":21,"tag":209,"props":32748,"children":32749},{"class":211,"line":2619},[32750],{"type":21,"tag":209,"props":32751,"children":32752},{"style":222},[32753],{"type":26,"value":32754},"})();\n",{"type":21,"tag":22,"props":32756,"children":32757},{},[32758],{"type":26,"value":32759},"See here:",{"type":21,"tag":200,"props":32761,"children":32762},{"className":16138,"code":31792,"language":16140,"meta":8,"style":8},[32763],{"type":21,"tag":63,"props":32764,"children":32765},{"__ignoreMap":8},[32766,32773,32780,32787,32794,32809,32816,32823,32842,32861,32880,32903,32910,32957,32992,33039,33062,33089,33112,33143,33170,33177,33236,33243,33278,33313,33348,33383,33390,33397,33416,33423,33454,33461,33468,33511,33518,33525,33568,33575,33614,33621,33628,33635,33642],{"type":21,"tag":209,"props":32767,"children":32768},{"class":211,"line":212},[32769],{"type":21,"tag":209,"props":32770,"children":32771},{"style":448},[32772],{"type":26,"value":731},{"type":21,"tag":209,"props":32774,"children":32775},{"class":211,"line":244},[32776],{"type":21,"tag":209,"props":32777,"children":32778},{"style":448},[32779],{"type":26,"value":31811},{"type":21,"tag":209,"props":32781,"children":32782},{"class":211,"line":254},[32783],{"type":21,"tag":209,"props":32784,"children":32785},{"style":448},[32786],{"type":26,"value":31819},{"type":21,"tag":209,"props":32788,"children":32789},{"class":211,"line":279},[32790],{"type":21,"tag":209,"props":32791,"children":32792},{"style":448},[32793],{"type":26,"value":755},{"type":21,"tag":209,"props":32795,"children":32796},{"class":211,"line":288},[32797,32801,32805],{"type":21,"tag":209,"props":32798,"children":32799},{"style":222},[32800],{"type":26,"value":368},{"type":21,"tag":209,"props":32802,"children":32803},{"style":216},[32804],{"type":26,"value":4622},{"type":21,"tag":209,"props":32806,"children":32807},{"style":222},[32808],{"type":26,"value":2561},{"type":21,"tag":209,"props":32810,"children":32811},{"class":211,"line":307},[32812],{"type":21,"tag":209,"props":32813,"children":32814},{"style":448},[32815],{"type":26,"value":13290},{"type":21,"tag":209,"props":32817,"children":32818},{"class":211,"line":325},[32819],{"type":21,"tag":209,"props":32820,"children":32821},{"style":448},[32822],{"type":26,"value":31856},{"type":21,"tag":209,"props":32824,"children":32825},{"class":211,"line":334},[32826,32830,32834,32838],{"type":21,"tag":209,"props":32827,"children":32828},{"style":448},[32829],{"type":26,"value":13306},{"type":21,"tag":209,"props":32831,"children":32832},{"style":216},[32833],{"type":26,"value":13311},{"type":21,"tag":209,"props":32835,"children":32836},{"style":360},[32837],{"type":26,"value":31872},{"type":21,"tag":209,"props":32839,"children":32840},{"style":222},[32841],{"type":26,"value":31877},{"type":21,"tag":209,"props":32843,"children":32844},{"class":211,"line":343},[32845,32849,32853,32857],{"type":21,"tag":209,"props":32846,"children":32847},{"style":448},[32848],{"type":26,"value":13306},{"type":21,"tag":209,"props":32850,"children":32851},{"style":216},[32852],{"type":26,"value":13311},{"type":21,"tag":209,"props":32854,"children":32855},{"style":360},[32856],{"type":26,"value":13316},{"type":21,"tag":209,"props":32858,"children":32859},{"style":222},[32860],{"type":26,"value":31897},{"type":21,"tag":209,"props":32862,"children":32863},{"class":211,"line":351},[32864,32868,32872,32876],{"type":21,"tag":209,"props":32865,"children":32866},{"style":448},[32867],{"type":26,"value":13306},{"type":21,"tag":209,"props":32869,"children":32870},{"style":216},[32871],{"type":26,"value":13311},{"type":21,"tag":209,"props":32873,"children":32874},{"style":360},[32875],{"type":26,"value":29175},{"type":21,"tag":209,"props":32877,"children":32878},{"style":222},[32879],{"type":26,"value":31917},{"type":21,"tag":209,"props":32881,"children":32882},{"class":211,"line":444},[32883,32887,32891,32895,32899],{"type":21,"tag":209,"props":32884,"children":32885},{"style":448},[32886],{"type":26,"value":13306},{"type":21,"tag":209,"props":32888,"children":32889},{"style":216},[32890],{"type":26,"value":13311},{"type":21,"tag":209,"props":32892,"children":32893},{"style":360},[32894],{"type":26,"value":31933},{"type":21,"tag":209,"props":32896,"children":32897},{"style":222},[32898],{"type":26,"value":31938},{"type":21,"tag":209,"props":32900,"children":32901},{"style":448},[32902],{"type":26,"value":31943},{"type":21,"tag":209,"props":32904,"children":32905},{"class":211,"line":454},[32906],{"type":21,"tag":209,"props":32907,"children":32908},{"style":448},[32909],{"type":26,"value":13346},{"type":21,"tag":209,"props":32911,"children":32912},{"class":211,"line":463},[32913,32917,32921,32925,32929,32933,32937,32941,32945,32949,32953],{"type":21,"tag":209,"props":32914,"children":32915},{"style":216},[32916],{"type":26,"value":2981},{"type":21,"tag":209,"props":32918,"children":32919},{"style":360},[32920],{"type":26,"value":31962},{"type":21,"tag":209,"props":32922,"children":32923},{"style":222},[32924],{"type":26,"value":368},{"type":21,"tag":209,"props":32926,"children":32927},{"style":400},[32928],{"type":26,"value":31971},{"type":21,"tag":209,"props":32930,"children":32931},{"style":222},[32932],{"type":26,"value":408},{"type":21,"tag":209,"props":32934,"children":32935},{"style":400},[32936],{"type":26,"value":24292},{"type":21,"tag":209,"props":32938,"children":32939},{"style":222},[32940],{"type":26,"value":408},{"type":21,"tag":209,"props":32942,"children":32943},{"style":400},[32944],{"type":26,"value":31988},{"type":21,"tag":209,"props":32946,"children":32947},{"style":222},[32948],{"type":26,"value":408},{"type":21,"tag":209,"props":32950,"children":32951},{"style":400},[32952],{"type":26,"value":31997},{"type":21,"tag":209,"props":32954,"children":32955},{"style":222},[32956],{"type":26,"value":2369},{"type":21,"tag":209,"props":32958,"children":32959},{"class":211,"line":472},[32960,32964,32968,32972,32976,32980,32984,32988],{"type":21,"tag":209,"props":32961,"children":32962},{"style":222},[32963],{"type":26,"value":32009},{"type":21,"tag":209,"props":32965,"children":32966},{"style":216},[32967],{"type":26,"value":1432},{"type":21,"tag":209,"props":32969,"children":32970},{"style":222},[32971],{"type":26,"value":32018},{"type":21,"tag":209,"props":32973,"children":32974},{"style":216},[32975],{"type":26,"value":13270},{"type":21,"tag":209,"props":32977,"children":32978},{"style":263},[32979],{"type":26,"value":20502},{"type":21,"tag":209,"props":32981,"children":32982},{"style":222},[32983],{"type":26,"value":378},{"type":21,"tag":209,"props":32985,"children":32986},{"style":360},[32987],{"type":26,"value":32035},{"type":21,"tag":209,"props":32989,"children":32990},{"style":222},[32991],{"type":26,"value":32040},{"type":21,"tag":209,"props":32993,"children":32994},{"class":211,"line":480},[32995,32999,33003,33007,33011,33015,33019,33023,33027,33031,33035],{"type":21,"tag":209,"props":32996,"children":32997},{"style":216},[32998],{"type":26,"value":14505},{"type":21,"tag":209,"props":33000,"children":33001},{"style":222},[33002],{"type":26,"value":32052},{"type":21,"tag":209,"props":33004,"children":33005},{"style":216},[33006],{"type":26,"value":1432},{"type":21,"tag":209,"props":33008,"children":33009},{"style":360},[33010],{"type":26,"value":32061},{"type":21,"tag":209,"props":33012,"children":33013},{"style":222},[33014],{"type":26,"value":32066},{"type":21,"tag":209,"props":33016,"children":33017},{"style":360},[33018],{"type":26,"value":6313},{"type":21,"tag":209,"props":33020,"children":33021},{"style":222},[33022],{"type":26,"value":368},{"type":21,"tag":209,"props":33024,"children":33025},{"style":233},[33026],{"type":26,"value":32079},{"type":21,"tag":209,"props":33028,"children":33029},{"style":222},[33030],{"type":26,"value":22804},{"type":21,"tag":209,"props":33032,"children":33033},{"style":263},[33034],{"type":26,"value":3224},{"type":21,"tag":209,"props":33036,"children":33037},{"style":222},[33038],{"type":26,"value":32092},{"type":21,"tag":209,"props":33040,"children":33041},{"class":211,"line":489},[33042,33046,33050,33054,33058],{"type":21,"tag":209,"props":33043,"children":33044},{"style":222},[33045],{"type":26,"value":32100},{"type":21,"tag":209,"props":33047,"children":33048},{"style":216},[33049],{"type":26,"value":1432},{"type":21,"tag":209,"props":33051,"children":33052},{"style":222},[33053],{"type":26,"value":32109},{"type":21,"tag":209,"props":33055,"children":33056},{"style":263},[33057],{"type":26,"value":6344},{"type":21,"tag":209,"props":33059,"children":33060},{"style":222},[33061],{"type":26,"value":304},{"type":21,"tag":209,"props":33063,"children":33064},{"class":211,"line":847},[33065,33069,33073,33077,33081,33085],{"type":21,"tag":209,"props":33066,"children":33067},{"style":222},[33068],{"type":26,"value":32125},{"type":21,"tag":209,"props":33070,"children":33071},{"style":216},[33072],{"type":26,"value":1432},{"type":21,"tag":209,"props":33074,"children":33075},{"style":222},[33076],{"type":26,"value":32134},{"type":21,"tag":209,"props":33078,"children":33079},{"style":216},[33080],{"type":26,"value":32139},{"type":21,"tag":209,"props":33082,"children":33083},{"style":263},[33084],{"type":26,"value":6354},{"type":21,"tag":209,"props":33086,"children":33087},{"style":222},[33088],{"type":26,"value":304},{"type":21,"tag":209,"props":33090,"children":33091},{"class":211,"line":860},[33092,33096,33100,33104,33108],{"type":21,"tag":209,"props":33093,"children":33094},{"style":222},[33095],{"type":26,"value":32155},{"type":21,"tag":209,"props":33097,"children":33098},{"style":216},[33099],{"type":26,"value":1432},{"type":21,"tag":209,"props":33101,"children":33102},{"style":216},[33103],{"type":26,"value":6371},{"type":21,"tag":209,"props":33105,"children":33106},{"style":360},[33107],{"type":26,"value":32168},{"type":21,"tag":209,"props":33109,"children":33110},{"style":222},[33111],{"type":26,"value":32173},{"type":21,"tag":209,"props":33113,"children":33114},{"class":211,"line":877},[33115,33119,33123,33127,33131,33135,33139],{"type":21,"tag":209,"props":33116,"children":33117},{"style":222},[33118],{"type":26,"value":32181},{"type":21,"tag":209,"props":33120,"children":33121},{"style":216},[33122],{"type":26,"value":1432},{"type":21,"tag":209,"props":33124,"children":33125},{"style":216},[33126],{"type":26,"value":6371},{"type":21,"tag":209,"props":33128,"children":33129},{"style":360},[33130],{"type":26,"value":32194},{"type":21,"tag":209,"props":33132,"children":33133},{"style":222},[33134],{"type":26,"value":32199},{"type":21,"tag":209,"props":33136,"children":33137},{"style":263},[33138],{"type":26,"value":8554},{"type":21,"tag":209,"props":33140,"children":33141},{"style":222},[33142],{"type":26,"value":32208},{"type":21,"tag":209,"props":33144,"children":33145},{"class":211,"line":889},[33146,33150,33154,33158,33162,33166],{"type":21,"tag":209,"props":33147,"children":33148},{"style":222},[33149],{"type":26,"value":32216},{"type":21,"tag":209,"props":33151,"children":33152},{"style":216},[33153],{"type":26,"value":1432},{"type":21,"tag":209,"props":33155,"children":33156},{"style":222},[33157],{"type":26,"value":32134},{"type":21,"tag":209,"props":33159,"children":33160},{"style":216},[33161],{"type":26,"value":32229},{"type":21,"tag":209,"props":33163,"children":33164},{"style":263},[33165],{"type":26,"value":32234},{"type":21,"tag":209,"props":33167,"children":33168},{"style":222},[33169],{"type":26,"value":241},{"type":21,"tag":209,"props":33171,"children":33172},{"class":211,"line":902},[33173],{"type":21,"tag":209,"props":33174,"children":33175},{"emptyLinePlaceholder":248},[33176],{"type":26,"value":251},{"type":21,"tag":209,"props":33178,"children":33179},{"class":211,"line":914},[33180,33184,33188,33192,33196,33200,33204,33208,33212,33216,33220,33224,33228,33232],{"type":21,"tag":209,"props":33181,"children":33182},{"style":216},[33183],{"type":26,"value":32253},{"type":21,"tag":209,"props":33185,"children":33186},{"style":222},[33187],{"type":26,"value":368},{"type":21,"tag":209,"props":33189,"children":33190},{"style":216},[33191],{"type":26,"value":3909},{"type":21,"tag":209,"props":33193,"children":33194},{"style":222},[33195],{"type":26,"value":32266},{"type":21,"tag":209,"props":33197,"children":33198},{"style":216},[33199],{"type":26,"value":1432},{"type":21,"tag":209,"props":33201,"children":33202},{"style":263},[33203],{"type":26,"value":8554},{"type":21,"tag":209,"props":33205,"children":33206},{"style":222},[33207],{"type":26,"value":32279},{"type":21,"tag":209,"props":33209,"children":33210},{"style":216},[33211],{"type":26,"value":1432},{"type":21,"tag":209,"props":33213,"children":33214},{"style":263},[33215],{"type":26,"value":8554},{"type":21,"tag":209,"props":33217,"children":33218},{"style":222},[33219],{"type":26,"value":32292},{"type":21,"tag":209,"props":33221,"children":33222},{"style":216},[33223],{"type":26,"value":1985},{"type":21,"tag":209,"props":33225,"children":33226},{"style":222},[33227],{"type":26,"value":32301},{"type":21,"tag":209,"props":33229,"children":33230},{"style":216},[33231],{"type":26,"value":32306},{"type":21,"tag":209,"props":33233,"children":33234},{"style":222},[33235],{"type":26,"value":8924},{"type":21,"tag":209,"props":33237,"children":33238},{"class":211,"line":922},[33239],{"type":21,"tag":209,"props":33240,"children":33241},{"style":222},[33242],{"type":26,"value":17555},{"type":21,"tag":209,"props":33244,"children":33245},{"class":211,"line":2312},[33246,33250,33254,33258,33262,33266,33270,33274],{"type":21,"tag":209,"props":33247,"children":33248},{"style":222},[33249],{"type":26,"value":32325},{"type":21,"tag":209,"props":33251,"children":33252},{"style":216},[33253],{"type":26,"value":1432},{"type":21,"tag":209,"props":33255,"children":33256},{"style":222},[33257],{"type":26,"value":32109},{"type":21,"tag":209,"props":33259,"children":33260},{"style":360},[33261],{"type":26,"value":32338},{"type":21,"tag":209,"props":33263,"children":33264},{"style":222},[33265],{"type":26,"value":32343},{"type":21,"tag":209,"props":33267,"children":33268},{"style":216},[33269],{"type":26,"value":32306},{"type":21,"tag":209,"props":33271,"children":33272},{"style":222},[33273],{"type":26,"value":432},{"type":21,"tag":209,"props":33275,"children":33276},{"style":216},[33277],{"type":26,"value":32356},{"type":21,"tag":209,"props":33279,"children":33280},{"class":211,"line":2321},[33281,33285,33289,33293,33297,33301,33305,33309],{"type":21,"tag":209,"props":33282,"children":33283},{"style":222},[33284],{"type":26,"value":32364},{"type":21,"tag":209,"props":33286,"children":33287},{"style":360},[33288],{"type":26,"value":32338},{"type":21,"tag":209,"props":33290,"children":33291},{"style":222},[33292],{"type":26,"value":32343},{"type":21,"tag":209,"props":33294,"children":33295},{"style":216},[33296],{"type":26,"value":32306},{"type":21,"tag":209,"props":33298,"children":33299},{"style":222},[33300],{"type":26,"value":432},{"type":21,"tag":209,"props":33302,"children":33303},{"style":216},[33304],{"type":26,"value":32385},{"type":21,"tag":209,"props":33306,"children":33307},{"style":263},[33308],{"type":26,"value":32390},{"type":21,"tag":209,"props":33310,"children":33311},{"style":216},[33312],{"type":26,"value":32395},{"type":21,"tag":209,"props":33314,"children":33315},{"class":211,"line":2372},[33316,33320,33324,33328,33332,33336,33340,33344],{"type":21,"tag":209,"props":33317,"children":33318},{"style":222},[33319],{"type":26,"value":32364},{"type":21,"tag":209,"props":33321,"children":33322},{"style":360},[33323],{"type":26,"value":32338},{"type":21,"tag":209,"props":33325,"children":33326},{"style":222},[33327],{"type":26,"value":32343},{"type":21,"tag":209,"props":33329,"children":33330},{"style":216},[33331],{"type":26,"value":32306},{"type":21,"tag":209,"props":33333,"children":33334},{"style":222},[33335],{"type":26,"value":432},{"type":21,"tag":209,"props":33337,"children":33338},{"style":216},[33339],{"type":26,"value":32385},{"type":21,"tag":209,"props":33341,"children":33342},{"style":263},[33343],{"type":26,"value":32427},{"type":21,"tag":209,"props":33345,"children":33346},{"style":216},[33347],{"type":26,"value":32395},{"type":21,"tag":209,"props":33349,"children":33350},{"class":211,"line":2381},[33351,33355,33359,33363,33367,33371,33375,33379],{"type":21,"tag":209,"props":33352,"children":33353},{"style":222},[33354],{"type":26,"value":32364},{"type":21,"tag":209,"props":33356,"children":33357},{"style":360},[33358],{"type":26,"value":32338},{"type":21,"tag":209,"props":33360,"children":33361},{"style":222},[33362],{"type":26,"value":32343},{"type":21,"tag":209,"props":33364,"children":33365},{"style":216},[33366],{"type":26,"value":32306},{"type":21,"tag":209,"props":33368,"children":33369},{"style":222},[33370],{"type":26,"value":432},{"type":21,"tag":209,"props":33372,"children":33373},{"style":216},[33374],{"type":26,"value":32385},{"type":21,"tag":209,"props":33376,"children":33377},{"style":263},[33378],{"type":26,"value":32463},{"type":21,"tag":209,"props":33380,"children":33381},{"style":222},[33382],{"type":26,"value":241},{"type":21,"tag":209,"props":33384,"children":33385},{"class":211,"line":2389},[33386],{"type":21,"tag":209,"props":33387,"children":33388},{"style":222},[33389],{"type":26,"value":2235},{"type":21,"tag":209,"props":33391,"children":33392},{"class":211,"line":2397},[33393],{"type":21,"tag":209,"props":33394,"children":33395},{"emptyLinePlaceholder":248},[33396],{"type":26,"value":251},{"type":21,"tag":209,"props":33398,"children":33399},{"class":211,"line":2406},[33400,33404,33408,33412],{"type":21,"tag":209,"props":33401,"children":33402},{"style":216},[33403],{"type":26,"value":32489},{"type":21,"tag":209,"props":33405,"children":33406},{"style":222},[33407],{"type":26,"value":32494},{"type":21,"tag":209,"props":33409,"children":33410},{"style":216},[33411],{"type":26,"value":32499},{"type":21,"tag":209,"props":33413,"children":33414},{"style":222},[33415],{"type":26,"value":8924},{"type":21,"tag":209,"props":33417,"children":33418},{"class":211,"line":2415},[33419],{"type":21,"tag":209,"props":33420,"children":33421},{"style":222},[33422],{"type":26,"value":17555},{"type":21,"tag":209,"props":33424,"children":33425},{"class":211,"line":2424},[33426,33430,33434,33438,33442,33446,33450],{"type":21,"tag":209,"props":33427,"children":33428},{"style":222},[33429],{"type":26,"value":32518},{"type":21,"tag":209,"props":33431,"children":33432},{"style":216},[33433],{"type":26,"value":1432},{"type":21,"tag":209,"props":33435,"children":33436},{"style":222},[33437],{"type":26,"value":32109},{"type":21,"tag":209,"props":33439,"children":33440},{"style":360},[33441],{"type":26,"value":32338},{"type":21,"tag":209,"props":33443,"children":33444},{"style":222},[33445],{"type":26,"value":32343},{"type":21,"tag":209,"props":33447,"children":33448},{"style":216},[33449],{"type":26,"value":32306},{"type":21,"tag":209,"props":33451,"children":33452},{"style":222},[33453],{"type":26,"value":2608},{"type":21,"tag":209,"props":33455,"children":33456},{"class":211,"line":2433},[33457],{"type":21,"tag":209,"props":33458,"children":33459},{"style":222},[33460],{"type":26,"value":2235},{"type":21,"tag":209,"props":33462,"children":33463},{"class":211,"line":2442},[33464],{"type":21,"tag":209,"props":33465,"children":33466},{"emptyLinePlaceholder":248},[33467],{"type":26,"value":251},{"type":21,"tag":209,"props":33469,"children":33470},{"class":211,"line":2471},[33471,33475,33479,33483,33487,33491,33495,33499,33503,33507],{"type":21,"tag":209,"props":33472,"children":33473},{"style":360},[33474],{"type":26,"value":32564},{"type":21,"tag":209,"props":33476,"children":33477},{"style":222},[33478],{"type":26,"value":368},{"type":21,"tag":209,"props":33480,"children":33481},{"style":216},[33482],{"type":26,"value":32573},{"type":21,"tag":209,"props":33484,"children":33485},{"style":360},[33486],{"type":26,"value":16108},{"type":21,"tag":209,"props":33488,"children":33489},{"style":222},[33490],{"type":26,"value":32582},{"type":21,"tag":209,"props":33492,"children":33493},{"style":233},[33494],{"type":26,"value":32587},{"type":21,"tag":209,"props":33496,"children":33497},{"style":222},[33498],{"type":26,"value":32592},{"type":21,"tag":209,"props":33500,"children":33501},{"style":216},[33502],{"type":26,"value":13270},{"type":21,"tag":209,"props":33504,"children":33505},{"style":233},[33506],{"type":26,"value":32601},{"type":21,"tag":209,"props":33508,"children":33509},{"style":222},[33510],{"type":26,"value":32606},{"type":21,"tag":209,"props":33512,"children":33513},{"class":211,"line":2480},[33514],{"type":21,"tag":209,"props":33515,"children":33516},{"style":222},[33517],{"type":26,"value":331},{"type":21,"tag":209,"props":33519,"children":33520},{"class":211,"line":2489},[33521],{"type":21,"tag":209,"props":33522,"children":33523},{"emptyLinePlaceholder":248},[33524],{"type":26,"value":251},{"type":21,"tag":209,"props":33526,"children":33527},{"class":211,"line":2516},[33528,33532,33536,33540,33544,33548,33552,33556,33560,33564],{"type":21,"tag":209,"props":33529,"children":33530},{"style":216},[33531],{"type":26,"value":9249},{"type":21,"tag":209,"props":33533,"children":33534},{"style":222},[33535],{"type":26,"value":32632},{"type":21,"tag":209,"props":33537,"children":33538},{"style":216},[33539],{"type":26,"value":18381},{"type":21,"tag":209,"props":33541,"children":33542},{"style":222},[33543],{"type":26,"value":32641},{"type":21,"tag":209,"props":33545,"children":33546},{"style":216},[33547],{"type":26,"value":18381},{"type":21,"tag":209,"props":33549,"children":33550},{"style":216},[33551],{"type":26,"value":19960},{"type":21,"tag":209,"props":33553,"children":33554},{"style":263},[33555],{"type":26,"value":16052},{"type":21,"tag":209,"props":33557,"children":33558},{"style":222},[33559],{"type":26,"value":378},{"type":21,"tag":209,"props":33561,"children":33562},{"style":263},[33563],{"type":26,"value":32662},{"type":21,"tag":209,"props":33565,"children":33566},{"style":222},[33567],{"type":26,"value":32667},{"type":21,"tag":209,"props":33569,"children":33570},{"class":211,"line":2525},[33571],{"type":21,"tag":209,"props":33572,"children":33573},{"style":222},[33574],{"type":26,"value":32675},{"type":21,"tag":209,"props":33576,"children":33577},{"class":211,"line":2533},[33578,33582,33586,33590,33594,33598,33602,33606,33610],{"type":21,"tag":209,"props":33579,"children":33580},{"style":222},[33581],{"type":26,"value":32683},{"type":21,"tag":209,"props":33583,"children":33584},{"style":360},[33585],{"type":26,"value":32688},{"type":21,"tag":209,"props":33587,"children":33588},{"style":222},[33589],{"type":26,"value":368},{"type":21,"tag":209,"props":33591,"children":33592},{"style":263},[33593],{"type":26,"value":16052},{"type":21,"tag":209,"props":33595,"children":33596},{"style":222},[33597],{"type":26,"value":378},{"type":21,"tag":209,"props":33599,"children":33600},{"style":263},[33601],{"type":26,"value":32662},{"type":21,"tag":209,"props":33603,"children":33604},{"style":222},[33605],{"type":26,"value":408},{"type":21,"tag":209,"props":33607,"children":33608},{"style":233},[33609],{"type":26,"value":32713},{"type":21,"tag":209,"props":33611,"children":33612},{"style":222},[33613],{"type":26,"value":304},{"type":21,"tag":209,"props":33615,"children":33616},{"class":211,"line":2542},[33617],{"type":21,"tag":209,"props":33618,"children":33619},{"style":222},[33620],{"type":26,"value":17555},{"type":21,"tag":209,"props":33622,"children":33623},{"class":211,"line":2550},[33624],{"type":21,"tag":209,"props":33625,"children":33626},{"style":222},[33627],{"type":26,"value":32732},{"type":21,"tag":209,"props":33629,"children":33630},{"class":211,"line":2564},[33631],{"type":21,"tag":209,"props":33632,"children":33633},{"style":222},[33634],{"type":26,"value":13702},{"type":21,"tag":209,"props":33636,"children":33637},{"class":211,"line":2611},[33638],{"type":21,"tag":209,"props":33639,"children":33640},{"style":222},[33641],{"type":26,"value":331},{"type":21,"tag":209,"props":33643,"children":33644},{"class":211,"line":2619},[33645],{"type":21,"tag":209,"props":33646,"children":33647},{"style":222},[33648],{"type":26,"value":32754},{"type":21,"tag":22,"props":33650,"children":33651},{},[33652,33654,33661,33663,33670],{"type":26,"value":33653},"Okay, but now we're golden, right? But what if we have to support iOS? Oh my, there is a ",{"type":21,"tag":29,"props":33655,"children":33658},{"href":33656,"rel":33657},"https://www.google.ca/search?output=search&sclient=psy-ab&q=ios%20safari%20megapixel%20bug&=&=&oq=&gs_l=&pbx=1",[93],[33659],{"type":26,"value":33660},"world",{"type":26,"value":33662}," of ",{"type":21,"tag":29,"props":33664,"children":33667},{"href":33665,"rel":33666},"http://stackoverflow.com/questions/15542045/mobile-safari-downsamples-large-images-how-to-retain",[93],[33668],{"type":26,"value":33669},"hurt",{"type":26,"value":33671}," awaiting you. You'll need to handle subsampling and vertical squashing on megapixel images, exif orientation to correct the orientation of the image, and limitations on the size/resolution of the canvas.",{"type":21,"tag":22,"props":33673,"children":33674},{},[33675],{"type":26,"value":33676},"Long story short: what works in one place is not guaranteed to work in another - at least, not without significant effort in some cases. \"Write Once, Run Anywhere\" is still just a pleasant dream.",{"type":21,"tag":3596,"props":33678,"children":33680},{"id":33679},"so-what-does-this-mean-to-me",[33681],{"type":26,"value":33682},"So what does this mean to me?",{"type":21,"tag":22,"props":33684,"children":33685},{},[33686],{"type":26,"value":33687},"The net effect is that, once the cost of testing and supporting multiple browser platforms is considered, the benefits of a shared codebase are somewhat reduced relative to native apps.",{"type":21,"tag":22,"props":33689,"children":33690},{},[33691],{"type":26,"value":33692},"In all likelihood, it will still be faster and less expensive to create a webapp compared to a native application equivalent for each platform to be supported, assuming that platforms > 1, but it should not be expected that the difference will be drastic, especially if support of cutting-edge features is desired.",{"type":21,"tag":22,"props":33694,"children":33695},{},[33696],{"type":26,"value":33697},"This is something that needs to be made clear to your client up-front - put simply, making a webapp is not easier than making a native application. There are advantages, but that isn't one of them.",{"type":21,"tag":3490,"props":33699,"children":33700},{},[33701],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":33703},[33704,33705,33706,33707],{"id":31633,"depth":244,"text":31636},{"id":31675,"depth":244,"text":31678},{"id":31724,"depth":244,"text":31727},{"id":33679,"depth":244,"text":33682},"content:ckeefer:2015-1:writeonce.md","ckeefer/2015-1/writeonce.md","ckeefer/2015-1/writeonce",{"user":3518,"name":3519},{"_path":33713,"_dir":33714,"_draft":7,"_partial":7,"_locale":8,"title":33715,"description":33716,"publishDate":33717,"tags":33718,"excerpt":33716,"body":33719,"_type":3511,"_id":34841,"_source":3513,"_file":34842,"_stem":34843,"_extension":3516,"author":34844},"/ckeefer/2014-8/behold-views","2014-8","Behold! (JavaScript Views)","JavaScript has the propensity to be very untidy - if you let it, it will sprawl all over the place. Hundreds of global variables scattered across dozens of files, messy half-measures towards object-orientation, mixed in seemingly at random with ungrouped functions - anyone who's had a client bring them a failed project from some other development team knows just how bad it can get.","2015-01-07",[12],{"type":18,"children":33720,"toc":34833},[33721,33725,33730,33735,33740,33745,33767,33779,33784,33790,33837,33842,33862,33874,33879,33884,33889,33894,33912,33942,33947,33975,33980,33985,34004,34016,34021,34026,34132,34145,34800,34804,34816,34829],{"type":21,"tag":22,"props":33722,"children":33723},{},[33724],{"type":26,"value":33716},{"type":21,"tag":22,"props":33726,"children":33727},{},[33728],{"type":26,"value":33729},"JavaScript also has the potential to be neat and tidy, and keep private variables and methods truly private - if you know how. Closures and an understanding of prototypical inheritance are the secrets, of course - but these are general purpose tools. For more specific scenarios - say, attaching logic to an existing or dynamically created view - tidy encapsulation is just the beginning of the suite of features we covet.",{"type":21,"tag":22,"props":33731,"children":33732},{},[33733],{"type":26,"value":33734},"We'd like to be able to declare and bind to page elements all in one spot, so we never duplicate jQuery selectors unnecessarily, it's clear what we've bound when looking at the view, and we can easily re-use those bindings through a variety of functions. Heck, while we're at it, we'd like to be able to bind events to these elements using the same mapping we've just created (maybe with some nice syntactical sugar to simplify statements), and assign arbitrary functions within our view to handle the events.",{"type":21,"tag":22,"props":33736,"children":33737},{},[33738],{"type":26,"value":33739},"All of this should be neatly encapsulated within a JavaScript'class', and instantiable when and where we desire; and as long as we're dreaming, how about a nice, modular system that keeps private variables and methods from being exposed to other classes, automatically offers us safe, localized references to jQuery, underscore or whatever other libraries we're using, and offers us the ability to initialize the module under conditions of our choosing.",{"type":21,"tag":22,"props":33741,"children":33742},{},[33743],{"type":26,"value":33744},"Pinch yourself, it's not a dream. After a few projects working with Backbone and Marionette, I was loath to do without those tidy and functional views and all the features above (and more) on future projects, even those that aren't a good fit for Backbone. Thus, Behold! A view framework was written.",{"type":21,"tag":22,"props":33746,"children":33747},{},[33748,33750,33757,33758,33765],{"type":26,"value":33749},"Behold is for those who like the tidy encapsulation and functionality that frameworks like ",{"type":21,"tag":29,"props":33751,"children":33754},{"href":33752,"rel":33753},"https://github.com/chaplinjs/chaplin",[93],[33755],{"type":26,"value":33756},"Chaplin",{"type":26,"value":5997},{"type":21,"tag":29,"props":33759,"children":33762},{"href":33760,"rel":33761},"http://marionettejs.com/",[93],[33763],{"type":26,"value":33764},"Marionette",{"type":26,"value":33766}," provide for js views, but don't need everything that Backbone offers, and can't justify the extra weight of it.",{"type":21,"tag":22,"props":33768,"children":33769},{},[33770,33772,33778],{"type":26,"value":33771},"Sold on the concept already? Go take a look at the ",{"type":21,"tag":29,"props":33773,"children":33776},{"href":33774,"rel":33775},"https://github.com/SaneMethod/Behold",[93],[33777],{"type":26,"value":31443},{"type":26,"value":378},{"type":21,"tag":22,"props":33780,"children":33781},{},[33782],{"type":26,"value":33783},"Need more convincing? Carry on, then.",{"type":21,"tag":3596,"props":33785,"children":33787},{"id":33786},"contents",[33788],{"type":26,"value":33789},"Contents",{"type":21,"tag":3679,"props":33791,"children":33792},{},[33793,33802,33811,33820,33829],{"type":21,"tag":3630,"props":33794,"children":33795},{},[33796],{"type":21,"tag":29,"props":33797,"children":33799},{"href":33798},"#why-views",[33800],{"type":26,"value":33801},"Why Views?",{"type":21,"tag":3630,"props":33803,"children":33804},{},[33805],{"type":21,"tag":29,"props":33806,"children":33808},{"href":33807},"#why-behold",[33809],{"type":26,"value":33810},"Why Behold?",{"type":21,"tag":3630,"props":33812,"children":33813},{},[33814],{"type":21,"tag":29,"props":33815,"children":33817},{"href":33816},"#dependencies",[33818],{"type":26,"value":33819},"Dependencies",{"type":21,"tag":3630,"props":33821,"children":33822},{},[33823],{"type":21,"tag":29,"props":33824,"children":33826},{"href":33825},"#usage-example",[33827],{"type":26,"value":33828},"Usage Example",{"type":21,"tag":3630,"props":33830,"children":33831},{},[33832],{"type":21,"tag":29,"props":33833,"children":33835},{"href":33834},"#more-details",[33836],{"type":26,"value":12481},{"type":21,"tag":3596,"props":33838,"children":33840},{"id":33839},"why-views",[33841],{"type":26,"value":33801},{"type":21,"tag":22,"props":33843,"children":33844},{},[33845,33847,33853,33855,33860],{"type":26,"value":33846},"What are js views? In a nutshell, the intent of a js view is to provide a neat encapsulation for all the ui binding, event handling and functionality associated with a given page, or set of pages. Novice JavaScriptoften involves terrible spaghetti code, spread throuhgout ",{"type":21,"tag":63,"props":33848,"children":33850},{"className":33849},[],[33851],{"type":26,"value":33852},"onevent",{"type":26,"value":33854}," handlers in the html, bunches of ",{"type":21,"tag":63,"props":33856,"children":33858},{"className":33857},[],[33859],{"type":26,"value":2059},{"type":26,"value":33861}," tags littered randomly through the markup, and an ugly mess of global variables and functions sitting in a single master file.",{"type":21,"tag":22,"props":33863,"children":33864},{},[33865,33867,33872],{"type":26,"value":33866},"With Views enabled by a library like Behold, you instead have nicely encapsulated modules that don't leak private variables or declare any new global variables (unless you really want to, or forget to prepend ",{"type":21,"tag":63,"props":33868,"children":33870},{"className":33869},[],[33871],{"type":26,"value":3909},{"type":26,"value":33873}," to your variable declaration, since no framework can save you from sloppy coding).",{"type":21,"tag":22,"props":33875,"children":33876},{},[33877],{"type":26,"value":33878},"With Views, all of your ui binding is scoped to a root element, keeping selectors performant; all of your ui binding can be declared in a single object, keeping the bindings easy to find and use throughout the code, reducing wasteful rebinding across functions; all of your event binding can take advantage of existing ui binding, is also declared in a single, easy to find object, and keeps its functions enclosed within the view, eliminating the chance of overriding like named functions by declaring them globally, or conflicting with other libraries you've added.",{"type":21,"tag":22,"props":33880,"children":33881},{},[33882],{"type":26,"value":33883},"In other words, Views can be the answer to keeping your site's Javascript tidy and maintainable, whether you have a few pages that just need some animation added, a js-based browser plugin, or a complex webapp.",{"type":21,"tag":3596,"props":33885,"children":33887},{"id":33886},"why-behold",[33888],{"type":26,"value":33810},{"type":21,"tag":22,"props":33890,"children":33891},{},[33892],{"type":26,"value":33893},"If you need:",{"type":21,"tag":3679,"props":33895,"children":33896},{},[33897,33902,33907],{"type":21,"tag":3630,"props":33898,"children":33899},{},[33900],{"type":26,"value":33901},"routing,",{"type":21,"tag":3630,"props":33903,"children":33904},{},[33905],{"type":26,"value":33906},"Collections,",{"type":21,"tag":3630,"props":33908,"children":33909},{},[33910],{"type":26,"value":33911},"client-side models of db tables,",{"type":21,"tag":22,"props":33913,"children":33914},{},[33915,33917,33924,33926,33933,33934,33941],{"type":26,"value":33916},"you should check out a full MVC framework like ",{"type":21,"tag":29,"props":33918,"children":33921},{"href":33919,"rel":33920},"http://backbonejs.org/",[93],[33922],{"type":26,"value":33923},"Backbone",{"type":26,"value":33925}," and one of the many frameworks building on it, such as the two mentioned above, or similar frameworks like ",{"type":21,"tag":29,"props":33927,"children":33930},{"href":33928,"rel":33929},"https://angularjs.org/",[93],[33931],{"type":26,"value":33932},"Angular",{"type":26,"value":1922},{"type":21,"tag":29,"props":33935,"children":33938},{"href":33936,"rel":33937},"http://emberjs.com/",[93],[33939],{"type":26,"value":33940},"Ember",{"type":26,"value":378},{"type":21,"tag":22,"props":33943,"children":33944},{},[33945],{"type":26,"value":33946},"If, on the other hand, you just need:",{"type":21,"tag":3679,"props":33948,"children":33949},{},[33950,33955,33960,33965,33970],{"type":21,"tag":3630,"props":33951,"children":33952},{},[33953],{"type":26,"value":33954},"Modular encapsulation that keeps global objects to a minimum, and keeps private variables really private;",{"type":21,"tag":3630,"props":33956,"children":33957},{},[33958],{"type":26,"value":33959},"Easy, organized declaration of UI elements to bind to, with automatic binding and all the niceties that jQuery has to offer immediately available;",{"type":21,"tag":3630,"props":33961,"children":33962},{},[33963],{"type":26,"value":33964},"Similarly easy and organized event binding, which are automatically bound upon view initialization, can be bound and unbound as a unit, and are compatible with the jQuery style bindings you're used to (including supporting event name-spacing);",{"type":21,"tag":3630,"props":33966,"children":33967},{},[33968],{"type":26,"value":33969},"Clear organization and encapsulation of functions being bound to, or that operate on a given view;",{"type":21,"tag":3630,"props":33971,"children":33972},{},[33973],{"type":26,"value":33974},"and similar helpful functionality (see below for more details)",{"type":21,"tag":22,"props":33976,"children":33977},{},[33978],{"type":26,"value":33979},"then Behold is for you.",{"type":21,"tag":3596,"props":33981,"children":33983},{"id":33982},"dependencies",[33984],{"type":26,"value":33819},{"type":21,"tag":22,"props":33986,"children":33987},{},[33988,33994,33996,34003],{"type":21,"tag":29,"props":33989,"children":33992},{"href":33990,"rel":33991},"https://jquery.com",[93],[33993],{"type":26,"value":20763},{"type":26,"value":33995},", or API-compatible replacement library, such as ",{"type":21,"tag":29,"props":33997,"children":34000},{"href":33998,"rel":33999},"http://zeptojs.com/",[93],[34001],{"type":26,"value":34002},"Zepto",{"type":26,"value":378},{"type":21,"tag":22,"props":34005,"children":34006},{},[34007,34014],{"type":21,"tag":29,"props":34008,"children":34011},{"href":34009,"rel":34010},"http://underscorejs.org/",[93],[34012],{"type":26,"value":34013},"Underscore",{"type":26,"value":34015}," - Optional - if not supplied, Behold includes a stripped down, native-reliant re-implementation of some of underscore's functionality. See below for more details.",{"type":21,"tag":3596,"props":34017,"children":34019},{"id":34018},"usage-example",[34020],{"type":26,"value":33828},{"type":21,"tag":22,"props":34022,"children":34023},{},[34024],{"type":26,"value":34025},"In your JavaScriptentry point of execution:",{"type":21,"tag":200,"props":34027,"children":34029},{"className":16138,"code":34028,"language":16140,"meta":8,"style":8},"var gApp = new Behold.Application();\n\n$(document).ready(function() {\n    gApp.start(); // Initializes all registered modules\n});\n",[34030],{"type":21,"tag":63,"props":34031,"children":34032},{"__ignoreMap":8},[34033,34067,34074,34103,34125],{"type":21,"tag":209,"props":34034,"children":34035},{"class":211,"line":212},[34036,34040,34045,34049,34053,34058,34063],{"type":21,"tag":209,"props":34037,"children":34038},{"style":216},[34039],{"type":26,"value":3909},{"type":21,"tag":209,"props":34041,"children":34042},{"style":222},[34043],{"type":26,"value":34044}," gApp ",{"type":21,"tag":209,"props":34046,"children":34047},{"style":216},[34048],{"type":26,"value":1432},{"type":21,"tag":209,"props":34050,"children":34051},{"style":216},[34052],{"type":26,"value":6371},{"type":21,"tag":209,"props":34054,"children":34055},{"style":222},[34056],{"type":26,"value":34057}," Behold.",{"type":21,"tag":209,"props":34059,"children":34060},{"style":360},[34061],{"type":26,"value":34062},"Application",{"type":21,"tag":209,"props":34064,"children":34065},{"style":222},[34066],{"type":26,"value":4123},{"type":21,"tag":209,"props":34068,"children":34069},{"class":211,"line":244},[34070],{"type":21,"tag":209,"props":34071,"children":34072},{"emptyLinePlaceholder":248},[34073],{"type":26,"value":251},{"type":21,"tag":209,"props":34075,"children":34076},{"class":211,"line":254},[34077,34081,34086,34091,34095,34099],{"type":21,"tag":209,"props":34078,"children":34079},{"style":360},[34080],{"type":26,"value":6476},{"type":21,"tag":209,"props":34082,"children":34083},{"style":222},[34084],{"type":26,"value":34085},"(document).",{"type":21,"tag":209,"props":34087,"children":34088},{"style":360},[34089],{"type":26,"value":34090},"ready",{"type":21,"tag":209,"props":34092,"children":34093},{"style":222},[34094],{"type":26,"value":368},{"type":21,"tag":209,"props":34096,"children":34097},{"style":216},[34098],{"type":26,"value":4622},{"type":21,"tag":209,"props":34100,"children":34101},{"style":222},[34102],{"type":26,"value":4799},{"type":21,"tag":209,"props":34104,"children":34105},{"class":211,"line":279},[34106,34111,34115,34120],{"type":21,"tag":209,"props":34107,"children":34108},{"style":222},[34109],{"type":26,"value":34110},"    gApp.",{"type":21,"tag":209,"props":34112,"children":34113},{"style":360},[34114],{"type":26,"value":13670},{"type":21,"tag":209,"props":34116,"children":34117},{"style":222},[34118],{"type":26,"value":34119},"(); ",{"type":21,"tag":209,"props":34121,"children":34122},{"style":448},[34123],{"type":26,"value":34124},"// Initializes all registered modules\n",{"type":21,"tag":209,"props":34126,"children":34127},{"class":211,"line":288},[34128],{"type":21,"tag":209,"props":34129,"children":34130},{"style":222},[34131],{"type":26,"value":469},{"type":21,"tag":22,"props":34133,"children":34134},{},[34135,34137,34143],{"type":26,"value":34136},"Then, in any other JavaScriptfile included in the page (you can include it before or after your entry point, so long as it will be loaded before whatever criteria you've selected for executing ",{"type":21,"tag":63,"props":34138,"children":34140},{"className":34139},[],[34141],{"type":26,"value":34142},"start()",{"type":26,"value":34144}," on your application object):",{"type":21,"tag":200,"props":34146,"children":34148},{"className":16138,"code":34147,"language":16140,"meta":8,"style":8},"/**\n * Module constructor functions are passed four arguments by default.\n * self = A reference to the module.\n * app = A reference to the application object that the module has been registered on.\n * $ = A reference to the jQuery library.\n * _ = A reference to the underscore library, or our fill in if underscore is not present and passed in.\n * Additional parameters can be fed into the constructor function by adding them, comma separated, after the\n * constructor function (see below).\n */\ngApp.module(\"moduleName\", function(self, app, $, _) {\n    // Variables declared with var are private to this closure.\n    // Convention is to preface the variable name with an underscore to visually indicate this.\n    var _Header = Behold.extend({ // _Header is now a constructor for a new Behold View.\n            el: \"#header\", // Root element\n            ui: { // ui bindings\n                // the key 'fbLogin' will automatically be bound to the element with the id #fbHeaderLogin, found\n                // somewhere beneath the root element #header\n                // Any valid jQuery selector can be used\n                fbLogin: \"#fbHeaderLogin\",\n                gpLogin: \"#gpHeaderLogin\"\n            },\n            events: { // event bindings\n                // A click event will automatically be bound to the element with the key 'fbLogin' within the ui\n                // object, as seen above. When this event fires, the 'onClick' handler within this view will be triggered.\n                \"click @ui.fbLogin\": \"onClick\"\n            },\n            /**\n             * The initialize function will be called when this view is instantiated, and is the perfect place to put\n             * code that should be run at that time, like bindings that can't live in the events object for whatever\n             * reason, or function calls to make first-run changes.\n             */\n            initialize: function() {},\n            /**\n             * This is the event handler that we bound to in the events object, above. Notice it takes one parameter,\n             * event, which is the jQuery Event, as per usual handler behaviour.\n             */\n            onClick: function(event) {}\n        }),\n        _header; // We declare another local variable for the instantiated view.\n\n    /**\n     * Initialize this module. This function will be called automatically by Behold.Application.start().\n     * In this example, if we detect that the header element is present, we instantiate the Header view.\n     */\n    self.initialize = function() {\n        if ($(\"#header\").length) {\n            _header = new _Header({} /* We can pass in options in this object, that will be available via this.options in the view */ );\n        }\n    };\n    // Here we could add a comma separated series of variables to pass into the module constructor function, after the\n    // functions closing curly bracket, should we wish to.\n});\n",[34149],{"type":21,"tag":63,"props":34150,"children":34151},{"__ignoreMap":8},[34152,34159,34167,34175,34183,34191,34199,34207,34215,34222,34289,34297,34305,34340,34362,34375,34383,34391,34399,34416,34429,34437,34450,34458,34466,34483,34490,34498,34506,34514,34522,34530,34551,34558,34566,34574,34581,34610,34618,34631,34638,34645,34653,34661,34668,34692,34727,34763,34770,34777,34785,34793],{"type":21,"tag":209,"props":34153,"children":34154},{"class":211,"line":212},[34155],{"type":21,"tag":209,"props":34156,"children":34157},{"style":448},[34158],{"type":26,"value":731},{"type":21,"tag":209,"props":34160,"children":34161},{"class":211,"line":244},[34162],{"type":21,"tag":209,"props":34163,"children":34164},{"style":448},[34165],{"type":26,"value":34166}," * Module constructor functions are passed four arguments by default.\n",{"type":21,"tag":209,"props":34168,"children":34169},{"class":211,"line":254},[34170],{"type":21,"tag":209,"props":34171,"children":34172},{"style":448},[34173],{"type":26,"value":34174}," * self = A reference to the module.\n",{"type":21,"tag":209,"props":34176,"children":34177},{"class":211,"line":279},[34178],{"type":21,"tag":209,"props":34179,"children":34180},{"style":448},[34181],{"type":26,"value":34182}," * app = A reference to the application object that the module has been registered on.\n",{"type":21,"tag":209,"props":34184,"children":34185},{"class":211,"line":288},[34186],{"type":21,"tag":209,"props":34187,"children":34188},{"style":448},[34189],{"type":26,"value":34190}," * $ = A reference to the jQuery library.\n",{"type":21,"tag":209,"props":34192,"children":34193},{"class":211,"line":307},[34194],{"type":21,"tag":209,"props":34195,"children":34196},{"style":448},[34197],{"type":26,"value":34198}," * _ = A reference to the underscore library, or our fill in if underscore is not present and passed in.\n",{"type":21,"tag":209,"props":34200,"children":34201},{"class":211,"line":325},[34202],{"type":21,"tag":209,"props":34203,"children":34204},{"style":448},[34205],{"type":26,"value":34206}," * Additional parameters can be fed into the constructor function by adding them, comma separated, after the\n",{"type":21,"tag":209,"props":34208,"children":34209},{"class":211,"line":334},[34210],{"type":21,"tag":209,"props":34211,"children":34212},{"style":448},[34213],{"type":26,"value":34214}," * constructor function (see below).\n",{"type":21,"tag":209,"props":34216,"children":34217},{"class":211,"line":343},[34218],{"type":21,"tag":209,"props":34219,"children":34220},{"style":448},[34221],{"type":26,"value":755},{"type":21,"tag":209,"props":34223,"children":34224},{"class":211,"line":351},[34225,34230,34234,34238,34243,34247,34251,34255,34260,34264,34268,34272,34276,34280,34285],{"type":21,"tag":209,"props":34226,"children":34227},{"style":222},[34228],{"type":26,"value":34229},"gApp.",{"type":21,"tag":209,"props":34231,"children":34232},{"style":360},[34233],{"type":26,"value":5534},{"type":21,"tag":209,"props":34235,"children":34236},{"style":222},[34237],{"type":26,"value":368},{"type":21,"tag":209,"props":34239,"children":34240},{"style":233},[34241],{"type":26,"value":34242},"\"moduleName\"",{"type":21,"tag":209,"props":34244,"children":34245},{"style":222},[34246],{"type":26,"value":408},{"type":21,"tag":209,"props":34248,"children":34249},{"style":216},[34250],{"type":26,"value":4622},{"type":21,"tag":209,"props":34252,"children":34253},{"style":222},[34254],{"type":26,"value":368},{"type":21,"tag":209,"props":34256,"children":34257},{"style":400},[34258],{"type":26,"value":34259},"self",{"type":21,"tag":209,"props":34261,"children":34262},{"style":222},[34263],{"type":26,"value":408},{"type":21,"tag":209,"props":34265,"children":34266},{"style":400},[34267],{"type":26,"value":5246},{"type":21,"tag":209,"props":34269,"children":34270},{"style":222},[34271],{"type":26,"value":408},{"type":21,"tag":209,"props":34273,"children":34274},{"style":400},[34275],{"type":26,"value":6476},{"type":21,"tag":209,"props":34277,"children":34278},{"style":222},[34279],{"type":26,"value":408},{"type":21,"tag":209,"props":34281,"children":34282},{"style":400},[34283],{"type":26,"value":34284},"_",{"type":21,"tag":209,"props":34286,"children":34287},{"style":222},[34288],{"type":26,"value":5588},{"type":21,"tag":209,"props":34290,"children":34291},{"class":211,"line":444},[34292],{"type":21,"tag":209,"props":34293,"children":34294},{"style":448},[34295],{"type":26,"value":34296},"    // Variables declared with var are private to this closure.\n",{"type":21,"tag":209,"props":34298,"children":34299},{"class":211,"line":454},[34300],{"type":21,"tag":209,"props":34301,"children":34302},{"style":448},[34303],{"type":26,"value":34304},"    // Convention is to preface the variable name with an underscore to visually indicate this.\n",{"type":21,"tag":209,"props":34306,"children":34307},{"class":211,"line":463},[34308,34312,34317,34321,34325,34330,34335],{"type":21,"tag":209,"props":34309,"children":34310},{"style":216},[34311],{"type":26,"value":16994},{"type":21,"tag":209,"props":34313,"children":34314},{"style":222},[34315],{"type":26,"value":34316}," _Header ",{"type":21,"tag":209,"props":34318,"children":34319},{"style":216},[34320],{"type":26,"value":1432},{"type":21,"tag":209,"props":34322,"children":34323},{"style":222},[34324],{"type":26,"value":34057},{"type":21,"tag":209,"props":34326,"children":34327},{"style":360},[34328],{"type":26,"value":34329},"extend",{"type":21,"tag":209,"props":34331,"children":34332},{"style":222},[34333],{"type":26,"value":34334},"({ ",{"type":21,"tag":209,"props":34336,"children":34337},{"style":448},[34338],{"type":26,"value":34339},"// _Header is now a constructor for a new Behold View.\n",{"type":21,"tag":209,"props":34341,"children":34342},{"class":211,"line":472},[34343,34348,34353,34357],{"type":21,"tag":209,"props":34344,"children":34345},{"style":222},[34346],{"type":26,"value":34347},"            el: ",{"type":21,"tag":209,"props":34349,"children":34350},{"style":233},[34351],{"type":26,"value":34352},"\"#header\"",{"type":21,"tag":209,"props":34354,"children":34355},{"style":222},[34356],{"type":26,"value":408},{"type":21,"tag":209,"props":34358,"children":34359},{"style":448},[34360],{"type":26,"value":34361},"// Root element\n",{"type":21,"tag":209,"props":34363,"children":34364},{"class":211,"line":480},[34365,34370],{"type":21,"tag":209,"props":34366,"children":34367},{"style":222},[34368],{"type":26,"value":34369},"            ui: { ",{"type":21,"tag":209,"props":34371,"children":34372},{"style":448},[34373],{"type":26,"value":34374},"// ui bindings\n",{"type":21,"tag":209,"props":34376,"children":34377},{"class":211,"line":489},[34378],{"type":21,"tag":209,"props":34379,"children":34380},{"style":448},[34381],{"type":26,"value":34382},"                // the key 'fbLogin' will automatically be bound to the element with the id #fbHeaderLogin, found\n",{"type":21,"tag":209,"props":34384,"children":34385},{"class":211,"line":847},[34386],{"type":21,"tag":209,"props":34387,"children":34388},{"style":448},[34389],{"type":26,"value":34390},"                // somewhere beneath the root element #header\n",{"type":21,"tag":209,"props":34392,"children":34393},{"class":211,"line":860},[34394],{"type":21,"tag":209,"props":34395,"children":34396},{"style":448},[34397],{"type":26,"value":34398},"                // Any valid jQuery selector can be used\n",{"type":21,"tag":209,"props":34400,"children":34401},{"class":211,"line":877},[34402,34407,34412],{"type":21,"tag":209,"props":34403,"children":34404},{"style":222},[34405],{"type":26,"value":34406},"                fbLogin: ",{"type":21,"tag":209,"props":34408,"children":34409},{"style":233},[34410],{"type":26,"value":34411},"\"#fbHeaderLogin\"",{"type":21,"tag":209,"props":34413,"children":34414},{"style":222},[34415],{"type":26,"value":304},{"type":21,"tag":209,"props":34417,"children":34418},{"class":211,"line":889},[34419,34424],{"type":21,"tag":209,"props":34420,"children":34421},{"style":222},[34422],{"type":26,"value":34423},"                gpLogin: ",{"type":21,"tag":209,"props":34425,"children":34426},{"style":233},[34427],{"type":26,"value":34428},"\"#gpHeaderLogin\"\n",{"type":21,"tag":209,"props":34430,"children":34431},{"class":211,"line":902},[34432],{"type":21,"tag":209,"props":34433,"children":34434},{"style":222},[34435],{"type":26,"value":34436},"            },\n",{"type":21,"tag":209,"props":34438,"children":34439},{"class":211,"line":914},[34440,34445],{"type":21,"tag":209,"props":34441,"children":34442},{"style":222},[34443],{"type":26,"value":34444},"            events: { ",{"type":21,"tag":209,"props":34446,"children":34447},{"style":448},[34448],{"type":26,"value":34449},"// event bindings\n",{"type":21,"tag":209,"props":34451,"children":34452},{"class":211,"line":922},[34453],{"type":21,"tag":209,"props":34454,"children":34455},{"style":448},[34456],{"type":26,"value":34457},"                // A click event will automatically be bound to the element with the key 'fbLogin' within the ui\n",{"type":21,"tag":209,"props":34459,"children":34460},{"class":211,"line":2312},[34461],{"type":21,"tag":209,"props":34462,"children":34463},{"style":448},[34464],{"type":26,"value":34465},"                // object, as seen above. When this event fires, the 'onClick' handler within this view will be triggered.\n",{"type":21,"tag":209,"props":34467,"children":34468},{"class":211,"line":2321},[34469,34474,34478],{"type":21,"tag":209,"props":34470,"children":34471},{"style":233},[34472],{"type":26,"value":34473},"                \"click @ui.fbLogin\"",{"type":21,"tag":209,"props":34475,"children":34476},{"style":222},[34477],{"type":26,"value":7821},{"type":21,"tag":209,"props":34479,"children":34480},{"style":233},[34481],{"type":26,"value":34482},"\"onClick\"\n",{"type":21,"tag":209,"props":34484,"children":34485},{"class":211,"line":2372},[34486],{"type":21,"tag":209,"props":34487,"children":34488},{"style":222},[34489],{"type":26,"value":34436},{"type":21,"tag":209,"props":34491,"children":34492},{"class":211,"line":2381},[34493],{"type":21,"tag":209,"props":34494,"children":34495},{"style":448},[34496],{"type":26,"value":34497},"            /**\n",{"type":21,"tag":209,"props":34499,"children":34500},{"class":211,"line":2389},[34501],{"type":21,"tag":209,"props":34502,"children":34503},{"style":448},[34504],{"type":26,"value":34505},"             * The initialize function will be called when this view is instantiated, and is the perfect place to put\n",{"type":21,"tag":209,"props":34507,"children":34508},{"class":211,"line":2397},[34509],{"type":21,"tag":209,"props":34510,"children":34511},{"style":448},[34512],{"type":26,"value":34513},"             * code that should be run at that time, like bindings that can't live in the events object for whatever\n",{"type":21,"tag":209,"props":34515,"children":34516},{"class":211,"line":2406},[34517],{"type":21,"tag":209,"props":34518,"children":34519},{"style":448},[34520],{"type":26,"value":34521},"             * reason, or function calls to make first-run changes.\n",{"type":21,"tag":209,"props":34523,"children":34524},{"class":211,"line":2415},[34525],{"type":21,"tag":209,"props":34526,"children":34527},{"style":448},[34528],{"type":26,"value":34529},"             */\n",{"type":21,"tag":209,"props":34531,"children":34532},{"class":211,"line":2424},[34533,34538,34542,34546],{"type":21,"tag":209,"props":34534,"children":34535},{"style":360},[34536],{"type":26,"value":34537},"            initialize",{"type":21,"tag":209,"props":34539,"children":34540},{"style":222},[34541],{"type":26,"value":7821},{"type":21,"tag":209,"props":34543,"children":34544},{"style":216},[34545],{"type":26,"value":4622},{"type":21,"tag":209,"props":34547,"children":34548},{"style":222},[34549],{"type":26,"value":34550},"() {},\n",{"type":21,"tag":209,"props":34552,"children":34553},{"class":211,"line":2433},[34554],{"type":21,"tag":209,"props":34555,"children":34556},{"style":448},[34557],{"type":26,"value":34497},{"type":21,"tag":209,"props":34559,"children":34560},{"class":211,"line":2442},[34561],{"type":21,"tag":209,"props":34562,"children":34563},{"style":448},[34564],{"type":26,"value":34565},"             * This is the event handler that we bound to in the events object, above. Notice it takes one parameter,\n",{"type":21,"tag":209,"props":34567,"children":34568},{"class":211,"line":2471},[34569],{"type":21,"tag":209,"props":34570,"children":34571},{"style":448},[34572],{"type":26,"value":34573},"             * event, which is the jQuery Event, as per usual handler behaviour.\n",{"type":21,"tag":209,"props":34575,"children":34576},{"class":211,"line":2480},[34577],{"type":21,"tag":209,"props":34578,"children":34579},{"style":448},[34580],{"type":26,"value":34529},{"type":21,"tag":209,"props":34582,"children":34583},{"class":211,"line":2489},[34584,34589,34593,34597,34601,34605],{"type":21,"tag":209,"props":34585,"children":34586},{"style":360},[34587],{"type":26,"value":34588},"            onClick",{"type":21,"tag":209,"props":34590,"children":34591},{"style":222},[34592],{"type":26,"value":7821},{"type":21,"tag":209,"props":34594,"children":34595},{"style":216},[34596],{"type":26,"value":4622},{"type":21,"tag":209,"props":34598,"children":34599},{"style":222},[34600],{"type":26,"value":368},{"type":21,"tag":209,"props":34602,"children":34603},{"style":400},[34604],{"type":26,"value":25805},{"type":21,"tag":209,"props":34606,"children":34607},{"style":222},[34608],{"type":26,"value":34609},") {}\n",{"type":21,"tag":209,"props":34611,"children":34612},{"class":211,"line":2516},[34613],{"type":21,"tag":209,"props":34614,"children":34615},{"style":222},[34616],{"type":26,"value":34617},"        }),\n",{"type":21,"tag":209,"props":34619,"children":34620},{"class":211,"line":2525},[34621,34626],{"type":21,"tag":209,"props":34622,"children":34623},{"style":222},[34624],{"type":26,"value":34625},"        _header; ",{"type":21,"tag":209,"props":34627,"children":34628},{"style":448},[34629],{"type":26,"value":34630},"// We declare another local variable for the instantiated view.\n",{"type":21,"tag":209,"props":34632,"children":34633},{"class":211,"line":2533},[34634],{"type":21,"tag":209,"props":34635,"children":34636},{"emptyLinePlaceholder":248},[34637],{"type":26,"value":251},{"type":21,"tag":209,"props":34639,"children":34640},{"class":211,"line":2542},[34641],{"type":21,"tag":209,"props":34642,"children":34643},{"style":448},[34644],{"type":26,"value":13290},{"type":21,"tag":209,"props":34646,"children":34647},{"class":211,"line":2550},[34648],{"type":21,"tag":209,"props":34649,"children":34650},{"style":448},[34651],{"type":26,"value":34652},"     * Initialize this module. This function will be called automatically by Behold.Application.start().\n",{"type":21,"tag":209,"props":34654,"children":34655},{"class":211,"line":2564},[34656],{"type":21,"tag":209,"props":34657,"children":34658},{"style":448},[34659],{"type":26,"value":34660},"     * In this example, if we detect that the header element is present, we instantiate the Header view.\n",{"type":21,"tag":209,"props":34662,"children":34663},{"class":211,"line":2611},[34664],{"type":21,"tag":209,"props":34665,"children":34666},{"style":448},[34667],{"type":26,"value":13346},{"type":21,"tag":209,"props":34669,"children":34670},{"class":211,"line":2619},[34671,34675,34680,34684,34688],{"type":21,"tag":209,"props":34672,"children":34673},{"style":222},[34674],{"type":26,"value":19666},{"type":21,"tag":209,"props":34676,"children":34677},{"style":360},[34678],{"type":26,"value":34679},"initialize",{"type":21,"tag":209,"props":34681,"children":34682},{"style":216},[34683],{"type":26,"value":271},{"type":21,"tag":209,"props":34685,"children":34686},{"style":216},[34687],{"type":26,"value":4789},{"type":21,"tag":209,"props":34689,"children":34690},{"style":222},[34691],{"type":26,"value":4799},{"type":21,"tag":209,"props":34693,"children":34694},{"class":211,"line":2627},[34695,34699,34703,34707,34711,34715,34719,34723],{"type":21,"tag":209,"props":34696,"children":34697},{"style":216},[34698],{"type":26,"value":6334},{"type":21,"tag":209,"props":34700,"children":34701},{"style":222},[34702],{"type":26,"value":5569},{"type":21,"tag":209,"props":34704,"children":34705},{"style":360},[34706],{"type":26,"value":6476},{"type":21,"tag":209,"props":34708,"children":34709},{"style":222},[34710],{"type":26,"value":368},{"type":21,"tag":209,"props":34712,"children":34713},{"style":233},[34714],{"type":26,"value":34352},{"type":21,"tag":209,"props":34716,"children":34717},{"style":222},[34718],{"type":26,"value":2699},{"type":21,"tag":209,"props":34720,"children":34721},{"style":263},[34722],{"type":26,"value":6344},{"type":21,"tag":209,"props":34724,"children":34725},{"style":222},[34726],{"type":26,"value":5588},{"type":21,"tag":209,"props":34728,"children":34729},{"class":211,"line":2636},[34730,34735,34739,34743,34748,34753,34758],{"type":21,"tag":209,"props":34731,"children":34732},{"style":222},[34733],{"type":26,"value":34734},"            _header ",{"type":21,"tag":209,"props":34736,"children":34737},{"style":216},[34738],{"type":26,"value":1432},{"type":21,"tag":209,"props":34740,"children":34741},{"style":216},[34742],{"type":26,"value":6371},{"type":21,"tag":209,"props":34744,"children":34745},{"style":360},[34746],{"type":26,"value":34747}," _Header",{"type":21,"tag":209,"props":34749,"children":34750},{"style":222},[34751],{"type":26,"value":34752},"({} ",{"type":21,"tag":209,"props":34754,"children":34755},{"style":448},[34756],{"type":26,"value":34757},"/* We can pass in options in this object, that will be available via this.options in the view */",{"type":21,"tag":209,"props":34759,"children":34760},{"style":222},[34761],{"type":26,"value":34762}," );\n",{"type":21,"tag":209,"props":34764,"children":34765},{"class":211,"line":2644},[34766],{"type":21,"tag":209,"props":34767,"children":34768},{"style":222},[34769],{"type":26,"value":2235},{"type":21,"tag":209,"props":34771,"children":34772},{"class":211,"line":2657},[34773],{"type":21,"tag":209,"props":34774,"children":34775},{"style":222},[34776],{"type":26,"value":13439},{"type":21,"tag":209,"props":34778,"children":34779},{"class":211,"line":2728},[34780],{"type":21,"tag":209,"props":34781,"children":34782},{"style":448},[34783],{"type":26,"value":34784},"    // Here we could add a comma separated series of variables to pass into the module constructor function, after the\n",{"type":21,"tag":209,"props":34786,"children":34787},{"class":211,"line":2758},[34788],{"type":21,"tag":209,"props":34789,"children":34790},{"style":448},[34791],{"type":26,"value":34792},"    // functions closing curly bracket, should we wish to.\n",{"type":21,"tag":209,"props":34794,"children":34795},{"class":211,"line":2776},[34796],{"type":21,"tag":209,"props":34797,"children":34798},{"style":222},[34799],{"type":26,"value":469},{"type":21,"tag":3596,"props":34801,"children":34802},{"id":12478},[34803],{"type":26,"value":12481},{"type":21,"tag":22,"props":34805,"children":34806},{},[34807,34809,34815],{"type":26,"value":34808},"View, download and/or Fork the code ",{"type":21,"tag":29,"props":34810,"children":34812},{"href":33774,"rel":34811},[93],[34813],{"type":26,"value":34814},"on GitHub",{"type":26,"value":378},{"type":21,"tag":22,"props":34817,"children":34818},{},[34819,34821,34828],{"type":26,"value":34820},"For a detailed view into the internals of Behold, ",{"type":21,"tag":29,"props":34822,"children":34825},{"href":34823,"rel":34824},"http://sanemethod.github.io/Behold/Behold.js.html",[93],[34826],{"type":26,"value":34827},"head to the doxx pages",{"type":26,"value":378},{"type":21,"tag":3490,"props":34830,"children":34831},{},[34832],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":34834},[34835,34836,34837,34838,34839,34840],{"id":33786,"depth":244,"text":33789},{"id":33839,"depth":244,"text":33801},{"id":33886,"depth":244,"text":33810},{"id":33982,"depth":244,"text":33819},{"id":34018,"depth":244,"text":33828},{"id":12478,"depth":244,"text":12481},"content:ckeefer:2014-8:behold-views.md","ckeefer/2014-8/behold-views.md","ckeefer/2014-8/behold-views",{"user":3518,"name":3519},{"_path":34846,"_dir":34847,"_draft":7,"_partial":7,"_locale":8,"title":34848,"description":34849,"publishDate":34850,"tags":34851,"excerpt":34849,"body":34852,"_type":3511,"_id":36528,"_source":3513,"_file":36529,"_stem":36530,"_extension":3516,"author":36531},"/ckeefer/2014-7/promises","2014-7","It's a (jQuery-style) Promise","Way back when I brought up the topic of promises (particularly, jQuery Deferred), and I promised we would come back to the topic someday.","2014-10-16",[12,16600],{"type":18,"children":34853,"toc":36495},[34854,34865,34877,34883,34888,34906,34929,34943,34957,34962,34967,34980,34986,34992,35013,35018,35023,35029,35077,35081,35087,35299,35302,35308,35711,35714,35720,35734,35896,35899,35905,35917,35923,35929,35989,35994,36024,36030,36035,36040,36045,36064,36070,36075,36115,36120,36200,36203,36209,36221,36227,36232,36238,36242,36292,36297,36411,36414,36418,36491],{"type":21,"tag":22,"props":34855,"children":34856},{},[34857,34863],{"type":21,"tag":29,"props":34858,"children":34860},{"href":34859},"/search/jquery/ajax/user:ckeefer",[34861],{"type":26,"value":34862},"Way back when",{"type":26,"value":34864}," I brought up the topic of promises (particularly, jQuery Deferred), and I promised we would come back to the topic someday.",{"type":21,"tag":22,"props":34866,"children":34867},{},[34868,34870,34875],{"type":26,"value":34869},"Well, that promise has finally resolved, and this is the done block. Don't get it? Don't worry, all shall be explained. If you do get it, and wish there ",{"type":21,"tag":1084,"props":34871,"children":34872},{},[34873],{"type":26,"value":34874},"were",{"type":26,"value":34876}," a done block in the Promise spec... well, read on.",{"type":21,"tag":3596,"props":34878,"children":34880},{"id":34879},"native-promises",[34881],{"type":26,"value":34882},"Native Promises",{"type":21,"tag":22,"props":34884,"children":34885},{},[34886],{"type":26,"value":34887},"Promises are pretty great.",{"type":21,"tag":22,"props":34889,"children":34890},{},[34891,34893,34898,34900,34905],{"type":26,"value":34892},"A lot of time and effort has been expended on explaining why - which would suggest that the answer might not be immediately obvious to everyone, especially if you haven't spent too much time with ",{"type":21,"tag":11881,"props":34894,"children":34895},{},[34896],{"type":26,"value":34897},"pyramid code",{"type":26,"value":34899}," languishing in ",{"type":21,"tag":11881,"props":34901,"children":34902},{},[34903],{"type":26,"value":34904},"callback hell",{"type":26,"value":378},{"type":21,"tag":22,"props":34907,"children":34908},{},[34909,34911,34918,34920,34927],{"type":26,"value":34910},"For the curious, I've included some further reading at the end of this post that should help. For the rest, suffice to say that there are no less than ",{"type":21,"tag":29,"props":34912,"children":34915},{"href":34913,"rel":34914},"https://github.com/promises-aplus/promises-spec/blob/master/implementations.md",[93],[34916],{"type":26,"value":34917},"37 different javascript promise implementations",{"type":26,"value":34919}," - and these are just the ones that conform to the ",{"type":21,"tag":29,"props":34921,"children":34924},{"href":34922,"rel":34923},"https://promisesaplus.com/",[93],[34925],{"type":26,"value":34926},"Promises/A+ spec",{"type":26,"value":34928},". Obviously, a lot of people are excited about promises.",{"type":21,"tag":22,"props":34930,"children":34931},{},[34932,34934,34941],{"type":26,"value":34933},"Most exciting for those interested in promises in js, however, is the fact that they'll soon be ",{"type":21,"tag":29,"props":34935,"children":34938},{"href":34936,"rel":34937},"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise",[93],[34939],{"type":26,"value":34940},"available natively in a browser near you",{"type":26,"value":34942},", if indeed they're not already. The native implementations will be compliant to the spec, faster (as a result of being native code), and available without the inclusion of an additional library. Yay!",{"type":21,"tag":22,"props":34944,"children":34945},{},[34946,34948,34955],{"type":26,"value":34947},"However, if you head to the list of promise implementations linked above and scan through them, including those listed as part of frameworks, you'll notice that ",{"type":21,"tag":29,"props":34949,"children":34952},{"href":34950,"rel":34951},"http://api.jquery.com/category/deferred-object/",[93],[34953],{"type":26,"value":34954},"jQuery's Deferred",{"type":26,"value":34956}," isn't among them.",{"type":21,"tag":22,"props":34958,"children":34959},{},[34960],{"type":26,"value":34961},"You see, while jQuery's Deferred plays nicely internally, it isn't compliant with the Promises/A+ spec that all the cool kids are using. If we're including jQuery in our project, we could just keep on using Deferred - but what if we really like jQuery's Deferred API, but want to take advantage of native promises?",{"type":21,"tag":22,"props":34963,"children":34964},{},[34965],{"type":26,"value":34966},"Sounds like a problem. Let's solve it, shall we? I've written a little wrapper lib named Defer (original, I know), that let's you use native promises with an API very similar (although not identical!) to the jQuery Deferred API. Details below.",{"type":21,"tag":22,"props":34968,"children":34969},{},[34970,34972,34978],{"type":26,"value":34971},"Head to the ",{"type":21,"tag":29,"props":34973,"children":34976},{"href":34974,"rel":34975},"https://github.com/SaneMethod/Defer",[93],[34977],{"type":26,"value":17738},{"type":26,"value":34979}," for more details, and to see the code.",{"type":21,"tag":3596,"props":34981,"children":34983},{"id":34982},"defer",[34984],{"type":26,"value":34985},"Defer",{"type":21,"tag":51,"props":34987,"children":34989},{"id":34988},"native-promise-api-wrapper",[34990],{"type":26,"value":34991},"Native Promise API Wrapper",{"type":21,"tag":22,"props":34993,"children":34994},{},[34995,34997,35002,35004,35011],{"type":26,"value":34996},"Defer is for those who like the jQuery API for ",{"type":21,"tag":29,"props":34998,"children":35000},{"href":34950,"rel":34999},[93],[35001],{"type":26,"value":25432},{"type":26,"value":35003},", but want to take advantage of the new, native Promise API built into modern versions of Firefox, Chrome, Opera and Safari (but not ie - see ",{"type":21,"tag":29,"props":35005,"children":35008},{"href":35006,"rel":35007},"http://caniuse.com/#feat=promises",[93],[35009],{"type":26,"value":35010},"caniuse",{"type":26,"value":35012}," for up-to-date details).",{"type":21,"tag":22,"props":35014,"children":35015},{},[35016],{"type":26,"value":35017},"Defer is also for those who'd like a 'done' function (that is, one which executes after the entire promise chain is completed, which doesn't currently exist in the Promise specification), for those who like to call resolve or reject from outside the Promise constructor, and for those who consider one function per composition ideal, and two or more unbearably ugly (with the exception of .then, because reasons). See below for some more details on this.",{"type":21,"tag":22,"props":35019,"children":35020},{},[35021],{"type":26,"value":35022},"Defer is in an immediately-invoked closure, so you can pass whatever context you'd like it to live in to it. By default, it attaches itself to the global window.",{"type":21,"tag":3596,"props":35024,"children":35026},{"id":35025},"usage",[35027],{"type":26,"value":35028},"Usage:",{"type":21,"tag":3679,"props":35030,"children":35031},{},[35032,35041,35050,35059,35068],{"type":21,"tag":3630,"props":35033,"children":35034},{},[35035],{"type":21,"tag":29,"props":35036,"children":35038},{"href":35037},"#simple-example",[35039],{"type":26,"value":35040},"Simple Example",{"type":21,"tag":3630,"props":35042,"children":35043},{},[35044],{"type":21,"tag":29,"props":35045,"children":35047},{"href":35046},"#another-example",[35048],{"type":26,"value":35049},"Another Example",{"type":21,"tag":3630,"props":35051,"children":35052},{},[35053],{"type":21,"tag":29,"props":35054,"children":35056},{"href":35055},"#ajax-example",[35057],{"type":26,"value":35058},"Ajax Example",{"type":21,"tag":3630,"props":35060,"children":35061},{},[35062],{"type":21,"tag":29,"props":35063,"children":35065},{"href":35064},"#native-comparison",[35066],{"type":26,"value":35067},"Comparison with Native API",{"type":21,"tag":3630,"props":35069,"children":35070},{},[35071],{"type":21,"tag":29,"props":35072,"children":35074},{"href":35073},"#jquery-comparison",[35075],{"type":26,"value":35076},"Comparison with jQuery API",{"type":21,"tag":35078,"props":35079,"children":35080},"hr",{},[],{"type":21,"tag":51,"props":35082,"children":35084},{"id":35083},"simple-example",[35085],{"type":26,"value":35086},"Simple Example:",{"type":21,"tag":200,"props":35088,"children":35090},{"className":16138,"code":35089,"language":16140,"meta":8,"style":8},"var defer = Defer();\ndefer.then(function(value){\n// Do something with the value\n// Returning an altered value will propagate to succeeding then and done calls\n}).done(function(value){\n// Called when the promise chain is fully resolved\n}).fail(function(error){\n// Called when the promise is rejected, with any value passed into reject\n// A nice convention is to make that value a new Error()\n});\n\n// ... Do your async stuff ...\ndefer.resolve(value /* some value your async stuff gave you */);\n",[35091],{"type":21,"tag":63,"props":35092,"children":35093},{"__ignoreMap":8},[35094,35118,35150,35158,35166,35197,35205,35236,35244,35252,35259,35266,35274],{"type":21,"tag":209,"props":35095,"children":35096},{"class":211,"line":212},[35097,35101,35105,35109,35114],{"type":21,"tag":209,"props":35098,"children":35099},{"style":216},[35100],{"type":26,"value":3909},{"type":21,"tag":209,"props":35102,"children":35103},{"style":222},[35104],{"type":26,"value":26603},{"type":21,"tag":209,"props":35106,"children":35107},{"style":216},[35108],{"type":26,"value":1432},{"type":21,"tag":209,"props":35110,"children":35111},{"style":360},[35112],{"type":26,"value":35113}," Defer",{"type":21,"tag":209,"props":35115,"children":35116},{"style":222},[35117],{"type":26,"value":4123},{"type":21,"tag":209,"props":35119,"children":35120},{"class":211,"line":244},[35121,35126,35130,35134,35138,35142,35146],{"type":21,"tag":209,"props":35122,"children":35123},{"style":222},[35124],{"type":26,"value":35125},"defer.",{"type":21,"tag":209,"props":35127,"children":35128},{"style":360},[35129],{"type":26,"value":2704},{"type":21,"tag":209,"props":35131,"children":35132},{"style":222},[35133],{"type":26,"value":368},{"type":21,"tag":209,"props":35135,"children":35136},{"style":216},[35137],{"type":26,"value":4622},{"type":21,"tag":209,"props":35139,"children":35140},{"style":222},[35141],{"type":26,"value":368},{"type":21,"tag":209,"props":35143,"children":35144},{"style":400},[35145],{"type":26,"value":17496},{"type":21,"tag":209,"props":35147,"children":35148},{"style":222},[35149],{"type":26,"value":2369},{"type":21,"tag":209,"props":35151,"children":35152},{"class":211,"line":254},[35153],{"type":21,"tag":209,"props":35154,"children":35155},{"style":448},[35156],{"type":26,"value":35157},"// Do something with the value\n",{"type":21,"tag":209,"props":35159,"children":35160},{"class":211,"line":279},[35161],{"type":21,"tag":209,"props":35162,"children":35163},{"style":448},[35164],{"type":26,"value":35165},"// Returning an altered value will propagate to succeeding then and done calls\n",{"type":21,"tag":209,"props":35167,"children":35168},{"class":211,"line":288},[35169,35173,35177,35181,35185,35189,35193],{"type":21,"tag":209,"props":35170,"children":35171},{"style":222},[35172],{"type":26,"value":20840},{"type":21,"tag":209,"props":35174,"children":35175},{"style":360},[35176],{"type":26,"value":20845},{"type":21,"tag":209,"props":35178,"children":35179},{"style":222},[35180],{"type":26,"value":368},{"type":21,"tag":209,"props":35182,"children":35183},{"style":216},[35184],{"type":26,"value":4622},{"type":21,"tag":209,"props":35186,"children":35187},{"style":222},[35188],{"type":26,"value":368},{"type":21,"tag":209,"props":35190,"children":35191},{"style":400},[35192],{"type":26,"value":17496},{"type":21,"tag":209,"props":35194,"children":35195},{"style":222},[35196],{"type":26,"value":2369},{"type":21,"tag":209,"props":35198,"children":35199},{"class":211,"line":307},[35200],{"type":21,"tag":209,"props":35201,"children":35202},{"style":448},[35203],{"type":26,"value":35204},"// Called when the promise chain is fully resolved\n",{"type":21,"tag":209,"props":35206,"children":35207},{"class":211,"line":325},[35208,35212,35216,35220,35224,35228,35232],{"type":21,"tag":209,"props":35209,"children":35210},{"style":222},[35211],{"type":26,"value":20840},{"type":21,"tag":209,"props":35213,"children":35214},{"style":360},[35215],{"type":26,"value":20894},{"type":21,"tag":209,"props":35217,"children":35218},{"style":222},[35219],{"type":26,"value":368},{"type":21,"tag":209,"props":35221,"children":35222},{"style":216},[35223],{"type":26,"value":4622},{"type":21,"tag":209,"props":35225,"children":35226},{"style":222},[35227],{"type":26,"value":368},{"type":21,"tag":209,"props":35229,"children":35230},{"style":400},[35231],{"type":26,"value":20749},{"type":21,"tag":209,"props":35233,"children":35234},{"style":222},[35235],{"type":26,"value":2369},{"type":21,"tag":209,"props":35237,"children":35238},{"class":211,"line":334},[35239],{"type":21,"tag":209,"props":35240,"children":35241},{"style":448},[35242],{"type":26,"value":35243},"// Called when the promise is rejected, with any value passed into reject\n",{"type":21,"tag":209,"props":35245,"children":35246},{"class":211,"line":343},[35247],{"type":21,"tag":209,"props":35248,"children":35249},{"style":448},[35250],{"type":26,"value":35251},"// A nice convention is to make that value a new Error()\n",{"type":21,"tag":209,"props":35253,"children":35254},{"class":211,"line":351},[35255],{"type":21,"tag":209,"props":35256,"children":35257},{"style":222},[35258],{"type":26,"value":469},{"type":21,"tag":209,"props":35260,"children":35261},{"class":211,"line":444},[35262],{"type":21,"tag":209,"props":35263,"children":35264},{"emptyLinePlaceholder":248},[35265],{"type":26,"value":251},{"type":21,"tag":209,"props":35267,"children":35268},{"class":211,"line":454},[35269],{"type":21,"tag":209,"props":35270,"children":35271},{"style":448},[35272],{"type":26,"value":35273},"// ... Do your async stuff ...\n",{"type":21,"tag":209,"props":35275,"children":35276},{"class":211,"line":463},[35277,35281,35285,35290,35295],{"type":21,"tag":209,"props":35278,"children":35279},{"style":222},[35280],{"type":26,"value":35125},{"type":21,"tag":209,"props":35282,"children":35283},{"style":360},[35284],{"type":26,"value":14173},{"type":21,"tag":209,"props":35286,"children":35287},{"style":222},[35288],{"type":26,"value":35289},"(value ",{"type":21,"tag":209,"props":35291,"children":35292},{"style":448},[35293],{"type":26,"value":35294},"/* some value your async stuff gave you */",{"type":21,"tag":209,"props":35296,"children":35297},{"style":222},[35298],{"type":26,"value":2608},{"type":21,"tag":35078,"props":35300,"children":35301},{},[],{"type":21,"tag":51,"props":35303,"children":35305},{"id":35304},"another-example",[35306],{"type":26,"value":35307},"Another Example:",{"type":21,"tag":200,"props":35309,"children":35311},{"className":16138,"code":35310,"language":16140,"meta":8,"style":8},"var p2 = Defer(),\np1 = Defer();\n\np2.then(function (value) {\n    console.log(value); // 1\n    return value + 1;\n}).done(function(value){\n    console.log(value); // 3\n}).then(function (value) {\n    console.log(value); // 2\n    return value + 1;\n});\n\np2.resolve(1);\np1.resolve(2);\n\nPromise.all([p2, p1]).then(function(vals){\n    console.log(vals); // [3, 2]\n});\n",[35312],{"type":21,"tag":63,"props":35313,"children":35314},{"__ignoreMap":8},[35315,35339,35359,35366,35398,35419,35444,35475,35495,35526,35546,35569,35576,35583,35606,35630,35637,35683,35704],{"type":21,"tag":209,"props":35316,"children":35317},{"class":211,"line":212},[35318,35322,35327,35331,35335],{"type":21,"tag":209,"props":35319,"children":35320},{"style":216},[35321],{"type":26,"value":3909},{"type":21,"tag":209,"props":35323,"children":35324},{"style":222},[35325],{"type":26,"value":35326}," p2 ",{"type":21,"tag":209,"props":35328,"children":35329},{"style":216},[35330],{"type":26,"value":1432},{"type":21,"tag":209,"props":35332,"children":35333},{"style":360},[35334],{"type":26,"value":35113},{"type":21,"tag":209,"props":35336,"children":35337},{"style":222},[35338],{"type":26,"value":13988},{"type":21,"tag":209,"props":35340,"children":35341},{"class":211,"line":244},[35342,35347,35351,35355],{"type":21,"tag":209,"props":35343,"children":35344},{"style":222},[35345],{"type":26,"value":35346},"p1 ",{"type":21,"tag":209,"props":35348,"children":35349},{"style":216},[35350],{"type":26,"value":1432},{"type":21,"tag":209,"props":35352,"children":35353},{"style":360},[35354],{"type":26,"value":35113},{"type":21,"tag":209,"props":35356,"children":35357},{"style":222},[35358],{"type":26,"value":4123},{"type":21,"tag":209,"props":35360,"children":35361},{"class":211,"line":254},[35362],{"type":21,"tag":209,"props":35363,"children":35364},{"emptyLinePlaceholder":248},[35365],{"type":26,"value":251},{"type":21,"tag":209,"props":35367,"children":35368},{"class":211,"line":279},[35369,35374,35378,35382,35386,35390,35394],{"type":21,"tag":209,"props":35370,"children":35371},{"style":222},[35372],{"type":26,"value":35373},"p2.",{"type":21,"tag":209,"props":35375,"children":35376},{"style":360},[35377],{"type":26,"value":2704},{"type":21,"tag":209,"props":35379,"children":35380},{"style":222},[35381],{"type":26,"value":368},{"type":21,"tag":209,"props":35383,"children":35384},{"style":216},[35385],{"type":26,"value":4622},{"type":21,"tag":209,"props":35387,"children":35388},{"style":222},[35389],{"type":26,"value":5569},{"type":21,"tag":209,"props":35391,"children":35392},{"style":400},[35393],{"type":26,"value":17496},{"type":21,"tag":209,"props":35395,"children":35396},{"style":222},[35397],{"type":26,"value":5588},{"type":21,"tag":209,"props":35399,"children":35400},{"class":211,"line":288},[35401,35405,35409,35414],{"type":21,"tag":209,"props":35402,"children":35403},{"style":222},[35404],{"type":26,"value":1054},{"type":21,"tag":209,"props":35406,"children":35407},{"style":360},[35408],{"type":26,"value":1059},{"type":21,"tag":209,"props":35410,"children":35411},{"style":222},[35412],{"type":26,"value":35413},"(value); ",{"type":21,"tag":209,"props":35415,"children":35416},{"style":448},[35417],{"type":26,"value":35418},"// 1\n",{"type":21,"tag":209,"props":35420,"children":35421},{"class":211,"line":307},[35422,35426,35431,35435,35440],{"type":21,"tag":209,"props":35423,"children":35424},{"style":216},[35425],{"type":26,"value":1298},{"type":21,"tag":209,"props":35427,"children":35428},{"style":222},[35429],{"type":26,"value":35430}," value ",{"type":21,"tag":209,"props":35432,"children":35433},{"style":216},[35434],{"type":26,"value":17170},{"type":21,"tag":209,"props":35436,"children":35437},{"style":263},[35438],{"type":26,"value":35439}," 1",{"type":21,"tag":209,"props":35441,"children":35442},{"style":222},[35443],{"type":26,"value":241},{"type":21,"tag":209,"props":35445,"children":35446},{"class":211,"line":325},[35447,35451,35455,35459,35463,35467,35471],{"type":21,"tag":209,"props":35448,"children":35449},{"style":222},[35450],{"type":26,"value":20840},{"type":21,"tag":209,"props":35452,"children":35453},{"style":360},[35454],{"type":26,"value":20845},{"type":21,"tag":209,"props":35456,"children":35457},{"style":222},[35458],{"type":26,"value":368},{"type":21,"tag":209,"props":35460,"children":35461},{"style":216},[35462],{"type":26,"value":4622},{"type":21,"tag":209,"props":35464,"children":35465},{"style":222},[35466],{"type":26,"value":368},{"type":21,"tag":209,"props":35468,"children":35469},{"style":400},[35470],{"type":26,"value":17496},{"type":21,"tag":209,"props":35472,"children":35473},{"style":222},[35474],{"type":26,"value":2369},{"type":21,"tag":209,"props":35476,"children":35477},{"class":211,"line":334},[35478,35482,35486,35490],{"type":21,"tag":209,"props":35479,"children":35480},{"style":222},[35481],{"type":26,"value":1054},{"type":21,"tag":209,"props":35483,"children":35484},{"style":360},[35485],{"type":26,"value":1059},{"type":21,"tag":209,"props":35487,"children":35488},{"style":222},[35489],{"type":26,"value":35413},{"type":21,"tag":209,"props":35491,"children":35492},{"style":448},[35493],{"type":26,"value":35494},"// 3\n",{"type":21,"tag":209,"props":35496,"children":35497},{"class":211,"line":343},[35498,35502,35506,35510,35514,35518,35522],{"type":21,"tag":209,"props":35499,"children":35500},{"style":222},[35501],{"type":26,"value":20840},{"type":21,"tag":209,"props":35503,"children":35504},{"style":360},[35505],{"type":26,"value":2704},{"type":21,"tag":209,"props":35507,"children":35508},{"style":222},[35509],{"type":26,"value":368},{"type":21,"tag":209,"props":35511,"children":35512},{"style":216},[35513],{"type":26,"value":4622},{"type":21,"tag":209,"props":35515,"children":35516},{"style":222},[35517],{"type":26,"value":5569},{"type":21,"tag":209,"props":35519,"children":35520},{"style":400},[35521],{"type":26,"value":17496},{"type":21,"tag":209,"props":35523,"children":35524},{"style":222},[35525],{"type":26,"value":5588},{"type":21,"tag":209,"props":35527,"children":35528},{"class":211,"line":351},[35529,35533,35537,35541],{"type":21,"tag":209,"props":35530,"children":35531},{"style":222},[35532],{"type":26,"value":1054},{"type":21,"tag":209,"props":35534,"children":35535},{"style":360},[35536],{"type":26,"value":1059},{"type":21,"tag":209,"props":35538,"children":35539},{"style":222},[35540],{"type":26,"value":35413},{"type":21,"tag":209,"props":35542,"children":35543},{"style":448},[35544],{"type":26,"value":35545},"// 2\n",{"type":21,"tag":209,"props":35547,"children":35548},{"class":211,"line":444},[35549,35553,35557,35561,35565],{"type":21,"tag":209,"props":35550,"children":35551},{"style":216},[35552],{"type":26,"value":1298},{"type":21,"tag":209,"props":35554,"children":35555},{"style":222},[35556],{"type":26,"value":35430},{"type":21,"tag":209,"props":35558,"children":35559},{"style":216},[35560],{"type":26,"value":17170},{"type":21,"tag":209,"props":35562,"children":35563},{"style":263},[35564],{"type":26,"value":35439},{"type":21,"tag":209,"props":35566,"children":35567},{"style":222},[35568],{"type":26,"value":241},{"type":21,"tag":209,"props":35570,"children":35571},{"class":211,"line":454},[35572],{"type":21,"tag":209,"props":35573,"children":35574},{"style":222},[35575],{"type":26,"value":469},{"type":21,"tag":209,"props":35577,"children":35578},{"class":211,"line":463},[35579],{"type":21,"tag":209,"props":35580,"children":35581},{"emptyLinePlaceholder":248},[35582],{"type":26,"value":251},{"type":21,"tag":209,"props":35584,"children":35585},{"class":211,"line":472},[35586,35590,35594,35598,35602],{"type":21,"tag":209,"props":35587,"children":35588},{"style":222},[35589],{"type":26,"value":35373},{"type":21,"tag":209,"props":35591,"children":35592},{"style":360},[35593],{"type":26,"value":14173},{"type":21,"tag":209,"props":35595,"children":35596},{"style":222},[35597],{"type":26,"value":368},{"type":21,"tag":209,"props":35599,"children":35600},{"style":263},[35601],{"type":26,"value":3224},{"type":21,"tag":209,"props":35603,"children":35604},{"style":222},[35605],{"type":26,"value":2608},{"type":21,"tag":209,"props":35607,"children":35608},{"class":211,"line":480},[35609,35614,35618,35622,35626],{"type":21,"tag":209,"props":35610,"children":35611},{"style":222},[35612],{"type":26,"value":35613},"p1.",{"type":21,"tag":209,"props":35615,"children":35616},{"style":360},[35617],{"type":26,"value":14173},{"type":21,"tag":209,"props":35619,"children":35620},{"style":222},[35621],{"type":26,"value":368},{"type":21,"tag":209,"props":35623,"children":35624},{"style":263},[35625],{"type":26,"value":3233},{"type":21,"tag":209,"props":35627,"children":35628},{"style":222},[35629],{"type":26,"value":2608},{"type":21,"tag":209,"props":35631,"children":35632},{"class":211,"line":489},[35633],{"type":21,"tag":209,"props":35634,"children":35635},{"emptyLinePlaceholder":248},[35636],{"type":26,"value":251},{"type":21,"tag":209,"props":35638,"children":35639},{"class":211,"line":847},[35640,35645,35649,35653,35658,35662,35666,35670,35674,35679],{"type":21,"tag":209,"props":35641,"children":35642},{"style":263},[35643],{"type":26,"value":35644},"Promise",{"type":21,"tag":209,"props":35646,"children":35647},{"style":222},[35648],{"type":26,"value":378},{"type":21,"tag":209,"props":35650,"children":35651},{"style":360},[35652],{"type":26,"value":8240},{"type":21,"tag":209,"props":35654,"children":35655},{"style":222},[35656],{"type":26,"value":35657},"([p2, p1]).",{"type":21,"tag":209,"props":35659,"children":35660},{"style":360},[35661],{"type":26,"value":2704},{"type":21,"tag":209,"props":35663,"children":35664},{"style":222},[35665],{"type":26,"value":368},{"type":21,"tag":209,"props":35667,"children":35668},{"style":216},[35669],{"type":26,"value":4622},{"type":21,"tag":209,"props":35671,"children":35672},{"style":222},[35673],{"type":26,"value":368},{"type":21,"tag":209,"props":35675,"children":35676},{"style":400},[35677],{"type":26,"value":35678},"vals",{"type":21,"tag":209,"props":35680,"children":35681},{"style":222},[35682],{"type":26,"value":2369},{"type":21,"tag":209,"props":35684,"children":35685},{"class":211,"line":860},[35686,35690,35694,35699],{"type":21,"tag":209,"props":35687,"children":35688},{"style":222},[35689],{"type":26,"value":1054},{"type":21,"tag":209,"props":35691,"children":35692},{"style":360},[35693],{"type":26,"value":1059},{"type":21,"tag":209,"props":35695,"children":35696},{"style":222},[35697],{"type":26,"value":35698},"(vals); ",{"type":21,"tag":209,"props":35700,"children":35701},{"style":448},[35702],{"type":26,"value":35703},"// [3, 2]\n",{"type":21,"tag":209,"props":35705,"children":35706},{"class":211,"line":877},[35707],{"type":21,"tag":209,"props":35708,"children":35709},{"style":222},[35710],{"type":26,"value":469},{"type":21,"tag":35078,"props":35712,"children":35713},{},[],{"type":21,"tag":51,"props":35715,"children":35717},{"id":35716},"ajax-example",[35718],{"type":26,"value":35719},"Ajax Example:",{"type":21,"tag":22,"props":35721,"children":35722},{},[35723,35725,35732],{"type":26,"value":35724},"See the ",{"type":21,"tag":29,"props":35726,"children":35729},{"href":35727,"rel":35728},"https://github.com/SaneMethod/Defer/blob/master/DeferAjaxExample.js",[93],[35730],{"type":26,"value":35731},"ajax example",{"type":26,"value":35733}," for the ajax wrapper being used below.",{"type":21,"tag":200,"props":35735,"children":35737},{"className":16138,"code":35736,"language":16140,"meta":8,"style":8},"ajax({\n    url:/somewhere/,\n    type:GET,\n    dataType:arraybuffer\n}).then(function(res){\n    // alter the result in someway and return it\n    return res;\n}).done(function(res){\n    // Do something with the result which was altered in the then block.\n});\n",[35738],{"type":21,"tag":63,"props":35739,"children":35740},{"__ignoreMap":8},[35741,35752,35776,35792,35800,35831,35839,35850,35881,35889],{"type":21,"tag":209,"props":35742,"children":35743},{"class":211,"line":212},[35744,35748],{"type":21,"tag":209,"props":35745,"children":35746},{"style":360},[35747],{"type":26,"value":20783},{"type":21,"tag":209,"props":35749,"children":35750},{"style":222},[35751],{"type":26,"value":7767},{"type":21,"tag":209,"props":35753,"children":35754},{"class":211,"line":244},[35755,35759,35763,35768,35772],{"type":21,"tag":209,"props":35756,"children":35757},{"style":222},[35758],{"type":26,"value":20811},{"type":21,"tag":209,"props":35760,"children":35761},{"style":233},[35762],{"type":26,"value":6460},{"type":21,"tag":209,"props":35764,"children":35765},{"style":6468},[35766],{"type":26,"value":35767},"somewhere",{"type":21,"tag":209,"props":35769,"children":35770},{"style":233},[35771],{"type":26,"value":6460},{"type":21,"tag":209,"props":35773,"children":35774},{"style":222},[35775],{"type":26,"value":304},{"type":21,"tag":209,"props":35777,"children":35778},{"class":211,"line":254},[35779,35783,35788],{"type":21,"tag":209,"props":35780,"children":35781},{"style":222},[35782],{"type":26,"value":20795},{"type":21,"tag":209,"props":35784,"children":35785},{"style":263},[35786],{"type":26,"value":35787},"GET",{"type":21,"tag":209,"props":35789,"children":35790},{"style":222},[35791],{"type":26,"value":304},{"type":21,"tag":209,"props":35793,"children":35794},{"class":211,"line":279},[35795],{"type":21,"tag":209,"props":35796,"children":35797},{"style":222},[35798],{"type":26,"value":35799},"    dataType:arraybuffer\n",{"type":21,"tag":209,"props":35801,"children":35802},{"class":211,"line":288},[35803,35807,35811,35815,35819,35823,35827],{"type":21,"tag":209,"props":35804,"children":35805},{"style":222},[35806],{"type":26,"value":20840},{"type":21,"tag":209,"props":35808,"children":35809},{"style":360},[35810],{"type":26,"value":2704},{"type":21,"tag":209,"props":35812,"children":35813},{"style":222},[35814],{"type":26,"value":368},{"type":21,"tag":209,"props":35816,"children":35817},{"style":216},[35818],{"type":26,"value":4622},{"type":21,"tag":209,"props":35820,"children":35821},{"style":222},[35822],{"type":26,"value":368},{"type":21,"tag":209,"props":35824,"children":35825},{"style":400},[35826],{"type":26,"value":1385},{"type":21,"tag":209,"props":35828,"children":35829},{"style":222},[35830],{"type":26,"value":2369},{"type":21,"tag":209,"props":35832,"children":35833},{"class":211,"line":307},[35834],{"type":21,"tag":209,"props":35835,"children":35836},{"style":448},[35837],{"type":26,"value":35838},"    // alter the result in someway and return it\n",{"type":21,"tag":209,"props":35840,"children":35841},{"class":211,"line":325},[35842,35846],{"type":21,"tag":209,"props":35843,"children":35844},{"style":216},[35845],{"type":26,"value":1298},{"type":21,"tag":209,"props":35847,"children":35848},{"style":222},[35849],{"type":26,"value":1442},{"type":21,"tag":209,"props":35851,"children":35852},{"class":211,"line":334},[35853,35857,35861,35865,35869,35873,35877],{"type":21,"tag":209,"props":35854,"children":35855},{"style":222},[35856],{"type":26,"value":20840},{"type":21,"tag":209,"props":35858,"children":35859},{"style":360},[35860],{"type":26,"value":20845},{"type":21,"tag":209,"props":35862,"children":35863},{"style":222},[35864],{"type":26,"value":368},{"type":21,"tag":209,"props":35866,"children":35867},{"style":216},[35868],{"type":26,"value":4622},{"type":21,"tag":209,"props":35870,"children":35871},{"style":222},[35872],{"type":26,"value":368},{"type":21,"tag":209,"props":35874,"children":35875},{"style":400},[35876],{"type":26,"value":1385},{"type":21,"tag":209,"props":35878,"children":35879},{"style":222},[35880],{"type":26,"value":2369},{"type":21,"tag":209,"props":35882,"children":35883},{"class":211,"line":343},[35884],{"type":21,"tag":209,"props":35885,"children":35886},{"style":448},[35887],{"type":26,"value":35888},"    // Do something with the result which was altered in the then block.\n",{"type":21,"tag":209,"props":35890,"children":35891},{"class":211,"line":351},[35892],{"type":21,"tag":209,"props":35893,"children":35894},{"style":222},[35895],{"type":26,"value":469},{"type":21,"tag":35078,"props":35897,"children":35898},{},[],{"type":21,"tag":3596,"props":35900,"children":35902},{"id":35901},"native-comparison",[35903],{"type":26,"value":35904},"Native Comparison:",{"type":21,"tag":22,"props":35906,"children":35907},{},[35908,35909,35915],{"type":26,"value":35724},{"type":21,"tag":29,"props":35910,"children":35912},{"href":21168,"rel":35911},[93],[35913],{"type":26,"value":35914},"MDN Promise article",{"type":26,"value":35916},"for the current form of the Promise API.",{"type":21,"tag":51,"props":35918,"children":35920},{"id":35919},"constructor",[35921],{"type":26,"value":35922},"Constructor",{"type":21,"tag":193,"props":35924,"children":35926},{"id":35925},"native",[35927],{"type":26,"value":35928},"Native",{"type":21,"tag":200,"props":35930,"children":35932},{"className":16138,"code":35931,"language":16140,"meta":8,"style":8},"var promise = new Promise(function(resolve, reject){});\n",[35933],{"type":21,"tag":63,"props":35934,"children":35935},{"__ignoreMap":8},[35936],{"type":21,"tag":209,"props":35937,"children":35938},{"class":211,"line":212},[35939,35943,35948,35952,35956,35960,35964,35968,35972,35976,35980,35984],{"type":21,"tag":209,"props":35940,"children":35941},{"style":216},[35942],{"type":26,"value":3909},{"type":21,"tag":209,"props":35944,"children":35945},{"style":222},[35946],{"type":26,"value":35947}," promise ",{"type":21,"tag":209,"props":35949,"children":35950},{"style":216},[35951],{"type":26,"value":1432},{"type":21,"tag":209,"props":35953,"children":35954},{"style":216},[35955],{"type":26,"value":6371},{"type":21,"tag":209,"props":35957,"children":35958},{"style":263},[35959],{"type":26,"value":14164},{"type":21,"tag":209,"props":35961,"children":35962},{"style":222},[35963],{"type":26,"value":368},{"type":21,"tag":209,"props":35965,"children":35966},{"style":216},[35967],{"type":26,"value":4622},{"type":21,"tag":209,"props":35969,"children":35970},{"style":222},[35971],{"type":26,"value":368},{"type":21,"tag":209,"props":35973,"children":35974},{"style":400},[35975],{"type":26,"value":14173},{"type":21,"tag":209,"props":35977,"children":35978},{"style":222},[35979],{"type":26,"value":408},{"type":21,"tag":209,"props":35981,"children":35982},{"style":400},[35983],{"type":26,"value":14182},{"type":21,"tag":209,"props":35985,"children":35986},{"style":222},[35987],{"type":26,"value":35988},"){});\n",{"type":21,"tag":193,"props":35990,"children":35992},{"id":35991},"defer-1",[35993],{"type":26,"value":34985},{"type":21,"tag":200,"props":35995,"children":35997},{"className":16138,"code":35996,"language":16140,"meta":8,"style":8},"var promise = Defer();\n",[35998],{"type":21,"tag":63,"props":35999,"children":36000},{"__ignoreMap":8},[36001],{"type":21,"tag":209,"props":36002,"children":36003},{"class":211,"line":212},[36004,36008,36012,36016,36020],{"type":21,"tag":209,"props":36005,"children":36006},{"style":216},[36007],{"type":26,"value":3909},{"type":21,"tag":209,"props":36009,"children":36010},{"style":222},[36011],{"type":26,"value":35947},{"type":21,"tag":209,"props":36013,"children":36014},{"style":216},[36015],{"type":26,"value":1432},{"type":21,"tag":209,"props":36017,"children":36018},{"style":360},[36019],{"type":26,"value":35113},{"type":21,"tag":209,"props":36021,"children":36022},{"style":222},[36023],{"type":26,"value":4123},{"type":21,"tag":51,"props":36025,"children":36027},{"id":36026},"resolve-or-reject",[36028],{"type":26,"value":36029},"Resolve or Reject",{"type":21,"tag":193,"props":36031,"children":36033},{"id":36032},"native-1",[36034],{"type":26,"value":35928},{"type":21,"tag":22,"props":36036,"children":36037},{},[36038],{"type":26,"value":36039},"Must be done within the Promise constructor.",{"type":21,"tag":193,"props":36041,"children":36043},{"id":36042},"defer-2",[36044],{"type":26,"value":34985},{"type":21,"tag":22,"props":36046,"children":36047},{},[36048,36050,36056,36057,36063],{"type":26,"value":36049},"Can be done anywhere the variable in question is in scope, via ",{"type":21,"tag":63,"props":36051,"children":36053},{"className":36052},[],[36054],{"type":26,"value":36055},".resolve()",{"type":26,"value":1922},{"type":21,"tag":63,"props":36058,"children":36060},{"className":36059},[],[36061],{"type":26,"value":36062},".reject()",{"type":26,"value":378},{"type":21,"tag":51,"props":36065,"children":36067},{"id":36066},"adding-successfailure-handlers",[36068],{"type":26,"value":36069},"Adding success/failure handlers",{"type":21,"tag":193,"props":36071,"children":36073},{"id":36072},"native-2",[36074],{"type":26,"value":35928},{"type":21,"tag":200,"props":36076,"children":36078},{"className":16138,"code":36077,"language":16140,"meta":8,"style":8},"promise.then(successHandler, optionalFailureHandler);\npromise.catch(failureHandler);\n",[36079],{"type":21,"tag":63,"props":36080,"children":36081},{"__ignoreMap":8},[36082,36099],{"type":21,"tag":209,"props":36083,"children":36084},{"class":211,"line":212},[36085,36090,36094],{"type":21,"tag":209,"props":36086,"children":36087},{"style":222},[36088],{"type":26,"value":36089},"promise.",{"type":21,"tag":209,"props":36091,"children":36092},{"style":360},[36093],{"type":26,"value":2704},{"type":21,"tag":209,"props":36095,"children":36096},{"style":222},[36097],{"type":26,"value":36098},"(successHandler, optionalFailureHandler);\n",{"type":21,"tag":209,"props":36100,"children":36101},{"class":211,"line":244},[36102,36106,36110],{"type":21,"tag":209,"props":36103,"children":36104},{"style":222},[36105],{"type":26,"value":36089},{"type":21,"tag":209,"props":36107,"children":36108},{"style":360},[36109],{"type":26,"value":5347},{"type":21,"tag":209,"props":36111,"children":36112},{"style":222},[36113],{"type":26,"value":36114},"(failureHandler);\n",{"type":21,"tag":193,"props":36116,"children":36118},{"id":36117},"defer-3",[36119],{"type":26,"value":34985},{"type":21,"tag":200,"props":36121,"children":36123},{"className":16138,"code":36122,"language":16140,"meta":8,"style":8},"promise.then(successHandler, optionalFailureHandler);\npromise.fail(failureHandler);\npromise.done(doneHandler); // Called when the promise chain fully resolves - not present in native Promise\npromise.always(alwaysHandler); // Called when the promise chain fully resolves, or is rejected - not present in native Promise\n",[36124],{"type":21,"tag":63,"props":36125,"children":36126},{"__ignoreMap":8},[36127,36142,36157,36178],{"type":21,"tag":209,"props":36128,"children":36129},{"class":211,"line":212},[36130,36134,36138],{"type":21,"tag":209,"props":36131,"children":36132},{"style":222},[36133],{"type":26,"value":36089},{"type":21,"tag":209,"props":36135,"children":36136},{"style":360},[36137],{"type":26,"value":2704},{"type":21,"tag":209,"props":36139,"children":36140},{"style":222},[36141],{"type":26,"value":36098},{"type":21,"tag":209,"props":36143,"children":36144},{"class":211,"line":244},[36145,36149,36153],{"type":21,"tag":209,"props":36146,"children":36147},{"style":222},[36148],{"type":26,"value":36089},{"type":21,"tag":209,"props":36150,"children":36151},{"style":360},[36152],{"type":26,"value":20894},{"type":21,"tag":209,"props":36154,"children":36155},{"style":222},[36156],{"type":26,"value":36114},{"type":21,"tag":209,"props":36158,"children":36159},{"class":211,"line":254},[36160,36164,36168,36173],{"type":21,"tag":209,"props":36161,"children":36162},{"style":222},[36163],{"type":26,"value":36089},{"type":21,"tag":209,"props":36165,"children":36166},{"style":360},[36167],{"type":26,"value":20845},{"type":21,"tag":209,"props":36169,"children":36170},{"style":222},[36171],{"type":26,"value":36172},"(doneHandler); ",{"type":21,"tag":209,"props":36174,"children":36175},{"style":448},[36176],{"type":26,"value":36177},"// Called when the promise chain fully resolves - not present in native Promise\n",{"type":21,"tag":209,"props":36179,"children":36180},{"class":211,"line":279},[36181,36185,36190,36195],{"type":21,"tag":209,"props":36182,"children":36183},{"style":222},[36184],{"type":26,"value":36089},{"type":21,"tag":209,"props":36186,"children":36187},{"style":360},[36188],{"type":26,"value":36189},"always",{"type":21,"tag":209,"props":36191,"children":36192},{"style":222},[36193],{"type":26,"value":36194},"(alwaysHandler); ",{"type":21,"tag":209,"props":36196,"children":36197},{"style":448},[36198],{"type":26,"value":36199},"// Called when the promise chain fully resolves, or is rejected - not present in native Promise\n",{"type":21,"tag":35078,"props":36201,"children":36202},{},[],{"type":21,"tag":3596,"props":36204,"children":36206},{"id":36205},"jquery-comparison",[36207],{"type":26,"value":36208},"jQuery Comparison:",{"type":21,"tag":22,"props":36210,"children":36211},{},[36212,36213,36219],{"type":26,"value":35724},{"type":21,"tag":29,"props":36214,"children":36216},{"href":34950,"rel":36215},[93],[36217],{"type":26,"value":36218},"jQuery Deferred documentation",{"type":26,"value":36220}," for the full Deferred API.",{"type":21,"tag":51,"props":36222,"children":36224},{"id":36223},"adding-handlers",[36225],{"type":26,"value":36226},"Adding handlers",{"type":21,"tag":22,"props":36228,"children":36229},{},[36230],{"type":26,"value":36231},"jQuery allows you to add an array of handlers, or a comma-seperated series of handlers, for most calls. Defer does not, for purely personal, aesthetic-preference reasons. If you want to add multiple handlers, make multiple calls to .done, .then, etc.",{"type":21,"tag":51,"props":36233,"children":36235},{"id":36234},"when-and-race",[36236],{"type":26,"value":36237},"When and race",{"type":21,"tag":193,"props":36239,"children":36240},{"id":16600},[36241],{"type":26,"value":20763},{"type":21,"tag":200,"props":36243,"children":36245},{"className":16138,"code":36244,"language":16140,"meta":8,"style":8},"jQuery.when(comma, separated, deferreds).done(function(valuesArray){});\n",[36246],{"type":21,"tag":63,"props":36247,"children":36248},{"__ignoreMap":8},[36249],{"type":21,"tag":209,"props":36250,"children":36251},{"class":211,"line":212},[36252,36257,36262,36267,36271,36275,36279,36283,36288],{"type":21,"tag":209,"props":36253,"children":36254},{"style":222},[36255],{"type":26,"value":36256},"jQuery.",{"type":21,"tag":209,"props":36258,"children":36259},{"style":360},[36260],{"type":26,"value":36261},"when",{"type":21,"tag":209,"props":36263,"children":36264},{"style":222},[36265],{"type":26,"value":36266},"(comma, separated, deferreds).",{"type":21,"tag":209,"props":36268,"children":36269},{"style":360},[36270],{"type":26,"value":20845},{"type":21,"tag":209,"props":36272,"children":36273},{"style":222},[36274],{"type":26,"value":368},{"type":21,"tag":209,"props":36276,"children":36277},{"style":216},[36278],{"type":26,"value":4622},{"type":21,"tag":209,"props":36280,"children":36281},{"style":222},[36282],{"type":26,"value":368},{"type":21,"tag":209,"props":36284,"children":36285},{"style":400},[36286],{"type":26,"value":36287},"valuesArray",{"type":21,"tag":209,"props":36289,"children":36290},{"style":222},[36291],{"type":26,"value":35988},{"type":21,"tag":193,"props":36293,"children":36295},{"id":36294},"defer-4",[36296],{"type":26,"value":34985},{"type":21,"tag":200,"props":36298,"children":36300},{"className":16138,"code":36299,"language":16140,"meta":8,"style":8},"Promise.all([array, of, Defer, Objects]).then(function(valuesArray){});\nPromise.race([array, of, Defer, Objects]).then(function(firstDeferToResolveValue){});\n",[36301],{"type":21,"tag":63,"props":36302,"children":36303},{"__ignoreMap":8},[36304,36358],{"type":21,"tag":209,"props":36305,"children":36306},{"class":211,"line":212},[36307,36311,36315,36319,36324,36329,36334,36338,36342,36346,36350,36354],{"type":21,"tag":209,"props":36308,"children":36309},{"style":263},[36310],{"type":26,"value":35644},{"type":21,"tag":209,"props":36312,"children":36313},{"style":222},[36314],{"type":26,"value":378},{"type":21,"tag":209,"props":36316,"children":36317},{"style":360},[36318],{"type":26,"value":8240},{"type":21,"tag":209,"props":36320,"children":36321},{"style":222},[36322],{"type":26,"value":36323},"([array, ",{"type":21,"tag":209,"props":36325,"children":36326},{"style":216},[36327],{"type":26,"value":36328},"of",{"type":21,"tag":209,"props":36330,"children":36331},{"style":222},[36332],{"type":26,"value":36333},", Defer, Objects]).",{"type":21,"tag":209,"props":36335,"children":36336},{"style":360},[36337],{"type":26,"value":2704},{"type":21,"tag":209,"props":36339,"children":36340},{"style":222},[36341],{"type":26,"value":368},{"type":21,"tag":209,"props":36343,"children":36344},{"style":216},[36345],{"type":26,"value":4622},{"type":21,"tag":209,"props":36347,"children":36348},{"style":222},[36349],{"type":26,"value":368},{"type":21,"tag":209,"props":36351,"children":36352},{"style":400},[36353],{"type":26,"value":36287},{"type":21,"tag":209,"props":36355,"children":36356},{"style":222},[36357],{"type":26,"value":35988},{"type":21,"tag":209,"props":36359,"children":36360},{"class":211,"line":244},[36361,36365,36369,36374,36378,36382,36386,36390,36394,36398,36402,36407],{"type":21,"tag":209,"props":36362,"children":36363},{"style":263},[36364],{"type":26,"value":35644},{"type":21,"tag":209,"props":36366,"children":36367},{"style":222},[36368],{"type":26,"value":378},{"type":21,"tag":209,"props":36370,"children":36371},{"style":360},[36372],{"type":26,"value":36373},"race",{"type":21,"tag":209,"props":36375,"children":36376},{"style":222},[36377],{"type":26,"value":36323},{"type":21,"tag":209,"props":36379,"children":36380},{"style":216},[36381],{"type":26,"value":36328},{"type":21,"tag":209,"props":36383,"children":36384},{"style":222},[36385],{"type":26,"value":36333},{"type":21,"tag":209,"props":36387,"children":36388},{"style":360},[36389],{"type":26,"value":2704},{"type":21,"tag":209,"props":36391,"children":36392},{"style":222},[36393],{"type":26,"value":368},{"type":21,"tag":209,"props":36395,"children":36396},{"style":216},[36397],{"type":26,"value":4622},{"type":21,"tag":209,"props":36399,"children":36400},{"style":222},[36401],{"type":26,"value":368},{"type":21,"tag":209,"props":36403,"children":36404},{"style":400},[36405],{"type":26,"value":36406},"firstDeferToResolveValue",{"type":21,"tag":209,"props":36408,"children":36409},{"style":222},[36410],{"type":26,"value":35988},{"type":21,"tag":35078,"props":36412,"children":36413},{},[],{"type":21,"tag":3596,"props":36415,"children":36416},{"id":21660},[36417],{"type":26,"value":21663},{"type":21,"tag":3679,"props":36419,"children":36420},{},[36421,36432,36444,36456,36467,36479],{"type":21,"tag":3630,"props":36422,"children":36423},{},[36424,36430],{"type":21,"tag":29,"props":36425,"children":36427},{"href":34922,"rel":36426},[93],[36428],{"type":26,"value":36429},"Promises/A+",{"type":26,"value":36431}," - The Promises spec.",{"type":21,"tag":3630,"props":36433,"children":36434},{},[36435,36442],{"type":21,"tag":29,"props":36436,"children":36439},{"href":36437,"rel":36438},"http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects",[93],[36440],{"type":26,"value":36441},"Es6 Promise Draft",{"type":26,"value":36443}," - The draft of the promise spec being implemented by browsers.",{"type":21,"tag":3630,"props":36445,"children":36446},{},[36447,36454],{"type":21,"tag":29,"props":36448,"children":36451},{"href":36449,"rel":36450},"https://github.com/kriskowal/q/wiki/Coming-from-jQuery",[93],[36452],{"type":26,"value":36453},"Coming from jQuery to Q",{"type":26,"value":36455}," - Discusses some of the differences between jQuery Deferred and a Promise/A+ compliant library.",{"type":21,"tag":3630,"props":36457,"children":36458},{},[36459,36465],{"type":21,"tag":29,"props":36460,"children":36462},{"href":34936,"rel":36461},[93],[36463],{"type":26,"value":36464},"MDN Promises",{"type":26,"value":36466}," - MDN reference on native Promises.",{"type":21,"tag":3630,"props":36468,"children":36469},{},[36470,36477],{"type":21,"tag":29,"props":36471,"children":36474},{"href":36472,"rel":36473},"http://www.html5rocks.com/en/tutorials/es6/promises/",[93],[36475],{"type":26,"value":36476},"HTML5rocks article",{"type":26,"value":36478}," - Article on 3s6 promises.",{"type":21,"tag":3630,"props":36480,"children":36481},{},[36482,36489],{"type":21,"tag":29,"props":36483,"children":36486},{"href":36484,"rel":36485},"http://www.mattgreer.org/articles/promises-in-wicked-detail/",[93],[36487],{"type":26,"value":36488},"Javascript Promises in Wicked Detail",{"type":26,"value":36490}," - Excellent article breaking down the what, if not the why, of promises.",{"type":21,"tag":3490,"props":36492,"children":36493},{},[36494],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":36496},[36497,36498,36501,36506,36520,36527],{"id":34879,"depth":244,"text":34882},{"id":34982,"depth":244,"text":34985,"children":36499},[36500],{"id":34988,"depth":254,"text":34991},{"id":35025,"depth":244,"text":35028,"children":36502},[36503,36504,36505],{"id":35083,"depth":254,"text":35086},{"id":35304,"depth":254,"text":35307},{"id":35716,"depth":254,"text":35719},{"id":35901,"depth":244,"text":35904,"children":36507},[36508,36512,36516],{"id":35919,"depth":254,"text":35922,"children":36509},[36510,36511],{"id":35925,"depth":279,"text":35928},{"id":35991,"depth":279,"text":34985},{"id":36026,"depth":254,"text":36029,"children":36513},[36514,36515],{"id":36032,"depth":279,"text":35928},{"id":36042,"depth":279,"text":34985},{"id":36066,"depth":254,"text":36069,"children":36517},[36518,36519],{"id":36072,"depth":279,"text":35928},{"id":36117,"depth":279,"text":34985},{"id":36205,"depth":244,"text":36208,"children":36521},[36522,36523],{"id":36223,"depth":254,"text":36226},{"id":36234,"depth":254,"text":36237,"children":36524},[36525,36526],{"id":16600,"depth":279,"text":20763},{"id":36294,"depth":279,"text":34985},{"id":21660,"depth":244,"text":21663},"content:ckeefer:2014-7:promises.md","ckeefer/2014-7/promises.md","ckeefer/2014-7/promises",{"user":3518,"name":3519},{"_path":36533,"_dir":36534,"_draft":7,"_partial":7,"_locale":8,"title":36535,"description":36536,"publishDate":36537,"tags":36538,"image":36541,"excerpt":36536,"body":36542,"_type":3511,"_id":42370,"_source":3513,"_file":42371,"_stem":42372,"_extension":3516,"author":42373},"/ckeefer/2014-6/backbonesocketsync","2014-6","Websockets for Backbone","Backbone's had some of its thunder stolen lately by trendier frameworks like Meteor and Angular; for good reason, in most cases, as without the prosthetic functionality offered by the likes of Marionette, Backbone's view handling (amongst a few other lacks and warts) is really just 'roughed in'.","2014-06-25",[12,36539,36540],"websockets","backbone","/ckeefer/2014-6/img/WebsocketsPlusBackbone.png",{"type":18,"children":36543,"toc":42368},[36544,36557,36562,36567,36580,36611,36616,38320,38325,38506,38511,38622,38641,38646,38697,39042,39062,39258,39263,39478,39505,39517,39529,39582,39596,39692,39697,39915,39920,40177,40189,40194,40199,42359,42364],{"type":21,"tag":22,"props":36545,"children":36546},{},[36547,36549,36555],{"type":26,"value":36548},"Backbone's had some of its thunder stolen lately by trendier frameworks like Meteor and Angular; for good reason, in most cases, as without the prosthetic functionality offered by the likes of ",{"type":21,"tag":29,"props":36550,"children":36553},{"href":36551,"rel":36552},"http://marionettejs.com",[93],[36554],{"type":26,"value":33764},{"type":26,"value":36556},", Backbone's view handling (amongst a few other lacks and warts) is really just 'roughed in'.",{"type":21,"tag":22,"props":36558,"children":36559},{},[36560],{"type":26,"value":36561},"But the fact that a framework like marionette can be built on top of Backbone is a testament to Backbone's flexibility - after all, as the name suggests, Backbone is really just the 'skeleton' of your app, and it's willing to be fit into place however you need it to be.",{"type":21,"tag":22,"props":36563,"children":36564},{},[36565],{"type":26,"value":36566},"For instance: Backbone's default persistance method is via jQuery's ajax - make a request to the server using one of the standard HTTP methods to persists changes to models in a collection to the server-side db. Works great, but maybe you need something faster/better/stronger/etc.",{"type":21,"tag":22,"props":36568,"children":36569},{},[36570,36572,36579],{"type":26,"value":36571},"Like, say, ",{"type":21,"tag":29,"props":36573,"children":36576},{"href":36574,"rel":36575},"https://developer.mozilla.org/en/docs/WebSockets",[93],[36577],{"type":26,"value":36578},"WebSockets",{"type":26,"value":378},{"type":21,"tag":22,"props":36581,"children":36582},{},[36583,36585,36592,36594,36600,36602,36609],{"type":26,"value":36584},"Let's replace Backbone's standard method of persistance via ajax with WebSockets! To do this, we'll take advantage of the excellent ",{"type":21,"tag":29,"props":36586,"children":36589},{"href":36587,"rel":36588},"http://socket.io",[93],[36590],{"type":26,"value":36591},"socket.io",{"type":26,"value":36593}," client library (and, of course, you'll need the appropriate server-side library for your chosen language - via ",{"type":21,"tag":63,"props":36595,"children":36597},{"className":36596},[],[36598],{"type":26,"value":36599},"npm install socket.io",{"type":26,"value":36601}," if you're using Node.js, a package like ",{"type":21,"tag":29,"props":36603,"children":36606},{"href":36604,"rel":36605},"https://github.com/abourget/gevent-socketio",[93],[36607],{"type":26,"value":36608},"Gevent Socket.io",{"type":26,"value":36610}," if you're using Python, etc.).",{"type":21,"tag":22,"props":36612,"children":36613},{},[36614],{"type":26,"value":36615},"Let's take a look at the code, and then break it down:",{"type":21,"tag":200,"props":36617,"children":36619},{"className":16138,"code":36618,"language":16140,"meta":8,"style":8},"/**\n * Copyright (c) Christopher Keefer. All Rights Reserved.\n *\n * Overrides the default transport for Backbone syncing to use websockets via socket.io.\n */\n(function(Backbone, $, _, io){\n    var urlError = function(){\n        throw new Error('A \"url\" property or function must be specified.');\n    },\n        eventEmit = io.EventEmitter.prototype.emit,\n        ajaxSync = Backbone.sync;\n\n    /**\n     * Preserve the standard, jquery ajax based persistance method as ajaxSync.\n     */\n    Backbone.ajaxSync = function(method, model, options){\n        return ajaxSync.call(this, method, model, options);\n    };\n\n    /**\n     * Replace the standard sync function with our new, websocket/socket.io based solution.\n     */\n    Backbone.sync = function(method, model, options){\n        var opts = _.extend({}, options),\n            defer = $.Deferred(),\n            promise = defer.promise(),\n            namespace,\n            socket;\n\n        opts.url = (opts.url) ? _.result(opts, 'url') : (model.url) ? _.result(model, 'url') : void 0;\n        // If no url property has been specified, throw an error, as per the standard Backbone sync\n        if (!opts.url) urlError();\n        // Transform the url into a namespace\n        namespace = Backbone.Model.prototype.namespace.call(this, opts.url);\n        // Determine what data we're sending, and ensure id is present if we're performing a PATCH call\n        if (!opts.data && model) opts.data = opts.attrs || model.toJSON(options) || {};\n        if ((opts.data.id === null || opts.data.id === void 0) && opts.patch === true && model){\n            opts.data.id = model.id;\n        }\n        // Determine which websocket to use - set in options or on model\n        socket = opts.socket || model.socket;\n        // Add a listener for our namespaced method, and resolve or reject our deferred based on the response\n        socket.once(namespace+method, function(res){\n            var success = (res && res.success); // Expects server json response to contain a boolean 'success' field\n            if (success)\n            {\n                if (_.isFunction(options.success)) options.success(res);\n                defer.resolve(res);\n                return;\n            }\n            if (_.isFunction(options.error)) options.error(res);\n            defer.reject(res);\n        });\n\n        // Emit our namespaced method and the model+opts data\n        socket.emit(namespace+method, opts.data);\n\n        // Trigger the request event on the model, as per backbone spec\n        model.trigger('request', model, promise, opts);\n        // Return the promise for us to use as per usual (hanging .done blocks off, add to a .when, etc.)\n        return promise;\n    };\n\n    /**\n     * Break url apart to create namespace - every '/' save any pre/post-fixing the url will become a ':' indicating\n     * namespace - so a collection that maps to /api/posts will now have its events on the namespace\n     * api:posts: (ie. api:posts:create, api:posts:delete, etc.), and a model that maps to /api/posts/21\n     * will have events on api:posts:21: (ie. api:posts:21:update, api:posts:21:patch, etc.)\n     * @param {string=} url\n     */\n    Backbone.Model.prototype.namespace = function(url){\n        url = url || this.url();\n        return _.trim(url, '/').replace('/', ':') + \":\";\n    };\n\n    /**\n     * Override EventEmitter.emit and SocketNamespace reference for socket.io to add a catch all case for the\n     * wildcard ('*') character. Now, socket.on('*') will catch any event, with the name of the caught event\n     * passed to the handler as the first argument.\n    */\n    io.EventEmitter.prototype.emit = function(name){\n        var args = Array.prototype.slice.call(arguments, 1);\n\n        eventEmit.apply(this, ['*', name].concat(args));\n        eventEmit.apply(this, [name].concat(args));\n    };\n    io.SocketNamespace.prototype.$emit = io.EventEmitter.prototype.emit;\n})(Backbone, jQuery, _, io);\n",[36620],{"type":21,"tag":63,"props":36621,"children":36622},{"__ignoreMap":8},[36623,36630,36638,36645,36653,36660,36708,36732,36760,36767,36793,36810,36817,36824,36832,36839,36890,36920,36927,36934,36941,36949,36956,37004,37034,37058,37082,37090,37098,37105,37199,37207,37236,37244,37287,37295,37360,37431,37448,37455,37463,37489,37497,37540,37575,37587,37594,37625,37640,37651,37658,37686,37701,37708,37715,37723,37748,37755,37763,37789,37797,37809,37816,37823,37830,37838,37846,37854,37862,37883,37890,37931,37967,38034,38041,38048,38055,38063,38071,38079,38086,38127,38186,38193,38239,38271,38278,38312],{"type":21,"tag":209,"props":36624,"children":36625},{"class":211,"line":212},[36626],{"type":21,"tag":209,"props":36627,"children":36628},{"style":448},[36629],{"type":26,"value":731},{"type":21,"tag":209,"props":36631,"children":36632},{"class":211,"line":244},[36633],{"type":21,"tag":209,"props":36634,"children":36635},{"style":448},[36636],{"type":26,"value":36637}," * Copyright (c) Christopher Keefer. All Rights Reserved.\n",{"type":21,"tag":209,"props":36639,"children":36640},{"class":211,"line":254},[36641],{"type":21,"tag":209,"props":36642,"children":36643},{"style":448},[36644],{"type":26,"value":17778},{"type":21,"tag":209,"props":36646,"children":36647},{"class":211,"line":279},[36648],{"type":21,"tag":209,"props":36649,"children":36650},{"style":448},[36651],{"type":26,"value":36652}," * Overrides the default transport for Backbone syncing to use websockets via socket.io.\n",{"type":21,"tag":209,"props":36654,"children":36655},{"class":211,"line":288},[36656],{"type":21,"tag":209,"props":36657,"children":36658},{"style":448},[36659],{"type":26,"value":755},{"type":21,"tag":209,"props":36661,"children":36662},{"class":211,"line":307},[36663,36667,36671,36675,36679,36683,36687,36691,36695,36699,36704],{"type":21,"tag":209,"props":36664,"children":36665},{"style":222},[36666],{"type":26,"value":368},{"type":21,"tag":209,"props":36668,"children":36669},{"style":216},[36670],{"type":26,"value":4622},{"type":21,"tag":209,"props":36672,"children":36673},{"style":222},[36674],{"type":26,"value":368},{"type":21,"tag":209,"props":36676,"children":36677},{"style":400},[36678],{"type":26,"value":33923},{"type":21,"tag":209,"props":36680,"children":36681},{"style":222},[36682],{"type":26,"value":408},{"type":21,"tag":209,"props":36684,"children":36685},{"style":400},[36686],{"type":26,"value":6476},{"type":21,"tag":209,"props":36688,"children":36689},{"style":222},[36690],{"type":26,"value":408},{"type":21,"tag":209,"props":36692,"children":36693},{"style":400},[36694],{"type":26,"value":34284},{"type":21,"tag":209,"props":36696,"children":36697},{"style":222},[36698],{"type":26,"value":408},{"type":21,"tag":209,"props":36700,"children":36701},{"style":400},[36702],{"type":26,"value":36703},"io",{"type":21,"tag":209,"props":36705,"children":36706},{"style":222},[36707],{"type":26,"value":2369},{"type":21,"tag":209,"props":36709,"children":36710},{"class":211,"line":325},[36711,36715,36720,36724,36728],{"type":21,"tag":209,"props":36712,"children":36713},{"style":216},[36714],{"type":26,"value":16994},{"type":21,"tag":209,"props":36716,"children":36717},{"style":360},[36718],{"type":26,"value":36719}," urlError",{"type":21,"tag":209,"props":36721,"children":36722},{"style":216},[36723],{"type":26,"value":271},{"type":21,"tag":209,"props":36725,"children":36726},{"style":216},[36727],{"type":26,"value":4789},{"type":21,"tag":209,"props":36729,"children":36730},{"style":222},[36731],{"type":26,"value":2561},{"type":21,"tag":209,"props":36733,"children":36734},{"class":211,"line":334},[36735,36739,36743,36747,36751,36756],{"type":21,"tag":209,"props":36736,"children":36737},{"style":216},[36738],{"type":26,"value":18422},{"type":21,"tag":209,"props":36740,"children":36741},{"style":216},[36742],{"type":26,"value":6371},{"type":21,"tag":209,"props":36744,"children":36745},{"style":360},[36746],{"type":26,"value":21552},{"type":21,"tag":209,"props":36748,"children":36749},{"style":222},[36750],{"type":26,"value":368},{"type":21,"tag":209,"props":36752,"children":36753},{"style":233},[36754],{"type":26,"value":36755},"'A \"url\" property or function must be specified.'",{"type":21,"tag":209,"props":36757,"children":36758},{"style":222},[36759],{"type":26,"value":2608},{"type":21,"tag":209,"props":36761,"children":36762},{"class":211,"line":343},[36763],{"type":21,"tag":209,"props":36764,"children":36765},{"style":222},[36766],{"type":26,"value":2251},{"type":21,"tag":209,"props":36768,"children":36769},{"class":211,"line":351},[36770,36775,36779,36784,36788],{"type":21,"tag":209,"props":36771,"children":36772},{"style":222},[36773],{"type":26,"value":36774},"        eventEmit ",{"type":21,"tag":209,"props":36776,"children":36777},{"style":216},[36778],{"type":26,"value":1432},{"type":21,"tag":209,"props":36780,"children":36781},{"style":222},[36782],{"type":26,"value":36783}," io.EventEmitter.",{"type":21,"tag":209,"props":36785,"children":36786},{"style":263},[36787],{"type":26,"value":32662},{"type":21,"tag":209,"props":36789,"children":36790},{"style":222},[36791],{"type":26,"value":36792},".emit,\n",{"type":21,"tag":209,"props":36794,"children":36795},{"class":211,"line":444},[36796,36801,36805],{"type":21,"tag":209,"props":36797,"children":36798},{"style":222},[36799],{"type":26,"value":36800},"        ajaxSync ",{"type":21,"tag":209,"props":36802,"children":36803},{"style":216},[36804],{"type":26,"value":1432},{"type":21,"tag":209,"props":36806,"children":36807},{"style":222},[36808],{"type":26,"value":36809}," Backbone.sync;\n",{"type":21,"tag":209,"props":36811,"children":36812},{"class":211,"line":454},[36813],{"type":21,"tag":209,"props":36814,"children":36815},{"emptyLinePlaceholder":248},[36816],{"type":26,"value":251},{"type":21,"tag":209,"props":36818,"children":36819},{"class":211,"line":463},[36820],{"type":21,"tag":209,"props":36821,"children":36822},{"style":448},[36823],{"type":26,"value":13290},{"type":21,"tag":209,"props":36825,"children":36826},{"class":211,"line":472},[36827],{"type":21,"tag":209,"props":36828,"children":36829},{"style":448},[36830],{"type":26,"value":36831},"     * Preserve the standard, jquery ajax based persistance method as ajaxSync.\n",{"type":21,"tag":209,"props":36833,"children":36834},{"class":211,"line":480},[36835],{"type":21,"tag":209,"props":36836,"children":36837},{"style":448},[36838],{"type":26,"value":13346},{"type":21,"tag":209,"props":36840,"children":36841},{"class":211,"line":489},[36842,36847,36852,36856,36860,36864,36869,36873,36878,36882,36886],{"type":21,"tag":209,"props":36843,"children":36844},{"style":222},[36845],{"type":26,"value":36846},"    Backbone.",{"type":21,"tag":209,"props":36848,"children":36849},{"style":360},[36850],{"type":26,"value":36851},"ajaxSync",{"type":21,"tag":209,"props":36853,"children":36854},{"style":216},[36855],{"type":26,"value":271},{"type":21,"tag":209,"props":36857,"children":36858},{"style":216},[36859],{"type":26,"value":4789},{"type":21,"tag":209,"props":36861,"children":36862},{"style":222},[36863],{"type":26,"value":368},{"type":21,"tag":209,"props":36865,"children":36866},{"style":400},[36867],{"type":26,"value":36868},"method",{"type":21,"tag":209,"props":36870,"children":36871},{"style":222},[36872],{"type":26,"value":408},{"type":21,"tag":209,"props":36874,"children":36875},{"style":400},[36876],{"type":26,"value":36877},"model",{"type":21,"tag":209,"props":36879,"children":36880},{"style":222},[36881],{"type":26,"value":408},{"type":21,"tag":209,"props":36883,"children":36884},{"style":400},[36885],{"type":26,"value":28349},{"type":21,"tag":209,"props":36887,"children":36888},{"style":222},[36889],{"type":26,"value":2369},{"type":21,"tag":209,"props":36891,"children":36892},{"class":211,"line":847},[36893,36897,36902,36907,36911,36915],{"type":21,"tag":209,"props":36894,"children":36895},{"style":216},[36896],{"type":26,"value":3069},{"type":21,"tag":209,"props":36898,"children":36899},{"style":222},[36900],{"type":26,"value":36901}," ajaxSync.",{"type":21,"tag":209,"props":36903,"children":36904},{"style":360},[36905],{"type":26,"value":36906},"call",{"type":21,"tag":209,"props":36908,"children":36909},{"style":222},[36910],{"type":26,"value":368},{"type":21,"tag":209,"props":36912,"children":36913},{"style":263},[36914],{"type":26,"value":2508},{"type":21,"tag":209,"props":36916,"children":36917},{"style":222},[36918],{"type":26,"value":36919},", method, model, options);\n",{"type":21,"tag":209,"props":36921,"children":36922},{"class":211,"line":860},[36923],{"type":21,"tag":209,"props":36924,"children":36925},{"style":222},[36926],{"type":26,"value":13439},{"type":21,"tag":209,"props":36928,"children":36929},{"class":211,"line":877},[36930],{"type":21,"tag":209,"props":36931,"children":36932},{"emptyLinePlaceholder":248},[36933],{"type":26,"value":251},{"type":21,"tag":209,"props":36935,"children":36936},{"class":211,"line":889},[36937],{"type":21,"tag":209,"props":36938,"children":36939},{"style":448},[36940],{"type":26,"value":13290},{"type":21,"tag":209,"props":36942,"children":36943},{"class":211,"line":902},[36944],{"type":21,"tag":209,"props":36945,"children":36946},{"style":448},[36947],{"type":26,"value":36948},"     * Replace the standard sync function with our new, websocket/socket.io based solution.\n",{"type":21,"tag":209,"props":36950,"children":36951},{"class":211,"line":914},[36952],{"type":21,"tag":209,"props":36953,"children":36954},{"style":448},[36955],{"type":26,"value":13346},{"type":21,"tag":209,"props":36957,"children":36958},{"class":211,"line":922},[36959,36963,36968,36972,36976,36980,36984,36988,36992,36996,37000],{"type":21,"tag":209,"props":36960,"children":36961},{"style":222},[36962],{"type":26,"value":36846},{"type":21,"tag":209,"props":36964,"children":36965},{"style":360},[36966],{"type":26,"value":36967},"sync",{"type":21,"tag":209,"props":36969,"children":36970},{"style":216},[36971],{"type":26,"value":271},{"type":21,"tag":209,"props":36973,"children":36974},{"style":216},[36975],{"type":26,"value":4789},{"type":21,"tag":209,"props":36977,"children":36978},{"style":222},[36979],{"type":26,"value":368},{"type":21,"tag":209,"props":36981,"children":36982},{"style":400},[36983],{"type":26,"value":36868},{"type":21,"tag":209,"props":36985,"children":36986},{"style":222},[36987],{"type":26,"value":408},{"type":21,"tag":209,"props":36989,"children":36990},{"style":400},[36991],{"type":26,"value":36877},{"type":21,"tag":209,"props":36993,"children":36994},{"style":222},[36995],{"type":26,"value":408},{"type":21,"tag":209,"props":36997,"children":36998},{"style":400},[36999],{"type":26,"value":28349},{"type":21,"tag":209,"props":37001,"children":37002},{"style":222},[37003],{"type":26,"value":2369},{"type":21,"tag":209,"props":37005,"children":37006},{"class":211,"line":2312},[37007,37011,37016,37020,37025,37029],{"type":21,"tag":209,"props":37008,"children":37009},{"style":216},[37010],{"type":26,"value":14505},{"type":21,"tag":209,"props":37012,"children":37013},{"style":222},[37014],{"type":26,"value":37015}," opts ",{"type":21,"tag":209,"props":37017,"children":37018},{"style":216},[37019],{"type":26,"value":1432},{"type":21,"tag":209,"props":37021,"children":37022},{"style":222},[37023],{"type":26,"value":37024}," _.",{"type":21,"tag":209,"props":37026,"children":37027},{"style":360},[37028],{"type":26,"value":34329},{"type":21,"tag":209,"props":37030,"children":37031},{"style":222},[37032],{"type":26,"value":37033},"({}, options),\n",{"type":21,"tag":209,"props":37035,"children":37036},{"class":211,"line":2321},[37037,37042,37046,37050,37054],{"type":21,"tag":209,"props":37038,"children":37039},{"style":222},[37040],{"type":26,"value":37041},"            defer ",{"type":21,"tag":209,"props":37043,"children":37044},{"style":216},[37045],{"type":26,"value":1432},{"type":21,"tag":209,"props":37047,"children":37048},{"style":222},[37049],{"type":26,"value":25427},{"type":21,"tag":209,"props":37051,"children":37052},{"style":360},[37053],{"type":26,"value":25432},{"type":21,"tag":209,"props":37055,"children":37056},{"style":222},[37057],{"type":26,"value":13988},{"type":21,"tag":209,"props":37059,"children":37060},{"class":211,"line":2372},[37061,37066,37070,37074,37078],{"type":21,"tag":209,"props":37062,"children":37063},{"style":222},[37064],{"type":26,"value":37065},"            promise ",{"type":21,"tag":209,"props":37067,"children":37068},{"style":216},[37069],{"type":26,"value":1432},{"type":21,"tag":209,"props":37071,"children":37072},{"style":222},[37073],{"type":26,"value":26782},{"type":21,"tag":209,"props":37075,"children":37076},{"style":360},[37077],{"type":26,"value":26332},{"type":21,"tag":209,"props":37079,"children":37080},{"style":222},[37081],{"type":26,"value":13988},{"type":21,"tag":209,"props":37083,"children":37084},{"class":211,"line":2381},[37085],{"type":21,"tag":209,"props":37086,"children":37087},{"style":222},[37088],{"type":26,"value":37089},"            namespace,\n",{"type":21,"tag":209,"props":37091,"children":37092},{"class":211,"line":2389},[37093],{"type":21,"tag":209,"props":37094,"children":37095},{"style":222},[37096],{"type":26,"value":37097},"            socket;\n",{"type":21,"tag":209,"props":37099,"children":37100},{"class":211,"line":2397},[37101],{"type":21,"tag":209,"props":37102,"children":37103},{"emptyLinePlaceholder":248},[37104],{"type":26,"value":251},{"type":21,"tag":209,"props":37106,"children":37107},{"class":211,"line":2406},[37108,37113,37117,37122,37126,37130,37134,37139,37144,37148,37152,37157,37161,37165,37169,37174,37178,37182,37186,37191,37195],{"type":21,"tag":209,"props":37109,"children":37110},{"style":222},[37111],{"type":26,"value":37112},"        opts.url ",{"type":21,"tag":209,"props":37114,"children":37115},{"style":216},[37116],{"type":26,"value":1432},{"type":21,"tag":209,"props":37118,"children":37119},{"style":222},[37120],{"type":26,"value":37121}," (opts.url) ",{"type":21,"tag":209,"props":37123,"children":37124},{"style":216},[37125],{"type":26,"value":8258},{"type":21,"tag":209,"props":37127,"children":37128},{"style":222},[37129],{"type":26,"value":37024},{"type":21,"tag":209,"props":37131,"children":37132},{"style":360},[37133],{"type":26,"value":30775},{"type":21,"tag":209,"props":37135,"children":37136},{"style":222},[37137],{"type":26,"value":37138},"(opts, ",{"type":21,"tag":209,"props":37140,"children":37141},{"style":233},[37142],{"type":26,"value":37143},"'url'",{"type":21,"tag":209,"props":37145,"children":37146},{"style":222},[37147],{"type":26,"value":432},{"type":21,"tag":209,"props":37149,"children":37150},{"style":216},[37151],{"type":26,"value":191},{"type":21,"tag":209,"props":37153,"children":37154},{"style":222},[37155],{"type":26,"value":37156}," (model.url) ",{"type":21,"tag":209,"props":37158,"children":37159},{"style":216},[37160],{"type":26,"value":8258},{"type":21,"tag":209,"props":37162,"children":37163},{"style":222},[37164],{"type":26,"value":37024},{"type":21,"tag":209,"props":37166,"children":37167},{"style":360},[37168],{"type":26,"value":30775},{"type":21,"tag":209,"props":37170,"children":37171},{"style":222},[37172],{"type":26,"value":37173},"(model, ",{"type":21,"tag":209,"props":37175,"children":37176},{"style":233},[37177],{"type":26,"value":37143},{"type":21,"tag":209,"props":37179,"children":37180},{"style":222},[37181],{"type":26,"value":432},{"type":21,"tag":209,"props":37183,"children":37184},{"style":216},[37185],{"type":26,"value":191},{"type":21,"tag":209,"props":37187,"children":37188},{"style":216},[37189],{"type":26,"value":37190}," void",{"type":21,"tag":209,"props":37192,"children":37193},{"style":263},[37194],{"type":26,"value":8009},{"type":21,"tag":209,"props":37196,"children":37197},{"style":222},[37198],{"type":26,"value":241},{"type":21,"tag":209,"props":37200,"children":37201},{"class":211,"line":2415},[37202],{"type":21,"tag":209,"props":37203,"children":37204},{"style":448},[37205],{"type":26,"value":37206},"        // If no url property has been specified, throw an error, as per the standard Backbone sync\n",{"type":21,"tag":209,"props":37208,"children":37209},{"class":211,"line":2424},[37210,37214,37218,37222,37227,37232],{"type":21,"tag":209,"props":37211,"children":37212},{"style":216},[37213],{"type":26,"value":6334},{"type":21,"tag":209,"props":37215,"children":37216},{"style":222},[37217],{"type":26,"value":5569},{"type":21,"tag":209,"props":37219,"children":37220},{"style":216},[37221],{"type":26,"value":6455},{"type":21,"tag":209,"props":37223,"children":37224},{"style":222},[37225],{"type":26,"value":37226},"opts.url) ",{"type":21,"tag":209,"props":37228,"children":37229},{"style":360},[37230],{"type":26,"value":37231},"urlError",{"type":21,"tag":209,"props":37233,"children":37234},{"style":222},[37235],{"type":26,"value":4123},{"type":21,"tag":209,"props":37237,"children":37238},{"class":211,"line":2433},[37239],{"type":21,"tag":209,"props":37240,"children":37241},{"style":448},[37242],{"type":26,"value":37243},"        // Transform the url into a namespace\n",{"type":21,"tag":209,"props":37245,"children":37246},{"class":211,"line":2442},[37247,37252,37256,37261,37265,37270,37274,37278,37282],{"type":21,"tag":209,"props":37248,"children":37249},{"style":222},[37250],{"type":26,"value":37251},"        namespace ",{"type":21,"tag":209,"props":37253,"children":37254},{"style":216},[37255],{"type":26,"value":1432},{"type":21,"tag":209,"props":37257,"children":37258},{"style":222},[37259],{"type":26,"value":37260}," Backbone.Model.",{"type":21,"tag":209,"props":37262,"children":37263},{"style":263},[37264],{"type":26,"value":32662},{"type":21,"tag":209,"props":37266,"children":37267},{"style":222},[37268],{"type":26,"value":37269},".namespace.",{"type":21,"tag":209,"props":37271,"children":37272},{"style":360},[37273],{"type":26,"value":36906},{"type":21,"tag":209,"props":37275,"children":37276},{"style":222},[37277],{"type":26,"value":368},{"type":21,"tag":209,"props":37279,"children":37280},{"style":263},[37281],{"type":26,"value":2508},{"type":21,"tag":209,"props":37283,"children":37284},{"style":222},[37285],{"type":26,"value":37286},", opts.url);\n",{"type":21,"tag":209,"props":37288,"children":37289},{"class":211,"line":2471},[37290],{"type":21,"tag":209,"props":37291,"children":37292},{"style":448},[37293],{"type":26,"value":37294},"        // Determine what data we're sending, and ensure id is present if we're performing a PATCH call\n",{"type":21,"tag":209,"props":37296,"children":37297},{"class":211,"line":2480},[37298,37302,37306,37310,37315,37319,37324,37328,37333,37337,37342,37347,37352,37356],{"type":21,"tag":209,"props":37299,"children":37300},{"style":216},[37301],{"type":26,"value":6334},{"type":21,"tag":209,"props":37303,"children":37304},{"style":222},[37305],{"type":26,"value":5569},{"type":21,"tag":209,"props":37307,"children":37308},{"style":216},[37309],{"type":26,"value":6455},{"type":21,"tag":209,"props":37311,"children":37312},{"style":222},[37313],{"type":26,"value":37314},"opts.data ",{"type":21,"tag":209,"props":37316,"children":37317},{"style":216},[37318],{"type":26,"value":18381},{"type":21,"tag":209,"props":37320,"children":37321},{"style":222},[37322],{"type":26,"value":37323}," model) opts.data ",{"type":21,"tag":209,"props":37325,"children":37326},{"style":216},[37327],{"type":26,"value":1432},{"type":21,"tag":209,"props":37329,"children":37330},{"style":222},[37331],{"type":26,"value":37332}," opts.attrs ",{"type":21,"tag":209,"props":37334,"children":37335},{"style":216},[37336],{"type":26,"value":13270},{"type":21,"tag":209,"props":37338,"children":37339},{"style":222},[37340],{"type":26,"value":37341}," model.",{"type":21,"tag":209,"props":37343,"children":37344},{"style":360},[37345],{"type":26,"value":37346},"toJSON",{"type":21,"tag":209,"props":37348,"children":37349},{"style":222},[37350],{"type":26,"value":37351},"(options) ",{"type":21,"tag":209,"props":37353,"children":37354},{"style":216},[37355],{"type":26,"value":13270},{"type":21,"tag":209,"props":37357,"children":37358},{"style":222},[37359],{"type":26,"value":7963},{"type":21,"tag":209,"props":37361,"children":37362},{"class":211,"line":2489},[37363,37367,37372,37376,37380,37384,37389,37393,37397,37401,37405,37409,37414,37418,37422,37426],{"type":21,"tag":209,"props":37364,"children":37365},{"style":216},[37366],{"type":26,"value":6334},{"type":21,"tag":209,"props":37368,"children":37369},{"style":222},[37370],{"type":26,"value":37371}," ((opts.data.id ",{"type":21,"tag":209,"props":37373,"children":37374},{"style":216},[37375],{"type":26,"value":14680},{"type":21,"tag":209,"props":37377,"children":37378},{"style":263},[37379],{"type":26,"value":8282},{"type":21,"tag":209,"props":37381,"children":37382},{"style":216},[37383],{"type":26,"value":4608},{"type":21,"tag":209,"props":37385,"children":37386},{"style":222},[37387],{"type":26,"value":37388}," opts.data.id ",{"type":21,"tag":209,"props":37390,"children":37391},{"style":216},[37392],{"type":26,"value":14680},{"type":21,"tag":209,"props":37394,"children":37395},{"style":216},[37396],{"type":26,"value":37190},{"type":21,"tag":209,"props":37398,"children":37399},{"style":263},[37400],{"type":26,"value":8009},{"type":21,"tag":209,"props":37402,"children":37403},{"style":222},[37404],{"type":26,"value":432},{"type":21,"tag":209,"props":37406,"children":37407},{"style":216},[37408],{"type":26,"value":18381},{"type":21,"tag":209,"props":37410,"children":37411},{"style":222},[37412],{"type":26,"value":37413}," opts.patch ",{"type":21,"tag":209,"props":37415,"children":37416},{"style":216},[37417],{"type":26,"value":14680},{"type":21,"tag":209,"props":37419,"children":37420},{"style":263},[37421],{"type":26,"value":14819},{"type":21,"tag":209,"props":37423,"children":37424},{"style":216},[37425],{"type":26,"value":18342},{"type":21,"tag":209,"props":37427,"children":37428},{"style":222},[37429],{"type":26,"value":37430}," model){\n",{"type":21,"tag":209,"props":37432,"children":37433},{"class":211,"line":2516},[37434,37439,37443],{"type":21,"tag":209,"props":37435,"children":37436},{"style":222},[37437],{"type":26,"value":37438},"            opts.data.id ",{"type":21,"tag":209,"props":37440,"children":37441},{"style":216},[37442],{"type":26,"value":1432},{"type":21,"tag":209,"props":37444,"children":37445},{"style":222},[37446],{"type":26,"value":37447}," model.id;\n",{"type":21,"tag":209,"props":37449,"children":37450},{"class":211,"line":2525},[37451],{"type":21,"tag":209,"props":37452,"children":37453},{"style":222},[37454],{"type":26,"value":2235},{"type":21,"tag":209,"props":37456,"children":37457},{"class":211,"line":2533},[37458],{"type":21,"tag":209,"props":37459,"children":37460},{"style":448},[37461],{"type":26,"value":37462},"        // Determine which websocket to use - set in options or on model\n",{"type":21,"tag":209,"props":37464,"children":37465},{"class":211,"line":2542},[37466,37471,37475,37480,37484],{"type":21,"tag":209,"props":37467,"children":37468},{"style":222},[37469],{"type":26,"value":37470},"        socket ",{"type":21,"tag":209,"props":37472,"children":37473},{"style":216},[37474],{"type":26,"value":1432},{"type":21,"tag":209,"props":37476,"children":37477},{"style":222},[37478],{"type":26,"value":37479}," opts.socket ",{"type":21,"tag":209,"props":37481,"children":37482},{"style":216},[37483],{"type":26,"value":13270},{"type":21,"tag":209,"props":37485,"children":37486},{"style":222},[37487],{"type":26,"value":37488}," model.socket;\n",{"type":21,"tag":209,"props":37490,"children":37491},{"class":211,"line":2550},[37492],{"type":21,"tag":209,"props":37493,"children":37494},{"style":448},[37495],{"type":26,"value":37496},"        // Add a listener for our namespaced method, and resolve or reject our deferred based on the response\n",{"type":21,"tag":209,"props":37498,"children":37499},{"class":211,"line":2564},[37500,37505,37510,37515,37519,37524,37528,37532,37536],{"type":21,"tag":209,"props":37501,"children":37502},{"style":222},[37503],{"type":26,"value":37504},"        socket.",{"type":21,"tag":209,"props":37506,"children":37507},{"style":360},[37508],{"type":26,"value":37509},"once",{"type":21,"tag":209,"props":37511,"children":37512},{"style":222},[37513],{"type":26,"value":37514},"(namespace",{"type":21,"tag":209,"props":37516,"children":37517},{"style":216},[37518],{"type":26,"value":17170},{"type":21,"tag":209,"props":37520,"children":37521},{"style":222},[37522],{"type":26,"value":37523},"method, ",{"type":21,"tag":209,"props":37525,"children":37526},{"style":216},[37527],{"type":26,"value":4622},{"type":21,"tag":209,"props":37529,"children":37530},{"style":222},[37531],{"type":26,"value":368},{"type":21,"tag":209,"props":37533,"children":37534},{"style":400},[37535],{"type":26,"value":1385},{"type":21,"tag":209,"props":37537,"children":37538},{"style":222},[37539],{"type":26,"value":2369},{"type":21,"tag":209,"props":37541,"children":37542},{"class":211,"line":2611},[37543,37547,37552,37556,37561,37565,37570],{"type":21,"tag":209,"props":37544,"children":37545},{"style":216},[37546],{"type":26,"value":14539},{"type":21,"tag":209,"props":37548,"children":37549},{"style":222},[37550],{"type":26,"value":37551}," success ",{"type":21,"tag":209,"props":37553,"children":37554},{"style":216},[37555],{"type":26,"value":1432},{"type":21,"tag":209,"props":37557,"children":37558},{"style":222},[37559],{"type":26,"value":37560}," (res ",{"type":21,"tag":209,"props":37562,"children":37563},{"style":216},[37564],{"type":26,"value":18381},{"type":21,"tag":209,"props":37566,"children":37567},{"style":222},[37568],{"type":26,"value":37569}," res.success); ",{"type":21,"tag":209,"props":37571,"children":37572},{"style":448},[37573],{"type":26,"value":37574},"// Expects server json response to contain a boolean 'success' field\n",{"type":21,"tag":209,"props":37576,"children":37577},{"class":211,"line":2619},[37578,37582],{"type":21,"tag":209,"props":37579,"children":37580},{"style":216},[37581],{"type":26,"value":14662},{"type":21,"tag":209,"props":37583,"children":37584},{"style":222},[37585],{"type":26,"value":37586}," (success)\n",{"type":21,"tag":209,"props":37588,"children":37589},{"class":211,"line":2627},[37590],{"type":21,"tag":209,"props":37591,"children":37592},{"style":222},[37593],{"type":26,"value":19379},{"type":21,"tag":209,"props":37595,"children":37596},{"class":211,"line":2636},[37597,37602,37607,37612,37617,37621],{"type":21,"tag":209,"props":37598,"children":37599},{"style":216},[37600],{"type":26,"value":37601},"                if",{"type":21,"tag":209,"props":37603,"children":37604},{"style":222},[37605],{"type":26,"value":37606}," (_.",{"type":21,"tag":209,"props":37608,"children":37609},{"style":360},[37610],{"type":26,"value":37611},"isFunction",{"type":21,"tag":209,"props":37613,"children":37614},{"style":222},[37615],{"type":26,"value":37616},"(options.success)) options.",{"type":21,"tag":209,"props":37618,"children":37619},{"style":360},[37620],{"type":26,"value":30164},{"type":21,"tag":209,"props":37622,"children":37623},{"style":222},[37624],{"type":26,"value":23711},{"type":21,"tag":209,"props":37626,"children":37627},{"class":211,"line":2644},[37628,37632,37636],{"type":21,"tag":209,"props":37629,"children":37630},{"style":222},[37631],{"type":26,"value":26985},{"type":21,"tag":209,"props":37633,"children":37634},{"style":360},[37635],{"type":26,"value":14173},{"type":21,"tag":209,"props":37637,"children":37638},{"style":222},[37639],{"type":26,"value":23711},{"type":21,"tag":209,"props":37641,"children":37642},{"class":211,"line":2657},[37643,37647],{"type":21,"tag":209,"props":37644,"children":37645},{"style":216},[37646],{"type":26,"value":14236},{"type":21,"tag":209,"props":37648,"children":37649},{"style":222},[37650],{"type":26,"value":241},{"type":21,"tag":209,"props":37652,"children":37653},{"class":211,"line":2728},[37654],{"type":21,"tag":209,"props":37655,"children":37656},{"style":222},[37657],{"type":26,"value":14714},{"type":21,"tag":209,"props":37659,"children":37660},{"class":211,"line":2758},[37661,37665,37669,37673,37678,37682],{"type":21,"tag":209,"props":37662,"children":37663},{"style":216},[37664],{"type":26,"value":14662},{"type":21,"tag":209,"props":37666,"children":37667},{"style":222},[37668],{"type":26,"value":37606},{"type":21,"tag":209,"props":37670,"children":37671},{"style":360},[37672],{"type":26,"value":37611},{"type":21,"tag":209,"props":37674,"children":37675},{"style":222},[37676],{"type":26,"value":37677},"(options.error)) options.",{"type":21,"tag":209,"props":37679,"children":37680},{"style":360},[37681],{"type":26,"value":20749},{"type":21,"tag":209,"props":37683,"children":37684},{"style":222},[37685],{"type":26,"value":23711},{"type":21,"tag":209,"props":37687,"children":37688},{"class":211,"line":2776},[37689,37693,37697],{"type":21,"tag":209,"props":37690,"children":37691},{"style":222},[37692],{"type":26,"value":29441},{"type":21,"tag":209,"props":37694,"children":37695},{"style":360},[37696],{"type":26,"value":14182},{"type":21,"tag":209,"props":37698,"children":37699},{"style":222},[37700],{"type":26,"value":23711},{"type":21,"tag":209,"props":37702,"children":37703},{"class":211,"line":2785},[37704],{"type":21,"tag":209,"props":37705,"children":37706},{"style":222},[37707],{"type":26,"value":13702},{"type":21,"tag":209,"props":37709,"children":37710},{"class":211,"line":2793},[37711],{"type":21,"tag":209,"props":37712,"children":37713},{"emptyLinePlaceholder":248},[37714],{"type":26,"value":251},{"type":21,"tag":209,"props":37716,"children":37717},{"class":211,"line":2801},[37718],{"type":21,"tag":209,"props":37719,"children":37720},{"style":448},[37721],{"type":26,"value":37722},"        // Emit our namespaced method and the model+opts data\n",{"type":21,"tag":209,"props":37724,"children":37725},{"class":211,"line":2809},[37726,37730,37735,37739,37743],{"type":21,"tag":209,"props":37727,"children":37728},{"style":222},[37729],{"type":26,"value":37504},{"type":21,"tag":209,"props":37731,"children":37732},{"style":360},[37733],{"type":26,"value":37734},"emit",{"type":21,"tag":209,"props":37736,"children":37737},{"style":222},[37738],{"type":26,"value":37514},{"type":21,"tag":209,"props":37740,"children":37741},{"style":216},[37742],{"type":26,"value":17170},{"type":21,"tag":209,"props":37744,"children":37745},{"style":222},[37746],{"type":26,"value":37747},"method, opts.data);\n",{"type":21,"tag":209,"props":37749,"children":37750},{"class":211,"line":10937},[37751],{"type":21,"tag":209,"props":37752,"children":37753},{"emptyLinePlaceholder":248},[37754],{"type":26,"value":251},{"type":21,"tag":209,"props":37756,"children":37757},{"class":211,"line":10967},[37758],{"type":21,"tag":209,"props":37759,"children":37760},{"style":448},[37761],{"type":26,"value":37762},"        // Trigger the request event on the model, as per backbone spec\n",{"type":21,"tag":209,"props":37764,"children":37765},{"class":211,"line":11003},[37766,37771,37775,37779,37784],{"type":21,"tag":209,"props":37767,"children":37768},{"style":222},[37769],{"type":26,"value":37770},"        model.",{"type":21,"tag":209,"props":37772,"children":37773},{"style":360},[37774],{"type":26,"value":499},{"type":21,"tag":209,"props":37776,"children":37777},{"style":222},[37778],{"type":26,"value":368},{"type":21,"tag":209,"props":37780,"children":37781},{"style":233},[37782],{"type":26,"value":37783},"'request'",{"type":21,"tag":209,"props":37785,"children":37786},{"style":222},[37787],{"type":26,"value":37788},", model, promise, opts);\n",{"type":21,"tag":209,"props":37790,"children":37791},{"class":211,"line":11038},[37792],{"type":21,"tag":209,"props":37793,"children":37794},{"style":448},[37795],{"type":26,"value":37796},"        // Return the promise for us to use as per usual (hanging .done blocks off, add to a .when, etc.)\n",{"type":21,"tag":209,"props":37798,"children":37799},{"class":211,"line":11072},[37800,37804],{"type":21,"tag":209,"props":37801,"children":37802},{"style":216},[37803],{"type":26,"value":3069},{"type":21,"tag":209,"props":37805,"children":37806},{"style":222},[37807],{"type":26,"value":37808}," promise;\n",{"type":21,"tag":209,"props":37810,"children":37811},{"class":211,"line":11106},[37812],{"type":21,"tag":209,"props":37813,"children":37814},{"style":222},[37815],{"type":26,"value":13439},{"type":21,"tag":209,"props":37817,"children":37818},{"class":211,"line":11114},[37819],{"type":21,"tag":209,"props":37820,"children":37821},{"emptyLinePlaceholder":248},[37822],{"type":26,"value":251},{"type":21,"tag":209,"props":37824,"children":37825},{"class":211,"line":14940},[37826],{"type":21,"tag":209,"props":37827,"children":37828},{"style":448},[37829],{"type":26,"value":13290},{"type":21,"tag":209,"props":37831,"children":37832},{"class":211,"line":14949},[37833],{"type":21,"tag":209,"props":37834,"children":37835},{"style":448},[37836],{"type":26,"value":37837},"     * Break url apart to create namespace - every '/' save any pre/post-fixing the url will become a ':' indicating\n",{"type":21,"tag":209,"props":37839,"children":37840},{"class":211,"line":14958},[37841],{"type":21,"tag":209,"props":37842,"children":37843},{"style":448},[37844],{"type":26,"value":37845},"     * namespace - so a collection that maps to /api/posts will now have its events on the namespace\n",{"type":21,"tag":209,"props":37847,"children":37848},{"class":211,"line":14966},[37849],{"type":21,"tag":209,"props":37850,"children":37851},{"style":448},[37852],{"type":26,"value":37853},"     * api:posts: (ie. api:posts:create, api:posts:delete, etc.), and a model that maps to /api/posts/21\n",{"type":21,"tag":209,"props":37855,"children":37856},{"class":211,"line":14975},[37857],{"type":21,"tag":209,"props":37858,"children":37859},{"style":448},[37860],{"type":26,"value":37861},"     * will have events on api:posts:21: (ie. api:posts:21:update, api:posts:21:patch, etc.)\n",{"type":21,"tag":209,"props":37863,"children":37864},{"class":211,"line":14984},[37865,37869,37873,37878],{"type":21,"tag":209,"props":37866,"children":37867},{"style":448},[37868],{"type":26,"value":13306},{"type":21,"tag":209,"props":37870,"children":37871},{"style":216},[37872],{"type":26,"value":13311},{"type":21,"tag":209,"props":37874,"children":37875},{"style":360},[37876],{"type":26,"value":37877}," {string=}",{"type":21,"tag":209,"props":37879,"children":37880},{"style":222},[37881],{"type":26,"value":37882}," url\n",{"type":21,"tag":209,"props":37884,"children":37885},{"class":211,"line":15018},[37886],{"type":21,"tag":209,"props":37887,"children":37888},{"style":448},[37889],{"type":26,"value":13346},{"type":21,"tag":209,"props":37891,"children":37892},{"class":211,"line":15050},[37893,37898,37902,37906,37911,37915,37919,37923,37927],{"type":21,"tag":209,"props":37894,"children":37895},{"style":222},[37896],{"type":26,"value":37897},"    Backbone.Model.",{"type":21,"tag":209,"props":37899,"children":37900},{"style":263},[37901],{"type":26,"value":32662},{"type":21,"tag":209,"props":37903,"children":37904},{"style":222},[37905],{"type":26,"value":378},{"type":21,"tag":209,"props":37907,"children":37908},{"style":360},[37909],{"type":26,"value":37910},"namespace",{"type":21,"tag":209,"props":37912,"children":37913},{"style":216},[37914],{"type":26,"value":271},{"type":21,"tag":209,"props":37916,"children":37917},{"style":216},[37918],{"type":26,"value":4789},{"type":21,"tag":209,"props":37920,"children":37921},{"style":222},[37922],{"type":26,"value":368},{"type":21,"tag":209,"props":37924,"children":37925},{"style":400},[37926],{"type":26,"value":17951},{"type":21,"tag":209,"props":37928,"children":37929},{"style":222},[37930],{"type":26,"value":2369},{"type":21,"tag":209,"props":37932,"children":37933},{"class":211,"line":15082},[37934,37939,37943,37947,37951,37955,37959,37963],{"type":21,"tag":209,"props":37935,"children":37936},{"style":222},[37937],{"type":26,"value":37938},"        url ",{"type":21,"tag":209,"props":37940,"children":37941},{"style":216},[37942],{"type":26,"value":1432},{"type":21,"tag":209,"props":37944,"children":37945},{"style":222},[37946],{"type":26,"value":18080},{"type":21,"tag":209,"props":37948,"children":37949},{"style":216},[37950],{"type":26,"value":13270},{"type":21,"tag":209,"props":37952,"children":37953},{"style":263},[37954],{"type":26,"value":20502},{"type":21,"tag":209,"props":37956,"children":37957},{"style":222},[37958],{"type":26,"value":378},{"type":21,"tag":209,"props":37960,"children":37961},{"style":360},[37962],{"type":26,"value":17951},{"type":21,"tag":209,"props":37964,"children":37965},{"style":222},[37966],{"type":26,"value":4123},{"type":21,"tag":209,"props":37968,"children":37969},{"class":211,"line":15090},[37970,37974,37978,37983,37988,37992,37996,38000,38004,38008,38012,38017,38021,38025,38030],{"type":21,"tag":209,"props":37971,"children":37972},{"style":216},[37973],{"type":26,"value":3069},{"type":21,"tag":209,"props":37975,"children":37976},{"style":222},[37977],{"type":26,"value":37024},{"type":21,"tag":209,"props":37979,"children":37980},{"style":360},[37981],{"type":26,"value":37982},"trim",{"type":21,"tag":209,"props":37984,"children":37985},{"style":222},[37986],{"type":26,"value":37987},"(url, ",{"type":21,"tag":209,"props":37989,"children":37990},{"style":233},[37991],{"type":26,"value":7645},{"type":21,"tag":209,"props":37993,"children":37994},{"style":222},[37995],{"type":26,"value":2699},{"type":21,"tag":209,"props":37997,"children":37998},{"style":360},[37999],{"type":26,"value":28378},{"type":21,"tag":209,"props":38001,"children":38002},{"style":222},[38003],{"type":26,"value":368},{"type":21,"tag":209,"props":38005,"children":38006},{"style":233},[38007],{"type":26,"value":7645},{"type":21,"tag":209,"props":38009,"children":38010},{"style":222},[38011],{"type":26,"value":408},{"type":21,"tag":209,"props":38013,"children":38014},{"style":233},[38015],{"type":26,"value":38016},"':'",{"type":21,"tag":209,"props":38018,"children":38019},{"style":222},[38020],{"type":26,"value":432},{"type":21,"tag":209,"props":38022,"children":38023},{"style":216},[38024],{"type":26,"value":17170},{"type":21,"tag":209,"props":38026,"children":38027},{"style":233},[38028],{"type":26,"value":38029}," \":\"",{"type":21,"tag":209,"props":38031,"children":38032},{"style":222},[38033],{"type":26,"value":241},{"type":21,"tag":209,"props":38035,"children":38036},{"class":211,"line":15098},[38037],{"type":21,"tag":209,"props":38038,"children":38039},{"style":222},[38040],{"type":26,"value":13439},{"type":21,"tag":209,"props":38042,"children":38043},{"class":211,"line":15106},[38044],{"type":21,"tag":209,"props":38045,"children":38046},{"emptyLinePlaceholder":248},[38047],{"type":26,"value":251},{"type":21,"tag":209,"props":38049,"children":38050},{"class":211,"line":15114},[38051],{"type":21,"tag":209,"props":38052,"children":38053},{"style":448},[38054],{"type":26,"value":13290},{"type":21,"tag":209,"props":38056,"children":38057},{"class":211,"line":15123},[38058],{"type":21,"tag":209,"props":38059,"children":38060},{"style":448},[38061],{"type":26,"value":38062},"     * Override EventEmitter.emit and SocketNamespace reference for socket.io to add a catch all case for the\n",{"type":21,"tag":209,"props":38064,"children":38065},{"class":211,"line":15143},[38066],{"type":21,"tag":209,"props":38067,"children":38068},{"style":448},[38069],{"type":26,"value":38070},"     * wildcard ('*') character. Now, socket.on('*') will catch any event, with the name of the caught event\n",{"type":21,"tag":209,"props":38072,"children":38073},{"class":211,"line":15160},[38074],{"type":21,"tag":209,"props":38075,"children":38076},{"style":448},[38077],{"type":26,"value":38078},"     * passed to the handler as the first argument.\n",{"type":21,"tag":209,"props":38080,"children":38081},{"class":211,"line":15168},[38082],{"type":21,"tag":209,"props":38083,"children":38084},{"style":448},[38085],{"type":26,"value":16934},{"type":21,"tag":209,"props":38087,"children":38088},{"class":211,"line":15196},[38089,38094,38098,38102,38106,38110,38114,38118,38123],{"type":21,"tag":209,"props":38090,"children":38091},{"style":222},[38092],{"type":26,"value":38093},"    io.EventEmitter.",{"type":21,"tag":209,"props":38095,"children":38096},{"style":263},[38097],{"type":26,"value":32662},{"type":21,"tag":209,"props":38099,"children":38100},{"style":222},[38101],{"type":26,"value":378},{"type":21,"tag":209,"props":38103,"children":38104},{"style":360},[38105],{"type":26,"value":37734},{"type":21,"tag":209,"props":38107,"children":38108},{"style":216},[38109],{"type":26,"value":271},{"type":21,"tag":209,"props":38111,"children":38112},{"style":216},[38113],{"type":26,"value":4789},{"type":21,"tag":209,"props":38115,"children":38116},{"style":222},[38117],{"type":26,"value":368},{"type":21,"tag":209,"props":38119,"children":38120},{"style":400},[38121],{"type":26,"value":38122},"name",{"type":21,"tag":209,"props":38124,"children":38125},{"style":222},[38126],{"type":26,"value":2369},{"type":21,"tag":209,"props":38128,"children":38129},{"class":211,"line":15219},[38130,38134,38139,38143,38148,38152,38156,38161,38165,38169,38174,38178,38182],{"type":21,"tag":209,"props":38131,"children":38132},{"style":216},[38133],{"type":26,"value":14505},{"type":21,"tag":209,"props":38135,"children":38136},{"style":222},[38137],{"type":26,"value":38138}," args ",{"type":21,"tag":209,"props":38140,"children":38141},{"style":216},[38142],{"type":26,"value":1432},{"type":21,"tag":209,"props":38144,"children":38145},{"style":263},[38146],{"type":26,"value":38147}," Array",{"type":21,"tag":209,"props":38149,"children":38150},{"style":222},[38151],{"type":26,"value":378},{"type":21,"tag":209,"props":38153,"children":38154},{"style":263},[38155],{"type":26,"value":32662},{"type":21,"tag":209,"props":38157,"children":38158},{"style":222},[38159],{"type":26,"value":38160},".slice.",{"type":21,"tag":209,"props":38162,"children":38163},{"style":360},[38164],{"type":26,"value":36906},{"type":21,"tag":209,"props":38166,"children":38167},{"style":222},[38168],{"type":26,"value":368},{"type":21,"tag":209,"props":38170,"children":38171},{"style":263},[38172],{"type":26,"value":38173},"arguments",{"type":21,"tag":209,"props":38175,"children":38176},{"style":222},[38177],{"type":26,"value":408},{"type":21,"tag":209,"props":38179,"children":38180},{"style":263},[38181],{"type":26,"value":3224},{"type":21,"tag":209,"props":38183,"children":38184},{"style":222},[38185],{"type":26,"value":2608},{"type":21,"tag":209,"props":38187,"children":38188},{"class":211,"line":15240},[38189],{"type":21,"tag":209,"props":38190,"children":38191},{"emptyLinePlaceholder":248},[38192],{"type":26,"value":251},{"type":21,"tag":209,"props":38194,"children":38195},{"class":211,"line":15248},[38196,38201,38206,38210,38214,38219,38224,38229,38234],{"type":21,"tag":209,"props":38197,"children":38198},{"style":222},[38199],{"type":26,"value":38200},"        eventEmit.",{"type":21,"tag":209,"props":38202,"children":38203},{"style":360},[38204],{"type":26,"value":38205},"apply",{"type":21,"tag":209,"props":38207,"children":38208},{"style":222},[38209],{"type":26,"value":368},{"type":21,"tag":209,"props":38211,"children":38212},{"style":263},[38213],{"type":26,"value":2508},{"type":21,"tag":209,"props":38215,"children":38216},{"style":222},[38217],{"type":26,"value":38218},", [",{"type":21,"tag":209,"props":38220,"children":38221},{"style":233},[38222],{"type":26,"value":38223},"'*'",{"type":21,"tag":209,"props":38225,"children":38226},{"style":222},[38227],{"type":26,"value":38228},", name].",{"type":21,"tag":209,"props":38230,"children":38231},{"style":360},[38232],{"type":26,"value":38233},"concat",{"type":21,"tag":209,"props":38235,"children":38236},{"style":222},[38237],{"type":26,"value":38238},"(args));\n",{"type":21,"tag":209,"props":38240,"children":38241},{"class":211,"line":15256},[38242,38246,38250,38254,38258,38263,38267],{"type":21,"tag":209,"props":38243,"children":38244},{"style":222},[38245],{"type":26,"value":38200},{"type":21,"tag":209,"props":38247,"children":38248},{"style":360},[38249],{"type":26,"value":38205},{"type":21,"tag":209,"props":38251,"children":38252},{"style":222},[38253],{"type":26,"value":368},{"type":21,"tag":209,"props":38255,"children":38256},{"style":263},[38257],{"type":26,"value":2508},{"type":21,"tag":209,"props":38259,"children":38260},{"style":222},[38261],{"type":26,"value":38262},", [name].",{"type":21,"tag":209,"props":38264,"children":38265},{"style":360},[38266],{"type":26,"value":38233},{"type":21,"tag":209,"props":38268,"children":38269},{"style":222},[38270],{"type":26,"value":38238},{"type":21,"tag":209,"props":38272,"children":38273},{"class":211,"line":15284},[38274],{"type":21,"tag":209,"props":38275,"children":38276},{"style":222},[38277],{"type":26,"value":13439},{"type":21,"tag":209,"props":38279,"children":38280},{"class":211,"line":15317},[38281,38286,38290,38295,38299,38303,38307],{"type":21,"tag":209,"props":38282,"children":38283},{"style":222},[38284],{"type":26,"value":38285},"    io.SocketNamespace.",{"type":21,"tag":209,"props":38287,"children":38288},{"style":263},[38289],{"type":26,"value":32662},{"type":21,"tag":209,"props":38291,"children":38292},{"style":222},[38293],{"type":26,"value":38294},".$emit ",{"type":21,"tag":209,"props":38296,"children":38297},{"style":216},[38298],{"type":26,"value":1432},{"type":21,"tag":209,"props":38300,"children":38301},{"style":222},[38302],{"type":26,"value":36783},{"type":21,"tag":209,"props":38304,"children":38305},{"style":263},[38306],{"type":26,"value":32662},{"type":21,"tag":209,"props":38308,"children":38309},{"style":222},[38310],{"type":26,"value":38311},".emit;\n",{"type":21,"tag":209,"props":38313,"children":38314},{"class":211,"line":15331},[38315],{"type":21,"tag":209,"props":38316,"children":38317},{"style":222},[38318],{"type":26,"value":38319},"})(Backbone, jQuery, _, io);\n",{"type":21,"tag":22,"props":38321,"children":38322},{},[38323],{"type":26,"value":38324},"So, let's start at the top (and the very bottom).",{"type":21,"tag":200,"props":38326,"children":38328},{"className":16138,"code":38327,"language":16140,"meta":8,"style":8},"(function(Backbone, $, _, io){\n    var urlError = function(){\n        throw new Error('A \"url\" property or function must be specified.');\n    },\n    eventEmit = io.EventEmitter.prototype.emit,\n    ajaxSync = Backbone.sync;\n\n    //... More code ...\n\n    })(Backbone, jQuery, _, io);\n",[38329],{"type":21,"tag":63,"props":38330,"children":38331},{"__ignoreMap":8},[38332,38379,38402,38429,38436,38460,38476,38483,38491,38498],{"type":21,"tag":209,"props":38333,"children":38334},{"class":211,"line":212},[38335,38339,38343,38347,38351,38355,38359,38363,38367,38371,38375],{"type":21,"tag":209,"props":38336,"children":38337},{"style":222},[38338],{"type":26,"value":368},{"type":21,"tag":209,"props":38340,"children":38341},{"style":216},[38342],{"type":26,"value":4622},{"type":21,"tag":209,"props":38344,"children":38345},{"style":222},[38346],{"type":26,"value":368},{"type":21,"tag":209,"props":38348,"children":38349},{"style":400},[38350],{"type":26,"value":33923},{"type":21,"tag":209,"props":38352,"children":38353},{"style":222},[38354],{"type":26,"value":408},{"type":21,"tag":209,"props":38356,"children":38357},{"style":400},[38358],{"type":26,"value":6476},{"type":21,"tag":209,"props":38360,"children":38361},{"style":222},[38362],{"type":26,"value":408},{"type":21,"tag":209,"props":38364,"children":38365},{"style":400},[38366],{"type":26,"value":34284},{"type":21,"tag":209,"props":38368,"children":38369},{"style":222},[38370],{"type":26,"value":408},{"type":21,"tag":209,"props":38372,"children":38373},{"style":400},[38374],{"type":26,"value":36703},{"type":21,"tag":209,"props":38376,"children":38377},{"style":222},[38378],{"type":26,"value":2369},{"type":21,"tag":209,"props":38380,"children":38381},{"class":211,"line":244},[38382,38386,38390,38394,38398],{"type":21,"tag":209,"props":38383,"children":38384},{"style":216},[38385],{"type":26,"value":16994},{"type":21,"tag":209,"props":38387,"children":38388},{"style":360},[38389],{"type":26,"value":36719},{"type":21,"tag":209,"props":38391,"children":38392},{"style":216},[38393],{"type":26,"value":271},{"type":21,"tag":209,"props":38395,"children":38396},{"style":216},[38397],{"type":26,"value":4789},{"type":21,"tag":209,"props":38399,"children":38400},{"style":222},[38401],{"type":26,"value":2561},{"type":21,"tag":209,"props":38403,"children":38404},{"class":211,"line":254},[38405,38409,38413,38417,38421,38425],{"type":21,"tag":209,"props":38406,"children":38407},{"style":216},[38408],{"type":26,"value":18422},{"type":21,"tag":209,"props":38410,"children":38411},{"style":216},[38412],{"type":26,"value":6371},{"type":21,"tag":209,"props":38414,"children":38415},{"style":360},[38416],{"type":26,"value":21552},{"type":21,"tag":209,"props":38418,"children":38419},{"style":222},[38420],{"type":26,"value":368},{"type":21,"tag":209,"props":38422,"children":38423},{"style":233},[38424],{"type":26,"value":36755},{"type":21,"tag":209,"props":38426,"children":38427},{"style":222},[38428],{"type":26,"value":2608},{"type":21,"tag":209,"props":38430,"children":38431},{"class":211,"line":279},[38432],{"type":21,"tag":209,"props":38433,"children":38434},{"style":222},[38435],{"type":26,"value":2251},{"type":21,"tag":209,"props":38437,"children":38438},{"class":211,"line":288},[38439,38444,38448,38452,38456],{"type":21,"tag":209,"props":38440,"children":38441},{"style":222},[38442],{"type":26,"value":38443},"    eventEmit ",{"type":21,"tag":209,"props":38445,"children":38446},{"style":216},[38447],{"type":26,"value":1432},{"type":21,"tag":209,"props":38449,"children":38450},{"style":222},[38451],{"type":26,"value":36783},{"type":21,"tag":209,"props":38453,"children":38454},{"style":263},[38455],{"type":26,"value":32662},{"type":21,"tag":209,"props":38457,"children":38458},{"style":222},[38459],{"type":26,"value":36792},{"type":21,"tag":209,"props":38461,"children":38462},{"class":211,"line":307},[38463,38468,38472],{"type":21,"tag":209,"props":38464,"children":38465},{"style":222},[38466],{"type":26,"value":38467},"    ajaxSync ",{"type":21,"tag":209,"props":38469,"children":38470},{"style":216},[38471],{"type":26,"value":1432},{"type":21,"tag":209,"props":38473,"children":38474},{"style":222},[38475],{"type":26,"value":36809},{"type":21,"tag":209,"props":38477,"children":38478},{"class":211,"line":325},[38479],{"type":21,"tag":209,"props":38480,"children":38481},{"emptyLinePlaceholder":248},[38482],{"type":26,"value":251},{"type":21,"tag":209,"props":38484,"children":38485},{"class":211,"line":334},[38486],{"type":21,"tag":209,"props":38487,"children":38488},{"style":448},[38489],{"type":26,"value":38490},"    //... More code ...\n",{"type":21,"tag":209,"props":38492,"children":38493},{"class":211,"line":343},[38494],{"type":21,"tag":209,"props":38495,"children":38496},{"emptyLinePlaceholder":248},[38497],{"type":26,"value":251},{"type":21,"tag":209,"props":38499,"children":38500},{"class":211,"line":351},[38501],{"type":21,"tag":209,"props":38502,"children":38503},{"style":222},[38504],{"type":26,"value":38505},"    })(Backbone, jQuery, _, io);\n",{"type":21,"tag":22,"props":38507,"children":38508},{},[38509],{"type":26,"value":38510},"We create a function expression, and feed it the expected globals - a reference to Backbone, jQuery, underscore and socket.io, in that order. At the top, we're reproducing backbone's standard urlError function, and then we're saving a reference to io's emit (more on that in a bit), and to the original, ajax-based sync.",{"type":21,"tag":200,"props":38512,"children":38514},{"className":16138,"code":38513,"language":16140,"meta":8,"style":8},"/**\n * Preserve the standard, jquery ajax based persistance method as ajaxSync.\n */\nBackbone.ajaxSync = function(method, model, options){\n    return ajaxSync.call(this, method, model, options);\n};\n",[38515],{"type":21,"tag":63,"props":38516,"children":38517},{"__ignoreMap":8},[38518,38525,38533,38540,38588,38615],{"type":21,"tag":209,"props":38519,"children":38520},{"class":211,"line":212},[38521],{"type":21,"tag":209,"props":38522,"children":38523},{"style":448},[38524],{"type":26,"value":731},{"type":21,"tag":209,"props":38526,"children":38527},{"class":211,"line":244},[38528],{"type":21,"tag":209,"props":38529,"children":38530},{"style":448},[38531],{"type":26,"value":38532}," * Preserve the standard, jquery ajax based persistance method as ajaxSync.\n",{"type":21,"tag":209,"props":38534,"children":38535},{"class":211,"line":254},[38536],{"type":21,"tag":209,"props":38537,"children":38538},{"style":448},[38539],{"type":26,"value":755},{"type":21,"tag":209,"props":38541,"children":38542},{"class":211,"line":279},[38543,38548,38552,38556,38560,38564,38568,38572,38576,38580,38584],{"type":21,"tag":209,"props":38544,"children":38545},{"style":222},[38546],{"type":26,"value":38547},"Backbone.",{"type":21,"tag":209,"props":38549,"children":38550},{"style":360},[38551],{"type":26,"value":36851},{"type":21,"tag":209,"props":38553,"children":38554},{"style":216},[38555],{"type":26,"value":271},{"type":21,"tag":209,"props":38557,"children":38558},{"style":216},[38559],{"type":26,"value":4789},{"type":21,"tag":209,"props":38561,"children":38562},{"style":222},[38563],{"type":26,"value":368},{"type":21,"tag":209,"props":38565,"children":38566},{"style":400},[38567],{"type":26,"value":36868},{"type":21,"tag":209,"props":38569,"children":38570},{"style":222},[38571],{"type":26,"value":408},{"type":21,"tag":209,"props":38573,"children":38574},{"style":400},[38575],{"type":26,"value":36877},{"type":21,"tag":209,"props":38577,"children":38578},{"style":222},[38579],{"type":26,"value":408},{"type":21,"tag":209,"props":38581,"children":38582},{"style":400},[38583],{"type":26,"value":28349},{"type":21,"tag":209,"props":38585,"children":38586},{"style":222},[38587],{"type":26,"value":2369},{"type":21,"tag":209,"props":38589,"children":38590},{"class":211,"line":288},[38591,38595,38599,38603,38607,38611],{"type":21,"tag":209,"props":38592,"children":38593},{"style":216},[38594],{"type":26,"value":1298},{"type":21,"tag":209,"props":38596,"children":38597},{"style":222},[38598],{"type":26,"value":36901},{"type":21,"tag":209,"props":38600,"children":38601},{"style":360},[38602],{"type":26,"value":36906},{"type":21,"tag":209,"props":38604,"children":38605},{"style":222},[38606],{"type":26,"value":368},{"type":21,"tag":209,"props":38608,"children":38609},{"style":263},[38610],{"type":26,"value":2508},{"type":21,"tag":209,"props":38612,"children":38613},{"style":222},[38614],{"type":26,"value":36919},{"type":21,"tag":209,"props":38616,"children":38617},{"class":211,"line":307},[38618],{"type":21,"tag":209,"props":38619,"children":38620},{"style":222},[38621],{"type":26,"value":340},{"type":21,"tag":22,"props":38623,"children":38624},{},[38625,38627,38632,38634,38639],{"type":26,"value":38626},"The comment says it all - we're preserving the standard ",{"type":21,"tag":63,"props":38628,"children":38630},{"className":38629},[],[38631],{"type":26,"value":36967},{"type":26,"value":38633}," as ",{"type":21,"tag":63,"props":38635,"children":38637},{"className":38636},[],[38638],{"type":26,"value":36851},{"type":26,"value":38640},", so if we want some collection or model to use the standard persistence method, we can.",{"type":21,"tag":22,"props":38642,"children":38643},{},[38644],{"type":26,"value":38645},"We can specify ajaxSync as our preferred sync method when we extend the collection:",{"type":21,"tag":200,"props":38647,"children":38649},{"className":16138,"code":38648,"language":16140,"meta":8,"style":8},"var collection = new (Backbone.Collection.extend({url:'/api/url', model:Backbone.Model, sync:Backbone.ajaxSync}))();\n",[38650],{"type":21,"tag":63,"props":38651,"children":38652},{"__ignoreMap":8},[38653],{"type":21,"tag":209,"props":38654,"children":38655},{"class":211,"line":212},[38656,38660,38665,38669,38673,38678,38682,38687,38692],{"type":21,"tag":209,"props":38657,"children":38658},{"style":216},[38659],{"type":26,"value":3909},{"type":21,"tag":209,"props":38661,"children":38662},{"style":222},[38663],{"type":26,"value":38664}," collection ",{"type":21,"tag":209,"props":38666,"children":38667},{"style":216},[38668],{"type":26,"value":1432},{"type":21,"tag":209,"props":38670,"children":38671},{"style":216},[38672],{"type":26,"value":6371},{"type":21,"tag":209,"props":38674,"children":38675},{"style":222},[38676],{"type":26,"value":38677}," (Backbone.Collection.",{"type":21,"tag":209,"props":38679,"children":38680},{"style":360},[38681],{"type":26,"value":34329},{"type":21,"tag":209,"props":38683,"children":38684},{"style":222},[38685],{"type":26,"value":38686},"({url:",{"type":21,"tag":209,"props":38688,"children":38689},{"style":233},[38690],{"type":26,"value":38691},"'/api/url'",{"type":21,"tag":209,"props":38693,"children":38694},{"style":222},[38695],{"type":26,"value":38696},", model:Backbone.Model, sync:Backbone.ajaxSync}))();\n",{"type":21,"tag":200,"props":38698,"children":38700},{"className":16138,"code":38699,"language":16140,"meta":8,"style":8},"/**\n * Replace the standard sync function with our new, websocket/socket.io based solution.\n */\nBackbone.sync = function(method, model, options){\n    var opts = _.extend({}, options),\n    defer = $.Deferred(),\n    promise = defer.promise(),\n    namespace,\n    socket;\n\n    opts.url = (opts.url) ? _.result(opts, 'url') : (model.url) ? _.result(model, 'url') : void 0;\n    // If no url property has been specified, throw an error, as per the standard Backbone sync\n    if (!opts.url) urlError();\n    // Transform the url into a namespace\n    namespace = Backbone.Model.prototype.namespace.call(this, opts.url);\n",[38701],{"type":21,"tag":63,"props":38702,"children":38703},{"__ignoreMap":8},[38704,38711,38719,38726,38773,38800,38824,38848,38856,38864,38871,38959,38967,38994,39002],{"type":21,"tag":209,"props":38705,"children":38706},{"class":211,"line":212},[38707],{"type":21,"tag":209,"props":38708,"children":38709},{"style":448},[38710],{"type":26,"value":731},{"type":21,"tag":209,"props":38712,"children":38713},{"class":211,"line":244},[38714],{"type":21,"tag":209,"props":38715,"children":38716},{"style":448},[38717],{"type":26,"value":38718}," * Replace the standard sync function with our new, websocket/socket.io based solution.\n",{"type":21,"tag":209,"props":38720,"children":38721},{"class":211,"line":254},[38722],{"type":21,"tag":209,"props":38723,"children":38724},{"style":448},[38725],{"type":26,"value":755},{"type":21,"tag":209,"props":38727,"children":38728},{"class":211,"line":279},[38729,38733,38737,38741,38745,38749,38753,38757,38761,38765,38769],{"type":21,"tag":209,"props":38730,"children":38731},{"style":222},[38732],{"type":26,"value":38547},{"type":21,"tag":209,"props":38734,"children":38735},{"style":360},[38736],{"type":26,"value":36967},{"type":21,"tag":209,"props":38738,"children":38739},{"style":216},[38740],{"type":26,"value":271},{"type":21,"tag":209,"props":38742,"children":38743},{"style":216},[38744],{"type":26,"value":4789},{"type":21,"tag":209,"props":38746,"children":38747},{"style":222},[38748],{"type":26,"value":368},{"type":21,"tag":209,"props":38750,"children":38751},{"style":400},[38752],{"type":26,"value":36868},{"type":21,"tag":209,"props":38754,"children":38755},{"style":222},[38756],{"type":26,"value":408},{"type":21,"tag":209,"props":38758,"children":38759},{"style":400},[38760],{"type":26,"value":36877},{"type":21,"tag":209,"props":38762,"children":38763},{"style":222},[38764],{"type":26,"value":408},{"type":21,"tag":209,"props":38766,"children":38767},{"style":400},[38768],{"type":26,"value":28349},{"type":21,"tag":209,"props":38770,"children":38771},{"style":222},[38772],{"type":26,"value":2369},{"type":21,"tag":209,"props":38774,"children":38775},{"class":211,"line":288},[38776,38780,38784,38788,38792,38796],{"type":21,"tag":209,"props":38777,"children":38778},{"style":216},[38779],{"type":26,"value":16994},{"type":21,"tag":209,"props":38781,"children":38782},{"style":222},[38783],{"type":26,"value":37015},{"type":21,"tag":209,"props":38785,"children":38786},{"style":216},[38787],{"type":26,"value":1432},{"type":21,"tag":209,"props":38789,"children":38790},{"style":222},[38791],{"type":26,"value":37024},{"type":21,"tag":209,"props":38793,"children":38794},{"style":360},[38795],{"type":26,"value":34329},{"type":21,"tag":209,"props":38797,"children":38798},{"style":222},[38799],{"type":26,"value":37033},{"type":21,"tag":209,"props":38801,"children":38802},{"class":211,"line":307},[38803,38808,38812,38816,38820],{"type":21,"tag":209,"props":38804,"children":38805},{"style":222},[38806],{"type":26,"value":38807},"    defer ",{"type":21,"tag":209,"props":38809,"children":38810},{"style":216},[38811],{"type":26,"value":1432},{"type":21,"tag":209,"props":38813,"children":38814},{"style":222},[38815],{"type":26,"value":25427},{"type":21,"tag":209,"props":38817,"children":38818},{"style":360},[38819],{"type":26,"value":25432},{"type":21,"tag":209,"props":38821,"children":38822},{"style":222},[38823],{"type":26,"value":13988},{"type":21,"tag":209,"props":38825,"children":38826},{"class":211,"line":325},[38827,38832,38836,38840,38844],{"type":21,"tag":209,"props":38828,"children":38829},{"style":222},[38830],{"type":26,"value":38831},"    promise ",{"type":21,"tag":209,"props":38833,"children":38834},{"style":216},[38835],{"type":26,"value":1432},{"type":21,"tag":209,"props":38837,"children":38838},{"style":222},[38839],{"type":26,"value":26782},{"type":21,"tag":209,"props":38841,"children":38842},{"style":360},[38843],{"type":26,"value":26332},{"type":21,"tag":209,"props":38845,"children":38846},{"style":222},[38847],{"type":26,"value":13988},{"type":21,"tag":209,"props":38849,"children":38850},{"class":211,"line":334},[38851],{"type":21,"tag":209,"props":38852,"children":38853},{"style":222},[38854],{"type":26,"value":38855},"    namespace,\n",{"type":21,"tag":209,"props":38857,"children":38858},{"class":211,"line":343},[38859],{"type":21,"tag":209,"props":38860,"children":38861},{"style":222},[38862],{"type":26,"value":38863},"    socket;\n",{"type":21,"tag":209,"props":38865,"children":38866},{"class":211,"line":351},[38867],{"type":21,"tag":209,"props":38868,"children":38869},{"emptyLinePlaceholder":248},[38870],{"type":26,"value":251},{"type":21,"tag":209,"props":38872,"children":38873},{"class":211,"line":444},[38874,38879,38883,38887,38891,38895,38899,38903,38907,38911,38915,38919,38923,38927,38931,38935,38939,38943,38947,38951,38955],{"type":21,"tag":209,"props":38875,"children":38876},{"style":222},[38877],{"type":26,"value":38878},"    opts.url ",{"type":21,"tag":209,"props":38880,"children":38881},{"style":216},[38882],{"type":26,"value":1432},{"type":21,"tag":209,"props":38884,"children":38885},{"style":222},[38886],{"type":26,"value":37121},{"type":21,"tag":209,"props":38888,"children":38889},{"style":216},[38890],{"type":26,"value":8258},{"type":21,"tag":209,"props":38892,"children":38893},{"style":222},[38894],{"type":26,"value":37024},{"type":21,"tag":209,"props":38896,"children":38897},{"style":360},[38898],{"type":26,"value":30775},{"type":21,"tag":209,"props":38900,"children":38901},{"style":222},[38902],{"type":26,"value":37138},{"type":21,"tag":209,"props":38904,"children":38905},{"style":233},[38906],{"type":26,"value":37143},{"type":21,"tag":209,"props":38908,"children":38909},{"style":222},[38910],{"type":26,"value":432},{"type":21,"tag":209,"props":38912,"children":38913},{"style":216},[38914],{"type":26,"value":191},{"type":21,"tag":209,"props":38916,"children":38917},{"style":222},[38918],{"type":26,"value":37156},{"type":21,"tag":209,"props":38920,"children":38921},{"style":216},[38922],{"type":26,"value":8258},{"type":21,"tag":209,"props":38924,"children":38925},{"style":222},[38926],{"type":26,"value":37024},{"type":21,"tag":209,"props":38928,"children":38929},{"style":360},[38930],{"type":26,"value":30775},{"type":21,"tag":209,"props":38932,"children":38933},{"style":222},[38934],{"type":26,"value":37173},{"type":21,"tag":209,"props":38936,"children":38937},{"style":233},[38938],{"type":26,"value":37143},{"type":21,"tag":209,"props":38940,"children":38941},{"style":222},[38942],{"type":26,"value":432},{"type":21,"tag":209,"props":38944,"children":38945},{"style":216},[38946],{"type":26,"value":191},{"type":21,"tag":209,"props":38948,"children":38949},{"style":216},[38950],{"type":26,"value":37190},{"type":21,"tag":209,"props":38952,"children":38953},{"style":263},[38954],{"type":26,"value":8009},{"type":21,"tag":209,"props":38956,"children":38957},{"style":222},[38958],{"type":26,"value":241},{"type":21,"tag":209,"props":38960,"children":38961},{"class":211,"line":454},[38962],{"type":21,"tag":209,"props":38963,"children":38964},{"style":448},[38965],{"type":26,"value":38966},"    // If no url property has been specified, throw an error, as per the standard Backbone sync\n",{"type":21,"tag":209,"props":38968,"children":38969},{"class":211,"line":463},[38970,38974,38978,38982,38986,38990],{"type":21,"tag":209,"props":38971,"children":38972},{"style":216},[38973],{"type":26,"value":9249},{"type":21,"tag":209,"props":38975,"children":38976},{"style":222},[38977],{"type":26,"value":5569},{"type":21,"tag":209,"props":38979,"children":38980},{"style":216},[38981],{"type":26,"value":6455},{"type":21,"tag":209,"props":38983,"children":38984},{"style":222},[38985],{"type":26,"value":37226},{"type":21,"tag":209,"props":38987,"children":38988},{"style":360},[38989],{"type":26,"value":37231},{"type":21,"tag":209,"props":38991,"children":38992},{"style":222},[38993],{"type":26,"value":4123},{"type":21,"tag":209,"props":38995,"children":38996},{"class":211,"line":472},[38997],{"type":21,"tag":209,"props":38998,"children":38999},{"style":448},[39000],{"type":26,"value":39001},"    // Transform the url into a namespace\n",{"type":21,"tag":209,"props":39003,"children":39004},{"class":211,"line":480},[39005,39010,39014,39018,39022,39026,39030,39034,39038],{"type":21,"tag":209,"props":39006,"children":39007},{"style":222},[39008],{"type":26,"value":39009},"    namespace ",{"type":21,"tag":209,"props":39011,"children":39012},{"style":216},[39013],{"type":26,"value":1432},{"type":21,"tag":209,"props":39015,"children":39016},{"style":222},[39017],{"type":26,"value":37260},{"type":21,"tag":209,"props":39019,"children":39020},{"style":263},[39021],{"type":26,"value":32662},{"type":21,"tag":209,"props":39023,"children":39024},{"style":222},[39025],{"type":26,"value":37269},{"type":21,"tag":209,"props":39027,"children":39028},{"style":360},[39029],{"type":26,"value":36906},{"type":21,"tag":209,"props":39031,"children":39032},{"style":222},[39033],{"type":26,"value":368},{"type":21,"tag":209,"props":39035,"children":39036},{"style":263},[39037],{"type":26,"value":2508},{"type":21,"tag":209,"props":39039,"children":39040},{"style":222},[39041],{"type":26,"value":37286},{"type":21,"tag":22,"props":39043,"children":39044},{},[39045,39047,39053,39055,39060],{"type":26,"value":39046},"So, we ensure options is an object (potentially empty, if no options have been passed to us), create a jQuery Deferred object and it's promise, and declare namespace and socket for later use. Then, we attempt to determine the url, from the options first or, if not set there, from the model. Note the use of underscore's ",{"type":21,"tag":29,"props":39048,"children":39051},{"href":39049,"rel":39050},"http://underscorejs.org/#result",[93],[39052],{"type":26,"value":30775},{"type":26,"value":39054}," function - ",{"type":21,"tag":63,"props":39056,"children":39058},{"className":39057},[],[39059],{"type":26,"value":17951},{"type":26,"value":39061}," can be either a function returning a string, or a string itself. If no url is found, we throw the backbone standard error. Otherwise, we translate the url into a namespace, using backbone conventions - more on that later.",{"type":21,"tag":200,"props":39063,"children":39065},{"className":16138,"code":39064,"language":16140,"meta":8,"style":8},"// Determine what data we're sending, and ensure id is present if we're performing a PATCH call\nif (!opts.data && model) opts.data = opts.attrs || model.toJSON(options) || {};\nif ((opts.data.id === null || opts.data.id === void 0) && opts.patch === true && model){\n    opts.data.id = model.id;\n}\n// Determine which websocket to use - set in options or on model\nsocket = opts.socket || model.socket;\n",[39066],{"type":21,"tag":63,"props":39067,"children":39068},{"__ignoreMap":8},[39069,39077,39136,39203,39219,39226,39234],{"type":21,"tag":209,"props":39070,"children":39071},{"class":211,"line":212},[39072],{"type":21,"tag":209,"props":39073,"children":39074},{"style":448},[39075],{"type":26,"value":39076},"// Determine what data we're sending, and ensure id is present if we're performing a PATCH call\n",{"type":21,"tag":209,"props":39078,"children":39079},{"class":211,"line":244},[39080,39084,39088,39092,39096,39100,39104,39108,39112,39116,39120,39124,39128,39132],{"type":21,"tag":209,"props":39081,"children":39082},{"style":216},[39083],{"type":26,"value":4301},{"type":21,"tag":209,"props":39085,"children":39086},{"style":222},[39087],{"type":26,"value":5569},{"type":21,"tag":209,"props":39089,"children":39090},{"style":216},[39091],{"type":26,"value":6455},{"type":21,"tag":209,"props":39093,"children":39094},{"style":222},[39095],{"type":26,"value":37314},{"type":21,"tag":209,"props":39097,"children":39098},{"style":216},[39099],{"type":26,"value":18381},{"type":21,"tag":209,"props":39101,"children":39102},{"style":222},[39103],{"type":26,"value":37323},{"type":21,"tag":209,"props":39105,"children":39106},{"style":216},[39107],{"type":26,"value":1432},{"type":21,"tag":209,"props":39109,"children":39110},{"style":222},[39111],{"type":26,"value":37332},{"type":21,"tag":209,"props":39113,"children":39114},{"style":216},[39115],{"type":26,"value":13270},{"type":21,"tag":209,"props":39117,"children":39118},{"style":222},[39119],{"type":26,"value":37341},{"type":21,"tag":209,"props":39121,"children":39122},{"style":360},[39123],{"type":26,"value":37346},{"type":21,"tag":209,"props":39125,"children":39126},{"style":222},[39127],{"type":26,"value":37351},{"type":21,"tag":209,"props":39129,"children":39130},{"style":216},[39131],{"type":26,"value":13270},{"type":21,"tag":209,"props":39133,"children":39134},{"style":222},[39135],{"type":26,"value":7963},{"type":21,"tag":209,"props":39137,"children":39138},{"class":211,"line":254},[39139,39143,39147,39151,39155,39159,39163,39167,39171,39175,39179,39183,39187,39191,39195,39199],{"type":21,"tag":209,"props":39140,"children":39141},{"style":216},[39142],{"type":26,"value":4301},{"type":21,"tag":209,"props":39144,"children":39145},{"style":222},[39146],{"type":26,"value":37371},{"type":21,"tag":209,"props":39148,"children":39149},{"style":216},[39150],{"type":26,"value":14680},{"type":21,"tag":209,"props":39152,"children":39153},{"style":263},[39154],{"type":26,"value":8282},{"type":21,"tag":209,"props":39156,"children":39157},{"style":216},[39158],{"type":26,"value":4608},{"type":21,"tag":209,"props":39160,"children":39161},{"style":222},[39162],{"type":26,"value":37388},{"type":21,"tag":209,"props":39164,"children":39165},{"style":216},[39166],{"type":26,"value":14680},{"type":21,"tag":209,"props":39168,"children":39169},{"style":216},[39170],{"type":26,"value":37190},{"type":21,"tag":209,"props":39172,"children":39173},{"style":263},[39174],{"type":26,"value":8009},{"type":21,"tag":209,"props":39176,"children":39177},{"style":222},[39178],{"type":26,"value":432},{"type":21,"tag":209,"props":39180,"children":39181},{"style":216},[39182],{"type":26,"value":18381},{"type":21,"tag":209,"props":39184,"children":39185},{"style":222},[39186],{"type":26,"value":37413},{"type":21,"tag":209,"props":39188,"children":39189},{"style":216},[39190],{"type":26,"value":14680},{"type":21,"tag":209,"props":39192,"children":39193},{"style":263},[39194],{"type":26,"value":14819},{"type":21,"tag":209,"props":39196,"children":39197},{"style":216},[39198],{"type":26,"value":18342},{"type":21,"tag":209,"props":39200,"children":39201},{"style":222},[39202],{"type":26,"value":37430},{"type":21,"tag":209,"props":39204,"children":39205},{"class":211,"line":279},[39206,39211,39215],{"type":21,"tag":209,"props":39207,"children":39208},{"style":222},[39209],{"type":26,"value":39210},"    opts.data.id ",{"type":21,"tag":209,"props":39212,"children":39213},{"style":216},[39214],{"type":26,"value":1432},{"type":21,"tag":209,"props":39216,"children":39217},{"style":222},[39218],{"type":26,"value":37447},{"type":21,"tag":209,"props":39220,"children":39221},{"class":211,"line":288},[39222],{"type":21,"tag":209,"props":39223,"children":39224},{"style":222},[39225],{"type":26,"value":4415},{"type":21,"tag":209,"props":39227,"children":39228},{"class":211,"line":307},[39229],{"type":21,"tag":209,"props":39230,"children":39231},{"style":448},[39232],{"type":26,"value":39233},"// Determine which websocket to use - set in options or on model\n",{"type":21,"tag":209,"props":39235,"children":39236},{"class":211,"line":325},[39237,39242,39246,39250,39254],{"type":21,"tag":209,"props":39238,"children":39239},{"style":222},[39240],{"type":26,"value":39241},"socket ",{"type":21,"tag":209,"props":39243,"children":39244},{"style":216},[39245],{"type":26,"value":1432},{"type":21,"tag":209,"props":39247,"children":39248},{"style":222},[39249],{"type":26,"value":37479},{"type":21,"tag":209,"props":39251,"children":39252},{"style":216},[39253],{"type":26,"value":13270},{"type":21,"tag":209,"props":39255,"children":39256},{"style":222},[39257],{"type":26,"value":37488},{"type":21,"tag":22,"props":39259,"children":39260},{},[39261],{"type":26,"value":39262},"Note that we're deciding what socket to use in the same order as we determined url - first checking the options for the socket to have been passed in with this sync request, then checking the model. If you expect that socket may not be set on either, you may want to add a check at this point. If you intend to use a globally available socket, this is also where you'd add that as a default.",{"type":21,"tag":200,"props":39264,"children":39266},{"className":16138,"code":39265,"language":16140,"meta":8,"style":8}," // Add a listener for our namespaced method, and resolve or reject our deferred based on the response\nsocket.once(namespace+method, function(res){\n    var success = (res && res.success); // Expects server json response to contain a boolean 'success' field\n    if (success)\n    {\n        if (_.isFunction(options.success)) options.success(res);\n        defer.resolve(res);\n        return;\n    }\n    if (_.isFunction(options.error)) options.error(res);\n    defer.reject(res);\n});\n",[39267],{"type":21,"tag":63,"props":39268,"children":39269},{"__ignoreMap":8},[39270,39278,39318,39349,39360,39367,39394,39410,39421,39428,39455,39471],{"type":21,"tag":209,"props":39271,"children":39272},{"class":211,"line":212},[39273],{"type":21,"tag":209,"props":39274,"children":39275},{"style":448},[39276],{"type":26,"value":39277}," // Add a listener for our namespaced method, and resolve or reject our deferred based on the response\n",{"type":21,"tag":209,"props":39279,"children":39280},{"class":211,"line":244},[39281,39286,39290,39294,39298,39302,39306,39310,39314],{"type":21,"tag":209,"props":39282,"children":39283},{"style":222},[39284],{"type":26,"value":39285},"socket.",{"type":21,"tag":209,"props":39287,"children":39288},{"style":360},[39289],{"type":26,"value":37509},{"type":21,"tag":209,"props":39291,"children":39292},{"style":222},[39293],{"type":26,"value":37514},{"type":21,"tag":209,"props":39295,"children":39296},{"style":216},[39297],{"type":26,"value":17170},{"type":21,"tag":209,"props":39299,"children":39300},{"style":222},[39301],{"type":26,"value":37523},{"type":21,"tag":209,"props":39303,"children":39304},{"style":216},[39305],{"type":26,"value":4622},{"type":21,"tag":209,"props":39307,"children":39308},{"style":222},[39309],{"type":26,"value":368},{"type":21,"tag":209,"props":39311,"children":39312},{"style":400},[39313],{"type":26,"value":1385},{"type":21,"tag":209,"props":39315,"children":39316},{"style":222},[39317],{"type":26,"value":2369},{"type":21,"tag":209,"props":39319,"children":39320},{"class":211,"line":254},[39321,39325,39329,39333,39337,39341,39345],{"type":21,"tag":209,"props":39322,"children":39323},{"style":216},[39324],{"type":26,"value":16994},{"type":21,"tag":209,"props":39326,"children":39327},{"style":222},[39328],{"type":26,"value":37551},{"type":21,"tag":209,"props":39330,"children":39331},{"style":216},[39332],{"type":26,"value":1432},{"type":21,"tag":209,"props":39334,"children":39335},{"style":222},[39336],{"type":26,"value":37560},{"type":21,"tag":209,"props":39338,"children":39339},{"style":216},[39340],{"type":26,"value":18381},{"type":21,"tag":209,"props":39342,"children":39343},{"style":222},[39344],{"type":26,"value":37569},{"type":21,"tag":209,"props":39346,"children":39347},{"style":448},[39348],{"type":26,"value":37574},{"type":21,"tag":209,"props":39350,"children":39351},{"class":211,"line":279},[39352,39356],{"type":21,"tag":209,"props":39353,"children":39354},{"style":216},[39355],{"type":26,"value":9249},{"type":21,"tag":209,"props":39357,"children":39358},{"style":222},[39359],{"type":26,"value":37586},{"type":21,"tag":209,"props":39361,"children":39362},{"class":211,"line":288},[39363],{"type":21,"tag":209,"props":39364,"children":39365},{"style":222},[39366],{"type":26,"value":32675},{"type":21,"tag":209,"props":39368,"children":39369},{"class":211,"line":307},[39370,39374,39378,39382,39386,39390],{"type":21,"tag":209,"props":39371,"children":39372},{"style":216},[39373],{"type":26,"value":6334},{"type":21,"tag":209,"props":39375,"children":39376},{"style":222},[39377],{"type":26,"value":37606},{"type":21,"tag":209,"props":39379,"children":39380},{"style":360},[39381],{"type":26,"value":37611},{"type":21,"tag":209,"props":39383,"children":39384},{"style":222},[39385],{"type":26,"value":37616},{"type":21,"tag":209,"props":39387,"children":39388},{"style":360},[39389],{"type":26,"value":30164},{"type":21,"tag":209,"props":39391,"children":39392},{"style":222},[39393],{"type":26,"value":23711},{"type":21,"tag":209,"props":39395,"children":39396},{"class":211,"line":325},[39397,39402,39406],{"type":21,"tag":209,"props":39398,"children":39399},{"style":222},[39400],{"type":26,"value":39401},"        defer.",{"type":21,"tag":209,"props":39403,"children":39404},{"style":360},[39405],{"type":26,"value":14173},{"type":21,"tag":209,"props":39407,"children":39408},{"style":222},[39409],{"type":26,"value":23711},{"type":21,"tag":209,"props":39411,"children":39412},{"class":211,"line":334},[39413,39417],{"type":21,"tag":209,"props":39414,"children":39415},{"style":216},[39416],{"type":26,"value":3069},{"type":21,"tag":209,"props":39418,"children":39419},{"style":222},[39420],{"type":26,"value":241},{"type":21,"tag":209,"props":39422,"children":39423},{"class":211,"line":343},[39424],{"type":21,"tag":209,"props":39425,"children":39426},{"style":222},[39427],{"type":26,"value":331},{"type":21,"tag":209,"props":39429,"children":39430},{"class":211,"line":351},[39431,39435,39439,39443,39447,39451],{"type":21,"tag":209,"props":39432,"children":39433},{"style":216},[39434],{"type":26,"value":9249},{"type":21,"tag":209,"props":39436,"children":39437},{"style":222},[39438],{"type":26,"value":37606},{"type":21,"tag":209,"props":39440,"children":39441},{"style":360},[39442],{"type":26,"value":37611},{"type":21,"tag":209,"props":39444,"children":39445},{"style":222},[39446],{"type":26,"value":37677},{"type":21,"tag":209,"props":39448,"children":39449},{"style":360},[39450],{"type":26,"value":20749},{"type":21,"tag":209,"props":39452,"children":39453},{"style":222},[39454],{"type":26,"value":23711},{"type":21,"tag":209,"props":39456,"children":39457},{"class":211,"line":444},[39458,39463,39467],{"type":21,"tag":209,"props":39459,"children":39460},{"style":222},[39461],{"type":26,"value":39462},"    defer.",{"type":21,"tag":209,"props":39464,"children":39465},{"style":360},[39466],{"type":26,"value":14182},{"type":21,"tag":209,"props":39468,"children":39469},{"style":222},[39470],{"type":26,"value":23711},{"type":21,"tag":209,"props":39472,"children":39473},{"class":211,"line":454},[39474],{"type":21,"tag":209,"props":39475,"children":39476},{"style":222},[39477],{"type":26,"value":469},{"type":21,"tag":22,"props":39479,"children":39480},{},[39481,39483,39489,39491,39497,39498,39504],{"type":26,"value":39482},"Now, we add a listener for our namespace and request method. I'll go into more detail on this shortly, but the general form will look like ",{"type":21,"tag":63,"props":39484,"children":39486},{"className":39485},[],[39487],{"type":26,"value":39488},"url:components:method",{"type":26,"value":39490},", e.g. ",{"type":21,"tag":63,"props":39492,"children":39494},{"className":39493},[],[39495],{"type":26,"value":39496},"api:json:get",{"type":26,"value":1922},{"type":21,"tag":63,"props":39499,"children":39501},{"className":39500},[],[39502],{"type":26,"value":39503},"api:json:post",{"type":26,"value":378},{"type":21,"tag":22,"props":39506,"children":39507},{},[39508,39510,39515],{"type":26,"value":39509},"We expect the server to reply with json that will include a boolean ",{"type":21,"tag":63,"props":39511,"children":39513},{"className":39512},[],[39514],{"type":26,"value":30164},{"type":26,"value":39516}," field, and decide whether to trigger any success or error functions based on whether we've received a response and that response indicates success. We at this point also resolve or reject the promise we created earlier, and will return shortly.",{"type":21,"tag":22,"props":39518,"children":39519},{},[39520,39522,39527],{"type":26,"value":39521},"An earlier version of the code used the ",{"type":21,"tag":63,"props":39523,"children":39525},{"className":39524},[],[39526],{"type":26,"value":31971},{"type":26,"value":39528}," method of emitting, that looks like:",{"type":21,"tag":200,"props":39530,"children":39532},{"className":16138,"code":39531,"language":16140,"meta":8,"style":8},"socket.emit(namespace+method, opts.data, function(res){ // ... resolve promise ...  }\n",[39533],{"type":21,"tag":63,"props":39534,"children":39535},{"__ignoreMap":8},[39536],{"type":21,"tag":209,"props":39537,"children":39538},{"class":211,"line":212},[39539,39543,39547,39551,39555,39560,39564,39568,39572,39577],{"type":21,"tag":209,"props":39540,"children":39541},{"style":222},[39542],{"type":26,"value":39285},{"type":21,"tag":209,"props":39544,"children":39545},{"style":360},[39546],{"type":26,"value":37734},{"type":21,"tag":209,"props":39548,"children":39549},{"style":222},[39550],{"type":26,"value":37514},{"type":21,"tag":209,"props":39552,"children":39553},{"style":216},[39554],{"type":26,"value":17170},{"type":21,"tag":209,"props":39556,"children":39557},{"style":222},[39558],{"type":26,"value":39559},"method, opts.data, ",{"type":21,"tag":209,"props":39561,"children":39562},{"style":216},[39563],{"type":26,"value":4622},{"type":21,"tag":209,"props":39565,"children":39566},{"style":222},[39567],{"type":26,"value":368},{"type":21,"tag":209,"props":39569,"children":39570},{"style":400},[39571],{"type":26,"value":1385},{"type":21,"tag":209,"props":39573,"children":39574},{"style":222},[39575],{"type":26,"value":39576},"){ ",{"type":21,"tag":209,"props":39578,"children":39579},{"style":448},[39580],{"type":26,"value":39581},"// ... resolve promise ...  }\n",{"type":21,"tag":22,"props":39583,"children":39584},{},[39585,39587,39594],{"type":26,"value":39586},"Why the change? This type of request emits a ",{"type":21,"tag":29,"props":39588,"children":39591},{"href":39589,"rel":39590},"https://github.com/automattic/socket.io-protocol",[93],[39592],{"type":26,"value":39593},"Data ACK packet",{"type":26,"value":39595},", which combines the ack packet (acknowledging the request) with the data expected of the response. It seems straightforward, but the protocol dictates that communication is BLOCKED until the ack packet is received, and now you've mandated that the ack packet not get sent until its ready to send the data along with it. Not an issue if you don't mind serving in order of request, and don't expect gathering the data to return to take long, but if you want to take advantage of async, out-of-order serving of requests, you need to use the approach we've discussed above, which sends an EVENT packet which can be responded to with an immediate ACK, and sent data later when it's ready.",{"type":21,"tag":200,"props":39597,"children":39599},{"className":16138,"code":39598,"language":16140,"meta":8,"style":8}," // Emit our namespaced method and the model+opts data\nsocket.emit(namespace+method, opts.data);\n\n// Trigger the request event on the model, as per backbone spec\nmodel.trigger('request', model, promise, opts);\n// Return the promise for us to use as per usual (hanging .done blocks off, add to a .when, etc.)\nreturn promise;\n",[39600],{"type":21,"tag":63,"props":39601,"children":39602},{"__ignoreMap":8},[39603,39611,39634,39641,39649,39673,39681],{"type":21,"tag":209,"props":39604,"children":39605},{"class":211,"line":212},[39606],{"type":21,"tag":209,"props":39607,"children":39608},{"style":448},[39609],{"type":26,"value":39610}," // Emit our namespaced method and the model+opts data\n",{"type":21,"tag":209,"props":39612,"children":39613},{"class":211,"line":244},[39614,39618,39622,39626,39630],{"type":21,"tag":209,"props":39615,"children":39616},{"style":222},[39617],{"type":26,"value":39285},{"type":21,"tag":209,"props":39619,"children":39620},{"style":360},[39621],{"type":26,"value":37734},{"type":21,"tag":209,"props":39623,"children":39624},{"style":222},[39625],{"type":26,"value":37514},{"type":21,"tag":209,"props":39627,"children":39628},{"style":216},[39629],{"type":26,"value":17170},{"type":21,"tag":209,"props":39631,"children":39632},{"style":222},[39633],{"type":26,"value":37747},{"type":21,"tag":209,"props":39635,"children":39636},{"class":211,"line":254},[39637],{"type":21,"tag":209,"props":39638,"children":39639},{"emptyLinePlaceholder":248},[39640],{"type":26,"value":251},{"type":21,"tag":209,"props":39642,"children":39643},{"class":211,"line":279},[39644],{"type":21,"tag":209,"props":39645,"children":39646},{"style":448},[39647],{"type":26,"value":39648},"// Trigger the request event on the model, as per backbone spec\n",{"type":21,"tag":209,"props":39650,"children":39651},{"class":211,"line":288},[39652,39657,39661,39665,39669],{"type":21,"tag":209,"props":39653,"children":39654},{"style":222},[39655],{"type":26,"value":39656},"model.",{"type":21,"tag":209,"props":39658,"children":39659},{"style":360},[39660],{"type":26,"value":499},{"type":21,"tag":209,"props":39662,"children":39663},{"style":222},[39664],{"type":26,"value":368},{"type":21,"tag":209,"props":39666,"children":39667},{"style":233},[39668],{"type":26,"value":37783},{"type":21,"tag":209,"props":39670,"children":39671},{"style":222},[39672],{"type":26,"value":37788},{"type":21,"tag":209,"props":39674,"children":39675},{"class":211,"line":307},[39676],{"type":21,"tag":209,"props":39677,"children":39678},{"style":448},[39679],{"type":26,"value":39680},"// Return the promise for us to use as per usual (hanging .done blocks off, add to a .when, etc.)\n",{"type":21,"tag":209,"props":39682,"children":39683},{"class":211,"line":325},[39684,39688],{"type":21,"tag":209,"props":39685,"children":39686},{"style":216},[39687],{"type":26,"value":8982},{"type":21,"tag":209,"props":39689,"children":39690},{"style":222},[39691],{"type":26,"value":37808},{"type":21,"tag":22,"props":39693,"children":39694},{},[39695],{"type":26,"value":39696},"Comments say it all for this one.",{"type":21,"tag":200,"props":39698,"children":39700},{"className":16138,"code":39699,"language":16140,"meta":8,"style":8},"/**\n * Break url apart to create namespace - every '/' save any pre/post-fixing the url will become a ':' indicating\n * namespace - so a collection that maps to /api/posts will now have its events on the namespace\n * api:posts: (ie. api:posts:create, api:posts:delete, etc.), and a model that maps to /api/posts/21\n * will have events on api:posts:21: (ie. api:posts:21:update, api:posts:21:patch, etc.)\n * @param {string=} url\n */\nBackbone.Model.prototype.namespace = function(url){\n    url = url || this.url();\n    return _.trim(url, '/').replace('/', ':') + \":\";\n};\n",[39701],{"type":21,"tag":63,"props":39702,"children":39703},{"__ignoreMap":8},[39704,39711,39719,39727,39735,39743,39763,39770,39810,39845,39908],{"type":21,"tag":209,"props":39705,"children":39706},{"class":211,"line":212},[39707],{"type":21,"tag":209,"props":39708,"children":39709},{"style":448},[39710],{"type":26,"value":731},{"type":21,"tag":209,"props":39712,"children":39713},{"class":211,"line":244},[39714],{"type":21,"tag":209,"props":39715,"children":39716},{"style":448},[39717],{"type":26,"value":39718}," * Break url apart to create namespace - every '/' save any pre/post-fixing the url will become a ':' indicating\n",{"type":21,"tag":209,"props":39720,"children":39721},{"class":211,"line":254},[39722],{"type":21,"tag":209,"props":39723,"children":39724},{"style":448},[39725],{"type":26,"value":39726}," * namespace - so a collection that maps to /api/posts will now have its events on the namespace\n",{"type":21,"tag":209,"props":39728,"children":39729},{"class":211,"line":279},[39730],{"type":21,"tag":209,"props":39731,"children":39732},{"style":448},[39733],{"type":26,"value":39734}," * api:posts: (ie. api:posts:create, api:posts:delete, etc.), and a model that maps to /api/posts/21\n",{"type":21,"tag":209,"props":39736,"children":39737},{"class":211,"line":288},[39738],{"type":21,"tag":209,"props":39739,"children":39740},{"style":448},[39741],{"type":26,"value":39742}," * will have events on api:posts:21: (ie. api:posts:21:update, api:posts:21:patch, etc.)\n",{"type":21,"tag":209,"props":39744,"children":39745},{"class":211,"line":307},[39746,39751,39755,39759],{"type":21,"tag":209,"props":39747,"children":39748},{"style":448},[39749],{"type":26,"value":39750}," * ",{"type":21,"tag":209,"props":39752,"children":39753},{"style":216},[39754],{"type":26,"value":13311},{"type":21,"tag":209,"props":39756,"children":39757},{"style":360},[39758],{"type":26,"value":37877},{"type":21,"tag":209,"props":39760,"children":39761},{"style":222},[39762],{"type":26,"value":37882},{"type":21,"tag":209,"props":39764,"children":39765},{"class":211,"line":325},[39766],{"type":21,"tag":209,"props":39767,"children":39768},{"style":448},[39769],{"type":26,"value":755},{"type":21,"tag":209,"props":39771,"children":39772},{"class":211,"line":334},[39773,39778,39782,39786,39790,39794,39798,39802,39806],{"type":21,"tag":209,"props":39774,"children":39775},{"style":222},[39776],{"type":26,"value":39777},"Backbone.Model.",{"type":21,"tag":209,"props":39779,"children":39780},{"style":263},[39781],{"type":26,"value":32662},{"type":21,"tag":209,"props":39783,"children":39784},{"style":222},[39785],{"type":26,"value":378},{"type":21,"tag":209,"props":39787,"children":39788},{"style":360},[39789],{"type":26,"value":37910},{"type":21,"tag":209,"props":39791,"children":39792},{"style":216},[39793],{"type":26,"value":271},{"type":21,"tag":209,"props":39795,"children":39796},{"style":216},[39797],{"type":26,"value":4789},{"type":21,"tag":209,"props":39799,"children":39800},{"style":222},[39801],{"type":26,"value":368},{"type":21,"tag":209,"props":39803,"children":39804},{"style":400},[39805],{"type":26,"value":17951},{"type":21,"tag":209,"props":39807,"children":39808},{"style":222},[39809],{"type":26,"value":2369},{"type":21,"tag":209,"props":39811,"children":39812},{"class":211,"line":343},[39813,39817,39821,39825,39829,39833,39837,39841],{"type":21,"tag":209,"props":39814,"children":39815},{"style":222},[39816],{"type":26,"value":31379},{"type":21,"tag":209,"props":39818,"children":39819},{"style":216},[39820],{"type":26,"value":1432},{"type":21,"tag":209,"props":39822,"children":39823},{"style":222},[39824],{"type":26,"value":18080},{"type":21,"tag":209,"props":39826,"children":39827},{"style":216},[39828],{"type":26,"value":13270},{"type":21,"tag":209,"props":39830,"children":39831},{"style":263},[39832],{"type":26,"value":20502},{"type":21,"tag":209,"props":39834,"children":39835},{"style":222},[39836],{"type":26,"value":378},{"type":21,"tag":209,"props":39838,"children":39839},{"style":360},[39840],{"type":26,"value":17951},{"type":21,"tag":209,"props":39842,"children":39843},{"style":222},[39844],{"type":26,"value":4123},{"type":21,"tag":209,"props":39846,"children":39847},{"class":211,"line":351},[39848,39852,39856,39860,39864,39868,39872,39876,39880,39884,39888,39892,39896,39900,39904],{"type":21,"tag":209,"props":39849,"children":39850},{"style":216},[39851],{"type":26,"value":1298},{"type":21,"tag":209,"props":39853,"children":39854},{"style":222},[39855],{"type":26,"value":37024},{"type":21,"tag":209,"props":39857,"children":39858},{"style":360},[39859],{"type":26,"value":37982},{"type":21,"tag":209,"props":39861,"children":39862},{"style":222},[39863],{"type":26,"value":37987},{"type":21,"tag":209,"props":39865,"children":39866},{"style":233},[39867],{"type":26,"value":7645},{"type":21,"tag":209,"props":39869,"children":39870},{"style":222},[39871],{"type":26,"value":2699},{"type":21,"tag":209,"props":39873,"children":39874},{"style":360},[39875],{"type":26,"value":28378},{"type":21,"tag":209,"props":39877,"children":39878},{"style":222},[39879],{"type":26,"value":368},{"type":21,"tag":209,"props":39881,"children":39882},{"style":233},[39883],{"type":26,"value":7645},{"type":21,"tag":209,"props":39885,"children":39886},{"style":222},[39887],{"type":26,"value":408},{"type":21,"tag":209,"props":39889,"children":39890},{"style":233},[39891],{"type":26,"value":38016},{"type":21,"tag":209,"props":39893,"children":39894},{"style":222},[39895],{"type":26,"value":432},{"type":21,"tag":209,"props":39897,"children":39898},{"style":216},[39899],{"type":26,"value":17170},{"type":21,"tag":209,"props":39901,"children":39902},{"style":233},[39903],{"type":26,"value":38029},{"type":21,"tag":209,"props":39905,"children":39906},{"style":222},[39907],{"type":26,"value":241},{"type":21,"tag":209,"props":39909,"children":39910},{"class":211,"line":444},[39911],{"type":21,"tag":209,"props":39912,"children":39913},{"style":222},[39914],{"type":26,"value":340},{"type":21,"tag":22,"props":39916,"children":39917},{},[39918],{"type":26,"value":39919},"This one too, I think. Note, this isn't a required part of implementing socket.io - it just nicely mirros the style of events that backbone uses internally.",{"type":21,"tag":200,"props":39921,"children":39923},{"className":16138,"code":39922,"language":16140,"meta":8,"style":8},"/**\n * Override EventEmitter.emit and SocketNamespace reference for socket.io to add a catch all case for the\n * wildcard ('*') character. Now, socket.on('*') will catch any event, with the name of the caught event\n * passed to the handler as the first argument.\n */\nio.EventEmitter.prototype.emit = function(name){\n    var args = Array.prototype.slice.call(arguments, 1);\n\n    eventEmit.apply(this, ['*', name].concat(args));\n    eventEmit.apply(this, [name].concat(args));\n};\nio.SocketNamespace.prototype.$emit = io.EventEmitter.prototype.emit;\n",[39924],{"type":21,"tag":63,"props":39925,"children":39926},{"__ignoreMap":8},[39927,39934,39942,39950,39958,39965,40005,40060,40067,40107,40138,40145],{"type":21,"tag":209,"props":39928,"children":39929},{"class":211,"line":212},[39930],{"type":21,"tag":209,"props":39931,"children":39932},{"style":448},[39933],{"type":26,"value":731},{"type":21,"tag":209,"props":39935,"children":39936},{"class":211,"line":244},[39937],{"type":21,"tag":209,"props":39938,"children":39939},{"style":448},[39940],{"type":26,"value":39941}," * Override EventEmitter.emit and SocketNamespace reference for socket.io to add a catch all case for the\n",{"type":21,"tag":209,"props":39943,"children":39944},{"class":211,"line":254},[39945],{"type":21,"tag":209,"props":39946,"children":39947},{"style":448},[39948],{"type":26,"value":39949}," * wildcard ('*') character. Now, socket.on('*') will catch any event, with the name of the caught event\n",{"type":21,"tag":209,"props":39951,"children":39952},{"class":211,"line":279},[39953],{"type":21,"tag":209,"props":39954,"children":39955},{"style":448},[39956],{"type":26,"value":39957}," * passed to the handler as the first argument.\n",{"type":21,"tag":209,"props":39959,"children":39960},{"class":211,"line":288},[39961],{"type":21,"tag":209,"props":39962,"children":39963},{"style":448},[39964],{"type":26,"value":755},{"type":21,"tag":209,"props":39966,"children":39967},{"class":211,"line":307},[39968,39973,39977,39981,39985,39989,39993,39997,40001],{"type":21,"tag":209,"props":39969,"children":39970},{"style":222},[39971],{"type":26,"value":39972},"io.EventEmitter.",{"type":21,"tag":209,"props":39974,"children":39975},{"style":263},[39976],{"type":26,"value":32662},{"type":21,"tag":209,"props":39978,"children":39979},{"style":222},[39980],{"type":26,"value":378},{"type":21,"tag":209,"props":39982,"children":39983},{"style":360},[39984],{"type":26,"value":37734},{"type":21,"tag":209,"props":39986,"children":39987},{"style":216},[39988],{"type":26,"value":271},{"type":21,"tag":209,"props":39990,"children":39991},{"style":216},[39992],{"type":26,"value":4789},{"type":21,"tag":209,"props":39994,"children":39995},{"style":222},[39996],{"type":26,"value":368},{"type":21,"tag":209,"props":39998,"children":39999},{"style":400},[40000],{"type":26,"value":38122},{"type":21,"tag":209,"props":40002,"children":40003},{"style":222},[40004],{"type":26,"value":2369},{"type":21,"tag":209,"props":40006,"children":40007},{"class":211,"line":325},[40008,40012,40016,40020,40024,40028,40032,40036,40040,40044,40048,40052,40056],{"type":21,"tag":209,"props":40009,"children":40010},{"style":216},[40011],{"type":26,"value":16994},{"type":21,"tag":209,"props":40013,"children":40014},{"style":222},[40015],{"type":26,"value":38138},{"type":21,"tag":209,"props":40017,"children":40018},{"style":216},[40019],{"type":26,"value":1432},{"type":21,"tag":209,"props":40021,"children":40022},{"style":263},[40023],{"type":26,"value":38147},{"type":21,"tag":209,"props":40025,"children":40026},{"style":222},[40027],{"type":26,"value":378},{"type":21,"tag":209,"props":40029,"children":40030},{"style":263},[40031],{"type":26,"value":32662},{"type":21,"tag":209,"props":40033,"children":40034},{"style":222},[40035],{"type":26,"value":38160},{"type":21,"tag":209,"props":40037,"children":40038},{"style":360},[40039],{"type":26,"value":36906},{"type":21,"tag":209,"props":40041,"children":40042},{"style":222},[40043],{"type":26,"value":368},{"type":21,"tag":209,"props":40045,"children":40046},{"style":263},[40047],{"type":26,"value":38173},{"type":21,"tag":209,"props":40049,"children":40050},{"style":222},[40051],{"type":26,"value":408},{"type":21,"tag":209,"props":40053,"children":40054},{"style":263},[40055],{"type":26,"value":3224},{"type":21,"tag":209,"props":40057,"children":40058},{"style":222},[40059],{"type":26,"value":2608},{"type":21,"tag":209,"props":40061,"children":40062},{"class":211,"line":334},[40063],{"type":21,"tag":209,"props":40064,"children":40065},{"emptyLinePlaceholder":248},[40066],{"type":26,"value":251},{"type":21,"tag":209,"props":40068,"children":40069},{"class":211,"line":343},[40070,40075,40079,40083,40087,40091,40095,40099,40103],{"type":21,"tag":209,"props":40071,"children":40072},{"style":222},[40073],{"type":26,"value":40074},"    eventEmit.",{"type":21,"tag":209,"props":40076,"children":40077},{"style":360},[40078],{"type":26,"value":38205},{"type":21,"tag":209,"props":40080,"children":40081},{"style":222},[40082],{"type":26,"value":368},{"type":21,"tag":209,"props":40084,"children":40085},{"style":263},[40086],{"type":26,"value":2508},{"type":21,"tag":209,"props":40088,"children":40089},{"style":222},[40090],{"type":26,"value":38218},{"type":21,"tag":209,"props":40092,"children":40093},{"style":233},[40094],{"type":26,"value":38223},{"type":21,"tag":209,"props":40096,"children":40097},{"style":222},[40098],{"type":26,"value":38228},{"type":21,"tag":209,"props":40100,"children":40101},{"style":360},[40102],{"type":26,"value":38233},{"type":21,"tag":209,"props":40104,"children":40105},{"style":222},[40106],{"type":26,"value":38238},{"type":21,"tag":209,"props":40108,"children":40109},{"class":211,"line":351},[40110,40114,40118,40122,40126,40130,40134],{"type":21,"tag":209,"props":40111,"children":40112},{"style":222},[40113],{"type":26,"value":40074},{"type":21,"tag":209,"props":40115,"children":40116},{"style":360},[40117],{"type":26,"value":38205},{"type":21,"tag":209,"props":40119,"children":40120},{"style":222},[40121],{"type":26,"value":368},{"type":21,"tag":209,"props":40123,"children":40124},{"style":263},[40125],{"type":26,"value":2508},{"type":21,"tag":209,"props":40127,"children":40128},{"style":222},[40129],{"type":26,"value":38262},{"type":21,"tag":209,"props":40131,"children":40132},{"style":360},[40133],{"type":26,"value":38233},{"type":21,"tag":209,"props":40135,"children":40136},{"style":222},[40137],{"type":26,"value":38238},{"type":21,"tag":209,"props":40139,"children":40140},{"class":211,"line":444},[40141],{"type":21,"tag":209,"props":40142,"children":40143},{"style":222},[40144],{"type":26,"value":340},{"type":21,"tag":209,"props":40146,"children":40147},{"class":211,"line":454},[40148,40153,40157,40161,40165,40169,40173],{"type":21,"tag":209,"props":40149,"children":40150},{"style":222},[40151],{"type":26,"value":40152},"io.SocketNamespace.",{"type":21,"tag":209,"props":40154,"children":40155},{"style":263},[40156],{"type":26,"value":32662},{"type":21,"tag":209,"props":40158,"children":40159},{"style":222},[40160],{"type":26,"value":38294},{"type":21,"tag":209,"props":40162,"children":40163},{"style":216},[40164],{"type":26,"value":1432},{"type":21,"tag":209,"props":40166,"children":40167},{"style":222},[40168],{"type":26,"value":36783},{"type":21,"tag":209,"props":40170,"children":40171},{"style":263},[40172],{"type":26,"value":32662},{"type":21,"tag":209,"props":40174,"children":40175},{"style":222},[40176],{"type":26,"value":38311},{"type":21,"tag":22,"props":40178,"children":40179},{},[40180,40182,40187],{"type":26,"value":40181},"And here's the reason why we saved the io ",{"type":21,"tag":63,"props":40183,"children":40185},{"className":40184},[],[40186],{"type":26,"value":37734},{"type":26,"value":40188}," function earlier - this little shim sits in front of the standard emit and allows us to add a wildcard catch-all for events on a socket.",{"type":21,"tag":22,"props":40190,"children":40191},{},[40192],{"type":26,"value":40193},"And that's all folks! Of course, you'll need to support your implementation on the server-side - how exactly you go about that will depend on the language and library your using.",{"type":21,"tag":22,"props":40195,"children":40196},{},[40197],{"type":26,"value":40198},"I do have one more goodie for you, though - here's a version of the above tailored for those of you using Marionette:",{"type":21,"tag":200,"props":40200,"children":40202},{"className":16138,"code":40201,"language":16140,"meta":8,"style":8},"/**\n * Copyright (c) Christopher Keefer. All Rights Reserved.\n *\n * Overrides the default transport for Backbone syncing to use websockets via socket.io. Includes marionette     \n * convenience code, specifically for sending socket-related events along the global event aggregator.\n */\n(function(app, Backbone, Marionette, $, _, io){\n    var urlError = function(){\n        throw new Error('A \"url\" property or function must be specified.');\n    },\n        eventEmit = io.EventEmitter.prototype.emit,\n        ajaxSync = Backbone.sync;\n\n    /**\n     * Preserve the standard, jquery ajax based persistance method as ajaxSync.\n     */\n    Backbone.ajaxSync = function(method, model, options){\n        return ajaxSync.call(this, method, model, options);\n    };\n\n    /**\n     * Replace the standard sync function with our new, websocket/socket.io based solution.\n     */\n    Backbone.sync = function(method, model, options){\n        var opts = _.extend({}, options),\n            defer = $.Deferred(),\n            promise = defer.promise(),\n            namespace,\n            socket;\n\n        opts.url = (opts.url) ? _.result(opts, 'url') : (model.url) ? _.result(model, 'url') : void 0;\n        // If no url property has been specified, throw an error, as per the standard Backbone sync\n        if (!opts.url) urlError();\n        namespace = Backbone.Model.prototype.namespace.call(this, opts.url);\n        // Determine what data we're sending, and ensure id is present if we're performing a PATCH call\n        if (!opts.data && model) opts.data = opts.attrs || model.toJSON(options) || {};\n        if ((opts.data.id === null || opts.data.id === void 0) && opts.patch === true && model){\n            opts.data.id = model.id;\n        }\n        // Determine which websocket to use - set in options, on model, or on global app\n        socket = opts.socket || model.socket || app.socket;\n        // Trigger the app event aggregator for interested listeners to know we're about to request data via websocket\n        app.vent.trigger('backbone:request', namespace);\n        // Add a listener for our namespaced method, and resolve or reject our deferred based on the response\n        socket.once(namespace+method, function(res){\n            var success = (res && res.success);\n            // Trigger the app event aggregator to indicate we've received a return from the server, and success\n            app.vent.trigger('backbone:receive', namespace, success);\n            if (success)\n            {\n                if (_.isFunction(options.success)) options.success(res);\n                defer.resolve(res);\n                return;\n            }\n            if (_.isFunction(options.error)) options.error(res);\n            defer.reject(res);\n        });\n\n        // Emit our namespaced method and the model+opts data\n        socket.emit(namespace+method, opts.data);\n\n        // Trigger the request event on the model, as per backbone spec\n        model.trigger('request', model, promise, opts);\n        // Return the promise for us to use as per usual (hanging .done blocks off, add to a .when, etc.)\n        return promise;\n    };\n\n    /**\n     * Break url apart to create namespace - every '/' save any pre/post-fixing the url will become a ':' indicating\n     * namespace - so a collection that maps to /api/posts will now have its events on the namespace\n     * api:posts: (ie. api:posts:create, api:posts:delete, etc.), and a model that maps to /api/posts/21\n     * will have events on api:posts:21: (ie. api:posts:21:update, api:posts:21:patch, etc.)\n     * @param {string=} url\n     */\n    Backbone.Model.prototype.namespace = function(url){\n        url = url || this.url();\n        return _.trim(url, '/').replace('/', ':') + \":\";\n    };\n\n    /**\n     * Override EventEmitter.emit and SocketNamespace reference for socket.io to add a catch all case for the\n     * wildcard ('*') character. Now, socket.on('*') will catch any event, with the name of the caught event\n     * passed to the handler as the first argument.\n    */\n    io.EventEmitter.prototype.emit = function(name){\n        var args = Array.prototype.slice.call(arguments, 1);\n\n        eventEmit.apply(this, ['*', name].concat(args));\n        eventEmit.apply(this, [name].concat(args));\n    };\n    io.SocketNamespace.prototype.$emit = io.EventEmitter.prototype.emit;\n\n    /**\n     * Create a socket io instance that will echo all events into the application event aggregator, so that\n     * collections, models, etc. can listen on app.vent for their events.\n     * @param {string=} url\n     * @constructor\n     */\n    Marionette.Application.prototype.SocketIO = function(url){\n        var socket = io.connect(url, {\n            transports:['websocket']\n        });\n\n        /**\n         * On any event from the server, trigger it on the app event aggregator. The first\n         * argument will always be the name of the event.\n         */\n        socket.on('*', function(){\n            var args = Array.prototype.slice.call(arguments, 0);\n            app.vent.trigger(args[0], args.slice(1));\n        });\n\n        /**\n         * On error, trigger the socket:error event on the global event aggregator for \n         * interested listeners.\n         */\n        socket.on('error', function(err){\n            app.vent.trigger('socket:error', err);\n        });\n\n        return socket;\n    }\n})(app /* replace with your global app object */, Backbone, Backbone.Marionette, jQuery, _, io);\n",[40203],{"type":21,"tag":63,"props":40204,"children":40205},{"__ignoreMap":8},[40206,40213,40220,40227,40235,40243,40250,40313,40336,40363,40370,40393,40408,40415,40422,40429,40436,40483,40510,40517,40524,40531,40538,40545,40592,40619,40642,40665,40672,40679,40686,40773,40780,40807,40846,40853,40912,40979,40994,41001,41009,41042,41050,41076,41083,41122,41150,41158,41184,41195,41202,41229,41244,41255,41262,41289,41304,41311,41318,41325,41348,41355,41362,41385,41392,41403,41410,41417,41424,41431,41438,41445,41452,41471,41478,41517,41552,41615,41622,41629,41636,41643,41650,41657,41664,41703,41758,41765,41804,41835,41842,41873,41880,41887,41895,41903,41922,41934,41941,41982,42012,42029,42036,42043,42050,42058,42066,42073,42104,42159,42201,42208,42215,42222,42230,42238,42245,42284,42308,42315,42322,42334,42341],{"type":21,"tag":209,"props":40207,"children":40208},{"class":211,"line":212},[40209],{"type":21,"tag":209,"props":40210,"children":40211},{"style":448},[40212],{"type":26,"value":731},{"type":21,"tag":209,"props":40214,"children":40215},{"class":211,"line":244},[40216],{"type":21,"tag":209,"props":40217,"children":40218},{"style":448},[40219],{"type":26,"value":36637},{"type":21,"tag":209,"props":40221,"children":40222},{"class":211,"line":254},[40223],{"type":21,"tag":209,"props":40224,"children":40225},{"style":448},[40226],{"type":26,"value":17778},{"type":21,"tag":209,"props":40228,"children":40229},{"class":211,"line":279},[40230],{"type":21,"tag":209,"props":40231,"children":40232},{"style":448},[40233],{"type":26,"value":40234}," * Overrides the default transport for Backbone syncing to use websockets via socket.io. Includes marionette     \n",{"type":21,"tag":209,"props":40236,"children":40237},{"class":211,"line":288},[40238],{"type":21,"tag":209,"props":40239,"children":40240},{"style":448},[40241],{"type":26,"value":40242}," * convenience code, specifically for sending socket-related events along the global event aggregator.\n",{"type":21,"tag":209,"props":40244,"children":40245},{"class":211,"line":307},[40246],{"type":21,"tag":209,"props":40247,"children":40248},{"style":448},[40249],{"type":26,"value":755},{"type":21,"tag":209,"props":40251,"children":40252},{"class":211,"line":325},[40253,40257,40261,40265,40269,40273,40277,40281,40285,40289,40293,40297,40301,40305,40309],{"type":21,"tag":209,"props":40254,"children":40255},{"style":222},[40256],{"type":26,"value":368},{"type":21,"tag":209,"props":40258,"children":40259},{"style":216},[40260],{"type":26,"value":4622},{"type":21,"tag":209,"props":40262,"children":40263},{"style":222},[40264],{"type":26,"value":368},{"type":21,"tag":209,"props":40266,"children":40267},{"style":400},[40268],{"type":26,"value":5246},{"type":21,"tag":209,"props":40270,"children":40271},{"style":222},[40272],{"type":26,"value":408},{"type":21,"tag":209,"props":40274,"children":40275},{"style":400},[40276],{"type":26,"value":33923},{"type":21,"tag":209,"props":40278,"children":40279},{"style":222},[40280],{"type":26,"value":408},{"type":21,"tag":209,"props":40282,"children":40283},{"style":400},[40284],{"type":26,"value":33764},{"type":21,"tag":209,"props":40286,"children":40287},{"style":222},[40288],{"type":26,"value":408},{"type":21,"tag":209,"props":40290,"children":40291},{"style":400},[40292],{"type":26,"value":6476},{"type":21,"tag":209,"props":40294,"children":40295},{"style":222},[40296],{"type":26,"value":408},{"type":21,"tag":209,"props":40298,"children":40299},{"style":400},[40300],{"type":26,"value":34284},{"type":21,"tag":209,"props":40302,"children":40303},{"style":222},[40304],{"type":26,"value":408},{"type":21,"tag":209,"props":40306,"children":40307},{"style":400},[40308],{"type":26,"value":36703},{"type":21,"tag":209,"props":40310,"children":40311},{"style":222},[40312],{"type":26,"value":2369},{"type":21,"tag":209,"props":40314,"children":40315},{"class":211,"line":334},[40316,40320,40324,40328,40332],{"type":21,"tag":209,"props":40317,"children":40318},{"style":216},[40319],{"type":26,"value":16994},{"type":21,"tag":209,"props":40321,"children":40322},{"style":360},[40323],{"type":26,"value":36719},{"type":21,"tag":209,"props":40325,"children":40326},{"style":216},[40327],{"type":26,"value":271},{"type":21,"tag":209,"props":40329,"children":40330},{"style":216},[40331],{"type":26,"value":4789},{"type":21,"tag":209,"props":40333,"children":40334},{"style":222},[40335],{"type":26,"value":2561},{"type":21,"tag":209,"props":40337,"children":40338},{"class":211,"line":343},[40339,40343,40347,40351,40355,40359],{"type":21,"tag":209,"props":40340,"children":40341},{"style":216},[40342],{"type":26,"value":18422},{"type":21,"tag":209,"props":40344,"children":40345},{"style":216},[40346],{"type":26,"value":6371},{"type":21,"tag":209,"props":40348,"children":40349},{"style":360},[40350],{"type":26,"value":21552},{"type":21,"tag":209,"props":40352,"children":40353},{"style":222},[40354],{"type":26,"value":368},{"type":21,"tag":209,"props":40356,"children":40357},{"style":233},[40358],{"type":26,"value":36755},{"type":21,"tag":209,"props":40360,"children":40361},{"style":222},[40362],{"type":26,"value":2608},{"type":21,"tag":209,"props":40364,"children":40365},{"class":211,"line":351},[40366],{"type":21,"tag":209,"props":40367,"children":40368},{"style":222},[40369],{"type":26,"value":2251},{"type":21,"tag":209,"props":40371,"children":40372},{"class":211,"line":444},[40373,40377,40381,40385,40389],{"type":21,"tag":209,"props":40374,"children":40375},{"style":222},[40376],{"type":26,"value":36774},{"type":21,"tag":209,"props":40378,"children":40379},{"style":216},[40380],{"type":26,"value":1432},{"type":21,"tag":209,"props":40382,"children":40383},{"style":222},[40384],{"type":26,"value":36783},{"type":21,"tag":209,"props":40386,"children":40387},{"style":263},[40388],{"type":26,"value":32662},{"type":21,"tag":209,"props":40390,"children":40391},{"style":222},[40392],{"type":26,"value":36792},{"type":21,"tag":209,"props":40394,"children":40395},{"class":211,"line":454},[40396,40400,40404],{"type":21,"tag":209,"props":40397,"children":40398},{"style":222},[40399],{"type":26,"value":36800},{"type":21,"tag":209,"props":40401,"children":40402},{"style":216},[40403],{"type":26,"value":1432},{"type":21,"tag":209,"props":40405,"children":40406},{"style":222},[40407],{"type":26,"value":36809},{"type":21,"tag":209,"props":40409,"children":40410},{"class":211,"line":463},[40411],{"type":21,"tag":209,"props":40412,"children":40413},{"emptyLinePlaceholder":248},[40414],{"type":26,"value":251},{"type":21,"tag":209,"props":40416,"children":40417},{"class":211,"line":472},[40418],{"type":21,"tag":209,"props":40419,"children":40420},{"style":448},[40421],{"type":26,"value":13290},{"type":21,"tag":209,"props":40423,"children":40424},{"class":211,"line":480},[40425],{"type":21,"tag":209,"props":40426,"children":40427},{"style":448},[40428],{"type":26,"value":36831},{"type":21,"tag":209,"props":40430,"children":40431},{"class":211,"line":489},[40432],{"type":21,"tag":209,"props":40433,"children":40434},{"style":448},[40435],{"type":26,"value":13346},{"type":21,"tag":209,"props":40437,"children":40438},{"class":211,"line":847},[40439,40443,40447,40451,40455,40459,40463,40467,40471,40475,40479],{"type":21,"tag":209,"props":40440,"children":40441},{"style":222},[40442],{"type":26,"value":36846},{"type":21,"tag":209,"props":40444,"children":40445},{"style":360},[40446],{"type":26,"value":36851},{"type":21,"tag":209,"props":40448,"children":40449},{"style":216},[40450],{"type":26,"value":271},{"type":21,"tag":209,"props":40452,"children":40453},{"style":216},[40454],{"type":26,"value":4789},{"type":21,"tag":209,"props":40456,"children":40457},{"style":222},[40458],{"type":26,"value":368},{"type":21,"tag":209,"props":40460,"children":40461},{"style":400},[40462],{"type":26,"value":36868},{"type":21,"tag":209,"props":40464,"children":40465},{"style":222},[40466],{"type":26,"value":408},{"type":21,"tag":209,"props":40468,"children":40469},{"style":400},[40470],{"type":26,"value":36877},{"type":21,"tag":209,"props":40472,"children":40473},{"style":222},[40474],{"type":26,"value":408},{"type":21,"tag":209,"props":40476,"children":40477},{"style":400},[40478],{"type":26,"value":28349},{"type":21,"tag":209,"props":40480,"children":40481},{"style":222},[40482],{"type":26,"value":2369},{"type":21,"tag":209,"props":40484,"children":40485},{"class":211,"line":860},[40486,40490,40494,40498,40502,40506],{"type":21,"tag":209,"props":40487,"children":40488},{"style":216},[40489],{"type":26,"value":3069},{"type":21,"tag":209,"props":40491,"children":40492},{"style":222},[40493],{"type":26,"value":36901},{"type":21,"tag":209,"props":40495,"children":40496},{"style":360},[40497],{"type":26,"value":36906},{"type":21,"tag":209,"props":40499,"children":40500},{"style":222},[40501],{"type":26,"value":368},{"type":21,"tag":209,"props":40503,"children":40504},{"style":263},[40505],{"type":26,"value":2508},{"type":21,"tag":209,"props":40507,"children":40508},{"style":222},[40509],{"type":26,"value":36919},{"type":21,"tag":209,"props":40511,"children":40512},{"class":211,"line":877},[40513],{"type":21,"tag":209,"props":40514,"children":40515},{"style":222},[40516],{"type":26,"value":13439},{"type":21,"tag":209,"props":40518,"children":40519},{"class":211,"line":889},[40520],{"type":21,"tag":209,"props":40521,"children":40522},{"emptyLinePlaceholder":248},[40523],{"type":26,"value":251},{"type":21,"tag":209,"props":40525,"children":40526},{"class":211,"line":902},[40527],{"type":21,"tag":209,"props":40528,"children":40529},{"style":448},[40530],{"type":26,"value":13290},{"type":21,"tag":209,"props":40532,"children":40533},{"class":211,"line":914},[40534],{"type":21,"tag":209,"props":40535,"children":40536},{"style":448},[40537],{"type":26,"value":36948},{"type":21,"tag":209,"props":40539,"children":40540},{"class":211,"line":922},[40541],{"type":21,"tag":209,"props":40542,"children":40543},{"style":448},[40544],{"type":26,"value":13346},{"type":21,"tag":209,"props":40546,"children":40547},{"class":211,"line":2312},[40548,40552,40556,40560,40564,40568,40572,40576,40580,40584,40588],{"type":21,"tag":209,"props":40549,"children":40550},{"style":222},[40551],{"type":26,"value":36846},{"type":21,"tag":209,"props":40553,"children":40554},{"style":360},[40555],{"type":26,"value":36967},{"type":21,"tag":209,"props":40557,"children":40558},{"style":216},[40559],{"type":26,"value":271},{"type":21,"tag":209,"props":40561,"children":40562},{"style":216},[40563],{"type":26,"value":4789},{"type":21,"tag":209,"props":40565,"children":40566},{"style":222},[40567],{"type":26,"value":368},{"type":21,"tag":209,"props":40569,"children":40570},{"style":400},[40571],{"type":26,"value":36868},{"type":21,"tag":209,"props":40573,"children":40574},{"style":222},[40575],{"type":26,"value":408},{"type":21,"tag":209,"props":40577,"children":40578},{"style":400},[40579],{"type":26,"value":36877},{"type":21,"tag":209,"props":40581,"children":40582},{"style":222},[40583],{"type":26,"value":408},{"type":21,"tag":209,"props":40585,"children":40586},{"style":400},[40587],{"type":26,"value":28349},{"type":21,"tag":209,"props":40589,"children":40590},{"style":222},[40591],{"type":26,"value":2369},{"type":21,"tag":209,"props":40593,"children":40594},{"class":211,"line":2321},[40595,40599,40603,40607,40611,40615],{"type":21,"tag":209,"props":40596,"children":40597},{"style":216},[40598],{"type":26,"value":14505},{"type":21,"tag":209,"props":40600,"children":40601},{"style":222},[40602],{"type":26,"value":37015},{"type":21,"tag":209,"props":40604,"children":40605},{"style":216},[40606],{"type":26,"value":1432},{"type":21,"tag":209,"props":40608,"children":40609},{"style":222},[40610],{"type":26,"value":37024},{"type":21,"tag":209,"props":40612,"children":40613},{"style":360},[40614],{"type":26,"value":34329},{"type":21,"tag":209,"props":40616,"children":40617},{"style":222},[40618],{"type":26,"value":37033},{"type":21,"tag":209,"props":40620,"children":40621},{"class":211,"line":2372},[40622,40626,40630,40634,40638],{"type":21,"tag":209,"props":40623,"children":40624},{"style":222},[40625],{"type":26,"value":37041},{"type":21,"tag":209,"props":40627,"children":40628},{"style":216},[40629],{"type":26,"value":1432},{"type":21,"tag":209,"props":40631,"children":40632},{"style":222},[40633],{"type":26,"value":25427},{"type":21,"tag":209,"props":40635,"children":40636},{"style":360},[40637],{"type":26,"value":25432},{"type":21,"tag":209,"props":40639,"children":40640},{"style":222},[40641],{"type":26,"value":13988},{"type":21,"tag":209,"props":40643,"children":40644},{"class":211,"line":2381},[40645,40649,40653,40657,40661],{"type":21,"tag":209,"props":40646,"children":40647},{"style":222},[40648],{"type":26,"value":37065},{"type":21,"tag":209,"props":40650,"children":40651},{"style":216},[40652],{"type":26,"value":1432},{"type":21,"tag":209,"props":40654,"children":40655},{"style":222},[40656],{"type":26,"value":26782},{"type":21,"tag":209,"props":40658,"children":40659},{"style":360},[40660],{"type":26,"value":26332},{"type":21,"tag":209,"props":40662,"children":40663},{"style":222},[40664],{"type":26,"value":13988},{"type":21,"tag":209,"props":40666,"children":40667},{"class":211,"line":2389},[40668],{"type":21,"tag":209,"props":40669,"children":40670},{"style":222},[40671],{"type":26,"value":37089},{"type":21,"tag":209,"props":40673,"children":40674},{"class":211,"line":2397},[40675],{"type":21,"tag":209,"props":40676,"children":40677},{"style":222},[40678],{"type":26,"value":37097},{"type":21,"tag":209,"props":40680,"children":40681},{"class":211,"line":2406},[40682],{"type":21,"tag":209,"props":40683,"children":40684},{"emptyLinePlaceholder":248},[40685],{"type":26,"value":251},{"type":21,"tag":209,"props":40687,"children":40688},{"class":211,"line":2415},[40689,40693,40697,40701,40705,40709,40713,40717,40721,40725,40729,40733,40737,40741,40745,40749,40753,40757,40761,40765,40769],{"type":21,"tag":209,"props":40690,"children":40691},{"style":222},[40692],{"type":26,"value":37112},{"type":21,"tag":209,"props":40694,"children":40695},{"style":216},[40696],{"type":26,"value":1432},{"type":21,"tag":209,"props":40698,"children":40699},{"style":222},[40700],{"type":26,"value":37121},{"type":21,"tag":209,"props":40702,"children":40703},{"style":216},[40704],{"type":26,"value":8258},{"type":21,"tag":209,"props":40706,"children":40707},{"style":222},[40708],{"type":26,"value":37024},{"type":21,"tag":209,"props":40710,"children":40711},{"style":360},[40712],{"type":26,"value":30775},{"type":21,"tag":209,"props":40714,"children":40715},{"style":222},[40716],{"type":26,"value":37138},{"type":21,"tag":209,"props":40718,"children":40719},{"style":233},[40720],{"type":26,"value":37143},{"type":21,"tag":209,"props":40722,"children":40723},{"style":222},[40724],{"type":26,"value":432},{"type":21,"tag":209,"props":40726,"children":40727},{"style":216},[40728],{"type":26,"value":191},{"type":21,"tag":209,"props":40730,"children":40731},{"style":222},[40732],{"type":26,"value":37156},{"type":21,"tag":209,"props":40734,"children":40735},{"style":216},[40736],{"type":26,"value":8258},{"type":21,"tag":209,"props":40738,"children":40739},{"style":222},[40740],{"type":26,"value":37024},{"type":21,"tag":209,"props":40742,"children":40743},{"style":360},[40744],{"type":26,"value":30775},{"type":21,"tag":209,"props":40746,"children":40747},{"style":222},[40748],{"type":26,"value":37173},{"type":21,"tag":209,"props":40750,"children":40751},{"style":233},[40752],{"type":26,"value":37143},{"type":21,"tag":209,"props":40754,"children":40755},{"style":222},[40756],{"type":26,"value":432},{"type":21,"tag":209,"props":40758,"children":40759},{"style":216},[40760],{"type":26,"value":191},{"type":21,"tag":209,"props":40762,"children":40763},{"style":216},[40764],{"type":26,"value":37190},{"type":21,"tag":209,"props":40766,"children":40767},{"style":263},[40768],{"type":26,"value":8009},{"type":21,"tag":209,"props":40770,"children":40771},{"style":222},[40772],{"type":26,"value":241},{"type":21,"tag":209,"props":40774,"children":40775},{"class":211,"line":2424},[40776],{"type":21,"tag":209,"props":40777,"children":40778},{"style":448},[40779],{"type":26,"value":37206},{"type":21,"tag":209,"props":40781,"children":40782},{"class":211,"line":2433},[40783,40787,40791,40795,40799,40803],{"type":21,"tag":209,"props":40784,"children":40785},{"style":216},[40786],{"type":26,"value":6334},{"type":21,"tag":209,"props":40788,"children":40789},{"style":222},[40790],{"type":26,"value":5569},{"type":21,"tag":209,"props":40792,"children":40793},{"style":216},[40794],{"type":26,"value":6455},{"type":21,"tag":209,"props":40796,"children":40797},{"style":222},[40798],{"type":26,"value":37226},{"type":21,"tag":209,"props":40800,"children":40801},{"style":360},[40802],{"type":26,"value":37231},{"type":21,"tag":209,"props":40804,"children":40805},{"style":222},[40806],{"type":26,"value":4123},{"type":21,"tag":209,"props":40808,"children":40809},{"class":211,"line":2442},[40810,40814,40818,40822,40826,40830,40834,40838,40842],{"type":21,"tag":209,"props":40811,"children":40812},{"style":222},[40813],{"type":26,"value":37251},{"type":21,"tag":209,"props":40815,"children":40816},{"style":216},[40817],{"type":26,"value":1432},{"type":21,"tag":209,"props":40819,"children":40820},{"style":222},[40821],{"type":26,"value":37260},{"type":21,"tag":209,"props":40823,"children":40824},{"style":263},[40825],{"type":26,"value":32662},{"type":21,"tag":209,"props":40827,"children":40828},{"style":222},[40829],{"type":26,"value":37269},{"type":21,"tag":209,"props":40831,"children":40832},{"style":360},[40833],{"type":26,"value":36906},{"type":21,"tag":209,"props":40835,"children":40836},{"style":222},[40837],{"type":26,"value":368},{"type":21,"tag":209,"props":40839,"children":40840},{"style":263},[40841],{"type":26,"value":2508},{"type":21,"tag":209,"props":40843,"children":40844},{"style":222},[40845],{"type":26,"value":37286},{"type":21,"tag":209,"props":40847,"children":40848},{"class":211,"line":2471},[40849],{"type":21,"tag":209,"props":40850,"children":40851},{"style":448},[40852],{"type":26,"value":37294},{"type":21,"tag":209,"props":40854,"children":40855},{"class":211,"line":2480},[40856,40860,40864,40868,40872,40876,40880,40884,40888,40892,40896,40900,40904,40908],{"type":21,"tag":209,"props":40857,"children":40858},{"style":216},[40859],{"type":26,"value":6334},{"type":21,"tag":209,"props":40861,"children":40862},{"style":222},[40863],{"type":26,"value":5569},{"type":21,"tag":209,"props":40865,"children":40866},{"style":216},[40867],{"type":26,"value":6455},{"type":21,"tag":209,"props":40869,"children":40870},{"style":222},[40871],{"type":26,"value":37314},{"type":21,"tag":209,"props":40873,"children":40874},{"style":216},[40875],{"type":26,"value":18381},{"type":21,"tag":209,"props":40877,"children":40878},{"style":222},[40879],{"type":26,"value":37323},{"type":21,"tag":209,"props":40881,"children":40882},{"style":216},[40883],{"type":26,"value":1432},{"type":21,"tag":209,"props":40885,"children":40886},{"style":222},[40887],{"type":26,"value":37332},{"type":21,"tag":209,"props":40889,"children":40890},{"style":216},[40891],{"type":26,"value":13270},{"type":21,"tag":209,"props":40893,"children":40894},{"style":222},[40895],{"type":26,"value":37341},{"type":21,"tag":209,"props":40897,"children":40898},{"style":360},[40899],{"type":26,"value":37346},{"type":21,"tag":209,"props":40901,"children":40902},{"style":222},[40903],{"type":26,"value":37351},{"type":21,"tag":209,"props":40905,"children":40906},{"style":216},[40907],{"type":26,"value":13270},{"type":21,"tag":209,"props":40909,"children":40910},{"style":222},[40911],{"type":26,"value":7963},{"type":21,"tag":209,"props":40913,"children":40914},{"class":211,"line":2489},[40915,40919,40923,40927,40931,40935,40939,40943,40947,40951,40955,40959,40963,40967,40971,40975],{"type":21,"tag":209,"props":40916,"children":40917},{"style":216},[40918],{"type":26,"value":6334},{"type":21,"tag":209,"props":40920,"children":40921},{"style":222},[40922],{"type":26,"value":37371},{"type":21,"tag":209,"props":40924,"children":40925},{"style":216},[40926],{"type":26,"value":14680},{"type":21,"tag":209,"props":40928,"children":40929},{"style":263},[40930],{"type":26,"value":8282},{"type":21,"tag":209,"props":40932,"children":40933},{"style":216},[40934],{"type":26,"value":4608},{"type":21,"tag":209,"props":40936,"children":40937},{"style":222},[40938],{"type":26,"value":37388},{"type":21,"tag":209,"props":40940,"children":40941},{"style":216},[40942],{"type":26,"value":14680},{"type":21,"tag":209,"props":40944,"children":40945},{"style":216},[40946],{"type":26,"value":37190},{"type":21,"tag":209,"props":40948,"children":40949},{"style":263},[40950],{"type":26,"value":8009},{"type":21,"tag":209,"props":40952,"children":40953},{"style":222},[40954],{"type":26,"value":432},{"type":21,"tag":209,"props":40956,"children":40957},{"style":216},[40958],{"type":26,"value":18381},{"type":21,"tag":209,"props":40960,"children":40961},{"style":222},[40962],{"type":26,"value":37413},{"type":21,"tag":209,"props":40964,"children":40965},{"style":216},[40966],{"type":26,"value":14680},{"type":21,"tag":209,"props":40968,"children":40969},{"style":263},[40970],{"type":26,"value":14819},{"type":21,"tag":209,"props":40972,"children":40973},{"style":216},[40974],{"type":26,"value":18342},{"type":21,"tag":209,"props":40976,"children":40977},{"style":222},[40978],{"type":26,"value":37430},{"type":21,"tag":209,"props":40980,"children":40981},{"class":211,"line":2516},[40982,40986,40990],{"type":21,"tag":209,"props":40983,"children":40984},{"style":222},[40985],{"type":26,"value":37438},{"type":21,"tag":209,"props":40987,"children":40988},{"style":216},[40989],{"type":26,"value":1432},{"type":21,"tag":209,"props":40991,"children":40992},{"style":222},[40993],{"type":26,"value":37447},{"type":21,"tag":209,"props":40995,"children":40996},{"class":211,"line":2525},[40997],{"type":21,"tag":209,"props":40998,"children":40999},{"style":222},[41000],{"type":26,"value":2235},{"type":21,"tag":209,"props":41002,"children":41003},{"class":211,"line":2533},[41004],{"type":21,"tag":209,"props":41005,"children":41006},{"style":448},[41007],{"type":26,"value":41008},"        // Determine which websocket to use - set in options, on model, or on global app\n",{"type":21,"tag":209,"props":41010,"children":41011},{"class":211,"line":2542},[41012,41016,41020,41024,41028,41033,41037],{"type":21,"tag":209,"props":41013,"children":41014},{"style":222},[41015],{"type":26,"value":37470},{"type":21,"tag":209,"props":41017,"children":41018},{"style":216},[41019],{"type":26,"value":1432},{"type":21,"tag":209,"props":41021,"children":41022},{"style":222},[41023],{"type":26,"value":37479},{"type":21,"tag":209,"props":41025,"children":41026},{"style":216},[41027],{"type":26,"value":13270},{"type":21,"tag":209,"props":41029,"children":41030},{"style":222},[41031],{"type":26,"value":41032}," model.socket ",{"type":21,"tag":209,"props":41034,"children":41035},{"style":216},[41036],{"type":26,"value":13270},{"type":21,"tag":209,"props":41038,"children":41039},{"style":222},[41040],{"type":26,"value":41041}," app.socket;\n",{"type":21,"tag":209,"props":41043,"children":41044},{"class":211,"line":2550},[41045],{"type":21,"tag":209,"props":41046,"children":41047},{"style":448},[41048],{"type":26,"value":41049},"        // Trigger the app event aggregator for interested listeners to know we're about to request data via websocket\n",{"type":21,"tag":209,"props":41051,"children":41052},{"class":211,"line":2564},[41053,41058,41062,41066,41071],{"type":21,"tag":209,"props":41054,"children":41055},{"style":222},[41056],{"type":26,"value":41057},"        app.vent.",{"type":21,"tag":209,"props":41059,"children":41060},{"style":360},[41061],{"type":26,"value":499},{"type":21,"tag":209,"props":41063,"children":41064},{"style":222},[41065],{"type":26,"value":368},{"type":21,"tag":209,"props":41067,"children":41068},{"style":233},[41069],{"type":26,"value":41070},"'backbone:request'",{"type":21,"tag":209,"props":41072,"children":41073},{"style":222},[41074],{"type":26,"value":41075},", namespace);\n",{"type":21,"tag":209,"props":41077,"children":41078},{"class":211,"line":2611},[41079],{"type":21,"tag":209,"props":41080,"children":41081},{"style":448},[41082],{"type":26,"value":37496},{"type":21,"tag":209,"props":41084,"children":41085},{"class":211,"line":2619},[41086,41090,41094,41098,41102,41106,41110,41114,41118],{"type":21,"tag":209,"props":41087,"children":41088},{"style":222},[41089],{"type":26,"value":37504},{"type":21,"tag":209,"props":41091,"children":41092},{"style":360},[41093],{"type":26,"value":37509},{"type":21,"tag":209,"props":41095,"children":41096},{"style":222},[41097],{"type":26,"value":37514},{"type":21,"tag":209,"props":41099,"children":41100},{"style":216},[41101],{"type":26,"value":17170},{"type":21,"tag":209,"props":41103,"children":41104},{"style":222},[41105],{"type":26,"value":37523},{"type":21,"tag":209,"props":41107,"children":41108},{"style":216},[41109],{"type":26,"value":4622},{"type":21,"tag":209,"props":41111,"children":41112},{"style":222},[41113],{"type":26,"value":368},{"type":21,"tag":209,"props":41115,"children":41116},{"style":400},[41117],{"type":26,"value":1385},{"type":21,"tag":209,"props":41119,"children":41120},{"style":222},[41121],{"type":26,"value":2369},{"type":21,"tag":209,"props":41123,"children":41124},{"class":211,"line":2627},[41125,41129,41133,41137,41141,41145],{"type":21,"tag":209,"props":41126,"children":41127},{"style":216},[41128],{"type":26,"value":14539},{"type":21,"tag":209,"props":41130,"children":41131},{"style":222},[41132],{"type":26,"value":37551},{"type":21,"tag":209,"props":41134,"children":41135},{"style":216},[41136],{"type":26,"value":1432},{"type":21,"tag":209,"props":41138,"children":41139},{"style":222},[41140],{"type":26,"value":37560},{"type":21,"tag":209,"props":41142,"children":41143},{"style":216},[41144],{"type":26,"value":18381},{"type":21,"tag":209,"props":41146,"children":41147},{"style":222},[41148],{"type":26,"value":41149}," res.success);\n",{"type":21,"tag":209,"props":41151,"children":41152},{"class":211,"line":2636},[41153],{"type":21,"tag":209,"props":41154,"children":41155},{"style":448},[41156],{"type":26,"value":41157},"            // Trigger the app event aggregator to indicate we've received a return from the server, and success\n",{"type":21,"tag":209,"props":41159,"children":41160},{"class":211,"line":2644},[41161,41166,41170,41174,41179],{"type":21,"tag":209,"props":41162,"children":41163},{"style":222},[41164],{"type":26,"value":41165},"            app.vent.",{"type":21,"tag":209,"props":41167,"children":41168},{"style":360},[41169],{"type":26,"value":499},{"type":21,"tag":209,"props":41171,"children":41172},{"style":222},[41173],{"type":26,"value":368},{"type":21,"tag":209,"props":41175,"children":41176},{"style":233},[41177],{"type":26,"value":41178},"'backbone:receive'",{"type":21,"tag":209,"props":41180,"children":41181},{"style":222},[41182],{"type":26,"value":41183},", namespace, success);\n",{"type":21,"tag":209,"props":41185,"children":41186},{"class":211,"line":2657},[41187,41191],{"type":21,"tag":209,"props":41188,"children":41189},{"style":216},[41190],{"type":26,"value":14662},{"type":21,"tag":209,"props":41192,"children":41193},{"style":222},[41194],{"type":26,"value":37586},{"type":21,"tag":209,"props":41196,"children":41197},{"class":211,"line":2728},[41198],{"type":21,"tag":209,"props":41199,"children":41200},{"style":222},[41201],{"type":26,"value":19379},{"type":21,"tag":209,"props":41203,"children":41204},{"class":211,"line":2758},[41205,41209,41213,41217,41221,41225],{"type":21,"tag":209,"props":41206,"children":41207},{"style":216},[41208],{"type":26,"value":37601},{"type":21,"tag":209,"props":41210,"children":41211},{"style":222},[41212],{"type":26,"value":37606},{"type":21,"tag":209,"props":41214,"children":41215},{"style":360},[41216],{"type":26,"value":37611},{"type":21,"tag":209,"props":41218,"children":41219},{"style":222},[41220],{"type":26,"value":37616},{"type":21,"tag":209,"props":41222,"children":41223},{"style":360},[41224],{"type":26,"value":30164},{"type":21,"tag":209,"props":41226,"children":41227},{"style":222},[41228],{"type":26,"value":23711},{"type":21,"tag":209,"props":41230,"children":41231},{"class":211,"line":2776},[41232,41236,41240],{"type":21,"tag":209,"props":41233,"children":41234},{"style":222},[41235],{"type":26,"value":26985},{"type":21,"tag":209,"props":41237,"children":41238},{"style":360},[41239],{"type":26,"value":14173},{"type":21,"tag":209,"props":41241,"children":41242},{"style":222},[41243],{"type":26,"value":23711},{"type":21,"tag":209,"props":41245,"children":41246},{"class":211,"line":2785},[41247,41251],{"type":21,"tag":209,"props":41248,"children":41249},{"style":216},[41250],{"type":26,"value":14236},{"type":21,"tag":209,"props":41252,"children":41253},{"style":222},[41254],{"type":26,"value":241},{"type":21,"tag":209,"props":41256,"children":41257},{"class":211,"line":2793},[41258],{"type":21,"tag":209,"props":41259,"children":41260},{"style":222},[41261],{"type":26,"value":14714},{"type":21,"tag":209,"props":41263,"children":41264},{"class":211,"line":2801},[41265,41269,41273,41277,41281,41285],{"type":21,"tag":209,"props":41266,"children":41267},{"style":216},[41268],{"type":26,"value":14662},{"type":21,"tag":209,"props":41270,"children":41271},{"style":222},[41272],{"type":26,"value":37606},{"type":21,"tag":209,"props":41274,"children":41275},{"style":360},[41276],{"type":26,"value":37611},{"type":21,"tag":209,"props":41278,"children":41279},{"style":222},[41280],{"type":26,"value":37677},{"type":21,"tag":209,"props":41282,"children":41283},{"style":360},[41284],{"type":26,"value":20749},{"type":21,"tag":209,"props":41286,"children":41287},{"style":222},[41288],{"type":26,"value":23711},{"type":21,"tag":209,"props":41290,"children":41291},{"class":211,"line":2809},[41292,41296,41300],{"type":21,"tag":209,"props":41293,"children":41294},{"style":222},[41295],{"type":26,"value":29441},{"type":21,"tag":209,"props":41297,"children":41298},{"style":360},[41299],{"type":26,"value":14182},{"type":21,"tag":209,"props":41301,"children":41302},{"style":222},[41303],{"type":26,"value":23711},{"type":21,"tag":209,"props":41305,"children":41306},{"class":211,"line":10937},[41307],{"type":21,"tag":209,"props":41308,"children":41309},{"style":222},[41310],{"type":26,"value":13702},{"type":21,"tag":209,"props":41312,"children":41313},{"class":211,"line":10967},[41314],{"type":21,"tag":209,"props":41315,"children":41316},{"emptyLinePlaceholder":248},[41317],{"type":26,"value":251},{"type":21,"tag":209,"props":41319,"children":41320},{"class":211,"line":11003},[41321],{"type":21,"tag":209,"props":41322,"children":41323},{"style":448},[41324],{"type":26,"value":37722},{"type":21,"tag":209,"props":41326,"children":41327},{"class":211,"line":11038},[41328,41332,41336,41340,41344],{"type":21,"tag":209,"props":41329,"children":41330},{"style":222},[41331],{"type":26,"value":37504},{"type":21,"tag":209,"props":41333,"children":41334},{"style":360},[41335],{"type":26,"value":37734},{"type":21,"tag":209,"props":41337,"children":41338},{"style":222},[41339],{"type":26,"value":37514},{"type":21,"tag":209,"props":41341,"children":41342},{"style":216},[41343],{"type":26,"value":17170},{"type":21,"tag":209,"props":41345,"children":41346},{"style":222},[41347],{"type":26,"value":37747},{"type":21,"tag":209,"props":41349,"children":41350},{"class":211,"line":11072},[41351],{"type":21,"tag":209,"props":41352,"children":41353},{"emptyLinePlaceholder":248},[41354],{"type":26,"value":251},{"type":21,"tag":209,"props":41356,"children":41357},{"class":211,"line":11106},[41358],{"type":21,"tag":209,"props":41359,"children":41360},{"style":448},[41361],{"type":26,"value":37762},{"type":21,"tag":209,"props":41363,"children":41364},{"class":211,"line":11114},[41365,41369,41373,41377,41381],{"type":21,"tag":209,"props":41366,"children":41367},{"style":222},[41368],{"type":26,"value":37770},{"type":21,"tag":209,"props":41370,"children":41371},{"style":360},[41372],{"type":26,"value":499},{"type":21,"tag":209,"props":41374,"children":41375},{"style":222},[41376],{"type":26,"value":368},{"type":21,"tag":209,"props":41378,"children":41379},{"style":233},[41380],{"type":26,"value":37783},{"type":21,"tag":209,"props":41382,"children":41383},{"style":222},[41384],{"type":26,"value":37788},{"type":21,"tag":209,"props":41386,"children":41387},{"class":211,"line":14940},[41388],{"type":21,"tag":209,"props":41389,"children":41390},{"style":448},[41391],{"type":26,"value":37796},{"type":21,"tag":209,"props":41393,"children":41394},{"class":211,"line":14949},[41395,41399],{"type":21,"tag":209,"props":41396,"children":41397},{"style":216},[41398],{"type":26,"value":3069},{"type":21,"tag":209,"props":41400,"children":41401},{"style":222},[41402],{"type":26,"value":37808},{"type":21,"tag":209,"props":41404,"children":41405},{"class":211,"line":14958},[41406],{"type":21,"tag":209,"props":41407,"children":41408},{"style":222},[41409],{"type":26,"value":13439},{"type":21,"tag":209,"props":41411,"children":41412},{"class":211,"line":14966},[41413],{"type":21,"tag":209,"props":41414,"children":41415},{"emptyLinePlaceholder":248},[41416],{"type":26,"value":251},{"type":21,"tag":209,"props":41418,"children":41419},{"class":211,"line":14975},[41420],{"type":21,"tag":209,"props":41421,"children":41422},{"style":448},[41423],{"type":26,"value":13290},{"type":21,"tag":209,"props":41425,"children":41426},{"class":211,"line":14984},[41427],{"type":21,"tag":209,"props":41428,"children":41429},{"style":448},[41430],{"type":26,"value":37837},{"type":21,"tag":209,"props":41432,"children":41433},{"class":211,"line":15018},[41434],{"type":21,"tag":209,"props":41435,"children":41436},{"style":448},[41437],{"type":26,"value":37845},{"type":21,"tag":209,"props":41439,"children":41440},{"class":211,"line":15050},[41441],{"type":21,"tag":209,"props":41442,"children":41443},{"style":448},[41444],{"type":26,"value":37853},{"type":21,"tag":209,"props":41446,"children":41447},{"class":211,"line":15082},[41448],{"type":21,"tag":209,"props":41449,"children":41450},{"style":448},[41451],{"type":26,"value":37861},{"type":21,"tag":209,"props":41453,"children":41454},{"class":211,"line":15090},[41455,41459,41463,41467],{"type":21,"tag":209,"props":41456,"children":41457},{"style":448},[41458],{"type":26,"value":13306},{"type":21,"tag":209,"props":41460,"children":41461},{"style":216},[41462],{"type":26,"value":13311},{"type":21,"tag":209,"props":41464,"children":41465},{"style":360},[41466],{"type":26,"value":37877},{"type":21,"tag":209,"props":41468,"children":41469},{"style":222},[41470],{"type":26,"value":37882},{"type":21,"tag":209,"props":41472,"children":41473},{"class":211,"line":15098},[41474],{"type":21,"tag":209,"props":41475,"children":41476},{"style":448},[41477],{"type":26,"value":13346},{"type":21,"tag":209,"props":41479,"children":41480},{"class":211,"line":15106},[41481,41485,41489,41493,41497,41501,41505,41509,41513],{"type":21,"tag":209,"props":41482,"children":41483},{"style":222},[41484],{"type":26,"value":37897},{"type":21,"tag":209,"props":41486,"children":41487},{"style":263},[41488],{"type":26,"value":32662},{"type":21,"tag":209,"props":41490,"children":41491},{"style":222},[41492],{"type":26,"value":378},{"type":21,"tag":209,"props":41494,"children":41495},{"style":360},[41496],{"type":26,"value":37910},{"type":21,"tag":209,"props":41498,"children":41499},{"style":216},[41500],{"type":26,"value":271},{"type":21,"tag":209,"props":41502,"children":41503},{"style":216},[41504],{"type":26,"value":4789},{"type":21,"tag":209,"props":41506,"children":41507},{"style":222},[41508],{"type":26,"value":368},{"type":21,"tag":209,"props":41510,"children":41511},{"style":400},[41512],{"type":26,"value":17951},{"type":21,"tag":209,"props":41514,"children":41515},{"style":222},[41516],{"type":26,"value":2369},{"type":21,"tag":209,"props":41518,"children":41519},{"class":211,"line":15114},[41520,41524,41528,41532,41536,41540,41544,41548],{"type":21,"tag":209,"props":41521,"children":41522},{"style":222},[41523],{"type":26,"value":37938},{"type":21,"tag":209,"props":41525,"children":41526},{"style":216},[41527],{"type":26,"value":1432},{"type":21,"tag":209,"props":41529,"children":41530},{"style":222},[41531],{"type":26,"value":18080},{"type":21,"tag":209,"props":41533,"children":41534},{"style":216},[41535],{"type":26,"value":13270},{"type":21,"tag":209,"props":41537,"children":41538},{"style":263},[41539],{"type":26,"value":20502},{"type":21,"tag":209,"props":41541,"children":41542},{"style":222},[41543],{"type":26,"value":378},{"type":21,"tag":209,"props":41545,"children":41546},{"style":360},[41547],{"type":26,"value":17951},{"type":21,"tag":209,"props":41549,"children":41550},{"style":222},[41551],{"type":26,"value":4123},{"type":21,"tag":209,"props":41553,"children":41554},{"class":211,"line":15123},[41555,41559,41563,41567,41571,41575,41579,41583,41587,41591,41595,41599,41603,41607,41611],{"type":21,"tag":209,"props":41556,"children":41557},{"style":216},[41558],{"type":26,"value":3069},{"type":21,"tag":209,"props":41560,"children":41561},{"style":222},[41562],{"type":26,"value":37024},{"type":21,"tag":209,"props":41564,"children":41565},{"style":360},[41566],{"type":26,"value":37982},{"type":21,"tag":209,"props":41568,"children":41569},{"style":222},[41570],{"type":26,"value":37987},{"type":21,"tag":209,"props":41572,"children":41573},{"style":233},[41574],{"type":26,"value":7645},{"type":21,"tag":209,"props":41576,"children":41577},{"style":222},[41578],{"type":26,"value":2699},{"type":21,"tag":209,"props":41580,"children":41581},{"style":360},[41582],{"type":26,"value":28378},{"type":21,"tag":209,"props":41584,"children":41585},{"style":222},[41586],{"type":26,"value":368},{"type":21,"tag":209,"props":41588,"children":41589},{"style":233},[41590],{"type":26,"value":7645},{"type":21,"tag":209,"props":41592,"children":41593},{"style":222},[41594],{"type":26,"value":408},{"type":21,"tag":209,"props":41596,"children":41597},{"style":233},[41598],{"type":26,"value":38016},{"type":21,"tag":209,"props":41600,"children":41601},{"style":222},[41602],{"type":26,"value":432},{"type":21,"tag":209,"props":41604,"children":41605},{"style":216},[41606],{"type":26,"value":17170},{"type":21,"tag":209,"props":41608,"children":41609},{"style":233},[41610],{"type":26,"value":38029},{"type":21,"tag":209,"props":41612,"children":41613},{"style":222},[41614],{"type":26,"value":241},{"type":21,"tag":209,"props":41616,"children":41617},{"class":211,"line":15143},[41618],{"type":21,"tag":209,"props":41619,"children":41620},{"style":222},[41621],{"type":26,"value":13439},{"type":21,"tag":209,"props":41623,"children":41624},{"class":211,"line":15160},[41625],{"type":21,"tag":209,"props":41626,"children":41627},{"emptyLinePlaceholder":248},[41628],{"type":26,"value":251},{"type":21,"tag":209,"props":41630,"children":41631},{"class":211,"line":15168},[41632],{"type":21,"tag":209,"props":41633,"children":41634},{"style":448},[41635],{"type":26,"value":13290},{"type":21,"tag":209,"props":41637,"children":41638},{"class":211,"line":15196},[41639],{"type":21,"tag":209,"props":41640,"children":41641},{"style":448},[41642],{"type":26,"value":38062},{"type":21,"tag":209,"props":41644,"children":41645},{"class":211,"line":15219},[41646],{"type":21,"tag":209,"props":41647,"children":41648},{"style":448},[41649],{"type":26,"value":38070},{"type":21,"tag":209,"props":41651,"children":41652},{"class":211,"line":15240},[41653],{"type":21,"tag":209,"props":41654,"children":41655},{"style":448},[41656],{"type":26,"value":38078},{"type":21,"tag":209,"props":41658,"children":41659},{"class":211,"line":15248},[41660],{"type":21,"tag":209,"props":41661,"children":41662},{"style":448},[41663],{"type":26,"value":16934},{"type":21,"tag":209,"props":41665,"children":41666},{"class":211,"line":15256},[41667,41671,41675,41679,41683,41687,41691,41695,41699],{"type":21,"tag":209,"props":41668,"children":41669},{"style":222},[41670],{"type":26,"value":38093},{"type":21,"tag":209,"props":41672,"children":41673},{"style":263},[41674],{"type":26,"value":32662},{"type":21,"tag":209,"props":41676,"children":41677},{"style":222},[41678],{"type":26,"value":378},{"type":21,"tag":209,"props":41680,"children":41681},{"style":360},[41682],{"type":26,"value":37734},{"type":21,"tag":209,"props":41684,"children":41685},{"style":216},[41686],{"type":26,"value":271},{"type":21,"tag":209,"props":41688,"children":41689},{"style":216},[41690],{"type":26,"value":4789},{"type":21,"tag":209,"props":41692,"children":41693},{"style":222},[41694],{"type":26,"value":368},{"type":21,"tag":209,"props":41696,"children":41697},{"style":400},[41698],{"type":26,"value":38122},{"type":21,"tag":209,"props":41700,"children":41701},{"style":222},[41702],{"type":26,"value":2369},{"type":21,"tag":209,"props":41704,"children":41705},{"class":211,"line":15284},[41706,41710,41714,41718,41722,41726,41730,41734,41738,41742,41746,41750,41754],{"type":21,"tag":209,"props":41707,"children":41708},{"style":216},[41709],{"type":26,"value":14505},{"type":21,"tag":209,"props":41711,"children":41712},{"style":222},[41713],{"type":26,"value":38138},{"type":21,"tag":209,"props":41715,"children":41716},{"style":216},[41717],{"type":26,"value":1432},{"type":21,"tag":209,"props":41719,"children":41720},{"style":263},[41721],{"type":26,"value":38147},{"type":21,"tag":209,"props":41723,"children":41724},{"style":222},[41725],{"type":26,"value":378},{"type":21,"tag":209,"props":41727,"children":41728},{"style":263},[41729],{"type":26,"value":32662},{"type":21,"tag":209,"props":41731,"children":41732},{"style":222},[41733],{"type":26,"value":38160},{"type":21,"tag":209,"props":41735,"children":41736},{"style":360},[41737],{"type":26,"value":36906},{"type":21,"tag":209,"props":41739,"children":41740},{"style":222},[41741],{"type":26,"value":368},{"type":21,"tag":209,"props":41743,"children":41744},{"style":263},[41745],{"type":26,"value":38173},{"type":21,"tag":209,"props":41747,"children":41748},{"style":222},[41749],{"type":26,"value":408},{"type":21,"tag":209,"props":41751,"children":41752},{"style":263},[41753],{"type":26,"value":3224},{"type":21,"tag":209,"props":41755,"children":41756},{"style":222},[41757],{"type":26,"value":2608},{"type":21,"tag":209,"props":41759,"children":41760},{"class":211,"line":15317},[41761],{"type":21,"tag":209,"props":41762,"children":41763},{"emptyLinePlaceholder":248},[41764],{"type":26,"value":251},{"type":21,"tag":209,"props":41766,"children":41767},{"class":211,"line":15331},[41768,41772,41776,41780,41784,41788,41792,41796,41800],{"type":21,"tag":209,"props":41769,"children":41770},{"style":222},[41771],{"type":26,"value":38200},{"type":21,"tag":209,"props":41773,"children":41774},{"style":360},[41775],{"type":26,"value":38205},{"type":21,"tag":209,"props":41777,"children":41778},{"style":222},[41779],{"type":26,"value":368},{"type":21,"tag":209,"props":41781,"children":41782},{"style":263},[41783],{"type":26,"value":2508},{"type":21,"tag":209,"props":41785,"children":41786},{"style":222},[41787],{"type":26,"value":38218},{"type":21,"tag":209,"props":41789,"children":41790},{"style":233},[41791],{"type":26,"value":38223},{"type":21,"tag":209,"props":41793,"children":41794},{"style":222},[41795],{"type":26,"value":38228},{"type":21,"tag":209,"props":41797,"children":41798},{"style":360},[41799],{"type":26,"value":38233},{"type":21,"tag":209,"props":41801,"children":41802},{"style":222},[41803],{"type":26,"value":38238},{"type":21,"tag":209,"props":41805,"children":41806},{"class":211,"line":15339},[41807,41811,41815,41819,41823,41827,41831],{"type":21,"tag":209,"props":41808,"children":41809},{"style":222},[41810],{"type":26,"value":38200},{"type":21,"tag":209,"props":41812,"children":41813},{"style":360},[41814],{"type":26,"value":38205},{"type":21,"tag":209,"props":41816,"children":41817},{"style":222},[41818],{"type":26,"value":368},{"type":21,"tag":209,"props":41820,"children":41821},{"style":263},[41822],{"type":26,"value":2508},{"type":21,"tag":209,"props":41824,"children":41825},{"style":222},[41826],{"type":26,"value":38262},{"type":21,"tag":209,"props":41828,"children":41829},{"style":360},[41830],{"type":26,"value":38233},{"type":21,"tag":209,"props":41832,"children":41833},{"style":222},[41834],{"type":26,"value":38238},{"type":21,"tag":209,"props":41836,"children":41837},{"class":211,"line":15352},[41838],{"type":21,"tag":209,"props":41839,"children":41840},{"style":222},[41841],{"type":26,"value":13439},{"type":21,"tag":209,"props":41843,"children":41844},{"class":211,"line":15382},[41845,41849,41853,41857,41861,41865,41869],{"type":21,"tag":209,"props":41846,"children":41847},{"style":222},[41848],{"type":26,"value":38285},{"type":21,"tag":209,"props":41850,"children":41851},{"style":263},[41852],{"type":26,"value":32662},{"type":21,"tag":209,"props":41854,"children":41855},{"style":222},[41856],{"type":26,"value":38294},{"type":21,"tag":209,"props":41858,"children":41859},{"style":216},[41860],{"type":26,"value":1432},{"type":21,"tag":209,"props":41862,"children":41863},{"style":222},[41864],{"type":26,"value":36783},{"type":21,"tag":209,"props":41866,"children":41867},{"style":263},[41868],{"type":26,"value":32662},{"type":21,"tag":209,"props":41870,"children":41871},{"style":222},[41872],{"type":26,"value":38311},{"type":21,"tag":209,"props":41874,"children":41875},{"class":211,"line":15400},[41876],{"type":21,"tag":209,"props":41877,"children":41878},{"emptyLinePlaceholder":248},[41879],{"type":26,"value":251},{"type":21,"tag":209,"props":41881,"children":41882},{"class":211,"line":15409},[41883],{"type":21,"tag":209,"props":41884,"children":41885},{"style":448},[41886],{"type":26,"value":13290},{"type":21,"tag":209,"props":41888,"children":41889},{"class":211,"line":15433},[41890],{"type":21,"tag":209,"props":41891,"children":41892},{"style":448},[41893],{"type":26,"value":41894},"     * Create a socket io instance that will echo all events into the application event aggregator, so that\n",{"type":21,"tag":209,"props":41896,"children":41897},{"class":211,"line":15441},[41898],{"type":21,"tag":209,"props":41899,"children":41900},{"style":448},[41901],{"type":26,"value":41902},"     * collections, models, etc. can listen on app.vent for their events.\n",{"type":21,"tag":209,"props":41904,"children":41905},{"class":211,"line":15449},[41906,41910,41914,41918],{"type":21,"tag":209,"props":41907,"children":41908},{"style":448},[41909],{"type":26,"value":13306},{"type":21,"tag":209,"props":41911,"children":41912},{"style":216},[41913],{"type":26,"value":13311},{"type":21,"tag":209,"props":41915,"children":41916},{"style":360},[41917],{"type":26,"value":37877},{"type":21,"tag":209,"props":41919,"children":41920},{"style":222},[41921],{"type":26,"value":37882},{"type":21,"tag":209,"props":41923,"children":41924},{"class":211,"line":15467},[41925,41929],{"type":21,"tag":209,"props":41926,"children":41927},{"style":448},[41928],{"type":26,"value":13306},{"type":21,"tag":209,"props":41930,"children":41931},{"style":216},[41932],{"type":26,"value":41933},"@constructor\n",{"type":21,"tag":209,"props":41935,"children":41936},{"class":211,"line":15475},[41937],{"type":21,"tag":209,"props":41938,"children":41939},{"style":448},[41940],{"type":26,"value":13346},{"type":21,"tag":209,"props":41942,"children":41943},{"class":211,"line":15487},[41944,41949,41953,41957,41962,41966,41970,41974,41978],{"type":21,"tag":209,"props":41945,"children":41946},{"style":222},[41947],{"type":26,"value":41948},"    Marionette.Application.",{"type":21,"tag":209,"props":41950,"children":41951},{"style":263},[41952],{"type":26,"value":32662},{"type":21,"tag":209,"props":41954,"children":41955},{"style":222},[41956],{"type":26,"value":378},{"type":21,"tag":209,"props":41958,"children":41959},{"style":360},[41960],{"type":26,"value":41961},"SocketIO",{"type":21,"tag":209,"props":41963,"children":41964},{"style":216},[41965],{"type":26,"value":271},{"type":21,"tag":209,"props":41967,"children":41968},{"style":216},[41969],{"type":26,"value":4789},{"type":21,"tag":209,"props":41971,"children":41972},{"style":222},[41973],{"type":26,"value":368},{"type":21,"tag":209,"props":41975,"children":41976},{"style":400},[41977],{"type":26,"value":17951},{"type":21,"tag":209,"props":41979,"children":41980},{"style":222},[41981],{"type":26,"value":2369},{"type":21,"tag":209,"props":41983,"children":41984},{"class":211,"line":15495},[41985,41989,41994,41998,42003,42007],{"type":21,"tag":209,"props":41986,"children":41987},{"style":216},[41988],{"type":26,"value":14505},{"type":21,"tag":209,"props":41990,"children":41991},{"style":222},[41992],{"type":26,"value":41993}," socket ",{"type":21,"tag":209,"props":41995,"children":41996},{"style":216},[41997],{"type":26,"value":1432},{"type":21,"tag":209,"props":41999,"children":42000},{"style":222},[42001],{"type":26,"value":42002}," io.",{"type":21,"tag":209,"props":42004,"children":42005},{"style":360},[42006],{"type":26,"value":4319},{"type":21,"tag":209,"props":42008,"children":42009},{"style":222},[42010],{"type":26,"value":42011},"(url, {\n",{"type":21,"tag":209,"props":42013,"children":42014},{"class":211,"line":15503},[42015,42020,42025],{"type":21,"tag":209,"props":42016,"children":42017},{"style":222},[42018],{"type":26,"value":42019},"            transports:[",{"type":21,"tag":209,"props":42021,"children":42022},{"style":233},[42023],{"type":26,"value":42024},"'websocket'",{"type":21,"tag":209,"props":42026,"children":42027},{"style":222},[42028],{"type":26,"value":24215},{"type":21,"tag":209,"props":42030,"children":42031},{"class":211,"line":15511},[42032],{"type":21,"tag":209,"props":42033,"children":42034},{"style":222},[42035],{"type":26,"value":13702},{"type":21,"tag":209,"props":42037,"children":42038},{"class":211,"line":15520},[42039],{"type":21,"tag":209,"props":42040,"children":42041},{"emptyLinePlaceholder":248},[42042],{"type":26,"value":251},{"type":21,"tag":209,"props":42044,"children":42045},{"class":211,"line":15529},[42046],{"type":21,"tag":209,"props":42047,"children":42048},{"style":448},[42049],{"type":26,"value":2412},{"type":21,"tag":209,"props":42051,"children":42052},{"class":211,"line":15545},[42053],{"type":21,"tag":209,"props":42054,"children":42055},{"style":448},[42056],{"type":26,"value":42057},"         * On any event from the server, trigger it on the app event aggregator. The first\n",{"type":21,"tag":209,"props":42059,"children":42060},{"class":211,"line":15561},[42061],{"type":21,"tag":209,"props":42062,"children":42063},{"style":448},[42064],{"type":26,"value":42065},"         * argument will always be the name of the event.\n",{"type":21,"tag":209,"props":42067,"children":42068},{"class":211,"line":15569},[42069],{"type":21,"tag":209,"props":42070,"children":42071},{"style":448},[42072],{"type":26,"value":2439},{"type":21,"tag":209,"props":42074,"children":42075},{"class":211,"line":15593},[42076,42080,42084,42088,42092,42096,42100],{"type":21,"tag":209,"props":42077,"children":42078},{"style":222},[42079],{"type":26,"value":37504},{"type":21,"tag":209,"props":42081,"children":42082},{"style":360},[42083],{"type":26,"value":363},{"type":21,"tag":209,"props":42085,"children":42086},{"style":222},[42087],{"type":26,"value":368},{"type":21,"tag":209,"props":42089,"children":42090},{"style":233},[42091],{"type":26,"value":38223},{"type":21,"tag":209,"props":42093,"children":42094},{"style":222},[42095],{"type":26,"value":408},{"type":21,"tag":209,"props":42097,"children":42098},{"style":216},[42099],{"type":26,"value":4622},{"type":21,"tag":209,"props":42101,"children":42102},{"style":222},[42103],{"type":26,"value":2561},{"type":21,"tag":209,"props":42105,"children":42106},{"class":211,"line":15634},[42107,42111,42115,42119,42123,42127,42131,42135,42139,42143,42147,42151,42155],{"type":21,"tag":209,"props":42108,"children":42109},{"style":216},[42110],{"type":26,"value":14539},{"type":21,"tag":209,"props":42112,"children":42113},{"style":222},[42114],{"type":26,"value":38138},{"type":21,"tag":209,"props":42116,"children":42117},{"style":216},[42118],{"type":26,"value":1432},{"type":21,"tag":209,"props":42120,"children":42121},{"style":263},[42122],{"type":26,"value":38147},{"type":21,"tag":209,"props":42124,"children":42125},{"style":222},[42126],{"type":26,"value":378},{"type":21,"tag":209,"props":42128,"children":42129},{"style":263},[42130],{"type":26,"value":32662},{"type":21,"tag":209,"props":42132,"children":42133},{"style":222},[42134],{"type":26,"value":38160},{"type":21,"tag":209,"props":42136,"children":42137},{"style":360},[42138],{"type":26,"value":36906},{"type":21,"tag":209,"props":42140,"children":42141},{"style":222},[42142],{"type":26,"value":368},{"type":21,"tag":209,"props":42144,"children":42145},{"style":263},[42146],{"type":26,"value":38173},{"type":21,"tag":209,"props":42148,"children":42149},{"style":222},[42150],{"type":26,"value":408},{"type":21,"tag":209,"props":42152,"children":42153},{"style":263},[42154],{"type":26,"value":8554},{"type":21,"tag":209,"props":42156,"children":42157},{"style":222},[42158],{"type":26,"value":2608},{"type":21,"tag":209,"props":42160,"children":42161},{"class":211,"line":15662},[42162,42166,42170,42175,42179,42184,42189,42193,42197],{"type":21,"tag":209,"props":42163,"children":42164},{"style":222},[42165],{"type":26,"value":41165},{"type":21,"tag":209,"props":42167,"children":42168},{"style":360},[42169],{"type":26,"value":499},{"type":21,"tag":209,"props":42171,"children":42172},{"style":222},[42173],{"type":26,"value":42174},"(args[",{"type":21,"tag":209,"props":42176,"children":42177},{"style":263},[42178],{"type":26,"value":8554},{"type":21,"tag":209,"props":42180,"children":42181},{"style":222},[42182],{"type":26,"value":42183},"], args.",{"type":21,"tag":209,"props":42185,"children":42186},{"style":360},[42187],{"type":26,"value":42188},"slice",{"type":21,"tag":209,"props":42190,"children":42191},{"style":222},[42192],{"type":26,"value":368},{"type":21,"tag":209,"props":42194,"children":42195},{"style":263},[42196],{"type":26,"value":3224},{"type":21,"tag":209,"props":42198,"children":42199},{"style":222},[42200],{"type":26,"value":4212},{"type":21,"tag":209,"props":42202,"children":42203},{"class":211,"line":15678},[42204],{"type":21,"tag":209,"props":42205,"children":42206},{"style":222},[42207],{"type":26,"value":13702},{"type":21,"tag":209,"props":42209,"children":42210},{"class":211,"line":15694},[42211],{"type":21,"tag":209,"props":42212,"children":42213},{"emptyLinePlaceholder":248},[42214],{"type":26,"value":251},{"type":21,"tag":209,"props":42216,"children":42217},{"class":211,"line":15710},[42218],{"type":21,"tag":209,"props":42219,"children":42220},{"style":448},[42221],{"type":26,"value":2412},{"type":21,"tag":209,"props":42223,"children":42224},{"class":211,"line":15718},[42225],{"type":21,"tag":209,"props":42226,"children":42227},{"style":448},[42228],{"type":26,"value":42229},"         * On error, trigger the socket:error event on the global event aggregator for \n",{"type":21,"tag":209,"props":42231,"children":42232},{"class":211,"line":15730},[42233],{"type":21,"tag":209,"props":42234,"children":42235},{"style":448},[42236],{"type":26,"value":42237},"         * interested listeners.\n",{"type":21,"tag":209,"props":42239,"children":42240},{"class":211,"line":15738},[42241],{"type":21,"tag":209,"props":42242,"children":42243},{"style":448},[42244],{"type":26,"value":2439},{"type":21,"tag":209,"props":42246,"children":42247},{"class":211,"line":15746},[42248,42252,42256,42260,42264,42268,42272,42276,42280],{"type":21,"tag":209,"props":42249,"children":42250},{"style":222},[42251],{"type":26,"value":37504},{"type":21,"tag":209,"props":42253,"children":42254},{"style":360},[42255],{"type":26,"value":363},{"type":21,"tag":209,"props":42257,"children":42258},{"style":222},[42259],{"type":26,"value":368},{"type":21,"tag":209,"props":42261,"children":42262},{"style":233},[42263],{"type":26,"value":20588},{"type":21,"tag":209,"props":42265,"children":42266},{"style":222},[42267],{"type":26,"value":408},{"type":21,"tag":209,"props":42269,"children":42270},{"style":216},[42271],{"type":26,"value":4622},{"type":21,"tag":209,"props":42273,"children":42274},{"style":222},[42275],{"type":26,"value":368},{"type":21,"tag":209,"props":42277,"children":42278},{"style":400},[42279],{"type":26,"value":14259},{"type":21,"tag":209,"props":42281,"children":42282},{"style":222},[42283],{"type":26,"value":2369},{"type":21,"tag":209,"props":42285,"children":42286},{"class":211,"line":15754},[42287,42291,42295,42299,42304],{"type":21,"tag":209,"props":42288,"children":42289},{"style":222},[42290],{"type":26,"value":41165},{"type":21,"tag":209,"props":42292,"children":42293},{"style":360},[42294],{"type":26,"value":499},{"type":21,"tag":209,"props":42296,"children":42297},{"style":222},[42298],{"type":26,"value":368},{"type":21,"tag":209,"props":42300,"children":42301},{"style":233},[42302],{"type":26,"value":42303},"'socket:error'",{"type":21,"tag":209,"props":42305,"children":42306},{"style":222},[42307],{"type":26,"value":20633},{"type":21,"tag":209,"props":42309,"children":42310},{"class":211,"line":15767},[42311],{"type":21,"tag":209,"props":42312,"children":42313},{"style":222},[42314],{"type":26,"value":13702},{"type":21,"tag":209,"props":42316,"children":42317},{"class":211,"line":19592},[42318],{"type":21,"tag":209,"props":42319,"children":42320},{"emptyLinePlaceholder":248},[42321],{"type":26,"value":251},{"type":21,"tag":209,"props":42323,"children":42324},{"class":211,"line":19601},[42325,42329],{"type":21,"tag":209,"props":42326,"children":42327},{"style":216},[42328],{"type":26,"value":3069},{"type":21,"tag":209,"props":42330,"children":42331},{"style":222},[42332],{"type":26,"value":42333}," socket;\n",{"type":21,"tag":209,"props":42335,"children":42336},{"class":211,"line":19615},[42337],{"type":21,"tag":209,"props":42338,"children":42339},{"style":222},[42340],{"type":26,"value":331},{"type":21,"tag":209,"props":42342,"children":42343},{"class":211,"line":19624},[42344,42349,42354],{"type":21,"tag":209,"props":42345,"children":42346},{"style":222},[42347],{"type":26,"value":42348},"})(app ",{"type":21,"tag":209,"props":42350,"children":42351},{"style":448},[42352],{"type":26,"value":42353},"/* replace with your global app object */",{"type":21,"tag":209,"props":42355,"children":42356},{"style":222},[42357],{"type":26,"value":42358},", Backbone, Backbone.Marionette, jQuery, _, io);\n",{"type":21,"tag":22,"props":42360,"children":42361},{},[42362],{"type":26,"value":42363},"As always, comments are appreciated.",{"type":21,"tag":3490,"props":42365,"children":42366},{},[42367],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":42369},[],"content:ckeefer:2014-6:backbonesocketsync.md","ckeefer/2014-6/backbonesocketsync.md","ckeefer/2014-6/backbonesocketsync",{"user":3518,"name":3519},{"_path":42375,"_dir":42376,"_draft":7,"_partial":7,"_locale":8,"title":42377,"description":42378,"publishDate":42379,"categories":42380,"tags":42382,"excerpt":42378,"body":42384,"_type":3511,"_id":45014,"_source":3513,"_file":45015,"_stem":45016,"_extension":3516,"author":45017},"/ckeefer/2014-5/cgwin2","2014-5","Custom Google Info Windows: Updated, Live","April 30, 2014 at 3:22 am Remy says:","2014-05-09",[42381],"developer-blog",[12,42383],"google-maps",{"type":18,"children":42385,"toc":45011},[42386,42398,42404,42416,42429,42434,42439,43749,43770,43996,44001,44189,44194,44420,44425,44983,44988,45007],{"type":21,"tag":13057,"props":42387,"children":42388},{},[42389,42393],{"type":21,"tag":22,"props":42390,"children":42391},{},[42392],{"type":26,"value":42378},{"type":21,"tag":22,"props":42394,"children":42395},{},[42396],{"type":26,"value":42397},"Do you have a webpage with the full code (html, js, css) to test how it works? Tia",{"type":21,"tag":3596,"props":42399,"children":42401},{"id":42400},"my-dear-remy-tia-both",[42402],{"type":26,"value":42403},"My dear... Remy? Tia? Both?",{"type":21,"tag":22,"props":42405,"children":42406},{},[42407,42409],{"type":26,"value":42408},"Whoever you are, your wish is granted: ",{"type":21,"tag":29,"props":42410,"children":42413},{"href":42411,"rel":42412},"http://sanemethod.github.io/CGWin/",[93],[42414],{"type":26,"value":42415},"CGWin Demo",{"type":21,"tag":22,"props":42417,"children":42418},{},[42419,42421,42427],{"type":26,"value":42420},"Not content to merely offer a live example of our ",{"type":21,"tag":29,"props":42422,"children":42424},{"href":42423},"/search/custom/google/maps/user:ckeefer",[42425],{"type":26,"value":42426},"Custom Google Info Windows",{"type":26,"value":42428},", we've also updated our implementation with panToView capability - that is, when you click on a marker and the resulting info window is outside the current map bounds, the map will now pan the minimum amount necessary to show the full info window.",{"type":21,"tag":22,"props":42430,"children":42431},{},[42432],{"type":26,"value":42433},"It's not as easy as you might expect! Let's take a look at what we have to do to make this happen (and then note the demo page again, just for good measure).",{"type":21,"tag":22,"props":42435,"children":42436},{},[42437],{"type":26,"value":42438},"So, let's start off with a big ol' block of code:",{"type":21,"tag":200,"props":42440,"children":42442},{"className":16138,"code":42441,"language":16140,"meta":8,"style":8},"/**\n * If the custom window is not already entirely within the map view, pan the map the minimum amount\n * necessary to bring the custom info window fully into view.\n */\nCustomWindow.prototype.panToView = function(){\n    var position = this.position,\n        latlng = this.marker.getPosition(),\n        top = parseInt(this.container.style.top, 10),\n        cHeight = position.y - top,\n        cWidth = this.container.offsetWidth / 2,\n        map = this.getMap(),\n        center = map.getCenter(),\n        bounds = map.getBounds(),\n        degPerPixel = (function(){\n            var degs = {},\n                div = map.getDiv(),\n                span = bounds.toSpan();\n\n        degs.x = span.lng() / div.offsetWidth;\n        degs.y = span.lat() / div.offsetHeight;\n        return degs;\n    })(),\n    infoBounds = (function(){\n        var infoBounds = {};\n\n        infoBounds.north = latlng.lat() + cHeight * degPerPixel.y;\n        infoBounds.south = latlng.lat();\n        infoBounds.west = latlng.lng() - cWidth * degPerPixel.x;\n        infoBounds.east = latlng.lng() + cWidth * degPerPixel.x;\n        return infoBounds;\n    })(),\n    newCenter = (function(){\n        var ne = bounds.getNorthEast(),\n            sw = bounds.getSouthWest(),\n            north = ne.lat(),\n            east = ne.lng(),\n            south = sw.lat(),\n            west = sw.lng(),\n            x = center.lng(),\n            y = center.lat(),\n            shiftLng = ((infoBounds.west \u003C west) ? west - infoBounds.west : 0) +\n                ((infoBounds.east > east) ? east - infoBounds.east : 0),\n            shiftLat = ((infoBounds.north > north) ? north - infoBounds.north : 0) +\n                ((infoBounds.south \u003C south) ? south - infoBounds.south : 0);\n\n        return (shiftLng || shiftLat) ? new google.maps.LatLng(y - shiftLat, x - shiftLng) : void 0;\n    })();\n\nif (newCenter){\n    map.panTo(newCenter);\n    }\n\n};\n",[42443],{"type":21,"tag":63,"props":42444,"children":42445},{"__ignoreMap":8},[42446,42453,42461,42469,42476,42513,42538,42568,42607,42634,42667,42696,42722,42747,42771,42792,42817,42843,42850,42885,42919,42931,42939,42963,42983,42990,43033,43057,43099,43139,43151,43158,43182,43211,43236,43261,43285,43310,43334,43359,43383,43444,43491,43551,43598,43605,43683,43691,43698,43710,43728,43735,43742],{"type":21,"tag":209,"props":42447,"children":42448},{"class":211,"line":212},[42449],{"type":21,"tag":209,"props":42450,"children":42451},{"style":448},[42452],{"type":26,"value":731},{"type":21,"tag":209,"props":42454,"children":42455},{"class":211,"line":244},[42456],{"type":21,"tag":209,"props":42457,"children":42458},{"style":448},[42459],{"type":26,"value":42460}," * If the custom window is not already entirely within the map view, pan the map the minimum amount\n",{"type":21,"tag":209,"props":42462,"children":42463},{"class":211,"line":254},[42464],{"type":21,"tag":209,"props":42465,"children":42466},{"style":448},[42467],{"type":26,"value":42468}," * necessary to bring the custom info window fully into view.\n",{"type":21,"tag":209,"props":42470,"children":42471},{"class":211,"line":279},[42472],{"type":21,"tag":209,"props":42473,"children":42474},{"style":448},[42475],{"type":26,"value":755},{"type":21,"tag":209,"props":42477,"children":42478},{"class":211,"line":288},[42479,42484,42488,42492,42496,42501,42505,42509],{"type":21,"tag":209,"props":42480,"children":42481},{"style":263},[42482],{"type":26,"value":42483},"CustomWindow",{"type":21,"tag":209,"props":42485,"children":42486},{"style":222},[42487],{"type":26,"value":378},{"type":21,"tag":209,"props":42489,"children":42490},{"style":263},[42491],{"type":26,"value":32662},{"type":21,"tag":209,"props":42493,"children":42494},{"style":222},[42495],{"type":26,"value":378},{"type":21,"tag":209,"props":42497,"children":42498},{"style":360},[42499],{"type":26,"value":42500},"panToView",{"type":21,"tag":209,"props":42502,"children":42503},{"style":216},[42504],{"type":26,"value":271},{"type":21,"tag":209,"props":42506,"children":42507},{"style":216},[42508],{"type":26,"value":4789},{"type":21,"tag":209,"props":42510,"children":42511},{"style":222},[42512],{"type":26,"value":2561},{"type":21,"tag":209,"props":42514,"children":42515},{"class":211,"line":307},[42516,42520,42525,42529,42533],{"type":21,"tag":209,"props":42517,"children":42518},{"style":216},[42519],{"type":26,"value":16994},{"type":21,"tag":209,"props":42521,"children":42522},{"style":222},[42523],{"type":26,"value":42524}," position ",{"type":21,"tag":209,"props":42526,"children":42527},{"style":216},[42528],{"type":26,"value":1432},{"type":21,"tag":209,"props":42530,"children":42531},{"style":263},[42532],{"type":26,"value":20502},{"type":21,"tag":209,"props":42534,"children":42535},{"style":222},[42536],{"type":26,"value":42537},".position,\n",{"type":21,"tag":209,"props":42539,"children":42540},{"class":211,"line":325},[42541,42546,42550,42554,42559,42564],{"type":21,"tag":209,"props":42542,"children":42543},{"style":222},[42544],{"type":26,"value":42545},"        latlng ",{"type":21,"tag":209,"props":42547,"children":42548},{"style":216},[42549],{"type":26,"value":1432},{"type":21,"tag":209,"props":42551,"children":42552},{"style":263},[42553],{"type":26,"value":20502},{"type":21,"tag":209,"props":42555,"children":42556},{"style":222},[42557],{"type":26,"value":42558},".marker.",{"type":21,"tag":209,"props":42560,"children":42561},{"style":360},[42562],{"type":26,"value":42563},"getPosition",{"type":21,"tag":209,"props":42565,"children":42566},{"style":222},[42567],{"type":26,"value":13988},{"type":21,"tag":209,"props":42569,"children":42570},{"class":211,"line":334},[42571,42576,42580,42585,42589,42593,42598,42603],{"type":21,"tag":209,"props":42572,"children":42573},{"style":222},[42574],{"type":26,"value":42575},"        top ",{"type":21,"tag":209,"props":42577,"children":42578},{"style":216},[42579],{"type":26,"value":1432},{"type":21,"tag":209,"props":42581,"children":42582},{"style":360},[42583],{"type":26,"value":42584}," parseInt",{"type":21,"tag":209,"props":42586,"children":42587},{"style":222},[42588],{"type":26,"value":368},{"type":21,"tag":209,"props":42590,"children":42591},{"style":263},[42592],{"type":26,"value":2508},{"type":21,"tag":209,"props":42594,"children":42595},{"style":222},[42596],{"type":26,"value":42597},".container.style.top, ",{"type":21,"tag":209,"props":42599,"children":42600},{"style":263},[42601],{"type":26,"value":42602},"10",{"type":21,"tag":209,"props":42604,"children":42605},{"style":222},[42606],{"type":26,"value":5404},{"type":21,"tag":209,"props":42608,"children":42609},{"class":211,"line":343},[42610,42615,42619,42624,42629],{"type":21,"tag":209,"props":42611,"children":42612},{"style":222},[42613],{"type":26,"value":42614},"        cHeight ",{"type":21,"tag":209,"props":42616,"children":42617},{"style":216},[42618],{"type":26,"value":1432},{"type":21,"tag":209,"props":42620,"children":42621},{"style":222},[42622],{"type":26,"value":42623}," position.y ",{"type":21,"tag":209,"props":42625,"children":42626},{"style":216},[42627],{"type":26,"value":42628},"-",{"type":21,"tag":209,"props":42630,"children":42631},{"style":222},[42632],{"type":26,"value":42633}," top,\n",{"type":21,"tag":209,"props":42635,"children":42636},{"class":211,"line":351},[42637,42642,42646,42650,42655,42659,42663],{"type":21,"tag":209,"props":42638,"children":42639},{"style":222},[42640],{"type":26,"value":42641},"        cWidth ",{"type":21,"tag":209,"props":42643,"children":42644},{"style":216},[42645],{"type":26,"value":1432},{"type":21,"tag":209,"props":42647,"children":42648},{"style":263},[42649],{"type":26,"value":20502},{"type":21,"tag":209,"props":42651,"children":42652},{"style":222},[42653],{"type":26,"value":42654},".container.offsetWidth ",{"type":21,"tag":209,"props":42656,"children":42657},{"style":216},[42658],{"type":26,"value":6460},{"type":21,"tag":209,"props":42660,"children":42661},{"style":263},[42662],{"type":26,"value":6354},{"type":21,"tag":209,"props":42664,"children":42665},{"style":222},[42666],{"type":26,"value":304},{"type":21,"tag":209,"props":42668,"children":42669},{"class":211,"line":444},[42670,42675,42679,42683,42687,42692],{"type":21,"tag":209,"props":42671,"children":42672},{"style":222},[42673],{"type":26,"value":42674},"        map ",{"type":21,"tag":209,"props":42676,"children":42677},{"style":216},[42678],{"type":26,"value":1432},{"type":21,"tag":209,"props":42680,"children":42681},{"style":263},[42682],{"type":26,"value":20502},{"type":21,"tag":209,"props":42684,"children":42685},{"style":222},[42686],{"type":26,"value":378},{"type":21,"tag":209,"props":42688,"children":42689},{"style":360},[42690],{"type":26,"value":42691},"getMap",{"type":21,"tag":209,"props":42693,"children":42694},{"style":222},[42695],{"type":26,"value":13988},{"type":21,"tag":209,"props":42697,"children":42698},{"class":211,"line":454},[42699,42704,42708,42713,42718],{"type":21,"tag":209,"props":42700,"children":42701},{"style":222},[42702],{"type":26,"value":42703},"        center ",{"type":21,"tag":209,"props":42705,"children":42706},{"style":216},[42707],{"type":26,"value":1432},{"type":21,"tag":209,"props":42709,"children":42710},{"style":222},[42711],{"type":26,"value":42712}," map.",{"type":21,"tag":209,"props":42714,"children":42715},{"style":360},[42716],{"type":26,"value":42717},"getCenter",{"type":21,"tag":209,"props":42719,"children":42720},{"style":222},[42721],{"type":26,"value":13988},{"type":21,"tag":209,"props":42723,"children":42724},{"class":211,"line":463},[42725,42730,42734,42738,42743],{"type":21,"tag":209,"props":42726,"children":42727},{"style":222},[42728],{"type":26,"value":42729},"        bounds ",{"type":21,"tag":209,"props":42731,"children":42732},{"style":216},[42733],{"type":26,"value":1432},{"type":21,"tag":209,"props":42735,"children":42736},{"style":222},[42737],{"type":26,"value":42712},{"type":21,"tag":209,"props":42739,"children":42740},{"style":360},[42741],{"type":26,"value":42742},"getBounds",{"type":21,"tag":209,"props":42744,"children":42745},{"style":222},[42746],{"type":26,"value":13988},{"type":21,"tag":209,"props":42748,"children":42749},{"class":211,"line":472},[42750,42755,42759,42763,42767],{"type":21,"tag":209,"props":42751,"children":42752},{"style":222},[42753],{"type":26,"value":42754},"        degPerPixel ",{"type":21,"tag":209,"props":42756,"children":42757},{"style":216},[42758],{"type":26,"value":1432},{"type":21,"tag":209,"props":42760,"children":42761},{"style":222},[42762],{"type":26,"value":5569},{"type":21,"tag":209,"props":42764,"children":42765},{"style":216},[42766],{"type":26,"value":4622},{"type":21,"tag":209,"props":42768,"children":42769},{"style":222},[42770],{"type":26,"value":2561},{"type":21,"tag":209,"props":42772,"children":42773},{"class":211,"line":480},[42774,42778,42783,42787],{"type":21,"tag":209,"props":42775,"children":42776},{"style":216},[42777],{"type":26,"value":14539},{"type":21,"tag":209,"props":42779,"children":42780},{"style":222},[42781],{"type":26,"value":42782}," degs ",{"type":21,"tag":209,"props":42784,"children":42785},{"style":216},[42786],{"type":26,"value":1432},{"type":21,"tag":209,"props":42788,"children":42789},{"style":222},[42790],{"type":26,"value":42791}," {},\n",{"type":21,"tag":209,"props":42793,"children":42794},{"class":211,"line":489},[42795,42800,42804,42808,42813],{"type":21,"tag":209,"props":42796,"children":42797},{"style":222},[42798],{"type":26,"value":42799},"                div ",{"type":21,"tag":209,"props":42801,"children":42802},{"style":216},[42803],{"type":26,"value":1432},{"type":21,"tag":209,"props":42805,"children":42806},{"style":222},[42807],{"type":26,"value":42712},{"type":21,"tag":209,"props":42809,"children":42810},{"style":360},[42811],{"type":26,"value":42812},"getDiv",{"type":21,"tag":209,"props":42814,"children":42815},{"style":222},[42816],{"type":26,"value":13988},{"type":21,"tag":209,"props":42818,"children":42819},{"class":211,"line":847},[42820,42825,42829,42834,42839],{"type":21,"tag":209,"props":42821,"children":42822},{"style":222},[42823],{"type":26,"value":42824},"                span ",{"type":21,"tag":209,"props":42826,"children":42827},{"style":216},[42828],{"type":26,"value":1432},{"type":21,"tag":209,"props":42830,"children":42831},{"style":222},[42832],{"type":26,"value":42833}," bounds.",{"type":21,"tag":209,"props":42835,"children":42836},{"style":360},[42837],{"type":26,"value":42838},"toSpan",{"type":21,"tag":209,"props":42840,"children":42841},{"style":222},[42842],{"type":26,"value":4123},{"type":21,"tag":209,"props":42844,"children":42845},{"class":211,"line":860},[42846],{"type":21,"tag":209,"props":42847,"children":42848},{"emptyLinePlaceholder":248},[42849],{"type":26,"value":251},{"type":21,"tag":209,"props":42851,"children":42852},{"class":211,"line":877},[42853,42858,42862,42867,42872,42876,42880],{"type":21,"tag":209,"props":42854,"children":42855},{"style":222},[42856],{"type":26,"value":42857},"        degs.x ",{"type":21,"tag":209,"props":42859,"children":42860},{"style":216},[42861],{"type":26,"value":1432},{"type":21,"tag":209,"props":42863,"children":42864},{"style":222},[42865],{"type":26,"value":42866}," span.",{"type":21,"tag":209,"props":42868,"children":42869},{"style":360},[42870],{"type":26,"value":42871},"lng",{"type":21,"tag":209,"props":42873,"children":42874},{"style":222},[42875],{"type":26,"value":17194},{"type":21,"tag":209,"props":42877,"children":42878},{"style":216},[42879],{"type":26,"value":6460},{"type":21,"tag":209,"props":42881,"children":42882},{"style":222},[42883],{"type":26,"value":42884}," div.offsetWidth;\n",{"type":21,"tag":209,"props":42886,"children":42887},{"class":211,"line":889},[42888,42893,42897,42901,42906,42910,42914],{"type":21,"tag":209,"props":42889,"children":42890},{"style":222},[42891],{"type":26,"value":42892},"        degs.y ",{"type":21,"tag":209,"props":42894,"children":42895},{"style":216},[42896],{"type":26,"value":1432},{"type":21,"tag":209,"props":42898,"children":42899},{"style":222},[42900],{"type":26,"value":42866},{"type":21,"tag":209,"props":42902,"children":42903},{"style":360},[42904],{"type":26,"value":42905},"lat",{"type":21,"tag":209,"props":42907,"children":42908},{"style":222},[42909],{"type":26,"value":17194},{"type":21,"tag":209,"props":42911,"children":42912},{"style":216},[42913],{"type":26,"value":6460},{"type":21,"tag":209,"props":42915,"children":42916},{"style":222},[42917],{"type":26,"value":42918}," div.offsetHeight;\n",{"type":21,"tag":209,"props":42920,"children":42921},{"class":211,"line":902},[42922,42926],{"type":21,"tag":209,"props":42923,"children":42924},{"style":216},[42925],{"type":26,"value":3069},{"type":21,"tag":209,"props":42927,"children":42928},{"style":222},[42929],{"type":26,"value":42930}," degs;\n",{"type":21,"tag":209,"props":42932,"children":42933},{"class":211,"line":914},[42934],{"type":21,"tag":209,"props":42935,"children":42936},{"style":222},[42937],{"type":26,"value":42938},"    })(),\n",{"type":21,"tag":209,"props":42940,"children":42941},{"class":211,"line":922},[42942,42947,42951,42955,42959],{"type":21,"tag":209,"props":42943,"children":42944},{"style":222},[42945],{"type":26,"value":42946},"    infoBounds ",{"type":21,"tag":209,"props":42948,"children":42949},{"style":216},[42950],{"type":26,"value":1432},{"type":21,"tag":209,"props":42952,"children":42953},{"style":222},[42954],{"type":26,"value":5569},{"type":21,"tag":209,"props":42956,"children":42957},{"style":216},[42958],{"type":26,"value":4622},{"type":21,"tag":209,"props":42960,"children":42961},{"style":222},[42962],{"type":26,"value":2561},{"type":21,"tag":209,"props":42964,"children":42965},{"class":211,"line":2312},[42966,42970,42975,42979],{"type":21,"tag":209,"props":42967,"children":42968},{"style":216},[42969],{"type":26,"value":14505},{"type":21,"tag":209,"props":42971,"children":42972},{"style":222},[42973],{"type":26,"value":42974}," infoBounds ",{"type":21,"tag":209,"props":42976,"children":42977},{"style":216},[42978],{"type":26,"value":1432},{"type":21,"tag":209,"props":42980,"children":42981},{"style":222},[42982],{"type":26,"value":7963},{"type":21,"tag":209,"props":42984,"children":42985},{"class":211,"line":2321},[42986],{"type":21,"tag":209,"props":42987,"children":42988},{"emptyLinePlaceholder":248},[42989],{"type":26,"value":251},{"type":21,"tag":209,"props":42991,"children":42992},{"class":211,"line":2372},[42993,42998,43002,43007,43011,43015,43019,43024,43028],{"type":21,"tag":209,"props":42994,"children":42995},{"style":222},[42996],{"type":26,"value":42997},"        infoBounds.north ",{"type":21,"tag":209,"props":42999,"children":43000},{"style":216},[43001],{"type":26,"value":1432},{"type":21,"tag":209,"props":43003,"children":43004},{"style":222},[43005],{"type":26,"value":43006}," latlng.",{"type":21,"tag":209,"props":43008,"children":43009},{"style":360},[43010],{"type":26,"value":42905},{"type":21,"tag":209,"props":43012,"children":43013},{"style":222},[43014],{"type":26,"value":17194},{"type":21,"tag":209,"props":43016,"children":43017},{"style":216},[43018],{"type":26,"value":17170},{"type":21,"tag":209,"props":43020,"children":43021},{"style":222},[43022],{"type":26,"value":43023}," cHeight ",{"type":21,"tag":209,"props":43025,"children":43026},{"style":216},[43027],{"type":26,"value":944},{"type":21,"tag":209,"props":43029,"children":43030},{"style":222},[43031],{"type":26,"value":43032}," degPerPixel.y;\n",{"type":21,"tag":209,"props":43034,"children":43035},{"class":211,"line":2381},[43036,43041,43045,43049,43053],{"type":21,"tag":209,"props":43037,"children":43038},{"style":222},[43039],{"type":26,"value":43040},"        infoBounds.south ",{"type":21,"tag":209,"props":43042,"children":43043},{"style":216},[43044],{"type":26,"value":1432},{"type":21,"tag":209,"props":43046,"children":43047},{"style":222},[43048],{"type":26,"value":43006},{"type":21,"tag":209,"props":43050,"children":43051},{"style":360},[43052],{"type":26,"value":42905},{"type":21,"tag":209,"props":43054,"children":43055},{"style":222},[43056],{"type":26,"value":4123},{"type":21,"tag":209,"props":43058,"children":43059},{"class":211,"line":2389},[43060,43065,43069,43073,43077,43081,43085,43090,43094],{"type":21,"tag":209,"props":43061,"children":43062},{"style":222},[43063],{"type":26,"value":43064},"        infoBounds.west ",{"type":21,"tag":209,"props":43066,"children":43067},{"style":216},[43068],{"type":26,"value":1432},{"type":21,"tag":209,"props":43070,"children":43071},{"style":222},[43072],{"type":26,"value":43006},{"type":21,"tag":209,"props":43074,"children":43075},{"style":360},[43076],{"type":26,"value":42871},{"type":21,"tag":209,"props":43078,"children":43079},{"style":222},[43080],{"type":26,"value":17194},{"type":21,"tag":209,"props":43082,"children":43083},{"style":216},[43084],{"type":26,"value":42628},{"type":21,"tag":209,"props":43086,"children":43087},{"style":222},[43088],{"type":26,"value":43089}," cWidth ",{"type":21,"tag":209,"props":43091,"children":43092},{"style":216},[43093],{"type":26,"value":944},{"type":21,"tag":209,"props":43095,"children":43096},{"style":222},[43097],{"type":26,"value":43098}," degPerPixel.x;\n",{"type":21,"tag":209,"props":43100,"children":43101},{"class":211,"line":2397},[43102,43107,43111,43115,43119,43123,43127,43131,43135],{"type":21,"tag":209,"props":43103,"children":43104},{"style":222},[43105],{"type":26,"value":43106},"        infoBounds.east ",{"type":21,"tag":209,"props":43108,"children":43109},{"style":216},[43110],{"type":26,"value":1432},{"type":21,"tag":209,"props":43112,"children":43113},{"style":222},[43114],{"type":26,"value":43006},{"type":21,"tag":209,"props":43116,"children":43117},{"style":360},[43118],{"type":26,"value":42871},{"type":21,"tag":209,"props":43120,"children":43121},{"style":222},[43122],{"type":26,"value":17194},{"type":21,"tag":209,"props":43124,"children":43125},{"style":216},[43126],{"type":26,"value":17170},{"type":21,"tag":209,"props":43128,"children":43129},{"style":222},[43130],{"type":26,"value":43089},{"type":21,"tag":209,"props":43132,"children":43133},{"style":216},[43134],{"type":26,"value":944},{"type":21,"tag":209,"props":43136,"children":43137},{"style":222},[43138],{"type":26,"value":43098},{"type":21,"tag":209,"props":43140,"children":43141},{"class":211,"line":2406},[43142,43146],{"type":21,"tag":209,"props":43143,"children":43144},{"style":216},[43145],{"type":26,"value":3069},{"type":21,"tag":209,"props":43147,"children":43148},{"style":222},[43149],{"type":26,"value":43150}," infoBounds;\n",{"type":21,"tag":209,"props":43152,"children":43153},{"class":211,"line":2415},[43154],{"type":21,"tag":209,"props":43155,"children":43156},{"style":222},[43157],{"type":26,"value":42938},{"type":21,"tag":209,"props":43159,"children":43160},{"class":211,"line":2424},[43161,43166,43170,43174,43178],{"type":21,"tag":209,"props":43162,"children":43163},{"style":222},[43164],{"type":26,"value":43165},"    newCenter ",{"type":21,"tag":209,"props":43167,"children":43168},{"style":216},[43169],{"type":26,"value":1432},{"type":21,"tag":209,"props":43171,"children":43172},{"style":222},[43173],{"type":26,"value":5569},{"type":21,"tag":209,"props":43175,"children":43176},{"style":216},[43177],{"type":26,"value":4622},{"type":21,"tag":209,"props":43179,"children":43180},{"style":222},[43181],{"type":26,"value":2561},{"type":21,"tag":209,"props":43183,"children":43184},{"class":211,"line":2433},[43185,43189,43194,43198,43202,43207],{"type":21,"tag":209,"props":43186,"children":43187},{"style":216},[43188],{"type":26,"value":14505},{"type":21,"tag":209,"props":43190,"children":43191},{"style":222},[43192],{"type":26,"value":43193}," ne ",{"type":21,"tag":209,"props":43195,"children":43196},{"style":216},[43197],{"type":26,"value":1432},{"type":21,"tag":209,"props":43199,"children":43200},{"style":222},[43201],{"type":26,"value":42833},{"type":21,"tag":209,"props":43203,"children":43204},{"style":360},[43205],{"type":26,"value":43206},"getNorthEast",{"type":21,"tag":209,"props":43208,"children":43209},{"style":222},[43210],{"type":26,"value":13988},{"type":21,"tag":209,"props":43212,"children":43213},{"class":211,"line":2442},[43214,43219,43223,43227,43232],{"type":21,"tag":209,"props":43215,"children":43216},{"style":222},[43217],{"type":26,"value":43218},"            sw ",{"type":21,"tag":209,"props":43220,"children":43221},{"style":216},[43222],{"type":26,"value":1432},{"type":21,"tag":209,"props":43224,"children":43225},{"style":222},[43226],{"type":26,"value":42833},{"type":21,"tag":209,"props":43228,"children":43229},{"style":360},[43230],{"type":26,"value":43231},"getSouthWest",{"type":21,"tag":209,"props":43233,"children":43234},{"style":222},[43235],{"type":26,"value":13988},{"type":21,"tag":209,"props":43237,"children":43238},{"class":211,"line":2471},[43239,43244,43248,43253,43257],{"type":21,"tag":209,"props":43240,"children":43241},{"style":222},[43242],{"type":26,"value":43243},"            north ",{"type":21,"tag":209,"props":43245,"children":43246},{"style":216},[43247],{"type":26,"value":1432},{"type":21,"tag":209,"props":43249,"children":43250},{"style":222},[43251],{"type":26,"value":43252}," ne.",{"type":21,"tag":209,"props":43254,"children":43255},{"style":360},[43256],{"type":26,"value":42905},{"type":21,"tag":209,"props":43258,"children":43259},{"style":222},[43260],{"type":26,"value":13988},{"type":21,"tag":209,"props":43262,"children":43263},{"class":211,"line":2480},[43264,43269,43273,43277,43281],{"type":21,"tag":209,"props":43265,"children":43266},{"style":222},[43267],{"type":26,"value":43268},"            east ",{"type":21,"tag":209,"props":43270,"children":43271},{"style":216},[43272],{"type":26,"value":1432},{"type":21,"tag":209,"props":43274,"children":43275},{"style":222},[43276],{"type":26,"value":43252},{"type":21,"tag":209,"props":43278,"children":43279},{"style":360},[43280],{"type":26,"value":42871},{"type":21,"tag":209,"props":43282,"children":43283},{"style":222},[43284],{"type":26,"value":13988},{"type":21,"tag":209,"props":43286,"children":43287},{"class":211,"line":2489},[43288,43293,43297,43302,43306],{"type":21,"tag":209,"props":43289,"children":43290},{"style":222},[43291],{"type":26,"value":43292},"            south ",{"type":21,"tag":209,"props":43294,"children":43295},{"style":216},[43296],{"type":26,"value":1432},{"type":21,"tag":209,"props":43298,"children":43299},{"style":222},[43300],{"type":26,"value":43301}," sw.",{"type":21,"tag":209,"props":43303,"children":43304},{"style":360},[43305],{"type":26,"value":42905},{"type":21,"tag":209,"props":43307,"children":43308},{"style":222},[43309],{"type":26,"value":13988},{"type":21,"tag":209,"props":43311,"children":43312},{"class":211,"line":2516},[43313,43318,43322,43326,43330],{"type":21,"tag":209,"props":43314,"children":43315},{"style":222},[43316],{"type":26,"value":43317},"            west ",{"type":21,"tag":209,"props":43319,"children":43320},{"style":216},[43321],{"type":26,"value":1432},{"type":21,"tag":209,"props":43323,"children":43324},{"style":222},[43325],{"type":26,"value":43301},{"type":21,"tag":209,"props":43327,"children":43328},{"style":360},[43329],{"type":26,"value":42871},{"type":21,"tag":209,"props":43331,"children":43332},{"style":222},[43333],{"type":26,"value":13988},{"type":21,"tag":209,"props":43335,"children":43336},{"class":211,"line":2525},[43337,43342,43346,43351,43355],{"type":21,"tag":209,"props":43338,"children":43339},{"style":222},[43340],{"type":26,"value":43341},"            x ",{"type":21,"tag":209,"props":43343,"children":43344},{"style":216},[43345],{"type":26,"value":1432},{"type":21,"tag":209,"props":43347,"children":43348},{"style":222},[43349],{"type":26,"value":43350}," center.",{"type":21,"tag":209,"props":43352,"children":43353},{"style":360},[43354],{"type":26,"value":42871},{"type":21,"tag":209,"props":43356,"children":43357},{"style":222},[43358],{"type":26,"value":13988},{"type":21,"tag":209,"props":43360,"children":43361},{"class":211,"line":2533},[43362,43367,43371,43375,43379],{"type":21,"tag":209,"props":43363,"children":43364},{"style":222},[43365],{"type":26,"value":43366},"            y ",{"type":21,"tag":209,"props":43368,"children":43369},{"style":216},[43370],{"type":26,"value":1432},{"type":21,"tag":209,"props":43372,"children":43373},{"style":222},[43374],{"type":26,"value":43350},{"type":21,"tag":209,"props":43376,"children":43377},{"style":360},[43378],{"type":26,"value":42905},{"type":21,"tag":209,"props":43380,"children":43381},{"style":222},[43382],{"type":26,"value":13988},{"type":21,"tag":209,"props":43384,"children":43385},{"class":211,"line":2542},[43386,43391,43395,43400,43404,43409,43413,43418,43422,43427,43431,43435,43439],{"type":21,"tag":209,"props":43387,"children":43388},{"style":222},[43389],{"type":26,"value":43390},"            shiftLng ",{"type":21,"tag":209,"props":43392,"children":43393},{"style":216},[43394],{"type":26,"value":1432},{"type":21,"tag":209,"props":43396,"children":43397},{"style":222},[43398],{"type":26,"value":43399}," ((infoBounds.west ",{"type":21,"tag":209,"props":43401,"children":43402},{"style":216},[43403],{"type":26,"value":1985},{"type":21,"tag":209,"props":43405,"children":43406},{"style":222},[43407],{"type":26,"value":43408}," west) ",{"type":21,"tag":209,"props":43410,"children":43411},{"style":216},[43412],{"type":26,"value":8258},{"type":21,"tag":209,"props":43414,"children":43415},{"style":222},[43416],{"type":26,"value":43417}," west ",{"type":21,"tag":209,"props":43419,"children":43420},{"style":216},[43421],{"type":26,"value":42628},{"type":21,"tag":209,"props":43423,"children":43424},{"style":222},[43425],{"type":26,"value":43426}," infoBounds.west ",{"type":21,"tag":209,"props":43428,"children":43429},{"style":216},[43430],{"type":26,"value":191},{"type":21,"tag":209,"props":43432,"children":43433},{"style":263},[43434],{"type":26,"value":8009},{"type":21,"tag":209,"props":43436,"children":43437},{"style":222},[43438],{"type":26,"value":432},{"type":21,"tag":209,"props":43440,"children":43441},{"style":216},[43442],{"type":26,"value":43443},"+\n",{"type":21,"tag":209,"props":43445,"children":43446},{"class":211,"line":2550},[43447,43452,43456,43461,43465,43470,43474,43479,43483,43487],{"type":21,"tag":209,"props":43448,"children":43449},{"style":222},[43450],{"type":26,"value":43451},"                ((infoBounds.east ",{"type":21,"tag":209,"props":43453,"children":43454},{"style":216},[43455],{"type":26,"value":2014},{"type":21,"tag":209,"props":43457,"children":43458},{"style":222},[43459],{"type":26,"value":43460}," east) ",{"type":21,"tag":209,"props":43462,"children":43463},{"style":216},[43464],{"type":26,"value":8258},{"type":21,"tag":209,"props":43466,"children":43467},{"style":222},[43468],{"type":26,"value":43469}," east ",{"type":21,"tag":209,"props":43471,"children":43472},{"style":216},[43473],{"type":26,"value":42628},{"type":21,"tag":209,"props":43475,"children":43476},{"style":222},[43477],{"type":26,"value":43478}," infoBounds.east ",{"type":21,"tag":209,"props":43480,"children":43481},{"style":216},[43482],{"type":26,"value":191},{"type":21,"tag":209,"props":43484,"children":43485},{"style":263},[43486],{"type":26,"value":8009},{"type":21,"tag":209,"props":43488,"children":43489},{"style":222},[43490],{"type":26,"value":5404},{"type":21,"tag":209,"props":43492,"children":43493},{"class":211,"line":2564},[43494,43499,43503,43508,43512,43517,43521,43526,43530,43535,43539,43543,43547],{"type":21,"tag":209,"props":43495,"children":43496},{"style":222},[43497],{"type":26,"value":43498},"            shiftLat ",{"type":21,"tag":209,"props":43500,"children":43501},{"style":216},[43502],{"type":26,"value":1432},{"type":21,"tag":209,"props":43504,"children":43505},{"style":222},[43506],{"type":26,"value":43507}," ((infoBounds.north ",{"type":21,"tag":209,"props":43509,"children":43510},{"style":216},[43511],{"type":26,"value":2014},{"type":21,"tag":209,"props":43513,"children":43514},{"style":222},[43515],{"type":26,"value":43516}," north) ",{"type":21,"tag":209,"props":43518,"children":43519},{"style":216},[43520],{"type":26,"value":8258},{"type":21,"tag":209,"props":43522,"children":43523},{"style":222},[43524],{"type":26,"value":43525}," north ",{"type":21,"tag":209,"props":43527,"children":43528},{"style":216},[43529],{"type":26,"value":42628},{"type":21,"tag":209,"props":43531,"children":43532},{"style":222},[43533],{"type":26,"value":43534}," infoBounds.north ",{"type":21,"tag":209,"props":43536,"children":43537},{"style":216},[43538],{"type":26,"value":191},{"type":21,"tag":209,"props":43540,"children":43541},{"style":263},[43542],{"type":26,"value":8009},{"type":21,"tag":209,"props":43544,"children":43545},{"style":222},[43546],{"type":26,"value":432},{"type":21,"tag":209,"props":43548,"children":43549},{"style":216},[43550],{"type":26,"value":43443},{"type":21,"tag":209,"props":43552,"children":43553},{"class":211,"line":2611},[43554,43559,43563,43568,43572,43577,43581,43586,43590,43594],{"type":21,"tag":209,"props":43555,"children":43556},{"style":222},[43557],{"type":26,"value":43558},"                ((infoBounds.south ",{"type":21,"tag":209,"props":43560,"children":43561},{"style":216},[43562],{"type":26,"value":1985},{"type":21,"tag":209,"props":43564,"children":43565},{"style":222},[43566],{"type":26,"value":43567}," south) ",{"type":21,"tag":209,"props":43569,"children":43570},{"style":216},[43571],{"type":26,"value":8258},{"type":21,"tag":209,"props":43573,"children":43574},{"style":222},[43575],{"type":26,"value":43576}," south ",{"type":21,"tag":209,"props":43578,"children":43579},{"style":216},[43580],{"type":26,"value":42628},{"type":21,"tag":209,"props":43582,"children":43583},{"style":222},[43584],{"type":26,"value":43585}," infoBounds.south ",{"type":21,"tag":209,"props":43587,"children":43588},{"style":216},[43589],{"type":26,"value":191},{"type":21,"tag":209,"props":43591,"children":43592},{"style":263},[43593],{"type":26,"value":8009},{"type":21,"tag":209,"props":43595,"children":43596},{"style":222},[43597],{"type":26,"value":2608},{"type":21,"tag":209,"props":43599,"children":43600},{"class":211,"line":2619},[43601],{"type":21,"tag":209,"props":43602,"children":43603},{"emptyLinePlaceholder":248},[43604],{"type":26,"value":251},{"type":21,"tag":209,"props":43606,"children":43607},{"class":211,"line":2627},[43608,43612,43617,43621,43626,43630,43634,43639,43644,43649,43653,43658,43662,43667,43671,43675,43679],{"type":21,"tag":209,"props":43609,"children":43610},{"style":216},[43611],{"type":26,"value":3069},{"type":21,"tag":209,"props":43613,"children":43614},{"style":222},[43615],{"type":26,"value":43616}," (shiftLng ",{"type":21,"tag":209,"props":43618,"children":43619},{"style":216},[43620],{"type":26,"value":13270},{"type":21,"tag":209,"props":43622,"children":43623},{"style":222},[43624],{"type":26,"value":43625}," shiftLat) ",{"type":21,"tag":209,"props":43627,"children":43628},{"style":216},[43629],{"type":26,"value":8258},{"type":21,"tag":209,"props":43631,"children":43632},{"style":216},[43633],{"type":26,"value":6371},{"type":21,"tag":209,"props":43635,"children":43636},{"style":222},[43637],{"type":26,"value":43638}," google.maps.",{"type":21,"tag":209,"props":43640,"children":43641},{"style":360},[43642],{"type":26,"value":43643},"LatLng",{"type":21,"tag":209,"props":43645,"children":43646},{"style":222},[43647],{"type":26,"value":43648},"(y ",{"type":21,"tag":209,"props":43650,"children":43651},{"style":216},[43652],{"type":26,"value":42628},{"type":21,"tag":209,"props":43654,"children":43655},{"style":222},[43656],{"type":26,"value":43657}," shiftLat, x ",{"type":21,"tag":209,"props":43659,"children":43660},{"style":216},[43661],{"type":26,"value":42628},{"type":21,"tag":209,"props":43663,"children":43664},{"style":222},[43665],{"type":26,"value":43666}," shiftLng) ",{"type":21,"tag":209,"props":43668,"children":43669},{"style":216},[43670],{"type":26,"value":191},{"type":21,"tag":209,"props":43672,"children":43673},{"style":216},[43674],{"type":26,"value":37190},{"type":21,"tag":209,"props":43676,"children":43677},{"style":263},[43678],{"type":26,"value":8009},{"type":21,"tag":209,"props":43680,"children":43681},{"style":222},[43682],{"type":26,"value":241},{"type":21,"tag":209,"props":43684,"children":43685},{"class":211,"line":2636},[43686],{"type":21,"tag":209,"props":43687,"children":43688},{"style":222},[43689],{"type":26,"value":43690},"    })();\n",{"type":21,"tag":209,"props":43692,"children":43693},{"class":211,"line":2644},[43694],{"type":21,"tag":209,"props":43695,"children":43696},{"emptyLinePlaceholder":248},[43697],{"type":26,"value":251},{"type":21,"tag":209,"props":43699,"children":43700},{"class":211,"line":2657},[43701,43705],{"type":21,"tag":209,"props":43702,"children":43703},{"style":216},[43704],{"type":26,"value":4301},{"type":21,"tag":209,"props":43706,"children":43707},{"style":222},[43708],{"type":26,"value":43709}," (newCenter){\n",{"type":21,"tag":209,"props":43711,"children":43712},{"class":211,"line":2728},[43713,43718,43723],{"type":21,"tag":209,"props":43714,"children":43715},{"style":222},[43716],{"type":26,"value":43717},"    map.",{"type":21,"tag":209,"props":43719,"children":43720},{"style":360},[43721],{"type":26,"value":43722},"panTo",{"type":21,"tag":209,"props":43724,"children":43725},{"style":222},[43726],{"type":26,"value":43727},"(newCenter);\n",{"type":21,"tag":209,"props":43729,"children":43730},{"class":211,"line":2758},[43731],{"type":21,"tag":209,"props":43732,"children":43733},{"style":222},[43734],{"type":26,"value":331},{"type":21,"tag":209,"props":43736,"children":43737},{"class":211,"line":2776},[43738],{"type":21,"tag":209,"props":43739,"children":43740},{"emptyLinePlaceholder":248},[43741],{"type":26,"value":251},{"type":21,"tag":209,"props":43743,"children":43744},{"class":211,"line":2785},[43745],{"type":21,"tag":209,"props":43746,"children":43747},{"style":222},[43748],{"type":26,"value":340},{"type":21,"tag":22,"props":43750,"children":43751},{},[43752,43754,43759,43761,43768],{"type":26,"value":43753},"You'll note almost all of the work happens in the long, run-on ",{"type":21,"tag":63,"props":43755,"children":43757},{"className":43756},[],[43758],{"type":26,"value":3909},{"type":26,"value":43760}," statement. At first blush, this looks like a mere effort at character saving (all those extra vars would be pretty messy) - but thanks to Javascript ",{"type":21,"tag":29,"props":43762,"children":43765},{"href":43763,"rel":43764},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting",[93],[43766],{"type":26,"value":43767},"var hoisting",{"type":26,"value":43769}," its actually a better representation of what the function block looks like to the runtime. But I digress.",{"type":21,"tag":200,"props":43771,"children":43773},{"className":16138,"code":43772,"language":16140,"meta":8,"style":8},"var position = this.position,\n    latlng = this.marker.getPosition(),\n    top = parseInt(this.container.style.top, 10),\n    cHeight = position.y - top,\n    cWidth = this.container.offsetWidth / 2,\n    map = this.getMap(),\n    center = map.getCenter(),\n    bounds = map.getBounds(),\n",[43774],{"type":21,"tag":63,"props":43775,"children":43776},{"__ignoreMap":8},[43777,43800,43828,43864,43888,43920,43948,43972],{"type":21,"tag":209,"props":43778,"children":43779},{"class":211,"line":212},[43780,43784,43788,43792,43796],{"type":21,"tag":209,"props":43781,"children":43782},{"style":216},[43783],{"type":26,"value":3909},{"type":21,"tag":209,"props":43785,"children":43786},{"style":222},[43787],{"type":26,"value":42524},{"type":21,"tag":209,"props":43789,"children":43790},{"style":216},[43791],{"type":26,"value":1432},{"type":21,"tag":209,"props":43793,"children":43794},{"style":263},[43795],{"type":26,"value":20502},{"type":21,"tag":209,"props":43797,"children":43798},{"style":222},[43799],{"type":26,"value":42537},{"type":21,"tag":209,"props":43801,"children":43802},{"class":211,"line":244},[43803,43808,43812,43816,43820,43824],{"type":21,"tag":209,"props":43804,"children":43805},{"style":222},[43806],{"type":26,"value":43807},"    latlng ",{"type":21,"tag":209,"props":43809,"children":43810},{"style":216},[43811],{"type":26,"value":1432},{"type":21,"tag":209,"props":43813,"children":43814},{"style":263},[43815],{"type":26,"value":20502},{"type":21,"tag":209,"props":43817,"children":43818},{"style":222},[43819],{"type":26,"value":42558},{"type":21,"tag":209,"props":43821,"children":43822},{"style":360},[43823],{"type":26,"value":42563},{"type":21,"tag":209,"props":43825,"children":43826},{"style":222},[43827],{"type":26,"value":13988},{"type":21,"tag":209,"props":43829,"children":43830},{"class":211,"line":254},[43831,43836,43840,43844,43848,43852,43856,43860],{"type":21,"tag":209,"props":43832,"children":43833},{"style":222},[43834],{"type":26,"value":43835},"    top ",{"type":21,"tag":209,"props":43837,"children":43838},{"style":216},[43839],{"type":26,"value":1432},{"type":21,"tag":209,"props":43841,"children":43842},{"style":360},[43843],{"type":26,"value":42584},{"type":21,"tag":209,"props":43845,"children":43846},{"style":222},[43847],{"type":26,"value":368},{"type":21,"tag":209,"props":43849,"children":43850},{"style":263},[43851],{"type":26,"value":2508},{"type":21,"tag":209,"props":43853,"children":43854},{"style":222},[43855],{"type":26,"value":42597},{"type":21,"tag":209,"props":43857,"children":43858},{"style":263},[43859],{"type":26,"value":42602},{"type":21,"tag":209,"props":43861,"children":43862},{"style":222},[43863],{"type":26,"value":5404},{"type":21,"tag":209,"props":43865,"children":43866},{"class":211,"line":279},[43867,43872,43876,43880,43884],{"type":21,"tag":209,"props":43868,"children":43869},{"style":222},[43870],{"type":26,"value":43871},"    cHeight ",{"type":21,"tag":209,"props":43873,"children":43874},{"style":216},[43875],{"type":26,"value":1432},{"type":21,"tag":209,"props":43877,"children":43878},{"style":222},[43879],{"type":26,"value":42623},{"type":21,"tag":209,"props":43881,"children":43882},{"style":216},[43883],{"type":26,"value":42628},{"type":21,"tag":209,"props":43885,"children":43886},{"style":222},[43887],{"type":26,"value":42633},{"type":21,"tag":209,"props":43889,"children":43890},{"class":211,"line":288},[43891,43896,43900,43904,43908,43912,43916],{"type":21,"tag":209,"props":43892,"children":43893},{"style":222},[43894],{"type":26,"value":43895},"    cWidth ",{"type":21,"tag":209,"props":43897,"children":43898},{"style":216},[43899],{"type":26,"value":1432},{"type":21,"tag":209,"props":43901,"children":43902},{"style":263},[43903],{"type":26,"value":20502},{"type":21,"tag":209,"props":43905,"children":43906},{"style":222},[43907],{"type":26,"value":42654},{"type":21,"tag":209,"props":43909,"children":43910},{"style":216},[43911],{"type":26,"value":6460},{"type":21,"tag":209,"props":43913,"children":43914},{"style":263},[43915],{"type":26,"value":6354},{"type":21,"tag":209,"props":43917,"children":43918},{"style":222},[43919],{"type":26,"value":304},{"type":21,"tag":209,"props":43921,"children":43922},{"class":211,"line":307},[43923,43928,43932,43936,43940,43944],{"type":21,"tag":209,"props":43924,"children":43925},{"style":222},[43926],{"type":26,"value":43927},"    map ",{"type":21,"tag":209,"props":43929,"children":43930},{"style":216},[43931],{"type":26,"value":1432},{"type":21,"tag":209,"props":43933,"children":43934},{"style":263},[43935],{"type":26,"value":20502},{"type":21,"tag":209,"props":43937,"children":43938},{"style":222},[43939],{"type":26,"value":378},{"type":21,"tag":209,"props":43941,"children":43942},{"style":360},[43943],{"type":26,"value":42691},{"type":21,"tag":209,"props":43945,"children":43946},{"style":222},[43947],{"type":26,"value":13988},{"type":21,"tag":209,"props":43949,"children":43950},{"class":211,"line":325},[43951,43956,43960,43964,43968],{"type":21,"tag":209,"props":43952,"children":43953},{"style":222},[43954],{"type":26,"value":43955},"    center ",{"type":21,"tag":209,"props":43957,"children":43958},{"style":216},[43959],{"type":26,"value":1432},{"type":21,"tag":209,"props":43961,"children":43962},{"style":222},[43963],{"type":26,"value":42712},{"type":21,"tag":209,"props":43965,"children":43966},{"style":360},[43967],{"type":26,"value":42717},{"type":21,"tag":209,"props":43969,"children":43970},{"style":222},[43971],{"type":26,"value":13988},{"type":21,"tag":209,"props":43973,"children":43974},{"class":211,"line":334},[43975,43980,43984,43988,43992],{"type":21,"tag":209,"props":43976,"children":43977},{"style":222},[43978],{"type":26,"value":43979},"    bounds ",{"type":21,"tag":209,"props":43981,"children":43982},{"style":216},[43983],{"type":26,"value":1432},{"type":21,"tag":209,"props":43985,"children":43986},{"style":222},[43987],{"type":26,"value":42712},{"type":21,"tag":209,"props":43989,"children":43990},{"style":360},[43991],{"type":26,"value":42742},{"type":21,"tag":209,"props":43993,"children":43994},{"style":222},[43995],{"type":26,"value":13988},{"type":21,"tag":22,"props":43997,"children":43998},{},[43999],{"type":26,"value":44000},"We start off by getting the locations and bounds of a few things - namely, the position of the custom window itself, the position of its marker, the dimensions of the container, the map and its center and bounds, all for use in later computations.",{"type":21,"tag":200,"props":44002,"children":44004},{"className":16138,"code":44003,"language":16140,"meta":8,"style":8},"degPerPixel = (function(){\n    var degs = {},\n        div = map.getDiv(),\n        span = bounds.toSpan();\n\ndegs.x = span.lng() / div.offsetWidth;\ndegs.y = span.lat() / div.offsetHeight;\nreturn degs;\n})(),\n",[44005],{"type":21,"tag":63,"props":44006,"children":44007},{"__ignoreMap":8},[44008,44032,44051,44075,44099,44106,44138,44170,44181],{"type":21,"tag":209,"props":44009,"children":44010},{"class":211,"line":212},[44011,44016,44020,44024,44028],{"type":21,"tag":209,"props":44012,"children":44013},{"style":222},[44014],{"type":26,"value":44015},"degPerPixel ",{"type":21,"tag":209,"props":44017,"children":44018},{"style":216},[44019],{"type":26,"value":1432},{"type":21,"tag":209,"props":44021,"children":44022},{"style":222},[44023],{"type":26,"value":5569},{"type":21,"tag":209,"props":44025,"children":44026},{"style":216},[44027],{"type":26,"value":4622},{"type":21,"tag":209,"props":44029,"children":44030},{"style":222},[44031],{"type":26,"value":2561},{"type":21,"tag":209,"props":44033,"children":44034},{"class":211,"line":244},[44035,44039,44043,44047],{"type":21,"tag":209,"props":44036,"children":44037},{"style":216},[44038],{"type":26,"value":16994},{"type":21,"tag":209,"props":44040,"children":44041},{"style":222},[44042],{"type":26,"value":42782},{"type":21,"tag":209,"props":44044,"children":44045},{"style":216},[44046],{"type":26,"value":1432},{"type":21,"tag":209,"props":44048,"children":44049},{"style":222},[44050],{"type":26,"value":42791},{"type":21,"tag":209,"props":44052,"children":44053},{"class":211,"line":254},[44054,44059,44063,44067,44071],{"type":21,"tag":209,"props":44055,"children":44056},{"style":222},[44057],{"type":26,"value":44058},"        div ",{"type":21,"tag":209,"props":44060,"children":44061},{"style":216},[44062],{"type":26,"value":1432},{"type":21,"tag":209,"props":44064,"children":44065},{"style":222},[44066],{"type":26,"value":42712},{"type":21,"tag":209,"props":44068,"children":44069},{"style":360},[44070],{"type":26,"value":42812},{"type":21,"tag":209,"props":44072,"children":44073},{"style":222},[44074],{"type":26,"value":13988},{"type":21,"tag":209,"props":44076,"children":44077},{"class":211,"line":279},[44078,44083,44087,44091,44095],{"type":21,"tag":209,"props":44079,"children":44080},{"style":222},[44081],{"type":26,"value":44082},"        span ",{"type":21,"tag":209,"props":44084,"children":44085},{"style":216},[44086],{"type":26,"value":1432},{"type":21,"tag":209,"props":44088,"children":44089},{"style":222},[44090],{"type":26,"value":42833},{"type":21,"tag":209,"props":44092,"children":44093},{"style":360},[44094],{"type":26,"value":42838},{"type":21,"tag":209,"props":44096,"children":44097},{"style":222},[44098],{"type":26,"value":4123},{"type":21,"tag":209,"props":44100,"children":44101},{"class":211,"line":288},[44102],{"type":21,"tag":209,"props":44103,"children":44104},{"emptyLinePlaceholder":248},[44105],{"type":26,"value":251},{"type":21,"tag":209,"props":44107,"children":44108},{"class":211,"line":307},[44109,44114,44118,44122,44126,44130,44134],{"type":21,"tag":209,"props":44110,"children":44111},{"style":222},[44112],{"type":26,"value":44113},"degs.x ",{"type":21,"tag":209,"props":44115,"children":44116},{"style":216},[44117],{"type":26,"value":1432},{"type":21,"tag":209,"props":44119,"children":44120},{"style":222},[44121],{"type":26,"value":42866},{"type":21,"tag":209,"props":44123,"children":44124},{"style":360},[44125],{"type":26,"value":42871},{"type":21,"tag":209,"props":44127,"children":44128},{"style":222},[44129],{"type":26,"value":17194},{"type":21,"tag":209,"props":44131,"children":44132},{"style":216},[44133],{"type":26,"value":6460},{"type":21,"tag":209,"props":44135,"children":44136},{"style":222},[44137],{"type":26,"value":42884},{"type":21,"tag":209,"props":44139,"children":44140},{"class":211,"line":325},[44141,44146,44150,44154,44158,44162,44166],{"type":21,"tag":209,"props":44142,"children":44143},{"style":222},[44144],{"type":26,"value":44145},"degs.y ",{"type":21,"tag":209,"props":44147,"children":44148},{"style":216},[44149],{"type":26,"value":1432},{"type":21,"tag":209,"props":44151,"children":44152},{"style":222},[44153],{"type":26,"value":42866},{"type":21,"tag":209,"props":44155,"children":44156},{"style":360},[44157],{"type":26,"value":42905},{"type":21,"tag":209,"props":44159,"children":44160},{"style":222},[44161],{"type":26,"value":17194},{"type":21,"tag":209,"props":44163,"children":44164},{"style":216},[44165],{"type":26,"value":6460},{"type":21,"tag":209,"props":44167,"children":44168},{"style":222},[44169],{"type":26,"value":42918},{"type":21,"tag":209,"props":44171,"children":44172},{"class":211,"line":334},[44173,44177],{"type":21,"tag":209,"props":44174,"children":44175},{"style":216},[44176],{"type":26,"value":8982},{"type":21,"tag":209,"props":44178,"children":44179},{"style":222},[44180],{"type":26,"value":42930},{"type":21,"tag":209,"props":44182,"children":44183},{"class":211,"line":343},[44184],{"type":21,"tag":209,"props":44185,"children":44186},{"style":222},[44187],{"type":26,"value":44188},"})(),\n",{"type":21,"tag":22,"props":44190,"children":44191},{},[44192],{"type":26,"value":44193},"Here, we create a closure to return an object whose values are the calculated number of degrees per pixel in our map view on the x and y axes. We need this in order to calculate the difference between the current bounds and position of the infoWindow versus the bounds of the map.",{"type":21,"tag":200,"props":44195,"children":44197},{"className":16138,"code":44196,"language":16140,"meta":8,"style":8},"infoBounds = (function(){\n    var infoBounds = {};\n\ninfoBounds.north = latlng.lat() + cHeight * degPerPixel.y;\ninfoBounds.south = latlng.lat();\ninfoBounds.west = latlng.lng() - cWidth * degPerPixel.x;\ninfoBounds.east = latlng.lng() + cWidth * degPerPixel.x;\nreturn infoBounds;\n\n})(),\n",[44198],{"type":21,"tag":63,"props":44199,"children":44200},{"__ignoreMap":8},[44201,44225,44244,44251,44291,44315,44355,44395,44406,44413],{"type":21,"tag":209,"props":44202,"children":44203},{"class":211,"line":212},[44204,44209,44213,44217,44221],{"type":21,"tag":209,"props":44205,"children":44206},{"style":222},[44207],{"type":26,"value":44208},"infoBounds ",{"type":21,"tag":209,"props":44210,"children":44211},{"style":216},[44212],{"type":26,"value":1432},{"type":21,"tag":209,"props":44214,"children":44215},{"style":222},[44216],{"type":26,"value":5569},{"type":21,"tag":209,"props":44218,"children":44219},{"style":216},[44220],{"type":26,"value":4622},{"type":21,"tag":209,"props":44222,"children":44223},{"style":222},[44224],{"type":26,"value":2561},{"type":21,"tag":209,"props":44226,"children":44227},{"class":211,"line":244},[44228,44232,44236,44240],{"type":21,"tag":209,"props":44229,"children":44230},{"style":216},[44231],{"type":26,"value":16994},{"type":21,"tag":209,"props":44233,"children":44234},{"style":222},[44235],{"type":26,"value":42974},{"type":21,"tag":209,"props":44237,"children":44238},{"style":216},[44239],{"type":26,"value":1432},{"type":21,"tag":209,"props":44241,"children":44242},{"style":222},[44243],{"type":26,"value":7963},{"type":21,"tag":209,"props":44245,"children":44246},{"class":211,"line":254},[44247],{"type":21,"tag":209,"props":44248,"children":44249},{"emptyLinePlaceholder":248},[44250],{"type":26,"value":251},{"type":21,"tag":209,"props":44252,"children":44253},{"class":211,"line":279},[44254,44259,44263,44267,44271,44275,44279,44283,44287],{"type":21,"tag":209,"props":44255,"children":44256},{"style":222},[44257],{"type":26,"value":44258},"infoBounds.north ",{"type":21,"tag":209,"props":44260,"children":44261},{"style":216},[44262],{"type":26,"value":1432},{"type":21,"tag":209,"props":44264,"children":44265},{"style":222},[44266],{"type":26,"value":43006},{"type":21,"tag":209,"props":44268,"children":44269},{"style":360},[44270],{"type":26,"value":42905},{"type":21,"tag":209,"props":44272,"children":44273},{"style":222},[44274],{"type":26,"value":17194},{"type":21,"tag":209,"props":44276,"children":44277},{"style":216},[44278],{"type":26,"value":17170},{"type":21,"tag":209,"props":44280,"children":44281},{"style":222},[44282],{"type":26,"value":43023},{"type":21,"tag":209,"props":44284,"children":44285},{"style":216},[44286],{"type":26,"value":944},{"type":21,"tag":209,"props":44288,"children":44289},{"style":222},[44290],{"type":26,"value":43032},{"type":21,"tag":209,"props":44292,"children":44293},{"class":211,"line":288},[44294,44299,44303,44307,44311],{"type":21,"tag":209,"props":44295,"children":44296},{"style":222},[44297],{"type":26,"value":44298},"infoBounds.south ",{"type":21,"tag":209,"props":44300,"children":44301},{"style":216},[44302],{"type":26,"value":1432},{"type":21,"tag":209,"props":44304,"children":44305},{"style":222},[44306],{"type":26,"value":43006},{"type":21,"tag":209,"props":44308,"children":44309},{"style":360},[44310],{"type":26,"value":42905},{"type":21,"tag":209,"props":44312,"children":44313},{"style":222},[44314],{"type":26,"value":4123},{"type":21,"tag":209,"props":44316,"children":44317},{"class":211,"line":307},[44318,44323,44327,44331,44335,44339,44343,44347,44351],{"type":21,"tag":209,"props":44319,"children":44320},{"style":222},[44321],{"type":26,"value":44322},"infoBounds.west ",{"type":21,"tag":209,"props":44324,"children":44325},{"style":216},[44326],{"type":26,"value":1432},{"type":21,"tag":209,"props":44328,"children":44329},{"style":222},[44330],{"type":26,"value":43006},{"type":21,"tag":209,"props":44332,"children":44333},{"style":360},[44334],{"type":26,"value":42871},{"type":21,"tag":209,"props":44336,"children":44337},{"style":222},[44338],{"type":26,"value":17194},{"type":21,"tag":209,"props":44340,"children":44341},{"style":216},[44342],{"type":26,"value":42628},{"type":21,"tag":209,"props":44344,"children":44345},{"style":222},[44346],{"type":26,"value":43089},{"type":21,"tag":209,"props":44348,"children":44349},{"style":216},[44350],{"type":26,"value":944},{"type":21,"tag":209,"props":44352,"children":44353},{"style":222},[44354],{"type":26,"value":43098},{"type":21,"tag":209,"props":44356,"children":44357},{"class":211,"line":325},[44358,44363,44367,44371,44375,44379,44383,44387,44391],{"type":21,"tag":209,"props":44359,"children":44360},{"style":222},[44361],{"type":26,"value":44362},"infoBounds.east ",{"type":21,"tag":209,"props":44364,"children":44365},{"style":216},[44366],{"type":26,"value":1432},{"type":21,"tag":209,"props":44368,"children":44369},{"style":222},[44370],{"type":26,"value":43006},{"type":21,"tag":209,"props":44372,"children":44373},{"style":360},[44374],{"type":26,"value":42871},{"type":21,"tag":209,"props":44376,"children":44377},{"style":222},[44378],{"type":26,"value":17194},{"type":21,"tag":209,"props":44380,"children":44381},{"style":216},[44382],{"type":26,"value":17170},{"type":21,"tag":209,"props":44384,"children":44385},{"style":222},[44386],{"type":26,"value":43089},{"type":21,"tag":209,"props":44388,"children":44389},{"style":216},[44390],{"type":26,"value":944},{"type":21,"tag":209,"props":44392,"children":44393},{"style":222},[44394],{"type":26,"value":43098},{"type":21,"tag":209,"props":44396,"children":44397},{"class":211,"line":334},[44398,44402],{"type":21,"tag":209,"props":44399,"children":44400},{"style":216},[44401],{"type":26,"value":8982},{"type":21,"tag":209,"props":44403,"children":44404},{"style":222},[44405],{"type":26,"value":43150},{"type":21,"tag":209,"props":44407,"children":44408},{"class":211,"line":343},[44409],{"type":21,"tag":209,"props":44410,"children":44411},{"emptyLinePlaceholder":248},[44412],{"type":26,"value":251},{"type":21,"tag":209,"props":44414,"children":44415},{"class":211,"line":351},[44416],{"type":21,"tag":209,"props":44417,"children":44418},{"style":222},[44419],{"type":26,"value":44188},{"type":21,"tag":22,"props":44421,"children":44422},{},[44423],{"type":26,"value":44424},"Similarly, here we return an object containing the calculating bounds of our info window in degrees, with the base of the marker being considered the southern boundary, so that both the marker and info window will be in view when we're done.",{"type":21,"tag":200,"props":44426,"children":44428},{"className":16138,"code":44427,"language":16140,"meta":8,"style":8},"newCenter = (function(){\n    var ne = bounds.getNorthEast(),\n        sw = bounds.getSouthWest(),\n        north = ne.lat(),\n        east = ne.lng(),\n        south = sw.lat(),\n        west = sw.lng(),\n        x = center.lng(),\n        y = center.lat(),\n        shiftLng = ((infoBounds.west \u003C west) ? west - infoBounds.west : 0) +\n            ((infoBounds.east > east) ? east - infoBounds.east : 0),\n        shiftLat = ((infoBounds.north > north) ? north - infoBounds.north : 0) +\n            ((infoBounds.south \u003C south) ? south - infoBounds.south : 0);\n\n        return (shiftLng || shiftLat) ? new google.maps.LatLng(y - shiftLat, x - shiftLng) : void 0;\n\n})();\n\nif (newCenter){\n    map.panTo(newCenter);\n}\n",[44429],{"type":21,"tag":63,"props":44430,"children":44431},{"__ignoreMap":8},[44432,44456,44483,44507,44531,44555,44579,44603,44627,44651,44707,44751,44807,44851,44858,44929,44936,44943,44950,44961,44976],{"type":21,"tag":209,"props":44433,"children":44434},{"class":211,"line":212},[44435,44440,44444,44448,44452],{"type":21,"tag":209,"props":44436,"children":44437},{"style":222},[44438],{"type":26,"value":44439},"newCenter ",{"type":21,"tag":209,"props":44441,"children":44442},{"style":216},[44443],{"type":26,"value":1432},{"type":21,"tag":209,"props":44445,"children":44446},{"style":222},[44447],{"type":26,"value":5569},{"type":21,"tag":209,"props":44449,"children":44450},{"style":216},[44451],{"type":26,"value":4622},{"type":21,"tag":209,"props":44453,"children":44454},{"style":222},[44455],{"type":26,"value":2561},{"type":21,"tag":209,"props":44457,"children":44458},{"class":211,"line":244},[44459,44463,44467,44471,44475,44479],{"type":21,"tag":209,"props":44460,"children":44461},{"style":216},[44462],{"type":26,"value":16994},{"type":21,"tag":209,"props":44464,"children":44465},{"style":222},[44466],{"type":26,"value":43193},{"type":21,"tag":209,"props":44468,"children":44469},{"style":216},[44470],{"type":26,"value":1432},{"type":21,"tag":209,"props":44472,"children":44473},{"style":222},[44474],{"type":26,"value":42833},{"type":21,"tag":209,"props":44476,"children":44477},{"style":360},[44478],{"type":26,"value":43206},{"type":21,"tag":209,"props":44480,"children":44481},{"style":222},[44482],{"type":26,"value":13988},{"type":21,"tag":209,"props":44484,"children":44485},{"class":211,"line":254},[44486,44491,44495,44499,44503],{"type":21,"tag":209,"props":44487,"children":44488},{"style":222},[44489],{"type":26,"value":44490},"        sw ",{"type":21,"tag":209,"props":44492,"children":44493},{"style":216},[44494],{"type":26,"value":1432},{"type":21,"tag":209,"props":44496,"children":44497},{"style":222},[44498],{"type":26,"value":42833},{"type":21,"tag":209,"props":44500,"children":44501},{"style":360},[44502],{"type":26,"value":43231},{"type":21,"tag":209,"props":44504,"children":44505},{"style":222},[44506],{"type":26,"value":13988},{"type":21,"tag":209,"props":44508,"children":44509},{"class":211,"line":279},[44510,44515,44519,44523,44527],{"type":21,"tag":209,"props":44511,"children":44512},{"style":222},[44513],{"type":26,"value":44514},"        north ",{"type":21,"tag":209,"props":44516,"children":44517},{"style":216},[44518],{"type":26,"value":1432},{"type":21,"tag":209,"props":44520,"children":44521},{"style":222},[44522],{"type":26,"value":43252},{"type":21,"tag":209,"props":44524,"children":44525},{"style":360},[44526],{"type":26,"value":42905},{"type":21,"tag":209,"props":44528,"children":44529},{"style":222},[44530],{"type":26,"value":13988},{"type":21,"tag":209,"props":44532,"children":44533},{"class":211,"line":288},[44534,44539,44543,44547,44551],{"type":21,"tag":209,"props":44535,"children":44536},{"style":222},[44537],{"type":26,"value":44538},"        east ",{"type":21,"tag":209,"props":44540,"children":44541},{"style":216},[44542],{"type":26,"value":1432},{"type":21,"tag":209,"props":44544,"children":44545},{"style":222},[44546],{"type":26,"value":43252},{"type":21,"tag":209,"props":44548,"children":44549},{"style":360},[44550],{"type":26,"value":42871},{"type":21,"tag":209,"props":44552,"children":44553},{"style":222},[44554],{"type":26,"value":13988},{"type":21,"tag":209,"props":44556,"children":44557},{"class":211,"line":307},[44558,44563,44567,44571,44575],{"type":21,"tag":209,"props":44559,"children":44560},{"style":222},[44561],{"type":26,"value":44562},"        south ",{"type":21,"tag":209,"props":44564,"children":44565},{"style":216},[44566],{"type":26,"value":1432},{"type":21,"tag":209,"props":44568,"children":44569},{"style":222},[44570],{"type":26,"value":43301},{"type":21,"tag":209,"props":44572,"children":44573},{"style":360},[44574],{"type":26,"value":42905},{"type":21,"tag":209,"props":44576,"children":44577},{"style":222},[44578],{"type":26,"value":13988},{"type":21,"tag":209,"props":44580,"children":44581},{"class":211,"line":325},[44582,44587,44591,44595,44599],{"type":21,"tag":209,"props":44583,"children":44584},{"style":222},[44585],{"type":26,"value":44586},"        west ",{"type":21,"tag":209,"props":44588,"children":44589},{"style":216},[44590],{"type":26,"value":1432},{"type":21,"tag":209,"props":44592,"children":44593},{"style":222},[44594],{"type":26,"value":43301},{"type":21,"tag":209,"props":44596,"children":44597},{"style":360},[44598],{"type":26,"value":42871},{"type":21,"tag":209,"props":44600,"children":44601},{"style":222},[44602],{"type":26,"value":13988},{"type":21,"tag":209,"props":44604,"children":44605},{"class":211,"line":334},[44606,44611,44615,44619,44623],{"type":21,"tag":209,"props":44607,"children":44608},{"style":222},[44609],{"type":26,"value":44610},"        x ",{"type":21,"tag":209,"props":44612,"children":44613},{"style":216},[44614],{"type":26,"value":1432},{"type":21,"tag":209,"props":44616,"children":44617},{"style":222},[44618],{"type":26,"value":43350},{"type":21,"tag":209,"props":44620,"children":44621},{"style":360},[44622],{"type":26,"value":42871},{"type":21,"tag":209,"props":44624,"children":44625},{"style":222},[44626],{"type":26,"value":13988},{"type":21,"tag":209,"props":44628,"children":44629},{"class":211,"line":343},[44630,44635,44639,44643,44647],{"type":21,"tag":209,"props":44631,"children":44632},{"style":222},[44633],{"type":26,"value":44634},"        y ",{"type":21,"tag":209,"props":44636,"children":44637},{"style":216},[44638],{"type":26,"value":1432},{"type":21,"tag":209,"props":44640,"children":44641},{"style":222},[44642],{"type":26,"value":43350},{"type":21,"tag":209,"props":44644,"children":44645},{"style":360},[44646],{"type":26,"value":42905},{"type":21,"tag":209,"props":44648,"children":44649},{"style":222},[44650],{"type":26,"value":13988},{"type":21,"tag":209,"props":44652,"children":44653},{"class":211,"line":351},[44654,44659,44663,44667,44671,44675,44679,44683,44687,44691,44695,44699,44703],{"type":21,"tag":209,"props":44655,"children":44656},{"style":222},[44657],{"type":26,"value":44658},"        shiftLng ",{"type":21,"tag":209,"props":44660,"children":44661},{"style":216},[44662],{"type":26,"value":1432},{"type":21,"tag":209,"props":44664,"children":44665},{"style":222},[44666],{"type":26,"value":43399},{"type":21,"tag":209,"props":44668,"children":44669},{"style":216},[44670],{"type":26,"value":1985},{"type":21,"tag":209,"props":44672,"children":44673},{"style":222},[44674],{"type":26,"value":43408},{"type":21,"tag":209,"props":44676,"children":44677},{"style":216},[44678],{"type":26,"value":8258},{"type":21,"tag":209,"props":44680,"children":44681},{"style":222},[44682],{"type":26,"value":43417},{"type":21,"tag":209,"props":44684,"children":44685},{"style":216},[44686],{"type":26,"value":42628},{"type":21,"tag":209,"props":44688,"children":44689},{"style":222},[44690],{"type":26,"value":43426},{"type":21,"tag":209,"props":44692,"children":44693},{"style":216},[44694],{"type":26,"value":191},{"type":21,"tag":209,"props":44696,"children":44697},{"style":263},[44698],{"type":26,"value":8009},{"type":21,"tag":209,"props":44700,"children":44701},{"style":222},[44702],{"type":26,"value":432},{"type":21,"tag":209,"props":44704,"children":44705},{"style":216},[44706],{"type":26,"value":43443},{"type":21,"tag":209,"props":44708,"children":44709},{"class":211,"line":444},[44710,44715,44719,44723,44727,44731,44735,44739,44743,44747],{"type":21,"tag":209,"props":44711,"children":44712},{"style":222},[44713],{"type":26,"value":44714},"            ((infoBounds.east ",{"type":21,"tag":209,"props":44716,"children":44717},{"style":216},[44718],{"type":26,"value":2014},{"type":21,"tag":209,"props":44720,"children":44721},{"style":222},[44722],{"type":26,"value":43460},{"type":21,"tag":209,"props":44724,"children":44725},{"style":216},[44726],{"type":26,"value":8258},{"type":21,"tag":209,"props":44728,"children":44729},{"style":222},[44730],{"type":26,"value":43469},{"type":21,"tag":209,"props":44732,"children":44733},{"style":216},[44734],{"type":26,"value":42628},{"type":21,"tag":209,"props":44736,"children":44737},{"style":222},[44738],{"type":26,"value":43478},{"type":21,"tag":209,"props":44740,"children":44741},{"style":216},[44742],{"type":26,"value":191},{"type":21,"tag":209,"props":44744,"children":44745},{"style":263},[44746],{"type":26,"value":8009},{"type":21,"tag":209,"props":44748,"children":44749},{"style":222},[44750],{"type":26,"value":5404},{"type":21,"tag":209,"props":44752,"children":44753},{"class":211,"line":454},[44754,44759,44763,44767,44771,44775,44779,44783,44787,44791,44795,44799,44803],{"type":21,"tag":209,"props":44755,"children":44756},{"style":222},[44757],{"type":26,"value":44758},"        shiftLat ",{"type":21,"tag":209,"props":44760,"children":44761},{"style":216},[44762],{"type":26,"value":1432},{"type":21,"tag":209,"props":44764,"children":44765},{"style":222},[44766],{"type":26,"value":43507},{"type":21,"tag":209,"props":44768,"children":44769},{"style":216},[44770],{"type":26,"value":2014},{"type":21,"tag":209,"props":44772,"children":44773},{"style":222},[44774],{"type":26,"value":43516},{"type":21,"tag":209,"props":44776,"children":44777},{"style":216},[44778],{"type":26,"value":8258},{"type":21,"tag":209,"props":44780,"children":44781},{"style":222},[44782],{"type":26,"value":43525},{"type":21,"tag":209,"props":44784,"children":44785},{"style":216},[44786],{"type":26,"value":42628},{"type":21,"tag":209,"props":44788,"children":44789},{"style":222},[44790],{"type":26,"value":43534},{"type":21,"tag":209,"props":44792,"children":44793},{"style":216},[44794],{"type":26,"value":191},{"type":21,"tag":209,"props":44796,"children":44797},{"style":263},[44798],{"type":26,"value":8009},{"type":21,"tag":209,"props":44800,"children":44801},{"style":222},[44802],{"type":26,"value":432},{"type":21,"tag":209,"props":44804,"children":44805},{"style":216},[44806],{"type":26,"value":43443},{"type":21,"tag":209,"props":44808,"children":44809},{"class":211,"line":463},[44810,44815,44819,44823,44827,44831,44835,44839,44843,44847],{"type":21,"tag":209,"props":44811,"children":44812},{"style":222},[44813],{"type":26,"value":44814},"            ((infoBounds.south ",{"type":21,"tag":209,"props":44816,"children":44817},{"style":216},[44818],{"type":26,"value":1985},{"type":21,"tag":209,"props":44820,"children":44821},{"style":222},[44822],{"type":26,"value":43567},{"type":21,"tag":209,"props":44824,"children":44825},{"style":216},[44826],{"type":26,"value":8258},{"type":21,"tag":209,"props":44828,"children":44829},{"style":222},[44830],{"type":26,"value":43576},{"type":21,"tag":209,"props":44832,"children":44833},{"style":216},[44834],{"type":26,"value":42628},{"type":21,"tag":209,"props":44836,"children":44837},{"style":222},[44838],{"type":26,"value":43585},{"type":21,"tag":209,"props":44840,"children":44841},{"style":216},[44842],{"type":26,"value":191},{"type":21,"tag":209,"props":44844,"children":44845},{"style":263},[44846],{"type":26,"value":8009},{"type":21,"tag":209,"props":44848,"children":44849},{"style":222},[44850],{"type":26,"value":2608},{"type":21,"tag":209,"props":44852,"children":44853},{"class":211,"line":472},[44854],{"type":21,"tag":209,"props":44855,"children":44856},{"emptyLinePlaceholder":248},[44857],{"type":26,"value":251},{"type":21,"tag":209,"props":44859,"children":44860},{"class":211,"line":480},[44861,44865,44869,44873,44877,44881,44885,44889,44893,44897,44901,44905,44909,44913,44917,44921,44925],{"type":21,"tag":209,"props":44862,"children":44863},{"style":216},[44864],{"type":26,"value":3069},{"type":21,"tag":209,"props":44866,"children":44867},{"style":222},[44868],{"type":26,"value":43616},{"type":21,"tag":209,"props":44870,"children":44871},{"style":216},[44872],{"type":26,"value":13270},{"type":21,"tag":209,"props":44874,"children":44875},{"style":222},[44876],{"type":26,"value":43625},{"type":21,"tag":209,"props":44878,"children":44879},{"style":216},[44880],{"type":26,"value":8258},{"type":21,"tag":209,"props":44882,"children":44883},{"style":216},[44884],{"type":26,"value":6371},{"type":21,"tag":209,"props":44886,"children":44887},{"style":222},[44888],{"type":26,"value":43638},{"type":21,"tag":209,"props":44890,"children":44891},{"style":360},[44892],{"type":26,"value":43643},{"type":21,"tag":209,"props":44894,"children":44895},{"style":222},[44896],{"type":26,"value":43648},{"type":21,"tag":209,"props":44898,"children":44899},{"style":216},[44900],{"type":26,"value":42628},{"type":21,"tag":209,"props":44902,"children":44903},{"style":222},[44904],{"type":26,"value":43657},{"type":21,"tag":209,"props":44906,"children":44907},{"style":216},[44908],{"type":26,"value":42628},{"type":21,"tag":209,"props":44910,"children":44911},{"style":222},[44912],{"type":26,"value":43666},{"type":21,"tag":209,"props":44914,"children":44915},{"style":216},[44916],{"type":26,"value":191},{"type":21,"tag":209,"props":44918,"children":44919},{"style":216},[44920],{"type":26,"value":37190},{"type":21,"tag":209,"props":44922,"children":44923},{"style":263},[44924],{"type":26,"value":8009},{"type":21,"tag":209,"props":44926,"children":44927},{"style":222},[44928],{"type":26,"value":241},{"type":21,"tag":209,"props":44930,"children":44931},{"class":211,"line":489},[44932],{"type":21,"tag":209,"props":44933,"children":44934},{"emptyLinePlaceholder":248},[44935],{"type":26,"value":251},{"type":21,"tag":209,"props":44937,"children":44938},{"class":211,"line":847},[44939],{"type":21,"tag":209,"props":44940,"children":44941},{"style":222},[44942],{"type":26,"value":32754},{"type":21,"tag":209,"props":44944,"children":44945},{"class":211,"line":860},[44946],{"type":21,"tag":209,"props":44947,"children":44948},{"emptyLinePlaceholder":248},[44949],{"type":26,"value":251},{"type":21,"tag":209,"props":44951,"children":44952},{"class":211,"line":877},[44953,44957],{"type":21,"tag":209,"props":44954,"children":44955},{"style":216},[44956],{"type":26,"value":4301},{"type":21,"tag":209,"props":44958,"children":44959},{"style":222},[44960],{"type":26,"value":43709},{"type":21,"tag":209,"props":44962,"children":44963},{"class":211,"line":889},[44964,44968,44972],{"type":21,"tag":209,"props":44965,"children":44966},{"style":222},[44967],{"type":26,"value":43717},{"type":21,"tag":209,"props":44969,"children":44970},{"style":360},[44971],{"type":26,"value":43722},{"type":21,"tag":209,"props":44973,"children":44974},{"style":222},[44975],{"type":26,"value":43727},{"type":21,"tag":209,"props":44977,"children":44978},{"class":211,"line":902},[44979],{"type":21,"tag":209,"props":44980,"children":44981},{"style":222},[44982],{"type":26,"value":4415},{"type":21,"tag":22,"props":44984,"children":44985},{},[44986],{"type":26,"value":44987},"Finally, we calculate what should be the new center of the map based on the minimum shift of the center necessary in order to ensure the full bounds of our info window, as previously calculated, will be in view, considering the bounds of the map. If no shift is required, we return undefined and skip setting a new center.",{"type":21,"tag":22,"props":44989,"children":44990},{},[44991,44993,44998,45000],{"type":26,"value":44992},"Want to see it in action? ",{"type":21,"tag":29,"props":44994,"children":44996},{"href":42411,"rel":44995},[93],[44997],{"type":26,"value":42415},{"type":26,"value":44999}," Want to see the code? ",{"type":21,"tag":29,"props":45001,"children":45004},{"href":45002,"rel":45003},"https://github.com/SaneMethod/CGWin",[93],[45005],{"type":26,"value":45006},"CGWin Github repo",{"type":21,"tag":3490,"props":45008,"children":45009},{},[45010],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":45012},[45013],{"id":42400,"depth":244,"text":42403},"content:ckeefer:2014-5:cgwin2.md","ckeefer/2014-5/cgwin2.md","ckeefer/2014-5/cgwin2",{"user":3518,"name":3519},{"_path":45019,"_dir":45020,"_draft":7,"_partial":7,"_locale":8,"title":45021,"description":45022,"publishDate":45023,"tags":45024,"excerpt":45022,"body":45025,"_type":3511,"_id":46565,"_source":3513,"_file":46566,"_stem":46567,"_extension":3516,"author":46568},"/ckeefer/2014-4/hidden-options","2014-4","Hidden Options: A Workaround","Here's the situation: You've got a select. Maybe a whole bunch of selects, with a ton of options each (metric ton - let's keep our imaginary hyperbolic units straight here); and these are meant to be complex interactive elements, with options made visible or not as some programmatic condition dictates.","2014-04-23",[11665,12,16600],{"type":18,"children":45026,"toc":46563},[45027,45031,45036,45049,45108,45113,45118,45162,45167,46370,46375,46430,46435,46496,46521,46535,46540,46554,46559],{"type":21,"tag":22,"props":45028,"children":45029},{},[45030],{"type":26,"value":45022},{"type":21,"tag":22,"props":45032,"children":45033},{},[45034],{"type":26,"value":45035},"Traditionally, if you wanted to selectively display options, you had to do it the hard way - remove the non-visible option nodes entirely. What, did you want to filter on some state information stored on the node? Too bad - you'll have to keep track of the full structure outside of the DOM and filter on that, inserting or removing elements as needed.",{"type":21,"tag":22,"props":45037,"children":45038},{},[45039,45041,45047],{"type":26,"value":45040},"This is sub-optimal. It's much tidier if we can just set ",{"type":21,"tag":63,"props":45042,"children":45044},{"className":45043},[],[45045],{"type":26,"value":45046},"display:none",{"type":26,"value":45048}," on our options elements, and have them hidden like any other DOM element:",{"type":21,"tag":200,"props":45050,"children":45054},{"className":45051,"code":45052,"language":45053,"meta":8,"style":8},"language-css shiki shiki-themes github-light github-dark","option[disabled]{\n    display:none;\n}\n","css",[45055],{"type":21,"tag":63,"props":45056,"children":45057},{"__ignoreMap":8},[45058,45080,45101],{"type":21,"tag":209,"props":45059,"children":45060},{"class":211,"line":212},[45061,45066,45070,45075],{"type":21,"tag":209,"props":45062,"children":45063},{"style":1988},[45064],{"type":26,"value":45065},"option",{"type":21,"tag":209,"props":45067,"children":45068},{"style":222},[45069],{"type":26,"value":28501},{"type":21,"tag":209,"props":45071,"children":45072},{"style":360},[45073],{"type":26,"value":45074},"disabled",{"type":21,"tag":209,"props":45076,"children":45077},{"style":222},[45078],{"type":26,"value":45079},"]{\n",{"type":21,"tag":209,"props":45081,"children":45082},{"class":211,"line":244},[45083,45088,45092,45097],{"type":21,"tag":209,"props":45084,"children":45085},{"style":263},[45086],{"type":26,"value":45087},"    display",{"type":21,"tag":209,"props":45089,"children":45090},{"style":222},[45091],{"type":26,"value":191},{"type":21,"tag":209,"props":45093,"children":45094},{"style":263},[45095],{"type":26,"value":45096},"none",{"type":21,"tag":209,"props":45098,"children":45099},{"style":222},[45100],{"type":26,"value":241},{"type":21,"tag":209,"props":45102,"children":45103},{"class":211,"line":254},[45104],{"type":21,"tag":209,"props":45105,"children":45106},{"style":222},[45107],{"type":26,"value":4415},{"type":21,"tag":22,"props":45109,"children":45110},{},[45111],{"type":26,"value":45112},"and in most modern browsers (Firefox, IE9+, Safari), this works just fine. We can then filter in place on the elements, and selectively display them.",{"type":21,"tag":22,"props":45114,"children":45115},{},[45116],{"type":26,"value":45117},"Have you noticed the glaring omission yet? Yes, Chrome isn't among the browsers this works 'just fine' in.",{"type":21,"tag":22,"props":45119,"children":45120},{},[45121,45123,45128,45130,45135,45137,45144,45146,45153,45155,45160],{"type":26,"value":45122},"You ",{"type":21,"tag":1084,"props":45124,"children":45125},{},[45126],{"type":26,"value":45127},"can",{"type":26,"value":45129}," set ",{"type":21,"tag":63,"props":45131,"children":45133},{"className":45132},[],[45134],{"type":26,"value":45046},{"type":26,"value":45136}," on your disabled options to hide them, and that will work - but as ",{"type":21,"tag":29,"props":45138,"children":45141},{"href":45139,"rel":45140},"http://stackoverflow.com/questions/17203826/chrome-bug-on-select-element-dropdown-when-many-options-are-hidden",[93],[45142],{"type":26,"value":45143},"stackoverflow user JMack discovered",{"type":26,"value":45145},", and per ",{"type":21,"tag":29,"props":45147,"children":45150},{"href":45148,"rel":45149},"http://code.google.com/p/chromium/issues/detail?id=139595",[93],[45151],{"type":26,"value":45152},"this long-standing chromium bug",{"type":26,"value":45154}," (open since Jul 30 2012, with the most recent activity on it a ",{"type":21,"tag":11881,"props":45156,"children":45157},{},[45158],{"type":26,"value":45159},"downgrade",{"type":26,"value":45161}," in priority), when you have hidden options in your select, the select dropdown will fail to resize itself appropriately - to the point that the dropdown may not show anything beyond the initial visible option, with the rest of the visible options hidden beneath. They're still selectable, and can be scrolled to, but the dropdown list will be tiny and scrolling won't work quite right, often leaving you with the top and bottom of the next two options visible.",{"type":21,"tag":22,"props":45163,"children":45164},{},[45165],{"type":26,"value":45166},"We're not here to complain, though - we're here to get things done. Let's whip up a workaround, and then discuss how to use it, how and why it works.",{"type":21,"tag":200,"props":45168,"children":45170},{"className":16138,"code":45169,"language":16140,"meta":8,"style":8},"(function($){\n    var userAgent = window.navigator.userAgent,\n        needsWrap = (userAgent.indexOf('Trident') !== -1 || userAgent.indexOf('AppleWebKit') !== -1);\n    /**\n     * Workaround for browsers that respect hidden options elements, but then fail to resize the select dropdown\n     * to display any visible elements beyond those that appear before any hidden elements - namely, Chrome.\n     * Based on the filter function, we either select all options that match (or, if invert is true, all that\n     * don't match), set them to disabled (with the expectation that there's a css rule hiding disabled options\n     * somewhere), and then pull the disabled options out of the DOM and insert them back in at the end of the\n     * select - this is tested as working in the most recent version of Chrome (as of this writing, v34).\n     * See also http://code.google.com/p/chromium/issues/detail?id=139595 and\n     * http://stackoverflow.com/questions/17203826/chrome-bug-on-select-element-dropdown-when-many-options-are-hidden\n     * for reports of the browser bug this works around.\n     *\n     * Additionally, we handle browsers that DON'T respect hidden options, by agent-sniffing such browsers\n     * and wrapping and unwrapping as necessary options that we want hidden in a span tag.\n     *\n     * @note This works, but DOM manipulation in IE is SLOW - much slower to perform an appendChild operation\n     * than any of the other major browsers. Wrapping/unwrapping large sets of options will take a relative long time (>2s)\n     * and have the potential to hang the UI thread.\n     * @param {string|HtmlElement|jQuery} el\n     * @param {function} filter\n     * @param {boolean=} invert\n     * @returns {jQuery}\n     */\n    $.elideOptions = function(el, filter, invert){\n        var $el = (el instanceof $) ? el : $(el);\n\n        $el.each(function(){\n            if (this.tagName !== 'SELECT') return;\n            var $this = $(this),\n                opts = $this.find('option').prop('disabled', false),\n                spans;\n\n            // Unwrap all options from their span tags\n            if (needsWrap && (spans = $this.find('span')) && spans.length){\n                spans.children().unwrap();\n            }\n\n            opts = (invert) ? opts.not(filter).prop('disabled', true) :\n                opts.filter(filter).prop('disabled', true);\n\n            // Wrap options in a single hidden span to hide them on browsers that don't support\n            // display:none for options\n            if (needsWrap) {\n                opts.wrapAll('\u003Cspan class=\"hide\">\u003C/span>');\n                opts = opts.parent('span');\n            }\n\n            opts.detach().appendTo($this);\n        });\n\n        return $el;\n    };\n\n    /**\n     * Allow for the $(element) form of invocation.\n     * @param {function} filter\n     * @param {boolean=} invert\n     * @returns {jQuery}\n     */\n    $.fn.elideOptions = function(filter, invert){\n        return $.elideOptions(this, filter, invert);\n    };\n})(jQuery);\n",[45171],{"type":21,"tag":63,"props":45172,"children":45173},{"__ignoreMap":8},[45174,45197,45218,45308,45315,45323,45331,45339,45347,45355,45363,45371,45379,45387,45394,45402,45410,45417,45434,45442,45450,45471,45491,45512,45528,45535,45586,45643,45650,45675,45716,45748,45809,45817,45824,45832,45896,45922,45929,45936,45999,46039,46046,46054,46062,46074,46099,46131,46138,46145,46172,46179,46186,46198,46205,46212,46219,46227,46246,46265,46280,46287,46327,46355,46362],{"type":21,"tag":209,"props":45175,"children":45176},{"class":211,"line":212},[45177,45181,45185,45189,45193],{"type":21,"tag":209,"props":45178,"children":45179},{"style":222},[45180],{"type":26,"value":368},{"type":21,"tag":209,"props":45182,"children":45183},{"style":216},[45184],{"type":26,"value":4622},{"type":21,"tag":209,"props":45186,"children":45187},{"style":222},[45188],{"type":26,"value":368},{"type":21,"tag":209,"props":45190,"children":45191},{"style":400},[45192],{"type":26,"value":6476},{"type":21,"tag":209,"props":45194,"children":45195},{"style":222},[45196],{"type":26,"value":2369},{"type":21,"tag":209,"props":45198,"children":45199},{"class":211,"line":244},[45200,45204,45209,45213],{"type":21,"tag":209,"props":45201,"children":45202},{"style":216},[45203],{"type":26,"value":16994},{"type":21,"tag":209,"props":45205,"children":45206},{"style":222},[45207],{"type":26,"value":45208}," userAgent ",{"type":21,"tag":209,"props":45210,"children":45211},{"style":216},[45212],{"type":26,"value":1432},{"type":21,"tag":209,"props":45214,"children":45215},{"style":222},[45216],{"type":26,"value":45217}," window.navigator.userAgent,\n",{"type":21,"tag":209,"props":45219,"children":45220},{"class":211,"line":254},[45221,45226,45230,45235,45240,45244,45249,45253,45257,45262,45266,45270,45275,45279,45283,45288,45292,45296,45300,45304],{"type":21,"tag":209,"props":45222,"children":45223},{"style":222},[45224],{"type":26,"value":45225},"        needsWrap ",{"type":21,"tag":209,"props":45227,"children":45228},{"style":216},[45229],{"type":26,"value":1432},{"type":21,"tag":209,"props":45231,"children":45232},{"style":222},[45233],{"type":26,"value":45234}," (userAgent.",{"type":21,"tag":209,"props":45236,"children":45237},{"style":360},[45238],{"type":26,"value":45239},"indexOf",{"type":21,"tag":209,"props":45241,"children":45242},{"style":222},[45243],{"type":26,"value":368},{"type":21,"tag":209,"props":45245,"children":45246},{"style":233},[45247],{"type":26,"value":45248},"'Trident'",{"type":21,"tag":209,"props":45250,"children":45251},{"style":222},[45252],{"type":26,"value":432},{"type":21,"tag":209,"props":45254,"children":45255},{"style":216},[45256],{"type":26,"value":8046},{"type":21,"tag":209,"props":45258,"children":45259},{"style":216},[45260],{"type":26,"value":45261}," -",{"type":21,"tag":209,"props":45263,"children":45264},{"style":263},[45265],{"type":26,"value":3224},{"type":21,"tag":209,"props":45267,"children":45268},{"style":216},[45269],{"type":26,"value":4608},{"type":21,"tag":209,"props":45271,"children":45272},{"style":222},[45273],{"type":26,"value":45274}," userAgent.",{"type":21,"tag":209,"props":45276,"children":45277},{"style":360},[45278],{"type":26,"value":45239},{"type":21,"tag":209,"props":45280,"children":45281},{"style":222},[45282],{"type":26,"value":368},{"type":21,"tag":209,"props":45284,"children":45285},{"style":233},[45286],{"type":26,"value":45287},"'AppleWebKit'",{"type":21,"tag":209,"props":45289,"children":45290},{"style":222},[45291],{"type":26,"value":432},{"type":21,"tag":209,"props":45293,"children":45294},{"style":216},[45295],{"type":26,"value":8046},{"type":21,"tag":209,"props":45297,"children":45298},{"style":216},[45299],{"type":26,"value":45261},{"type":21,"tag":209,"props":45301,"children":45302},{"style":263},[45303],{"type":26,"value":3224},{"type":21,"tag":209,"props":45305,"children":45306},{"style":222},[45307],{"type":26,"value":2608},{"type":21,"tag":209,"props":45309,"children":45310},{"class":211,"line":279},[45311],{"type":21,"tag":209,"props":45312,"children":45313},{"style":448},[45314],{"type":26,"value":13290},{"type":21,"tag":209,"props":45316,"children":45317},{"class":211,"line":288},[45318],{"type":21,"tag":209,"props":45319,"children":45320},{"style":448},[45321],{"type":26,"value":45322},"     * Workaround for browsers that respect hidden options elements, but then fail to resize the select dropdown\n",{"type":21,"tag":209,"props":45324,"children":45325},{"class":211,"line":307},[45326],{"type":21,"tag":209,"props":45327,"children":45328},{"style":448},[45329],{"type":26,"value":45330},"     * to display any visible elements beyond those that appear before any hidden elements - namely, Chrome.\n",{"type":21,"tag":209,"props":45332,"children":45333},{"class":211,"line":325},[45334],{"type":21,"tag":209,"props":45335,"children":45336},{"style":448},[45337],{"type":26,"value":45338},"     * Based on the filter function, we either select all options that match (or, if invert is true, all that\n",{"type":21,"tag":209,"props":45340,"children":45341},{"class":211,"line":334},[45342],{"type":21,"tag":209,"props":45343,"children":45344},{"style":448},[45345],{"type":26,"value":45346},"     * don't match), set them to disabled (with the expectation that there's a css rule hiding disabled options\n",{"type":21,"tag":209,"props":45348,"children":45349},{"class":211,"line":343},[45350],{"type":21,"tag":209,"props":45351,"children":45352},{"style":448},[45353],{"type":26,"value":45354},"     * somewhere), and then pull the disabled options out of the DOM and insert them back in at the end of the\n",{"type":21,"tag":209,"props":45356,"children":45357},{"class":211,"line":351},[45358],{"type":21,"tag":209,"props":45359,"children":45360},{"style":448},[45361],{"type":26,"value":45362},"     * select - this is tested as working in the most recent version of Chrome (as of this writing, v34).\n",{"type":21,"tag":209,"props":45364,"children":45365},{"class":211,"line":444},[45366],{"type":21,"tag":209,"props":45367,"children":45368},{"style":448},[45369],{"type":26,"value":45370},"     * See also http://code.google.com/p/chromium/issues/detail?id=139595 and\n",{"type":21,"tag":209,"props":45372,"children":45373},{"class":211,"line":454},[45374],{"type":21,"tag":209,"props":45375,"children":45376},{"style":448},[45377],{"type":26,"value":45378},"     * http://stackoverflow.com/questions/17203826/chrome-bug-on-select-element-dropdown-when-many-options-are-hidden\n",{"type":21,"tag":209,"props":45380,"children":45381},{"class":211,"line":463},[45382],{"type":21,"tag":209,"props":45383,"children":45384},{"style":448},[45385],{"type":26,"value":45386},"     * for reports of the browser bug this works around.\n",{"type":21,"tag":209,"props":45388,"children":45389},{"class":211,"line":472},[45390],{"type":21,"tag":209,"props":45391,"children":45392},{"style":448},[45393],{"type":26,"value":17907},{"type":21,"tag":209,"props":45395,"children":45396},{"class":211,"line":480},[45397],{"type":21,"tag":209,"props":45398,"children":45399},{"style":448},[45400],{"type":26,"value":45401},"     * Additionally, we handle browsers that DON'T respect hidden options, by agent-sniffing such browsers\n",{"type":21,"tag":209,"props":45403,"children":45404},{"class":211,"line":489},[45405],{"type":21,"tag":209,"props":45406,"children":45407},{"style":448},[45408],{"type":26,"value":45409},"     * and wrapping and unwrapping as necessary options that we want hidden in a span tag.\n",{"type":21,"tag":209,"props":45411,"children":45412},{"class":211,"line":847},[45413],{"type":21,"tag":209,"props":45414,"children":45415},{"style":448},[45416],{"type":26,"value":17907},{"type":21,"tag":209,"props":45418,"children":45419},{"class":211,"line":860},[45420,45424,45429],{"type":21,"tag":209,"props":45421,"children":45422},{"style":448},[45423],{"type":26,"value":13306},{"type":21,"tag":209,"props":45425,"children":45426},{"style":216},[45427],{"type":26,"value":45428},"@note",{"type":21,"tag":209,"props":45430,"children":45431},{"style":448},[45432],{"type":26,"value":45433}," This works, but DOM manipulation in IE is SLOW - much slower to perform an appendChild operation\n",{"type":21,"tag":209,"props":45435,"children":45436},{"class":211,"line":877},[45437],{"type":21,"tag":209,"props":45438,"children":45439},{"style":448},[45440],{"type":26,"value":45441},"     * than any of the other major browsers. Wrapping/unwrapping large sets of options will take a relative long time (>2s)\n",{"type":21,"tag":209,"props":45443,"children":45444},{"class":211,"line":889},[45445],{"type":21,"tag":209,"props":45446,"children":45447},{"style":448},[45448],{"type":26,"value":45449},"     * and have the potential to hang the UI thread.\n",{"type":21,"tag":209,"props":45451,"children":45452},{"class":211,"line":902},[45453,45457,45461,45466],{"type":21,"tag":209,"props":45454,"children":45455},{"style":448},[45456],{"type":26,"value":13306},{"type":21,"tag":209,"props":45458,"children":45459},{"style":216},[45460],{"type":26,"value":13311},{"type":21,"tag":209,"props":45462,"children":45463},{"style":360},[45464],{"type":26,"value":45465}," {string|HtmlElement|jQuery}",{"type":21,"tag":209,"props":45467,"children":45468},{"style":222},[45469],{"type":26,"value":45470}," el\n",{"type":21,"tag":209,"props":45472,"children":45473},{"class":211,"line":914},[45474,45478,45482,45486],{"type":21,"tag":209,"props":45475,"children":45476},{"style":448},[45477],{"type":26,"value":13306},{"type":21,"tag":209,"props":45479,"children":45480},{"style":216},[45481],{"type":26,"value":13311},{"type":21,"tag":209,"props":45483,"children":45484},{"style":360},[45485],{"type":26,"value":31872},{"type":21,"tag":209,"props":45487,"children":45488},{"style":222},[45489],{"type":26,"value":45490}," filter\n",{"type":21,"tag":209,"props":45492,"children":45493},{"class":211,"line":922},[45494,45498,45502,45507],{"type":21,"tag":209,"props":45495,"children":45496},{"style":448},[45497],{"type":26,"value":13306},{"type":21,"tag":209,"props":45499,"children":45500},{"style":216},[45501],{"type":26,"value":13311},{"type":21,"tag":209,"props":45503,"children":45504},{"style":360},[45505],{"type":26,"value":45506}," {boolean=}",{"type":21,"tag":209,"props":45508,"children":45509},{"style":222},[45510],{"type":26,"value":45511}," invert\n",{"type":21,"tag":209,"props":45513,"children":45514},{"class":211,"line":2312},[45515,45519,45523],{"type":21,"tag":209,"props":45516,"children":45517},{"style":448},[45518],{"type":26,"value":13306},{"type":21,"tag":209,"props":45520,"children":45521},{"style":216},[45522],{"type":26,"value":13333},{"type":21,"tag":209,"props":45524,"children":45525},{"style":360},[45526],{"type":26,"value":45527}," {jQuery}\n",{"type":21,"tag":209,"props":45529,"children":45530},{"class":211,"line":2321},[45531],{"type":21,"tag":209,"props":45532,"children":45533},{"style":448},[45534],{"type":26,"value":13346},{"type":21,"tag":209,"props":45536,"children":45537},{"class":211,"line":2372},[45538,45542,45547,45551,45555,45559,45564,45568,45573,45577,45582],{"type":21,"tag":209,"props":45539,"children":45540},{"style":222},[45541],{"type":26,"value":29649},{"type":21,"tag":209,"props":45543,"children":45544},{"style":360},[45545],{"type":26,"value":45546},"elideOptions",{"type":21,"tag":209,"props":45548,"children":45549},{"style":216},[45550],{"type":26,"value":271},{"type":21,"tag":209,"props":45552,"children":45553},{"style":216},[45554],{"type":26,"value":4789},{"type":21,"tag":209,"props":45556,"children":45557},{"style":222},[45558],{"type":26,"value":368},{"type":21,"tag":209,"props":45560,"children":45561},{"style":400},[45562],{"type":26,"value":45563},"el",{"type":21,"tag":209,"props":45565,"children":45566},{"style":222},[45567],{"type":26,"value":408},{"type":21,"tag":209,"props":45569,"children":45570},{"style":400},[45571],{"type":26,"value":45572},"filter",{"type":21,"tag":209,"props":45574,"children":45575},{"style":222},[45576],{"type":26,"value":408},{"type":21,"tag":209,"props":45578,"children":45579},{"style":400},[45580],{"type":26,"value":45581},"invert",{"type":21,"tag":209,"props":45583,"children":45584},{"style":222},[45585],{"type":26,"value":2369},{"type":21,"tag":209,"props":45587,"children":45588},{"class":211,"line":2381},[45589,45593,45598,45602,45607,45612,45617,45621,45625,45630,45634,45638],{"type":21,"tag":209,"props":45590,"children":45591},{"style":216},[45592],{"type":26,"value":14505},{"type":21,"tag":209,"props":45594,"children":45595},{"style":222},[45596],{"type":26,"value":45597}," $el ",{"type":21,"tag":209,"props":45599,"children":45600},{"style":216},[45601],{"type":26,"value":1432},{"type":21,"tag":209,"props":45603,"children":45604},{"style":222},[45605],{"type":26,"value":45606}," (el ",{"type":21,"tag":209,"props":45608,"children":45609},{"style":216},[45610],{"type":26,"value":45611},"instanceof",{"type":21,"tag":209,"props":45613,"children":45614},{"style":360},[45615],{"type":26,"value":45616}," $",{"type":21,"tag":209,"props":45618,"children":45619},{"style":222},[45620],{"type":26,"value":432},{"type":21,"tag":209,"props":45622,"children":45623},{"style":216},[45624],{"type":26,"value":8258},{"type":21,"tag":209,"props":45626,"children":45627},{"style":222},[45628],{"type":26,"value":45629}," el ",{"type":21,"tag":209,"props":45631,"children":45632},{"style":216},[45633],{"type":26,"value":191},{"type":21,"tag":209,"props":45635,"children":45636},{"style":360},[45637],{"type":26,"value":45616},{"type":21,"tag":209,"props":45639,"children":45640},{"style":222},[45641],{"type":26,"value":45642},"(el);\n",{"type":21,"tag":209,"props":45644,"children":45645},{"class":211,"line":2389},[45646],{"type":21,"tag":209,"props":45647,"children":45648},{"emptyLinePlaceholder":248},[45649],{"type":26,"value":251},{"type":21,"tag":209,"props":45651,"children":45652},{"class":211,"line":2397},[45653,45658,45663,45667,45671],{"type":21,"tag":209,"props":45654,"children":45655},{"style":222},[45656],{"type":26,"value":45657},"        $el.",{"type":21,"tag":209,"props":45659,"children":45660},{"style":360},[45661],{"type":26,"value":45662},"each",{"type":21,"tag":209,"props":45664,"children":45665},{"style":222},[45666],{"type":26,"value":368},{"type":21,"tag":209,"props":45668,"children":45669},{"style":216},[45670],{"type":26,"value":4622},{"type":21,"tag":209,"props":45672,"children":45673},{"style":222},[45674],{"type":26,"value":2561},{"type":21,"tag":209,"props":45676,"children":45677},{"class":211,"line":2406},[45678,45682,45686,45690,45695,45699,45704,45708,45712],{"type":21,"tag":209,"props":45679,"children":45680},{"style":216},[45681],{"type":26,"value":14662},{"type":21,"tag":209,"props":45683,"children":45684},{"style":222},[45685],{"type":26,"value":5569},{"type":21,"tag":209,"props":45687,"children":45688},{"style":263},[45689],{"type":26,"value":2508},{"type":21,"tag":209,"props":45691,"children":45692},{"style":222},[45693],{"type":26,"value":45694},".tagName ",{"type":21,"tag":209,"props":45696,"children":45697},{"style":216},[45698],{"type":26,"value":8046},{"type":21,"tag":209,"props":45700,"children":45701},{"style":233},[45702],{"type":26,"value":45703}," 'SELECT'",{"type":21,"tag":209,"props":45705,"children":45706},{"style":222},[45707],{"type":26,"value":432},{"type":21,"tag":209,"props":45709,"children":45710},{"style":216},[45711],{"type":26,"value":8982},{"type":21,"tag":209,"props":45713,"children":45714},{"style":222},[45715],{"type":26,"value":241},{"type":21,"tag":209,"props":45717,"children":45718},{"class":211,"line":2415},[45719,45723,45728,45732,45736,45740,45744],{"type":21,"tag":209,"props":45720,"children":45721},{"style":216},[45722],{"type":26,"value":14539},{"type":21,"tag":209,"props":45724,"children":45725},{"style":222},[45726],{"type":26,"value":45727}," $this ",{"type":21,"tag":209,"props":45729,"children":45730},{"style":216},[45731],{"type":26,"value":1432},{"type":21,"tag":209,"props":45733,"children":45734},{"style":360},[45735],{"type":26,"value":45616},{"type":21,"tag":209,"props":45737,"children":45738},{"style":222},[45739],{"type":26,"value":368},{"type":21,"tag":209,"props":45741,"children":45742},{"style":263},[45743],{"type":26,"value":2508},{"type":21,"tag":209,"props":45745,"children":45746},{"style":222},[45747],{"type":26,"value":5404},{"type":21,"tag":209,"props":45749,"children":45750},{"class":211,"line":2424},[45751,45756,45760,45765,45770,45774,45779,45783,45788,45792,45797,45801,45805],{"type":21,"tag":209,"props":45752,"children":45753},{"style":222},[45754],{"type":26,"value":45755},"                opts ",{"type":21,"tag":209,"props":45757,"children":45758},{"style":216},[45759],{"type":26,"value":1432},{"type":21,"tag":209,"props":45761,"children":45762},{"style":222},[45763],{"type":26,"value":45764}," $this.",{"type":21,"tag":209,"props":45766,"children":45767},{"style":360},[45768],{"type":26,"value":45769},"find",{"type":21,"tag":209,"props":45771,"children":45772},{"style":222},[45773],{"type":26,"value":368},{"type":21,"tag":209,"props":45775,"children":45776},{"style":233},[45777],{"type":26,"value":45778},"'option'",{"type":21,"tag":209,"props":45780,"children":45781},{"style":222},[45782],{"type":26,"value":2699},{"type":21,"tag":209,"props":45784,"children":45785},{"style":360},[45786],{"type":26,"value":45787},"prop",{"type":21,"tag":209,"props":45789,"children":45790},{"style":222},[45791],{"type":26,"value":368},{"type":21,"tag":209,"props":45793,"children":45794},{"style":233},[45795],{"type":26,"value":45796},"'disabled'",{"type":21,"tag":209,"props":45798,"children":45799},{"style":222},[45800],{"type":26,"value":408},{"type":21,"tag":209,"props":45802,"children":45803},{"style":263},[45804],{"type":26,"value":4243},{"type":21,"tag":209,"props":45806,"children":45807},{"style":222},[45808],{"type":26,"value":5404},{"type":21,"tag":209,"props":45810,"children":45811},{"class":211,"line":2433},[45812],{"type":21,"tag":209,"props":45813,"children":45814},{"style":222},[45815],{"type":26,"value":45816},"                spans;\n",{"type":21,"tag":209,"props":45818,"children":45819},{"class":211,"line":2442},[45820],{"type":21,"tag":209,"props":45821,"children":45822},{"emptyLinePlaceholder":248},[45823],{"type":26,"value":251},{"type":21,"tag":209,"props":45825,"children":45826},{"class":211,"line":2471},[45827],{"type":21,"tag":209,"props":45828,"children":45829},{"style":448},[45830],{"type":26,"value":45831},"            // Unwrap all options from their span tags\n",{"type":21,"tag":209,"props":45833,"children":45834},{"class":211,"line":2480},[45835,45839,45844,45848,45853,45857,45861,45865,45869,45874,45879,45883,45888,45892],{"type":21,"tag":209,"props":45836,"children":45837},{"style":216},[45838],{"type":26,"value":14662},{"type":21,"tag":209,"props":45840,"children":45841},{"style":222},[45842],{"type":26,"value":45843}," (needsWrap ",{"type":21,"tag":209,"props":45845,"children":45846},{"style":216},[45847],{"type":26,"value":18381},{"type":21,"tag":209,"props":45849,"children":45850},{"style":222},[45851],{"type":26,"value":45852}," (spans ",{"type":21,"tag":209,"props":45854,"children":45855},{"style":216},[45856],{"type":26,"value":1432},{"type":21,"tag":209,"props":45858,"children":45859},{"style":222},[45860],{"type":26,"value":45764},{"type":21,"tag":209,"props":45862,"children":45863},{"style":360},[45864],{"type":26,"value":45769},{"type":21,"tag":209,"props":45866,"children":45867},{"style":222},[45868],{"type":26,"value":368},{"type":21,"tag":209,"props":45870,"children":45871},{"style":233},[45872],{"type":26,"value":45873},"'span'",{"type":21,"tag":209,"props":45875,"children":45876},{"style":222},[45877],{"type":26,"value":45878},")) ",{"type":21,"tag":209,"props":45880,"children":45881},{"style":216},[45882],{"type":26,"value":18381},{"type":21,"tag":209,"props":45884,"children":45885},{"style":222},[45886],{"type":26,"value":45887}," spans.",{"type":21,"tag":209,"props":45889,"children":45890},{"style":263},[45891],{"type":26,"value":6344},{"type":21,"tag":209,"props":45893,"children":45894},{"style":222},[45895],{"type":26,"value":2369},{"type":21,"tag":209,"props":45897,"children":45898},{"class":211,"line":2489},[45899,45904,45909,45913,45918],{"type":21,"tag":209,"props":45900,"children":45901},{"style":222},[45902],{"type":26,"value":45903},"                spans.",{"type":21,"tag":209,"props":45905,"children":45906},{"style":360},[45907],{"type":26,"value":45908},"children",{"type":21,"tag":209,"props":45910,"children":45911},{"style":222},[45912],{"type":26,"value":17096},{"type":21,"tag":209,"props":45914,"children":45915},{"style":360},[45916],{"type":26,"value":45917},"unwrap",{"type":21,"tag":209,"props":45919,"children":45920},{"style":222},[45921],{"type":26,"value":4123},{"type":21,"tag":209,"props":45923,"children":45924},{"class":211,"line":2516},[45925],{"type":21,"tag":209,"props":45926,"children":45927},{"style":222},[45928],{"type":26,"value":14714},{"type":21,"tag":209,"props":45930,"children":45931},{"class":211,"line":2525},[45932],{"type":21,"tag":209,"props":45933,"children":45934},{"emptyLinePlaceholder":248},[45935],{"type":26,"value":251},{"type":21,"tag":209,"props":45937,"children":45938},{"class":211,"line":2533},[45939,45944,45948,45953,45957,45962,45966,45971,45975,45979,45983,45987,45991,45995],{"type":21,"tag":209,"props":45940,"children":45941},{"style":222},[45942],{"type":26,"value":45943},"            opts ",{"type":21,"tag":209,"props":45945,"children":45946},{"style":216},[45947],{"type":26,"value":1432},{"type":21,"tag":209,"props":45949,"children":45950},{"style":222},[45951],{"type":26,"value":45952}," (invert) ",{"type":21,"tag":209,"props":45954,"children":45955},{"style":216},[45956],{"type":26,"value":8258},{"type":21,"tag":209,"props":45958,"children":45959},{"style":222},[45960],{"type":26,"value":45961}," opts.",{"type":21,"tag":209,"props":45963,"children":45964},{"style":360},[45965],{"type":26,"value":11871},{"type":21,"tag":209,"props":45967,"children":45968},{"style":222},[45969],{"type":26,"value":45970},"(filter).",{"type":21,"tag":209,"props":45972,"children":45973},{"style":360},[45974],{"type":26,"value":45787},{"type":21,"tag":209,"props":45976,"children":45977},{"style":222},[45978],{"type":26,"value":368},{"type":21,"tag":209,"props":45980,"children":45981},{"style":233},[45982],{"type":26,"value":45796},{"type":21,"tag":209,"props":45984,"children":45985},{"style":222},[45986],{"type":26,"value":408},{"type":21,"tag":209,"props":45988,"children":45989},{"style":263},[45990],{"type":26,"value":2223},{"type":21,"tag":209,"props":45992,"children":45993},{"style":222},[45994],{"type":26,"value":432},{"type":21,"tag":209,"props":45996,"children":45997},{"style":216},[45998],{"type":26,"value":844},{"type":21,"tag":209,"props":46000,"children":46001},{"class":211,"line":2542},[46002,46007,46011,46015,46019,46023,46027,46031,46035],{"type":21,"tag":209,"props":46003,"children":46004},{"style":222},[46005],{"type":26,"value":46006},"                opts.",{"type":21,"tag":209,"props":46008,"children":46009},{"style":360},[46010],{"type":26,"value":45572},{"type":21,"tag":209,"props":46012,"children":46013},{"style":222},[46014],{"type":26,"value":45970},{"type":21,"tag":209,"props":46016,"children":46017},{"style":360},[46018],{"type":26,"value":45787},{"type":21,"tag":209,"props":46020,"children":46021},{"style":222},[46022],{"type":26,"value":368},{"type":21,"tag":209,"props":46024,"children":46025},{"style":233},[46026],{"type":26,"value":45796},{"type":21,"tag":209,"props":46028,"children":46029},{"style":222},[46030],{"type":26,"value":408},{"type":21,"tag":209,"props":46032,"children":46033},{"style":263},[46034],{"type":26,"value":2223},{"type":21,"tag":209,"props":46036,"children":46037},{"style":222},[46038],{"type":26,"value":2608},{"type":21,"tag":209,"props":46040,"children":46041},{"class":211,"line":2550},[46042],{"type":21,"tag":209,"props":46043,"children":46044},{"emptyLinePlaceholder":248},[46045],{"type":26,"value":251},{"type":21,"tag":209,"props":46047,"children":46048},{"class":211,"line":2564},[46049],{"type":21,"tag":209,"props":46050,"children":46051},{"style":448},[46052],{"type":26,"value":46053},"            // Wrap options in a single hidden span to hide them on browsers that don't support\n",{"type":21,"tag":209,"props":46055,"children":46056},{"class":211,"line":2611},[46057],{"type":21,"tag":209,"props":46058,"children":46059},{"style":448},[46060],{"type":26,"value":46061},"            // display:none for options\n",{"type":21,"tag":209,"props":46063,"children":46064},{"class":211,"line":2619},[46065,46069],{"type":21,"tag":209,"props":46066,"children":46067},{"style":216},[46068],{"type":26,"value":14662},{"type":21,"tag":209,"props":46070,"children":46071},{"style":222},[46072],{"type":26,"value":46073}," (needsWrap) {\n",{"type":21,"tag":209,"props":46075,"children":46076},{"class":211,"line":2627},[46077,46081,46086,46090,46095],{"type":21,"tag":209,"props":46078,"children":46079},{"style":222},[46080],{"type":26,"value":46006},{"type":21,"tag":209,"props":46082,"children":46083},{"style":360},[46084],{"type":26,"value":46085},"wrapAll",{"type":21,"tag":209,"props":46087,"children":46088},{"style":222},[46089],{"type":26,"value":368},{"type":21,"tag":209,"props":46091,"children":46092},{"style":233},[46093],{"type":26,"value":46094},"'\u003Cspan class=\"hide\">\u003C/span>'",{"type":21,"tag":209,"props":46096,"children":46097},{"style":222},[46098],{"type":26,"value":2608},{"type":21,"tag":209,"props":46100,"children":46101},{"class":211,"line":2636},[46102,46106,46110,46114,46119,46123,46127],{"type":21,"tag":209,"props":46103,"children":46104},{"style":222},[46105],{"type":26,"value":45755},{"type":21,"tag":209,"props":46107,"children":46108},{"style":216},[46109],{"type":26,"value":1432},{"type":21,"tag":209,"props":46111,"children":46112},{"style":222},[46113],{"type":26,"value":45961},{"type":21,"tag":209,"props":46115,"children":46116},{"style":360},[46117],{"type":26,"value":46118},"parent",{"type":21,"tag":209,"props":46120,"children":46121},{"style":222},[46122],{"type":26,"value":368},{"type":21,"tag":209,"props":46124,"children":46125},{"style":233},[46126],{"type":26,"value":45873},{"type":21,"tag":209,"props":46128,"children":46129},{"style":222},[46130],{"type":26,"value":2608},{"type":21,"tag":209,"props":46132,"children":46133},{"class":211,"line":2644},[46134],{"type":21,"tag":209,"props":46135,"children":46136},{"style":222},[46137],{"type":26,"value":14714},{"type":21,"tag":209,"props":46139,"children":46140},{"class":211,"line":2657},[46141],{"type":21,"tag":209,"props":46142,"children":46143},{"emptyLinePlaceholder":248},[46144],{"type":26,"value":251},{"type":21,"tag":209,"props":46146,"children":46147},{"class":211,"line":2728},[46148,46153,46158,46162,46167],{"type":21,"tag":209,"props":46149,"children":46150},{"style":222},[46151],{"type":26,"value":46152},"            opts.",{"type":21,"tag":209,"props":46154,"children":46155},{"style":360},[46156],{"type":26,"value":46157},"detach",{"type":21,"tag":209,"props":46159,"children":46160},{"style":222},[46161],{"type":26,"value":17096},{"type":21,"tag":209,"props":46163,"children":46164},{"style":360},[46165],{"type":26,"value":46166},"appendTo",{"type":21,"tag":209,"props":46168,"children":46169},{"style":222},[46170],{"type":26,"value":46171},"($this);\n",{"type":21,"tag":209,"props":46173,"children":46174},{"class":211,"line":2758},[46175],{"type":21,"tag":209,"props":46176,"children":46177},{"style":222},[46178],{"type":26,"value":13702},{"type":21,"tag":209,"props":46180,"children":46181},{"class":211,"line":2776},[46182],{"type":21,"tag":209,"props":46183,"children":46184},{"emptyLinePlaceholder":248},[46185],{"type":26,"value":251},{"type":21,"tag":209,"props":46187,"children":46188},{"class":211,"line":2785},[46189,46193],{"type":21,"tag":209,"props":46190,"children":46191},{"style":216},[46192],{"type":26,"value":3069},{"type":21,"tag":209,"props":46194,"children":46195},{"style":222},[46196],{"type":26,"value":46197}," $el;\n",{"type":21,"tag":209,"props":46199,"children":46200},{"class":211,"line":2793},[46201],{"type":21,"tag":209,"props":46202,"children":46203},{"style":222},[46204],{"type":26,"value":13439},{"type":21,"tag":209,"props":46206,"children":46207},{"class":211,"line":2801},[46208],{"type":21,"tag":209,"props":46209,"children":46210},{"emptyLinePlaceholder":248},[46211],{"type":26,"value":251},{"type":21,"tag":209,"props":46213,"children":46214},{"class":211,"line":2809},[46215],{"type":21,"tag":209,"props":46216,"children":46217},{"style":448},[46218],{"type":26,"value":13290},{"type":21,"tag":209,"props":46220,"children":46221},{"class":211,"line":10937},[46222],{"type":21,"tag":209,"props":46223,"children":46224},{"style":448},[46225],{"type":26,"value":46226},"     * Allow for the $(element) form of invocation.\n",{"type":21,"tag":209,"props":46228,"children":46229},{"class":211,"line":10967},[46230,46234,46238,46242],{"type":21,"tag":209,"props":46231,"children":46232},{"style":448},[46233],{"type":26,"value":13306},{"type":21,"tag":209,"props":46235,"children":46236},{"style":216},[46237],{"type":26,"value":13311},{"type":21,"tag":209,"props":46239,"children":46240},{"style":360},[46241],{"type":26,"value":31872},{"type":21,"tag":209,"props":46243,"children":46244},{"style":222},[46245],{"type":26,"value":45490},{"type":21,"tag":209,"props":46247,"children":46248},{"class":211,"line":11003},[46249,46253,46257,46261],{"type":21,"tag":209,"props":46250,"children":46251},{"style":448},[46252],{"type":26,"value":13306},{"type":21,"tag":209,"props":46254,"children":46255},{"style":216},[46256],{"type":26,"value":13311},{"type":21,"tag":209,"props":46258,"children":46259},{"style":360},[46260],{"type":26,"value":45506},{"type":21,"tag":209,"props":46262,"children":46263},{"style":222},[46264],{"type":26,"value":45511},{"type":21,"tag":209,"props":46266,"children":46267},{"class":211,"line":11038},[46268,46272,46276],{"type":21,"tag":209,"props":46269,"children":46270},{"style":448},[46271],{"type":26,"value":13306},{"type":21,"tag":209,"props":46273,"children":46274},{"style":216},[46275],{"type":26,"value":13333},{"type":21,"tag":209,"props":46277,"children":46278},{"style":360},[46279],{"type":26,"value":45527},{"type":21,"tag":209,"props":46281,"children":46282},{"class":211,"line":11072},[46283],{"type":21,"tag":209,"props":46284,"children":46285},{"style":448},[46286],{"type":26,"value":13346},{"type":21,"tag":209,"props":46288,"children":46289},{"class":211,"line":11106},[46290,46295,46299,46303,46307,46311,46315,46319,46323],{"type":21,"tag":209,"props":46291,"children":46292},{"style":222},[46293],{"type":26,"value":46294},"    $.fn.",{"type":21,"tag":209,"props":46296,"children":46297},{"style":360},[46298],{"type":26,"value":45546},{"type":21,"tag":209,"props":46300,"children":46301},{"style":216},[46302],{"type":26,"value":271},{"type":21,"tag":209,"props":46304,"children":46305},{"style":216},[46306],{"type":26,"value":4789},{"type":21,"tag":209,"props":46308,"children":46309},{"style":222},[46310],{"type":26,"value":368},{"type":21,"tag":209,"props":46312,"children":46313},{"style":400},[46314],{"type":26,"value":45572},{"type":21,"tag":209,"props":46316,"children":46317},{"style":222},[46318],{"type":26,"value":408},{"type":21,"tag":209,"props":46320,"children":46321},{"style":400},[46322],{"type":26,"value":45581},{"type":21,"tag":209,"props":46324,"children":46325},{"style":222},[46326],{"type":26,"value":2369},{"type":21,"tag":209,"props":46328,"children":46329},{"class":211,"line":11114},[46330,46334,46338,46342,46346,46350],{"type":21,"tag":209,"props":46331,"children":46332},{"style":216},[46333],{"type":26,"value":3069},{"type":21,"tag":209,"props":46335,"children":46336},{"style":222},[46337],{"type":26,"value":25427},{"type":21,"tag":209,"props":46339,"children":46340},{"style":360},[46341],{"type":26,"value":45546},{"type":21,"tag":209,"props":46343,"children":46344},{"style":222},[46345],{"type":26,"value":368},{"type":21,"tag":209,"props":46347,"children":46348},{"style":263},[46349],{"type":26,"value":2508},{"type":21,"tag":209,"props":46351,"children":46352},{"style":222},[46353],{"type":26,"value":46354},", filter, invert);\n",{"type":21,"tag":209,"props":46356,"children":46357},{"class":211,"line":14940},[46358],{"type":21,"tag":209,"props":46359,"children":46360},{"style":222},[46361],{"type":26,"value":13439},{"type":21,"tag":209,"props":46363,"children":46364},{"class":211,"line":14949},[46365],{"type":21,"tag":209,"props":46366,"children":46367},{"style":222},[46368],{"type":26,"value":46369},"})(jQuery);\n",{"type":21,"tag":22,"props":46371,"children":46372},{},[46373],{"type":26,"value":46374},"Usage for this plugin looks like:",{"type":21,"tag":200,"props":46376,"children":46378},{"className":16138,"code":46377,"language":16140,"meta":8,"style":8},"$.elideOptions('#mydiv select', function(){ \n    /* return true to keep option in selected set */\n});\n",[46379],{"type":21,"tag":63,"props":46380,"children":46381},{"__ignoreMap":8},[46382,46415,46423],{"type":21,"tag":209,"props":46383,"children":46384},{"class":211,"line":212},[46385,46389,46393,46397,46402,46406,46410],{"type":21,"tag":209,"props":46386,"children":46387},{"style":222},[46388],{"type":26,"value":20778},{"type":21,"tag":209,"props":46390,"children":46391},{"style":360},[46392],{"type":26,"value":45546},{"type":21,"tag":209,"props":46394,"children":46395},{"style":222},[46396],{"type":26,"value":368},{"type":21,"tag":209,"props":46398,"children":46399},{"style":233},[46400],{"type":26,"value":46401},"'#mydiv select'",{"type":21,"tag":209,"props":46403,"children":46404},{"style":222},[46405],{"type":26,"value":408},{"type":21,"tag":209,"props":46407,"children":46408},{"style":216},[46409],{"type":26,"value":4622},{"type":21,"tag":209,"props":46411,"children":46412},{"style":222},[46413],{"type":26,"value":46414},"(){ \n",{"type":21,"tag":209,"props":46416,"children":46417},{"class":211,"line":244},[46418],{"type":21,"tag":209,"props":46419,"children":46420},{"style":448},[46421],{"type":26,"value":46422},"    /* return true to keep option in selected set */\n",{"type":21,"tag":209,"props":46424,"children":46425},{"class":211,"line":254},[46426],{"type":21,"tag":209,"props":46427,"children":46428},{"style":222},[46429],{"type":26,"value":469},{"type":21,"tag":22,"props":46431,"children":46432},{},[46433],{"type":26,"value":46434},"OR",{"type":21,"tag":200,"props":46436,"children":46438},{"className":16138,"code":46437,"language":16140,"meta":8,"style":8},"$('#mydiv select').elideOptions(function(){ \n    /* return true to keep option in selected set */ \n});\n",[46439],{"type":21,"tag":63,"props":46440,"children":46441},{"__ignoreMap":8},[46442,46477,46489],{"type":21,"tag":209,"props":46443,"children":46444},{"class":211,"line":212},[46445,46449,46453,46457,46461,46465,46469,46473],{"type":21,"tag":209,"props":46446,"children":46447},{"style":360},[46448],{"type":26,"value":6476},{"type":21,"tag":209,"props":46450,"children":46451},{"style":222},[46452],{"type":26,"value":368},{"type":21,"tag":209,"props":46454,"children":46455},{"style":233},[46456],{"type":26,"value":46401},{"type":21,"tag":209,"props":46458,"children":46459},{"style":222},[46460],{"type":26,"value":2699},{"type":21,"tag":209,"props":46462,"children":46463},{"style":360},[46464],{"type":26,"value":45546},{"type":21,"tag":209,"props":46466,"children":46467},{"style":222},[46468],{"type":26,"value":368},{"type":21,"tag":209,"props":46470,"children":46471},{"style":216},[46472],{"type":26,"value":4622},{"type":21,"tag":209,"props":46474,"children":46475},{"style":222},[46476],{"type":26,"value":46414},{"type":21,"tag":209,"props":46478,"children":46479},{"class":211,"line":244},[46480,46485],{"type":21,"tag":209,"props":46481,"children":46482},{"style":448},[46483],{"type":26,"value":46484},"    /* return true to keep option in selected set */",{"type":21,"tag":209,"props":46486,"children":46487},{"style":222},[46488],{"type":26,"value":24469},{"type":21,"tag":209,"props":46490,"children":46491},{"class":211,"line":254},[46492],{"type":21,"tag":209,"props":46493,"children":46494},{"style":222},[46495],{"type":26,"value":469},{"type":21,"tag":22,"props":46497,"children":46498},{},[46499,46501,46506,46508,46513,46514,46519],{"type":26,"value":46500},"Additionally, you can specify a third optional parameter, ",{"type":21,"tag":63,"props":46502,"children":46504},{"className":46503},[],[46505],{"type":26,"value":45581},{"type":26,"value":46507}," - if true, the logic of the filter function is inverted (that is, options that match the criteria [ie. you return true from the filter function] will be omitted from the options that will be acted upon - essentially, using ",{"type":21,"tag":63,"props":46509,"children":46511},{"className":46510},[],[46512],{"type":26,"value":11871},{"type":26,"value":9754},{"type":21,"tag":63,"props":46515,"children":46517},{"className":46516},[],[46518],{"type":26,"value":45572},{"type":26,"value":46520}," on the set).",{"type":21,"tag":22,"props":46522,"children":46523},{},[46524,46526,46533],{"type":26,"value":46525},"As per the comments at the top of the above gist, we work around our issue with Chrome by performing the disable as per usual, then ",{"type":21,"tag":29,"props":46527,"children":46530},{"href":46528,"rel":46529},"https://api.jquery.com/detach/",[93],[46531],{"type":26,"value":46532},"detaching",{"type":26,"value":46534}," the disabled options from the select, and appending them back onto the end of the select.",{"type":21,"tag":22,"props":46536,"children":46537},{},[46538],{"type":26,"value":46539},"The behaviour of this bug is such that any visible options that occur after hidden elements aren't counted towards the height of the list box - by ensuring all visible options will be above any hidden options, we avoid this behaviour. Now we can still filter on the elements within the select, not needing to create a shadow element or object to store state for this select, while still having the select dropdown expand to the dimensions of the visible options as expected.",{"type":21,"tag":22,"props":46541,"children":46542},{},[46543,46545,46552],{"type":26,"value":46544},"So, we know the how - but are you curious as to the why? The answer lurks somewhere in ",{"type":21,"tag":29,"props":46546,"children":46549},{"href":46547,"rel":46548},"https://codereview.chromium.org/189543012/diff/200001/Source/core/rendering/RenderListBox.cpp",[93],[46550],{"type":26,"value":46551},"this diff",{"type":26,"value":46553},". I've only had time to give it a cursory read-through - there's not a lot to go on, given the lack of documentation (come on guys, a doc-block per function wouldn't be that hard), but given the bug behaviour, it probably has something to do with either the calculation of the list box height only including those items encountered before the first hidden item, or with the lastIndex being calculated as the last visible element before the first hidden element.",{"type":21,"tag":22,"props":46555,"children":46556},{},[46557],{"type":26,"value":46558},"Need to get the job done today? My plugin can help with that. Want to be a hero? Go fix this for realsies.",{"type":21,"tag":3490,"props":46560,"children":46561},{},[46562],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":46564},[],"content:ckeefer:2014-4:hidden-options.md","ckeefer/2014-4/hidden-options.md","ckeefer/2014-4/hidden-options",{"user":3518,"name":3519},{"_path":46570,"_dir":46571,"_draft":7,"_partial":7,"_locale":8,"title":46572,"description":46573,"publishDate":46574,"tags":46575,"excerpt":46573,"body":46576,"_type":3511,"_id":51394,"_source":3513,"_file":51395,"_stem":51396,"_extension":3516,"author":51397},"/ckeefer/2014-3/customgmapsinfowindow","2014-3","Custom Google Maps Info Windows","When it comes time to relate the ephemeral world of data to the physical world, Maps are key in both enterprise and consumer applications. Whatever else you might think of it, Google Maps tends to be the default option - certainly, its the only one I've ever had clients ask for by name.","2014-02-26",[12,42383],{"type":18,"children":46577,"toc":51386},[46578,46582,46587,46598,46604,46618,46704,46709,46722,46974,46979,46984,46989,48415,48420,48459,48471,48839,48845,48866,48871,48967,48972,48977,49117,49122,49634,49639,49645,49658,49815,49821,49826,49940,49946,49951,51377,51382],{"type":21,"tag":22,"props":46579,"children":46580},{},[46581],{"type":26,"value":46573},{"type":21,"tag":22,"props":46583,"children":46584},{},[46585],{"type":26,"value":46586},"Even when they do ask for it specifically, though, the client generally wants to set 'their map' apart from the generic experience - and this isn't as easy a task as it might be. There are a lot of areas of customization for google maps that might make for a good article, but today we'll focus on custom info windows - those displays that pop up when you click on a marker.",{"type":21,"tag":22,"props":46588,"children":46589},{},[46590,46592,46597],{"type":26,"value":46591},"And there's one added wrinkle that might catch your interest - we need to extend a google maps api object ",{"type":21,"tag":1084,"props":46593,"children":46594},{},[46595],{"type":26,"value":46596},"asynchronously",{"type":26,"value":378},{"type":21,"tag":51,"props":46599,"children":46601},{"id":46600},"loading-and-extending-google-maps-asynchronously",[46602],{"type":26,"value":46603},"Loading and Extending Google Maps Asynchronously",{"type":21,"tag":22,"props":46605,"children":46606},{},[46607,46609,46616],{"type":26,"value":46608},"You're probably familiar with loading ",{"type":21,"tag":29,"props":46610,"children":46613},{"href":46611,"rel":46612},"https://developers.google.com/maps/documentation/javascript/examples/map-simple-async",[93],[46614],{"type":26,"value":46615},"google maps async",{"type":26,"value":46617}," - you create a new script element, add the script url, and provide the api version, your api key, sensor paramater and callback as query string parameters.",{"type":21,"tag":200,"props":46619,"children":46621},{"className":16138,"code":46620,"language":16140,"meta":8,"style":8},"var script = document.createElement('script');\nscript.type = 'text/javascript';\nscript.src = 'https://maps.googleapis.com/maps/api/jsv=3&key=yourapikey&sensor=false&callback=init';\n",[46622],{"type":21,"tag":63,"props":46623,"children":46624},{"__ignoreMap":8},[46625,46662,46683],{"type":21,"tag":209,"props":46626,"children":46627},{"class":211,"line":212},[46628,46632,46637,46641,46645,46649,46653,46658],{"type":21,"tag":209,"props":46629,"children":46630},{"style":216},[46631],{"type":26,"value":3909},{"type":21,"tag":209,"props":46633,"children":46634},{"style":222},[46635],{"type":26,"value":46636}," script ",{"type":21,"tag":209,"props":46638,"children":46639},{"style":216},[46640],{"type":26,"value":1432},{"type":21,"tag":209,"props":46642,"children":46643},{"style":222},[46644],{"type":26,"value":16365},{"type":21,"tag":209,"props":46646,"children":46647},{"style":360},[46648],{"type":26,"value":16370},{"type":21,"tag":209,"props":46650,"children":46651},{"style":222},[46652],{"type":26,"value":368},{"type":21,"tag":209,"props":46654,"children":46655},{"style":233},[46656],{"type":26,"value":46657},"'script'",{"type":21,"tag":209,"props":46659,"children":46660},{"style":222},[46661],{"type":26,"value":2608},{"type":21,"tag":209,"props":46663,"children":46664},{"class":211,"line":244},[46665,46670,46674,46679],{"type":21,"tag":209,"props":46666,"children":46667},{"style":222},[46668],{"type":26,"value":46669},"script.type ",{"type":21,"tag":209,"props":46671,"children":46672},{"style":216},[46673],{"type":26,"value":1432},{"type":21,"tag":209,"props":46675,"children":46676},{"style":233},[46677],{"type":26,"value":46678}," 'text/javascript'",{"type":21,"tag":209,"props":46680,"children":46681},{"style":222},[46682],{"type":26,"value":241},{"type":21,"tag":209,"props":46684,"children":46685},{"class":211,"line":254},[46686,46691,46695,46700],{"type":21,"tag":209,"props":46687,"children":46688},{"style":222},[46689],{"type":26,"value":46690},"script.src ",{"type":21,"tag":209,"props":46692,"children":46693},{"style":216},[46694],{"type":26,"value":1432},{"type":21,"tag":209,"props":46696,"children":46697},{"style":233},[46698],{"type":26,"value":46699}," 'https://maps.googleapis.com/maps/api/jsv=3&key=yourapikey&sensor=false&callback=init'",{"type":21,"tag":209,"props":46701,"children":46702},{"style":222},[46703],{"type":26,"value":241},{"type":21,"tag":22,"props":46705,"children":46706},{},[46707],{"type":26,"value":46708},"The callback is, of course, the key to knowing when the maps api is loaded and ready to run - and so, its also the key to knowing when the api objects are available to be extended.",{"type":21,"tag":22,"props":46710,"children":46711},{},[46712,46714,46720],{"type":26,"value":46713},"In order to create our custom info window, we need to extend ",{"type":21,"tag":63,"props":46715,"children":46717},{"className":46716},[],[46718],{"type":26,"value":46719},"google.maps.OverlayView",{"type":26,"value":46721},". Let's create a simple wrapper class for maps, with an init function to be called when google maps is ready.",{"type":21,"tag":200,"props":46723,"children":46725},{"className":16138,"code":46724,"language":16140,"meta":8,"style":8},"function GMaps(){\n    // Set properties\n    this.mapReady = false;\n}\n\n/**\n* Note you'll need to have an object of type GMaps sitting in the global context ready to receive the init callback\n* which you would append to the script as object.init\n*/\nGMaps.prototype.init = function(){\n    this.mapReady = true;\n}\n\n// OR\n\n/*\n* This function is 'static', and could be passed to the callback param as GMaps.init\n*/\nGMaps.init = function(){\n    // No access to 'this' here - just perform whatever startup tasks you think are necessary\n}\n",[46726],{"type":21,"tag":63,"props":46727,"children":46728},{"__ignoreMap":8},[46729,46745,46753,46778,46785,46792,46799,46807,46815,46823,46860,46883,46890,46897,46905,46912,46920,46928,46935,46959,46967],{"type":21,"tag":209,"props":46730,"children":46731},{"class":211,"line":212},[46732,46736,46741],{"type":21,"tag":209,"props":46733,"children":46734},{"style":216},[46735],{"type":26,"value":4622},{"type":21,"tag":209,"props":46737,"children":46738},{"style":360},[46739],{"type":26,"value":46740}," GMaps",{"type":21,"tag":209,"props":46742,"children":46743},{"style":222},[46744],{"type":26,"value":2561},{"type":21,"tag":209,"props":46746,"children":46747},{"class":211,"line":244},[46748],{"type":21,"tag":209,"props":46749,"children":46750},{"style":448},[46751],{"type":26,"value":46752},"    // Set properties\n",{"type":21,"tag":209,"props":46754,"children":46755},{"class":211,"line":254},[46756,46761,46766,46770,46774],{"type":21,"tag":209,"props":46757,"children":46758},{"style":263},[46759],{"type":26,"value":46760},"    this",{"type":21,"tag":209,"props":46762,"children":46763},{"style":222},[46764],{"type":26,"value":46765},".mapReady ",{"type":21,"tag":209,"props":46767,"children":46768},{"style":216},[46769],{"type":26,"value":1432},{"type":21,"tag":209,"props":46771,"children":46772},{"style":263},[46773],{"type":26,"value":14038},{"type":21,"tag":209,"props":46775,"children":46776},{"style":222},[46777],{"type":26,"value":241},{"type":21,"tag":209,"props":46779,"children":46780},{"class":211,"line":279},[46781],{"type":21,"tag":209,"props":46782,"children":46783},{"style":222},[46784],{"type":26,"value":4415},{"type":21,"tag":209,"props":46786,"children":46787},{"class":211,"line":288},[46788],{"type":21,"tag":209,"props":46789,"children":46790},{"emptyLinePlaceholder":248},[46791],{"type":26,"value":251},{"type":21,"tag":209,"props":46793,"children":46794},{"class":211,"line":307},[46795],{"type":21,"tag":209,"props":46796,"children":46797},{"style":448},[46798],{"type":26,"value":731},{"type":21,"tag":209,"props":46800,"children":46801},{"class":211,"line":325},[46802],{"type":21,"tag":209,"props":46803,"children":46804},{"style":448},[46805],{"type":26,"value":46806},"* Note you'll need to have an object of type GMaps sitting in the global context ready to receive the init callback\n",{"type":21,"tag":209,"props":46808,"children":46809},{"class":211,"line":334},[46810],{"type":21,"tag":209,"props":46811,"children":46812},{"style":448},[46813],{"type":26,"value":46814},"* which you would append to the script as object.init\n",{"type":21,"tag":209,"props":46816,"children":46817},{"class":211,"line":343},[46818],{"type":21,"tag":209,"props":46819,"children":46820},{"style":448},[46821],{"type":26,"value":46822},"*/\n",{"type":21,"tag":209,"props":46824,"children":46825},{"class":211,"line":351},[46826,46831,46835,46839,46843,46848,46852,46856],{"type":21,"tag":209,"props":46827,"children":46828},{"style":263},[46829],{"type":26,"value":46830},"GMaps",{"type":21,"tag":209,"props":46832,"children":46833},{"style":222},[46834],{"type":26,"value":378},{"type":21,"tag":209,"props":46836,"children":46837},{"style":263},[46838],{"type":26,"value":32662},{"type":21,"tag":209,"props":46840,"children":46841},{"style":222},[46842],{"type":26,"value":378},{"type":21,"tag":209,"props":46844,"children":46845},{"style":360},[46846],{"type":26,"value":46847},"init",{"type":21,"tag":209,"props":46849,"children":46850},{"style":216},[46851],{"type":26,"value":271},{"type":21,"tag":209,"props":46853,"children":46854},{"style":216},[46855],{"type":26,"value":4789},{"type":21,"tag":209,"props":46857,"children":46858},{"style":222},[46859],{"type":26,"value":2561},{"type":21,"tag":209,"props":46861,"children":46862},{"class":211,"line":444},[46863,46867,46871,46875,46879],{"type":21,"tag":209,"props":46864,"children":46865},{"style":263},[46866],{"type":26,"value":46760},{"type":21,"tag":209,"props":46868,"children":46869},{"style":222},[46870],{"type":26,"value":46765},{"type":21,"tag":209,"props":46872,"children":46873},{"style":216},[46874],{"type":26,"value":1432},{"type":21,"tag":209,"props":46876,"children":46877},{"style":263},[46878],{"type":26,"value":14819},{"type":21,"tag":209,"props":46880,"children":46881},{"style":222},[46882],{"type":26,"value":241},{"type":21,"tag":209,"props":46884,"children":46885},{"class":211,"line":454},[46886],{"type":21,"tag":209,"props":46887,"children":46888},{"style":222},[46889],{"type":26,"value":4415},{"type":21,"tag":209,"props":46891,"children":46892},{"class":211,"line":463},[46893],{"type":21,"tag":209,"props":46894,"children":46895},{"emptyLinePlaceholder":248},[46896],{"type":26,"value":251},{"type":21,"tag":209,"props":46898,"children":46899},{"class":211,"line":472},[46900],{"type":21,"tag":209,"props":46901,"children":46902},{"style":448},[46903],{"type":26,"value":46904},"// OR\n",{"type":21,"tag":209,"props":46906,"children":46907},{"class":211,"line":480},[46908],{"type":21,"tag":209,"props":46909,"children":46910},{"emptyLinePlaceholder":248},[46911],{"type":26,"value":251},{"type":21,"tag":209,"props":46913,"children":46914},{"class":211,"line":489},[46915],{"type":21,"tag":209,"props":46916,"children":46917},{"style":448},[46918],{"type":26,"value":46919},"/*\n",{"type":21,"tag":209,"props":46921,"children":46922},{"class":211,"line":847},[46923],{"type":21,"tag":209,"props":46924,"children":46925},{"style":448},[46926],{"type":26,"value":46927},"* This function is 'static', and could be passed to the callback param as GMaps.init\n",{"type":21,"tag":209,"props":46929,"children":46930},{"class":211,"line":860},[46931],{"type":21,"tag":209,"props":46932,"children":46933},{"style":448},[46934],{"type":26,"value":46822},{"type":21,"tag":209,"props":46936,"children":46937},{"class":211,"line":877},[46938,46943,46947,46951,46955],{"type":21,"tag":209,"props":46939,"children":46940},{"style":222},[46941],{"type":26,"value":46942},"GMaps.",{"type":21,"tag":209,"props":46944,"children":46945},{"style":360},[46946],{"type":26,"value":46847},{"type":21,"tag":209,"props":46948,"children":46949},{"style":216},[46950],{"type":26,"value":271},{"type":21,"tag":209,"props":46952,"children":46953},{"style":216},[46954],{"type":26,"value":4789},{"type":21,"tag":209,"props":46956,"children":46957},{"style":222},[46958],{"type":26,"value":2561},{"type":21,"tag":209,"props":46960,"children":46961},{"class":211,"line":889},[46962],{"type":21,"tag":209,"props":46963,"children":46964},{"style":448},[46965],{"type":26,"value":46966},"    // No access to 'this' here - just perform whatever startup tasks you think are necessary\n",{"type":21,"tag":209,"props":46968,"children":46969},{"class":211,"line":902},[46970],{"type":21,"tag":209,"props":46971,"children":46972},{"style":222},[46973],{"type":26,"value":4415},{"type":21,"tag":22,"props":46975,"children":46976},{},[46977],{"type":26,"value":46978},"Whether we're using the 'static' function or not, the init callback will let us know we can now extend and instantiate an OverlayView.",{"type":21,"tag":51,"props":46980,"children":46982},{"id":46981},"customwindow",[46983],{"type":26,"value":42483},{"type":21,"tag":22,"props":46985,"children":46986},{},[46987],{"type":26,"value":46988},"We don't want to have to stick our custom window object inside of the init callback though - that would be ugly. So instead:",{"type":21,"tag":200,"props":46990,"children":46992},{"className":16138,"code":46991,"language":16140,"meta":8,"style":8},"/**\n     * Create a custom overlay for our window marker display, extending google.maps.OverlayView.\n     * This is somewhat complicated by needing to async load the google.maps api first - thus, we\n     * wrap CustomWindow into a closure, and when instantiating CustomWindow, we first execute the closure (to create\n     * our CustomWindow function, now properly extending the newly loaded google.maps.OverlayView), and then\n     * instantiate said function.\n     * Note that this version uses jQuery.\n     * @type {Function}\n     */\n(function(){\n    var CustomWindow = function(){\n        this.container = $('\u003Cdiv class=\"map-info-window\">\u003C/div>');\n        this.layer = null;\n        this.marker = null;\n        this.position = null;\n    };\n    /**\n     * Inherit from OverlayView\n     * @type {google.maps.OverlayView}\n     */\n    CustomWindow.prototype = new google.maps.OverlayView();\n    /**\n     * Called when this overlay is set to a map via this.setMap. Get the appropriate map pane\n     * to add the window to, append the container, bind to close element.\n     * @see CustomWindow.open\n     */\n    CustomWindow.prototype.onAdd = function(){\n        this.layer = $(this.getPanes().floatPane);\n        this.layer.append(this.container);\n        this.container.find('.map-info-close').on('click', _.bind(function(){\n            // Close info window on click\n            this.close();\n        }, this));\n    };\n    /**\n     * Called after onAdd, and every time the map is moved, zoomed, or anything else that\n     * would effect positions, to redraw this overlay.\n     */\n    CustomWindow.prototype.draw = function(){\n        var markerIcon = this.marker.getIcon(),\n            cHeight = this.container.outerHeight() + markerIcon.scaledSize.height + 10,\n            cWidth = this.container.width() / 2 + markerIcon.scaledSize.width / 2;\n        this.position = this.getProjection().fromLatLngToDivPixel(this.marker.getPosition());\n        this.container.css({\n            'top':this.position.y - cHeight,\n            'left':this.position.x - cWidth\n        });\n    };\n    /**\n     * Called when this overlay has its map set to null.\n     * @see CustomWindow.close\n     */\n    CustomWindow.prototype.onRemove = function(){\n        this.container.remove();\n    };\n    /**\n     * Sets the contents of this overlay.\n     * @param {string} html\n     */\n    CustomWindow.prototype.setContent = function(html){\n        this.container.html(html);\n    };\n    /**\n     * Sets the map and relevant marker for this overlay.\n     * @param {google.maps.Map} map\n     * @param {google.maps.Marker} marker\n     */\n    CustomWindow.prototype.open = function(map, marker){\n        this.marker = marker;\n        this.setMap(map);\n    };\n    /**\n     * Close this overlay by setting its map to null.\n     */\n    CustomWindow.prototype.close = function(){\n        this.setMap(null);\n    };\n    return CustomWindow;\n});\n",[46993],{"type":21,"tag":63,"props":46994,"children":46995},{"__ignoreMap":8},[46996,47003,47011,47019,47027,47035,47043,47051,47068,47075,47090,47114,47148,47172,47196,47220,47227,47234,47242,47258,47265,47302,47309,47317,47325,47342,47349,47385,47426,47456,47518,47526,47545,47561,47568,47575,47583,47591,47598,47634,47667,47718,47776,47833,47852,47882,47912,47919,47926,47933,47941,47957,47964,48000,48020,48027,48034,48042,48062,48069,48113,48133,48140,48147,48155,48176,48197,48204,48257,48277,48298,48305,48312,48320,48327,48362,48389,48396,48408],{"type":21,"tag":209,"props":46997,"children":46998},{"class":211,"line":212},[46999],{"type":21,"tag":209,"props":47000,"children":47001},{"style":448},[47002],{"type":26,"value":731},{"type":21,"tag":209,"props":47004,"children":47005},{"class":211,"line":244},[47006],{"type":21,"tag":209,"props":47007,"children":47008},{"style":448},[47009],{"type":26,"value":47010},"     * Create a custom overlay for our window marker display, extending google.maps.OverlayView.\n",{"type":21,"tag":209,"props":47012,"children":47013},{"class":211,"line":254},[47014],{"type":21,"tag":209,"props":47015,"children":47016},{"style":448},[47017],{"type":26,"value":47018},"     * This is somewhat complicated by needing to async load the google.maps api first - thus, we\n",{"type":21,"tag":209,"props":47020,"children":47021},{"class":211,"line":279},[47022],{"type":21,"tag":209,"props":47023,"children":47024},{"style":448},[47025],{"type":26,"value":47026},"     * wrap CustomWindow into a closure, and when instantiating CustomWindow, we first execute the closure (to create\n",{"type":21,"tag":209,"props":47028,"children":47029},{"class":211,"line":288},[47030],{"type":21,"tag":209,"props":47031,"children":47032},{"style":448},[47033],{"type":26,"value":47034},"     * our CustomWindow function, now properly extending the newly loaded google.maps.OverlayView), and then\n",{"type":21,"tag":209,"props":47036,"children":47037},{"class":211,"line":307},[47038],{"type":21,"tag":209,"props":47039,"children":47040},{"style":448},[47041],{"type":26,"value":47042},"     * instantiate said function.\n",{"type":21,"tag":209,"props":47044,"children":47045},{"class":211,"line":325},[47046],{"type":21,"tag":209,"props":47047,"children":47048},{"style":448},[47049],{"type":26,"value":47050},"     * Note that this version uses jQuery.\n",{"type":21,"tag":209,"props":47052,"children":47053},{"class":211,"line":334},[47054,47058,47063],{"type":21,"tag":209,"props":47055,"children":47056},{"style":448},[47057],{"type":26,"value":13306},{"type":21,"tag":209,"props":47059,"children":47060},{"style":216},[47061],{"type":26,"value":47062},"@type",{"type":21,"tag":209,"props":47064,"children":47065},{"style":360},[47066],{"type":26,"value":47067}," {Function}\n",{"type":21,"tag":209,"props":47069,"children":47070},{"class":211,"line":343},[47071],{"type":21,"tag":209,"props":47072,"children":47073},{"style":448},[47074],{"type":26,"value":13346},{"type":21,"tag":209,"props":47076,"children":47077},{"class":211,"line":351},[47078,47082,47086],{"type":21,"tag":209,"props":47079,"children":47080},{"style":222},[47081],{"type":26,"value":368},{"type":21,"tag":209,"props":47083,"children":47084},{"style":216},[47085],{"type":26,"value":4622},{"type":21,"tag":209,"props":47087,"children":47088},{"style":222},[47089],{"type":26,"value":2561},{"type":21,"tag":209,"props":47091,"children":47092},{"class":211,"line":444},[47093,47097,47102,47106,47110],{"type":21,"tag":209,"props":47094,"children":47095},{"style":216},[47096],{"type":26,"value":16994},{"type":21,"tag":209,"props":47098,"children":47099},{"style":360},[47100],{"type":26,"value":47101}," CustomWindow",{"type":21,"tag":209,"props":47103,"children":47104},{"style":216},[47105],{"type":26,"value":271},{"type":21,"tag":209,"props":47107,"children":47108},{"style":216},[47109],{"type":26,"value":4789},{"type":21,"tag":209,"props":47111,"children":47112},{"style":222},[47113],{"type":26,"value":2561},{"type":21,"tag":209,"props":47115,"children":47116},{"class":211,"line":454},[47117,47122,47127,47131,47135,47139,47144],{"type":21,"tag":209,"props":47118,"children":47119},{"style":263},[47120],{"type":26,"value":47121},"        this",{"type":21,"tag":209,"props":47123,"children":47124},{"style":222},[47125],{"type":26,"value":47126},".container ",{"type":21,"tag":209,"props":47128,"children":47129},{"style":216},[47130],{"type":26,"value":1432},{"type":21,"tag":209,"props":47132,"children":47133},{"style":360},[47134],{"type":26,"value":45616},{"type":21,"tag":209,"props":47136,"children":47137},{"style":222},[47138],{"type":26,"value":368},{"type":21,"tag":209,"props":47140,"children":47141},{"style":233},[47142],{"type":26,"value":47143},"'\u003Cdiv class=\"map-info-window\">\u003C/div>'",{"type":21,"tag":209,"props":47145,"children":47146},{"style":222},[47147],{"type":26,"value":2608},{"type":21,"tag":209,"props":47149,"children":47150},{"class":211,"line":463},[47151,47155,47160,47164,47168],{"type":21,"tag":209,"props":47152,"children":47153},{"style":263},[47154],{"type":26,"value":47121},{"type":21,"tag":209,"props":47156,"children":47157},{"style":222},[47158],{"type":26,"value":47159},".layer ",{"type":21,"tag":209,"props":47161,"children":47162},{"style":216},[47163],{"type":26,"value":1432},{"type":21,"tag":209,"props":47165,"children":47166},{"style":263},[47167],{"type":26,"value":8282},{"type":21,"tag":209,"props":47169,"children":47170},{"style":222},[47171],{"type":26,"value":241},{"type":21,"tag":209,"props":47173,"children":47174},{"class":211,"line":472},[47175,47179,47184,47188,47192],{"type":21,"tag":209,"props":47176,"children":47177},{"style":263},[47178],{"type":26,"value":47121},{"type":21,"tag":209,"props":47180,"children":47181},{"style":222},[47182],{"type":26,"value":47183},".marker ",{"type":21,"tag":209,"props":47185,"children":47186},{"style":216},[47187],{"type":26,"value":1432},{"type":21,"tag":209,"props":47189,"children":47190},{"style":263},[47191],{"type":26,"value":8282},{"type":21,"tag":209,"props":47193,"children":47194},{"style":222},[47195],{"type":26,"value":241},{"type":21,"tag":209,"props":47197,"children":47198},{"class":211,"line":480},[47199,47203,47208,47212,47216],{"type":21,"tag":209,"props":47200,"children":47201},{"style":263},[47202],{"type":26,"value":47121},{"type":21,"tag":209,"props":47204,"children":47205},{"style":222},[47206],{"type":26,"value":47207},".position ",{"type":21,"tag":209,"props":47209,"children":47210},{"style":216},[47211],{"type":26,"value":1432},{"type":21,"tag":209,"props":47213,"children":47214},{"style":263},[47215],{"type":26,"value":8282},{"type":21,"tag":209,"props":47217,"children":47218},{"style":222},[47219],{"type":26,"value":241},{"type":21,"tag":209,"props":47221,"children":47222},{"class":211,"line":489},[47223],{"type":21,"tag":209,"props":47224,"children":47225},{"style":222},[47226],{"type":26,"value":13439},{"type":21,"tag":209,"props":47228,"children":47229},{"class":211,"line":847},[47230],{"type":21,"tag":209,"props":47231,"children":47232},{"style":448},[47233],{"type":26,"value":13290},{"type":21,"tag":209,"props":47235,"children":47236},{"class":211,"line":860},[47237],{"type":21,"tag":209,"props":47238,"children":47239},{"style":448},[47240],{"type":26,"value":47241},"     * Inherit from OverlayView\n",{"type":21,"tag":209,"props":47243,"children":47244},{"class":211,"line":877},[47245,47249,47253],{"type":21,"tag":209,"props":47246,"children":47247},{"style":448},[47248],{"type":26,"value":13306},{"type":21,"tag":209,"props":47250,"children":47251},{"style":216},[47252],{"type":26,"value":47062},{"type":21,"tag":209,"props":47254,"children":47255},{"style":360},[47256],{"type":26,"value":47257}," {google.maps.OverlayView}\n",{"type":21,"tag":209,"props":47259,"children":47260},{"class":211,"line":889},[47261],{"type":21,"tag":209,"props":47262,"children":47263},{"style":448},[47264],{"type":26,"value":13346},{"type":21,"tag":209,"props":47266,"children":47267},{"class":211,"line":902},[47268,47273,47277,47281,47285,47289,47293,47298],{"type":21,"tag":209,"props":47269,"children":47270},{"style":263},[47271],{"type":26,"value":47272},"    CustomWindow",{"type":21,"tag":209,"props":47274,"children":47275},{"style":222},[47276],{"type":26,"value":378},{"type":21,"tag":209,"props":47278,"children":47279},{"style":263},[47280],{"type":26,"value":32662},{"type":21,"tag":209,"props":47282,"children":47283},{"style":216},[47284],{"type":26,"value":271},{"type":21,"tag":209,"props":47286,"children":47287},{"style":216},[47288],{"type":26,"value":6371},{"type":21,"tag":209,"props":47290,"children":47291},{"style":222},[47292],{"type":26,"value":43638},{"type":21,"tag":209,"props":47294,"children":47295},{"style":360},[47296],{"type":26,"value":47297},"OverlayView",{"type":21,"tag":209,"props":47299,"children":47300},{"style":222},[47301],{"type":26,"value":4123},{"type":21,"tag":209,"props":47303,"children":47304},{"class":211,"line":914},[47305],{"type":21,"tag":209,"props":47306,"children":47307},{"style":448},[47308],{"type":26,"value":13290},{"type":21,"tag":209,"props":47310,"children":47311},{"class":211,"line":922},[47312],{"type":21,"tag":209,"props":47313,"children":47314},{"style":448},[47315],{"type":26,"value":47316},"     * Called when this overlay is set to a map via this.setMap. Get the appropriate map pane\n",{"type":21,"tag":209,"props":47318,"children":47319},{"class":211,"line":2312},[47320],{"type":21,"tag":209,"props":47321,"children":47322},{"style":448},[47323],{"type":26,"value":47324},"     * to add the window to, append the container, bind to close element.\n",{"type":21,"tag":209,"props":47326,"children":47327},{"class":211,"line":2321},[47328,47332,47337],{"type":21,"tag":209,"props":47329,"children":47330},{"style":448},[47331],{"type":26,"value":13306},{"type":21,"tag":209,"props":47333,"children":47334},{"style":216},[47335],{"type":26,"value":47336},"@see",{"type":21,"tag":209,"props":47338,"children":47339},{"style":360},[47340],{"type":26,"value":47341}," CustomWindow.open\n",{"type":21,"tag":209,"props":47343,"children":47344},{"class":211,"line":2372},[47345],{"type":21,"tag":209,"props":47346,"children":47347},{"style":448},[47348],{"type":26,"value":13346},{"type":21,"tag":209,"props":47350,"children":47351},{"class":211,"line":2381},[47352,47356,47360,47364,47368,47373,47377,47381],{"type":21,"tag":209,"props":47353,"children":47354},{"style":263},[47355],{"type":26,"value":47272},{"type":21,"tag":209,"props":47357,"children":47358},{"style":222},[47359],{"type":26,"value":378},{"type":21,"tag":209,"props":47361,"children":47362},{"style":263},[47363],{"type":26,"value":32662},{"type":21,"tag":209,"props":47365,"children":47366},{"style":222},[47367],{"type":26,"value":378},{"type":21,"tag":209,"props":47369,"children":47370},{"style":360},[47371],{"type":26,"value":47372},"onAdd",{"type":21,"tag":209,"props":47374,"children":47375},{"style":216},[47376],{"type":26,"value":271},{"type":21,"tag":209,"props":47378,"children":47379},{"style":216},[47380],{"type":26,"value":4789},{"type":21,"tag":209,"props":47382,"children":47383},{"style":222},[47384],{"type":26,"value":2561},{"type":21,"tag":209,"props":47386,"children":47387},{"class":211,"line":2389},[47388,47392,47396,47400,47404,47408,47412,47416,47421],{"type":21,"tag":209,"props":47389,"children":47390},{"style":263},[47391],{"type":26,"value":47121},{"type":21,"tag":209,"props":47393,"children":47394},{"style":222},[47395],{"type":26,"value":47159},{"type":21,"tag":209,"props":47397,"children":47398},{"style":216},[47399],{"type":26,"value":1432},{"type":21,"tag":209,"props":47401,"children":47402},{"style":360},[47403],{"type":26,"value":45616},{"type":21,"tag":209,"props":47405,"children":47406},{"style":222},[47407],{"type":26,"value":368},{"type":21,"tag":209,"props":47409,"children":47410},{"style":263},[47411],{"type":26,"value":2508},{"type":21,"tag":209,"props":47413,"children":47414},{"style":222},[47415],{"type":26,"value":378},{"type":21,"tag":209,"props":47417,"children":47418},{"style":360},[47419],{"type":26,"value":47420},"getPanes",{"type":21,"tag":209,"props":47422,"children":47423},{"style":222},[47424],{"type":26,"value":47425},"().floatPane);\n",{"type":21,"tag":209,"props":47427,"children":47428},{"class":211,"line":2397},[47429,47433,47438,47443,47447,47451],{"type":21,"tag":209,"props":47430,"children":47431},{"style":263},[47432],{"type":26,"value":47121},{"type":21,"tag":209,"props":47434,"children":47435},{"style":222},[47436],{"type":26,"value":47437},".layer.",{"type":21,"tag":209,"props":47439,"children":47440},{"style":360},[47441],{"type":26,"value":47442},"append",{"type":21,"tag":209,"props":47444,"children":47445},{"style":222},[47446],{"type":26,"value":368},{"type":21,"tag":209,"props":47448,"children":47449},{"style":263},[47450],{"type":26,"value":2508},{"type":21,"tag":209,"props":47452,"children":47453},{"style":222},[47454],{"type":26,"value":47455},".container);\n",{"type":21,"tag":209,"props":47457,"children":47458},{"class":211,"line":2406},[47459,47463,47468,47472,47476,47481,47485,47489,47493,47497,47502,47506,47510,47514],{"type":21,"tag":209,"props":47460,"children":47461},{"style":263},[47462],{"type":26,"value":47121},{"type":21,"tag":209,"props":47464,"children":47465},{"style":222},[47466],{"type":26,"value":47467},".container.",{"type":21,"tag":209,"props":47469,"children":47470},{"style":360},[47471],{"type":26,"value":45769},{"type":21,"tag":209,"props":47473,"children":47474},{"style":222},[47475],{"type":26,"value":368},{"type":21,"tag":209,"props":47477,"children":47478},{"style":233},[47479],{"type":26,"value":47480},"'.map-info-close'",{"type":21,"tag":209,"props":47482,"children":47483},{"style":222},[47484],{"type":26,"value":2699},{"type":21,"tag":209,"props":47486,"children":47487},{"style":360},[47488],{"type":26,"value":363},{"type":21,"tag":209,"props":47490,"children":47491},{"style":222},[47492],{"type":26,"value":368},{"type":21,"tag":209,"props":47494,"children":47495},{"style":233},[47496],{"type":26,"value":14925},{"type":21,"tag":209,"props":47498,"children":47499},{"style":222},[47500],{"type":26,"value":47501},", _.",{"type":21,"tag":209,"props":47503,"children":47504},{"style":360},[47505],{"type":26,"value":20189},{"type":21,"tag":209,"props":47507,"children":47508},{"style":222},[47509],{"type":26,"value":368},{"type":21,"tag":209,"props":47511,"children":47512},{"style":216},[47513],{"type":26,"value":4622},{"type":21,"tag":209,"props":47515,"children":47516},{"style":222},[47517],{"type":26,"value":2561},{"type":21,"tag":209,"props":47519,"children":47520},{"class":211,"line":2415},[47521],{"type":21,"tag":209,"props":47522,"children":47523},{"style":448},[47524],{"type":26,"value":47525},"            // Close info window on click\n",{"type":21,"tag":209,"props":47527,"children":47528},{"class":211,"line":2424},[47529,47533,47537,47541],{"type":21,"tag":209,"props":47530,"children":47531},{"style":263},[47532],{"type":26,"value":2570},{"type":21,"tag":209,"props":47534,"children":47535},{"style":222},[47536],{"type":26,"value":378},{"type":21,"tag":209,"props":47538,"children":47539},{"style":360},[47540],{"type":26,"value":10540},{"type":21,"tag":209,"props":47542,"children":47543},{"style":222},[47544],{"type":26,"value":4123},{"type":21,"tag":209,"props":47546,"children":47547},{"class":211,"line":2433},[47548,47553,47557],{"type":21,"tag":209,"props":47549,"children":47550},{"style":222},[47551],{"type":26,"value":47552},"        }, ",{"type":21,"tag":209,"props":47554,"children":47555},{"style":263},[47556],{"type":26,"value":2508},{"type":21,"tag":209,"props":47558,"children":47559},{"style":222},[47560],{"type":26,"value":4212},{"type":21,"tag":209,"props":47562,"children":47563},{"class":211,"line":2442},[47564],{"type":21,"tag":209,"props":47565,"children":47566},{"style":222},[47567],{"type":26,"value":13439},{"type":21,"tag":209,"props":47569,"children":47570},{"class":211,"line":2471},[47571],{"type":21,"tag":209,"props":47572,"children":47573},{"style":448},[47574],{"type":26,"value":13290},{"type":21,"tag":209,"props":47576,"children":47577},{"class":211,"line":2480},[47578],{"type":21,"tag":209,"props":47579,"children":47580},{"style":448},[47581],{"type":26,"value":47582},"     * Called after onAdd, and every time the map is moved, zoomed, or anything else that\n",{"type":21,"tag":209,"props":47584,"children":47585},{"class":211,"line":2489},[47586],{"type":21,"tag":209,"props":47587,"children":47588},{"style":448},[47589],{"type":26,"value":47590},"     * would effect positions, to redraw this overlay.\n",{"type":21,"tag":209,"props":47592,"children":47593},{"class":211,"line":2516},[47594],{"type":21,"tag":209,"props":47595,"children":47596},{"style":448},[47597],{"type":26,"value":13346},{"type":21,"tag":209,"props":47599,"children":47600},{"class":211,"line":2525},[47601,47605,47609,47613,47617,47622,47626,47630],{"type":21,"tag":209,"props":47602,"children":47603},{"style":263},[47604],{"type":26,"value":47272},{"type":21,"tag":209,"props":47606,"children":47607},{"style":222},[47608],{"type":26,"value":378},{"type":21,"tag":209,"props":47610,"children":47611},{"style":263},[47612],{"type":26,"value":32662},{"type":21,"tag":209,"props":47614,"children":47615},{"style":222},[47616],{"type":26,"value":378},{"type":21,"tag":209,"props":47618,"children":47619},{"style":360},[47620],{"type":26,"value":47621},"draw",{"type":21,"tag":209,"props":47623,"children":47624},{"style":216},[47625],{"type":26,"value":271},{"type":21,"tag":209,"props":47627,"children":47628},{"style":216},[47629],{"type":26,"value":4789},{"type":21,"tag":209,"props":47631,"children":47632},{"style":222},[47633],{"type":26,"value":2561},{"type":21,"tag":209,"props":47635,"children":47636},{"class":211,"line":2533},[47637,47641,47646,47650,47654,47658,47663],{"type":21,"tag":209,"props":47638,"children":47639},{"style":216},[47640],{"type":26,"value":14505},{"type":21,"tag":209,"props":47642,"children":47643},{"style":222},[47644],{"type":26,"value":47645}," markerIcon ",{"type":21,"tag":209,"props":47647,"children":47648},{"style":216},[47649],{"type":26,"value":1432},{"type":21,"tag":209,"props":47651,"children":47652},{"style":263},[47653],{"type":26,"value":20502},{"type":21,"tag":209,"props":47655,"children":47656},{"style":222},[47657],{"type":26,"value":42558},{"type":21,"tag":209,"props":47659,"children":47660},{"style":360},[47661],{"type":26,"value":47662},"getIcon",{"type":21,"tag":209,"props":47664,"children":47665},{"style":222},[47666],{"type":26,"value":13988},{"type":21,"tag":209,"props":47668,"children":47669},{"class":211,"line":2542},[47670,47675,47679,47683,47687,47692,47696,47700,47705,47709,47714],{"type":21,"tag":209,"props":47671,"children":47672},{"style":222},[47673],{"type":26,"value":47674},"            cHeight ",{"type":21,"tag":209,"props":47676,"children":47677},{"style":216},[47678],{"type":26,"value":1432},{"type":21,"tag":209,"props":47680,"children":47681},{"style":263},[47682],{"type":26,"value":20502},{"type":21,"tag":209,"props":47684,"children":47685},{"style":222},[47686],{"type":26,"value":47467},{"type":21,"tag":209,"props":47688,"children":47689},{"style":360},[47690],{"type":26,"value":47691},"outerHeight",{"type":21,"tag":209,"props":47693,"children":47694},{"style":222},[47695],{"type":26,"value":17194},{"type":21,"tag":209,"props":47697,"children":47698},{"style":216},[47699],{"type":26,"value":17170},{"type":21,"tag":209,"props":47701,"children":47702},{"style":222},[47703],{"type":26,"value":47704}," markerIcon.scaledSize.height ",{"type":21,"tag":209,"props":47706,"children":47707},{"style":216},[47708],{"type":26,"value":17170},{"type":21,"tag":209,"props":47710,"children":47711},{"style":263},[47712],{"type":26,"value":47713}," 10",{"type":21,"tag":209,"props":47715,"children":47716},{"style":222},[47717],{"type":26,"value":304},{"type":21,"tag":209,"props":47719,"children":47720},{"class":211,"line":2550},[47721,47726,47730,47734,47738,47743,47747,47751,47755,47759,47764,47768,47772],{"type":21,"tag":209,"props":47722,"children":47723},{"style":222},[47724],{"type":26,"value":47725},"            cWidth ",{"type":21,"tag":209,"props":47727,"children":47728},{"style":216},[47729],{"type":26,"value":1432},{"type":21,"tag":209,"props":47731,"children":47732},{"style":263},[47733],{"type":26,"value":20502},{"type":21,"tag":209,"props":47735,"children":47736},{"style":222},[47737],{"type":26,"value":47467},{"type":21,"tag":209,"props":47739,"children":47740},{"style":360},[47741],{"type":26,"value":47742},"width",{"type":21,"tag":209,"props":47744,"children":47745},{"style":222},[47746],{"type":26,"value":17194},{"type":21,"tag":209,"props":47748,"children":47749},{"style":216},[47750],{"type":26,"value":6460},{"type":21,"tag":209,"props":47752,"children":47753},{"style":263},[47754],{"type":26,"value":6354},{"type":21,"tag":209,"props":47756,"children":47757},{"style":216},[47758],{"type":26,"value":4652},{"type":21,"tag":209,"props":47760,"children":47761},{"style":222},[47762],{"type":26,"value":47763}," markerIcon.scaledSize.width ",{"type":21,"tag":209,"props":47765,"children":47766},{"style":216},[47767],{"type":26,"value":6460},{"type":21,"tag":209,"props":47769,"children":47770},{"style":263},[47771],{"type":26,"value":6354},{"type":21,"tag":209,"props":47773,"children":47774},{"style":222},[47775],{"type":26,"value":241},{"type":21,"tag":209,"props":47777,"children":47778},{"class":211,"line":2564},[47779,47783,47787,47791,47795,47799,47804,47808,47813,47817,47821,47825,47829],{"type":21,"tag":209,"props":47780,"children":47781},{"style":263},[47782],{"type":26,"value":47121},{"type":21,"tag":209,"props":47784,"children":47785},{"style":222},[47786],{"type":26,"value":47207},{"type":21,"tag":209,"props":47788,"children":47789},{"style":216},[47790],{"type":26,"value":1432},{"type":21,"tag":209,"props":47792,"children":47793},{"style":263},[47794],{"type":26,"value":20502},{"type":21,"tag":209,"props":47796,"children":47797},{"style":222},[47798],{"type":26,"value":378},{"type":21,"tag":209,"props":47800,"children":47801},{"style":360},[47802],{"type":26,"value":47803},"getProjection",{"type":21,"tag":209,"props":47805,"children":47806},{"style":222},[47807],{"type":26,"value":17096},{"type":21,"tag":209,"props":47809,"children":47810},{"style":360},[47811],{"type":26,"value":47812},"fromLatLngToDivPixel",{"type":21,"tag":209,"props":47814,"children":47815},{"style":222},[47816],{"type":26,"value":368},{"type":21,"tag":209,"props":47818,"children":47819},{"style":263},[47820],{"type":26,"value":2508},{"type":21,"tag":209,"props":47822,"children":47823},{"style":222},[47824],{"type":26,"value":42558},{"type":21,"tag":209,"props":47826,"children":47827},{"style":360},[47828],{"type":26,"value":42563},{"type":21,"tag":209,"props":47830,"children":47831},{"style":222},[47832],{"type":26,"value":4161},{"type":21,"tag":209,"props":47834,"children":47835},{"class":211,"line":2611},[47836,47840,47844,47848],{"type":21,"tag":209,"props":47837,"children":47838},{"style":263},[47839],{"type":26,"value":47121},{"type":21,"tag":209,"props":47841,"children":47842},{"style":222},[47843],{"type":26,"value":47467},{"type":21,"tag":209,"props":47845,"children":47846},{"style":360},[47847],{"type":26,"value":45053},{"type":21,"tag":209,"props":47849,"children":47850},{"style":222},[47851],{"type":26,"value":7767},{"type":21,"tag":209,"props":47853,"children":47854},{"class":211,"line":2619},[47855,47860,47864,47868,47873,47877],{"type":21,"tag":209,"props":47856,"children":47857},{"style":233},[47858],{"type":26,"value":47859},"            'top'",{"type":21,"tag":209,"props":47861,"children":47862},{"style":222},[47863],{"type":26,"value":191},{"type":21,"tag":209,"props":47865,"children":47866},{"style":263},[47867],{"type":26,"value":2508},{"type":21,"tag":209,"props":47869,"children":47870},{"style":222},[47871],{"type":26,"value":47872},".position.y ",{"type":21,"tag":209,"props":47874,"children":47875},{"style":216},[47876],{"type":26,"value":42628},{"type":21,"tag":209,"props":47878,"children":47879},{"style":222},[47880],{"type":26,"value":47881}," cHeight,\n",{"type":21,"tag":209,"props":47883,"children":47884},{"class":211,"line":2627},[47885,47890,47894,47898,47903,47907],{"type":21,"tag":209,"props":47886,"children":47887},{"style":233},[47888],{"type":26,"value":47889},"            'left'",{"type":21,"tag":209,"props":47891,"children":47892},{"style":222},[47893],{"type":26,"value":191},{"type":21,"tag":209,"props":47895,"children":47896},{"style":263},[47897],{"type":26,"value":2508},{"type":21,"tag":209,"props":47899,"children":47900},{"style":222},[47901],{"type":26,"value":47902},".position.x ",{"type":21,"tag":209,"props":47904,"children":47905},{"style":216},[47906],{"type":26,"value":42628},{"type":21,"tag":209,"props":47908,"children":47909},{"style":222},[47910],{"type":26,"value":47911}," cWidth\n",{"type":21,"tag":209,"props":47913,"children":47914},{"class":211,"line":2636},[47915],{"type":21,"tag":209,"props":47916,"children":47917},{"style":222},[47918],{"type":26,"value":13702},{"type":21,"tag":209,"props":47920,"children":47921},{"class":211,"line":2644},[47922],{"type":21,"tag":209,"props":47923,"children":47924},{"style":222},[47925],{"type":26,"value":13439},{"type":21,"tag":209,"props":47927,"children":47928},{"class":211,"line":2657},[47929],{"type":21,"tag":209,"props":47930,"children":47931},{"style":448},[47932],{"type":26,"value":13290},{"type":21,"tag":209,"props":47934,"children":47935},{"class":211,"line":2728},[47936],{"type":21,"tag":209,"props":47937,"children":47938},{"style":448},[47939],{"type":26,"value":47940},"     * Called when this overlay has its map set to null.\n",{"type":21,"tag":209,"props":47942,"children":47943},{"class":211,"line":2758},[47944,47948,47952],{"type":21,"tag":209,"props":47945,"children":47946},{"style":448},[47947],{"type":26,"value":13306},{"type":21,"tag":209,"props":47949,"children":47950},{"style":216},[47951],{"type":26,"value":47336},{"type":21,"tag":209,"props":47953,"children":47954},{"style":360},[47955],{"type":26,"value":47956}," CustomWindow.close\n",{"type":21,"tag":209,"props":47958,"children":47959},{"class":211,"line":2776},[47960],{"type":21,"tag":209,"props":47961,"children":47962},{"style":448},[47963],{"type":26,"value":13346},{"type":21,"tag":209,"props":47965,"children":47966},{"class":211,"line":2785},[47967,47971,47975,47979,47983,47988,47992,47996],{"type":21,"tag":209,"props":47968,"children":47969},{"style":263},[47970],{"type":26,"value":47272},{"type":21,"tag":209,"props":47972,"children":47973},{"style":222},[47974],{"type":26,"value":378},{"type":21,"tag":209,"props":47976,"children":47977},{"style":263},[47978],{"type":26,"value":32662},{"type":21,"tag":209,"props":47980,"children":47981},{"style":222},[47982],{"type":26,"value":378},{"type":21,"tag":209,"props":47984,"children":47985},{"style":360},[47986],{"type":26,"value":47987},"onRemove",{"type":21,"tag":209,"props":47989,"children":47990},{"style":216},[47991],{"type":26,"value":271},{"type":21,"tag":209,"props":47993,"children":47994},{"style":216},[47995],{"type":26,"value":4789},{"type":21,"tag":209,"props":47997,"children":47998},{"style":222},[47999],{"type":26,"value":2561},{"type":21,"tag":209,"props":48001,"children":48002},{"class":211,"line":2793},[48003,48007,48011,48016],{"type":21,"tag":209,"props":48004,"children":48005},{"style":263},[48006],{"type":26,"value":47121},{"type":21,"tag":209,"props":48008,"children":48009},{"style":222},[48010],{"type":26,"value":47467},{"type":21,"tag":209,"props":48012,"children":48013},{"style":360},[48014],{"type":26,"value":48015},"remove",{"type":21,"tag":209,"props":48017,"children":48018},{"style":222},[48019],{"type":26,"value":4123},{"type":21,"tag":209,"props":48021,"children":48022},{"class":211,"line":2801},[48023],{"type":21,"tag":209,"props":48024,"children":48025},{"style":222},[48026],{"type":26,"value":13439},{"type":21,"tag":209,"props":48028,"children":48029},{"class":211,"line":2809},[48030],{"type":21,"tag":209,"props":48031,"children":48032},{"style":448},[48033],{"type":26,"value":13290},{"type":21,"tag":209,"props":48035,"children":48036},{"class":211,"line":10937},[48037],{"type":21,"tag":209,"props":48038,"children":48039},{"style":448},[48040],{"type":26,"value":48041},"     * Sets the contents of this overlay.\n",{"type":21,"tag":209,"props":48043,"children":48044},{"class":211,"line":10967},[48045,48049,48053,48057],{"type":21,"tag":209,"props":48046,"children":48047},{"style":448},[48048],{"type":26,"value":13306},{"type":21,"tag":209,"props":48050,"children":48051},{"style":216},[48052],{"type":26,"value":13311},{"type":21,"tag":209,"props":48054,"children":48055},{"style":360},[48056],{"type":26,"value":13316},{"type":21,"tag":209,"props":48058,"children":48059},{"style":222},[48060],{"type":26,"value":48061}," html\n",{"type":21,"tag":209,"props":48063,"children":48064},{"class":211,"line":11003},[48065],{"type":21,"tag":209,"props":48066,"children":48067},{"style":448},[48068],{"type":26,"value":13346},{"type":21,"tag":209,"props":48070,"children":48071},{"class":211,"line":11038},[48072,48076,48080,48084,48088,48093,48097,48101,48105,48109],{"type":21,"tag":209,"props":48073,"children":48074},{"style":263},[48075],{"type":26,"value":47272},{"type":21,"tag":209,"props":48077,"children":48078},{"style":222},[48079],{"type":26,"value":378},{"type":21,"tag":209,"props":48081,"children":48082},{"style":263},[48083],{"type":26,"value":32662},{"type":21,"tag":209,"props":48085,"children":48086},{"style":222},[48087],{"type":26,"value":378},{"type":21,"tag":209,"props":48089,"children":48090},{"style":360},[48091],{"type":26,"value":48092},"setContent",{"type":21,"tag":209,"props":48094,"children":48095},{"style":216},[48096],{"type":26,"value":271},{"type":21,"tag":209,"props":48098,"children":48099},{"style":216},[48100],{"type":26,"value":4789},{"type":21,"tag":209,"props":48102,"children":48103},{"style":222},[48104],{"type":26,"value":368},{"type":21,"tag":209,"props":48106,"children":48107},{"style":400},[48108],{"type":26,"value":22955},{"type":21,"tag":209,"props":48110,"children":48111},{"style":222},[48112],{"type":26,"value":2369},{"type":21,"tag":209,"props":48114,"children":48115},{"class":211,"line":11072},[48116,48120,48124,48128],{"type":21,"tag":209,"props":48117,"children":48118},{"style":263},[48119],{"type":26,"value":47121},{"type":21,"tag":209,"props":48121,"children":48122},{"style":222},[48123],{"type":26,"value":47467},{"type":21,"tag":209,"props":48125,"children":48126},{"style":360},[48127],{"type":26,"value":22955},{"type":21,"tag":209,"props":48129,"children":48130},{"style":222},[48131],{"type":26,"value":48132},"(html);\n",{"type":21,"tag":209,"props":48134,"children":48135},{"class":211,"line":11106},[48136],{"type":21,"tag":209,"props":48137,"children":48138},{"style":222},[48139],{"type":26,"value":13439},{"type":21,"tag":209,"props":48141,"children":48142},{"class":211,"line":11114},[48143],{"type":21,"tag":209,"props":48144,"children":48145},{"style":448},[48146],{"type":26,"value":13290},{"type":21,"tag":209,"props":48148,"children":48149},{"class":211,"line":14940},[48150],{"type":21,"tag":209,"props":48151,"children":48152},{"style":448},[48153],{"type":26,"value":48154},"     * Sets the map and relevant marker for this overlay.\n",{"type":21,"tag":209,"props":48156,"children":48157},{"class":211,"line":14949},[48158,48162,48166,48171],{"type":21,"tag":209,"props":48159,"children":48160},{"style":448},[48161],{"type":26,"value":13306},{"type":21,"tag":209,"props":48163,"children":48164},{"style":216},[48165],{"type":26,"value":13311},{"type":21,"tag":209,"props":48167,"children":48168},{"style":360},[48169],{"type":26,"value":48170}," {google.maps.Map}",{"type":21,"tag":209,"props":48172,"children":48173},{"style":222},[48174],{"type":26,"value":48175}," map\n",{"type":21,"tag":209,"props":48177,"children":48178},{"class":211,"line":14958},[48179,48183,48187,48192],{"type":21,"tag":209,"props":48180,"children":48181},{"style":448},[48182],{"type":26,"value":13306},{"type":21,"tag":209,"props":48184,"children":48185},{"style":216},[48186],{"type":26,"value":13311},{"type":21,"tag":209,"props":48188,"children":48189},{"style":360},[48190],{"type":26,"value":48191}," {google.maps.Marker}",{"type":21,"tag":209,"props":48193,"children":48194},{"style":222},[48195],{"type":26,"value":48196}," marker\n",{"type":21,"tag":209,"props":48198,"children":48199},{"class":211,"line":14966},[48200],{"type":21,"tag":209,"props":48201,"children":48202},{"style":448},[48203],{"type":26,"value":13346},{"type":21,"tag":209,"props":48205,"children":48206},{"class":211,"line":14975},[48207,48211,48215,48219,48223,48227,48231,48235,48239,48244,48248,48253],{"type":21,"tag":209,"props":48208,"children":48209},{"style":263},[48210],{"type":26,"value":47272},{"type":21,"tag":209,"props":48212,"children":48213},{"style":222},[48214],{"type":26,"value":378},{"type":21,"tag":209,"props":48216,"children":48217},{"style":263},[48218],{"type":26,"value":32662},{"type":21,"tag":209,"props":48220,"children":48221},{"style":222},[48222],{"type":26,"value":378},{"type":21,"tag":209,"props":48224,"children":48225},{"style":360},[48226],{"type":26,"value":20680},{"type":21,"tag":209,"props":48228,"children":48229},{"style":216},[48230],{"type":26,"value":271},{"type":21,"tag":209,"props":48232,"children":48233},{"style":216},[48234],{"type":26,"value":4789},{"type":21,"tag":209,"props":48236,"children":48237},{"style":222},[48238],{"type":26,"value":368},{"type":21,"tag":209,"props":48240,"children":48241},{"style":400},[48242],{"type":26,"value":48243},"map",{"type":21,"tag":209,"props":48245,"children":48246},{"style":222},[48247],{"type":26,"value":408},{"type":21,"tag":209,"props":48249,"children":48250},{"style":400},[48251],{"type":26,"value":48252},"marker",{"type":21,"tag":209,"props":48254,"children":48255},{"style":222},[48256],{"type":26,"value":2369},{"type":21,"tag":209,"props":48258,"children":48259},{"class":211,"line":14984},[48260,48264,48268,48272],{"type":21,"tag":209,"props":48261,"children":48262},{"style":263},[48263],{"type":26,"value":47121},{"type":21,"tag":209,"props":48265,"children":48266},{"style":222},[48267],{"type":26,"value":47183},{"type":21,"tag":209,"props":48269,"children":48270},{"style":216},[48271],{"type":26,"value":1432},{"type":21,"tag":209,"props":48273,"children":48274},{"style":222},[48275],{"type":26,"value":48276}," marker;\n",{"type":21,"tag":209,"props":48278,"children":48279},{"class":211,"line":15018},[48280,48284,48288,48293],{"type":21,"tag":209,"props":48281,"children":48282},{"style":263},[48283],{"type":26,"value":47121},{"type":21,"tag":209,"props":48285,"children":48286},{"style":222},[48287],{"type":26,"value":378},{"type":21,"tag":209,"props":48289,"children":48290},{"style":360},[48291],{"type":26,"value":48292},"setMap",{"type":21,"tag":209,"props":48294,"children":48295},{"style":222},[48296],{"type":26,"value":48297},"(map);\n",{"type":21,"tag":209,"props":48299,"children":48300},{"class":211,"line":15050},[48301],{"type":21,"tag":209,"props":48302,"children":48303},{"style":222},[48304],{"type":26,"value":13439},{"type":21,"tag":209,"props":48306,"children":48307},{"class":211,"line":15082},[48308],{"type":21,"tag":209,"props":48309,"children":48310},{"style":448},[48311],{"type":26,"value":13290},{"type":21,"tag":209,"props":48313,"children":48314},{"class":211,"line":15090},[48315],{"type":21,"tag":209,"props":48316,"children":48317},{"style":448},[48318],{"type":26,"value":48319},"     * Close this overlay by setting its map to null.\n",{"type":21,"tag":209,"props":48321,"children":48322},{"class":211,"line":15098},[48323],{"type":21,"tag":209,"props":48324,"children":48325},{"style":448},[48326],{"type":26,"value":13346},{"type":21,"tag":209,"props":48328,"children":48329},{"class":211,"line":15106},[48330,48334,48338,48342,48346,48350,48354,48358],{"type":21,"tag":209,"props":48331,"children":48332},{"style":263},[48333],{"type":26,"value":47272},{"type":21,"tag":209,"props":48335,"children":48336},{"style":222},[48337],{"type":26,"value":378},{"type":21,"tag":209,"props":48339,"children":48340},{"style":263},[48341],{"type":26,"value":32662},{"type":21,"tag":209,"props":48343,"children":48344},{"style":222},[48345],{"type":26,"value":378},{"type":21,"tag":209,"props":48347,"children":48348},{"style":360},[48349],{"type":26,"value":10540},{"type":21,"tag":209,"props":48351,"children":48352},{"style":216},[48353],{"type":26,"value":271},{"type":21,"tag":209,"props":48355,"children":48356},{"style":216},[48357],{"type":26,"value":4789},{"type":21,"tag":209,"props":48359,"children":48360},{"style":222},[48361],{"type":26,"value":2561},{"type":21,"tag":209,"props":48363,"children":48364},{"class":211,"line":15114},[48365,48369,48373,48377,48381,48385],{"type":21,"tag":209,"props":48366,"children":48367},{"style":263},[48368],{"type":26,"value":47121},{"type":21,"tag":209,"props":48370,"children":48371},{"style":222},[48372],{"type":26,"value":378},{"type":21,"tag":209,"props":48374,"children":48375},{"style":360},[48376],{"type":26,"value":48292},{"type":21,"tag":209,"props":48378,"children":48379},{"style":222},[48380],{"type":26,"value":368},{"type":21,"tag":209,"props":48382,"children":48383},{"style":263},[48384],{"type":26,"value":20198},{"type":21,"tag":209,"props":48386,"children":48387},{"style":222},[48388],{"type":26,"value":2608},{"type":21,"tag":209,"props":48390,"children":48391},{"class":211,"line":15123},[48392],{"type":21,"tag":209,"props":48393,"children":48394},{"style":222},[48395],{"type":26,"value":13439},{"type":21,"tag":209,"props":48397,"children":48398},{"class":211,"line":15143},[48399,48403],{"type":21,"tag":209,"props":48400,"children":48401},{"style":216},[48402],{"type":26,"value":1298},{"type":21,"tag":209,"props":48404,"children":48405},{"style":222},[48406],{"type":26,"value":48407}," CustomWindow;\n",{"type":21,"tag":209,"props":48409,"children":48410},{"class":211,"line":15160},[48411],{"type":21,"tag":209,"props":48412,"children":48413},{"style":222},[48414],{"type":26,"value":469},{"type":21,"tag":22,"props":48416,"children":48417},{},[48418],{"type":26,"value":48419},"We create a closure that contains our custom window object, and extend OverlayView within. You'll notice this isn't executing - we don't want to call it immediately, but rather wait until init. We'll assume we've assigned this function to a property of GMaps, for example:",{"type":21,"tag":200,"props":48421,"children":48423},{"className":16138,"code":48422,"language":16140,"meta":8,"style":8},"GMaps.CustomWindow = (function(){\n...\n",[48424],{"type":21,"tag":63,"props":48425,"children":48426},{"__ignoreMap":8},[48427,48451],{"type":21,"tag":209,"props":48428,"children":48429},{"class":211,"line":212},[48430,48435,48439,48443,48447],{"type":21,"tag":209,"props":48431,"children":48432},{"style":222},[48433],{"type":26,"value":48434},"GMaps.CustomWindow ",{"type":21,"tag":209,"props":48436,"children":48437},{"style":216},[48438],{"type":26,"value":1432},{"type":21,"tag":209,"props":48440,"children":48441},{"style":222},[48442],{"type":26,"value":5569},{"type":21,"tag":209,"props":48444,"children":48445},{"style":216},[48446],{"type":26,"value":4622},{"type":21,"tag":209,"props":48448,"children":48449},{"style":222},[48450],{"type":26,"value":2561},{"type":21,"tag":209,"props":48452,"children":48453},{"class":211,"line":244},[48454],{"type":21,"tag":209,"props":48455,"children":48456},{"style":216},[48457],{"type":26,"value":48458},"...\n",{"type":21,"tag":22,"props":48460,"children":48461},{},[48462,48464,48469],{"type":26,"value":48463},"There's a few ways we could now create our custom info window, depending on whether we decided to use an instantiated object or a 'static' function as our init callback. We could use a listener (listening for an event triggered on some guaranteed-present element, like 'body') for the static, so that we access to ",{"type":21,"tag":63,"props":48465,"children":48467},{"className":48466},[],[48468],{"type":26,"value":2508},{"type":26,"value":48470}," when we create the info window; or, if we already have our GMaps object, we could simply instantiate it in our init function itself.",{"type":21,"tag":200,"props":48472,"children":48474},{"className":16138,"code":48473,"language":16140,"meta":8,"style":8},"function GMaps(){\n    // Set properties\n    this.mapReady = false;\n    $('body').one('gmaps:ready', function(){\n        this.mapReady = true;\n        this.infoWindow = (GMaps.CustomWindow())();\n    }.bind(this));\n}\n\nGMaps.init = function(){\n    $('body').trigger('gmaps:ready');\n}\n\n// OR\n\nGMaps.prototype.init = function(){\n    this.mapReady = true;\n    this.infoWindow = (GMaps.CustomWindow())();\n}\n",[48475],{"type":21,"tag":63,"props":48476,"children":48477},{"__ignoreMap":8},[48478,48493,48500,48523,48570,48593,48623,48647,48654,48661,48684,48719,48726,48733,48740,48747,48782,48805,48832],{"type":21,"tag":209,"props":48479,"children":48480},{"class":211,"line":212},[48481,48485,48489],{"type":21,"tag":209,"props":48482,"children":48483},{"style":216},[48484],{"type":26,"value":4622},{"type":21,"tag":209,"props":48486,"children":48487},{"style":360},[48488],{"type":26,"value":46740},{"type":21,"tag":209,"props":48490,"children":48491},{"style":222},[48492],{"type":26,"value":2561},{"type":21,"tag":209,"props":48494,"children":48495},{"class":211,"line":244},[48496],{"type":21,"tag":209,"props":48497,"children":48498},{"style":448},[48499],{"type":26,"value":46752},{"type":21,"tag":209,"props":48501,"children":48502},{"class":211,"line":254},[48503,48507,48511,48515,48519],{"type":21,"tag":209,"props":48504,"children":48505},{"style":263},[48506],{"type":26,"value":46760},{"type":21,"tag":209,"props":48508,"children":48509},{"style":222},[48510],{"type":26,"value":46765},{"type":21,"tag":209,"props":48512,"children":48513},{"style":216},[48514],{"type":26,"value":1432},{"type":21,"tag":209,"props":48516,"children":48517},{"style":263},[48518],{"type":26,"value":14038},{"type":21,"tag":209,"props":48520,"children":48521},{"style":222},[48522],{"type":26,"value":241},{"type":21,"tag":209,"props":48524,"children":48525},{"class":211,"line":279},[48526,48531,48535,48540,48544,48549,48553,48558,48562,48566],{"type":21,"tag":209,"props":48527,"children":48528},{"style":360},[48529],{"type":26,"value":48530},"    $",{"type":21,"tag":209,"props":48532,"children":48533},{"style":222},[48534],{"type":26,"value":368},{"type":21,"tag":209,"props":48536,"children":48537},{"style":233},[48538],{"type":26,"value":48539},"'body'",{"type":21,"tag":209,"props":48541,"children":48542},{"style":222},[48543],{"type":26,"value":2699},{"type":21,"tag":209,"props":48545,"children":48546},{"style":360},[48547],{"type":26,"value":48548},"one",{"type":21,"tag":209,"props":48550,"children":48551},{"style":222},[48552],{"type":26,"value":368},{"type":21,"tag":209,"props":48554,"children":48555},{"style":233},[48556],{"type":26,"value":48557},"'gmaps:ready'",{"type":21,"tag":209,"props":48559,"children":48560},{"style":222},[48561],{"type":26,"value":408},{"type":21,"tag":209,"props":48563,"children":48564},{"style":216},[48565],{"type":26,"value":4622},{"type":21,"tag":209,"props":48567,"children":48568},{"style":222},[48569],{"type":26,"value":2561},{"type":21,"tag":209,"props":48571,"children":48572},{"class":211,"line":288},[48573,48577,48581,48585,48589],{"type":21,"tag":209,"props":48574,"children":48575},{"style":263},[48576],{"type":26,"value":47121},{"type":21,"tag":209,"props":48578,"children":48579},{"style":222},[48580],{"type":26,"value":46765},{"type":21,"tag":209,"props":48582,"children":48583},{"style":216},[48584],{"type":26,"value":1432},{"type":21,"tag":209,"props":48586,"children":48587},{"style":263},[48588],{"type":26,"value":14819},{"type":21,"tag":209,"props":48590,"children":48591},{"style":222},[48592],{"type":26,"value":241},{"type":21,"tag":209,"props":48594,"children":48595},{"class":211,"line":307},[48596,48600,48605,48609,48614,48618],{"type":21,"tag":209,"props":48597,"children":48598},{"style":263},[48599],{"type":26,"value":47121},{"type":21,"tag":209,"props":48601,"children":48602},{"style":222},[48603],{"type":26,"value":48604},".infoWindow ",{"type":21,"tag":209,"props":48606,"children":48607},{"style":216},[48608],{"type":26,"value":1432},{"type":21,"tag":209,"props":48610,"children":48611},{"style":222},[48612],{"type":26,"value":48613}," (GMaps.",{"type":21,"tag":209,"props":48615,"children":48616},{"style":360},[48617],{"type":26,"value":42483},{"type":21,"tag":209,"props":48619,"children":48620},{"style":222},[48621],{"type":26,"value":48622},"())();\n",{"type":21,"tag":209,"props":48624,"children":48625},{"class":211,"line":325},[48626,48631,48635,48639,48643],{"type":21,"tag":209,"props":48627,"children":48628},{"style":222},[48629],{"type":26,"value":48630},"    }.",{"type":21,"tag":209,"props":48632,"children":48633},{"style":360},[48634],{"type":26,"value":20189},{"type":21,"tag":209,"props":48636,"children":48637},{"style":222},[48638],{"type":26,"value":368},{"type":21,"tag":209,"props":48640,"children":48641},{"style":263},[48642],{"type":26,"value":2508},{"type":21,"tag":209,"props":48644,"children":48645},{"style":222},[48646],{"type":26,"value":4212},{"type":21,"tag":209,"props":48648,"children":48649},{"class":211,"line":334},[48650],{"type":21,"tag":209,"props":48651,"children":48652},{"style":222},[48653],{"type":26,"value":4415},{"type":21,"tag":209,"props":48655,"children":48656},{"class":211,"line":343},[48657],{"type":21,"tag":209,"props":48658,"children":48659},{"emptyLinePlaceholder":248},[48660],{"type":26,"value":251},{"type":21,"tag":209,"props":48662,"children":48663},{"class":211,"line":351},[48664,48668,48672,48676,48680],{"type":21,"tag":209,"props":48665,"children":48666},{"style":222},[48667],{"type":26,"value":46942},{"type":21,"tag":209,"props":48669,"children":48670},{"style":360},[48671],{"type":26,"value":46847},{"type":21,"tag":209,"props":48673,"children":48674},{"style":216},[48675],{"type":26,"value":271},{"type":21,"tag":209,"props":48677,"children":48678},{"style":216},[48679],{"type":26,"value":4789},{"type":21,"tag":209,"props":48681,"children":48682},{"style":222},[48683],{"type":26,"value":2561},{"type":21,"tag":209,"props":48685,"children":48686},{"class":211,"line":444},[48687,48691,48695,48699,48703,48707,48711,48715],{"type":21,"tag":209,"props":48688,"children":48689},{"style":360},[48690],{"type":26,"value":48530},{"type":21,"tag":209,"props":48692,"children":48693},{"style":222},[48694],{"type":26,"value":368},{"type":21,"tag":209,"props":48696,"children":48697},{"style":233},[48698],{"type":26,"value":48539},{"type":21,"tag":209,"props":48700,"children":48701},{"style":222},[48702],{"type":26,"value":2699},{"type":21,"tag":209,"props":48704,"children":48705},{"style":360},[48706],{"type":26,"value":499},{"type":21,"tag":209,"props":48708,"children":48709},{"style":222},[48710],{"type":26,"value":368},{"type":21,"tag":209,"props":48712,"children":48713},{"style":233},[48714],{"type":26,"value":48557},{"type":21,"tag":209,"props":48716,"children":48717},{"style":222},[48718],{"type":26,"value":2608},{"type":21,"tag":209,"props":48720,"children":48721},{"class":211,"line":454},[48722],{"type":21,"tag":209,"props":48723,"children":48724},{"style":222},[48725],{"type":26,"value":4415},{"type":21,"tag":209,"props":48727,"children":48728},{"class":211,"line":463},[48729],{"type":21,"tag":209,"props":48730,"children":48731},{"emptyLinePlaceholder":248},[48732],{"type":26,"value":251},{"type":21,"tag":209,"props":48734,"children":48735},{"class":211,"line":472},[48736],{"type":21,"tag":209,"props":48737,"children":48738},{"style":448},[48739],{"type":26,"value":46904},{"type":21,"tag":209,"props":48741,"children":48742},{"class":211,"line":480},[48743],{"type":21,"tag":209,"props":48744,"children":48745},{"emptyLinePlaceholder":248},[48746],{"type":26,"value":251},{"type":21,"tag":209,"props":48748,"children":48749},{"class":211,"line":489},[48750,48754,48758,48762,48766,48770,48774,48778],{"type":21,"tag":209,"props":48751,"children":48752},{"style":263},[48753],{"type":26,"value":46830},{"type":21,"tag":209,"props":48755,"children":48756},{"style":222},[48757],{"type":26,"value":378},{"type":21,"tag":209,"props":48759,"children":48760},{"style":263},[48761],{"type":26,"value":32662},{"type":21,"tag":209,"props":48763,"children":48764},{"style":222},[48765],{"type":26,"value":378},{"type":21,"tag":209,"props":48767,"children":48768},{"style":360},[48769],{"type":26,"value":46847},{"type":21,"tag":209,"props":48771,"children":48772},{"style":216},[48773],{"type":26,"value":271},{"type":21,"tag":209,"props":48775,"children":48776},{"style":216},[48777],{"type":26,"value":4789},{"type":21,"tag":209,"props":48779,"children":48780},{"style":222},[48781],{"type":26,"value":2561},{"type":21,"tag":209,"props":48783,"children":48784},{"class":211,"line":847},[48785,48789,48793,48797,48801],{"type":21,"tag":209,"props":48786,"children":48787},{"style":263},[48788],{"type":26,"value":46760},{"type":21,"tag":209,"props":48790,"children":48791},{"style":222},[48792],{"type":26,"value":46765},{"type":21,"tag":209,"props":48794,"children":48795},{"style":216},[48796],{"type":26,"value":1432},{"type":21,"tag":209,"props":48798,"children":48799},{"style":263},[48800],{"type":26,"value":14819},{"type":21,"tag":209,"props":48802,"children":48803},{"style":222},[48804],{"type":26,"value":241},{"type":21,"tag":209,"props":48806,"children":48807},{"class":211,"line":860},[48808,48812,48816,48820,48824,48828],{"type":21,"tag":209,"props":48809,"children":48810},{"style":263},[48811],{"type":26,"value":46760},{"type":21,"tag":209,"props":48813,"children":48814},{"style":222},[48815],{"type":26,"value":48604},{"type":21,"tag":209,"props":48817,"children":48818},{"style":216},[48819],{"type":26,"value":1432},{"type":21,"tag":209,"props":48821,"children":48822},{"style":222},[48823],{"type":26,"value":48613},{"type":21,"tag":209,"props":48825,"children":48826},{"style":360},[48827],{"type":26,"value":42483},{"type":21,"tag":209,"props":48829,"children":48830},{"style":222},[48831],{"type":26,"value":48622},{"type":21,"tag":209,"props":48833,"children":48834},{"class":211,"line":877},[48835],{"type":21,"tag":209,"props":48836,"children":48837},{"style":222},[48838],{"type":26,"value":4415},{"type":21,"tag":51,"props":48840,"children":48842},{"id":48841},"content-and-styling",[48843],{"type":26,"value":48844},"Content and Styling",{"type":21,"tag":22,"props":48846,"children":48847},{},[48848,48850,48856,48858,48864],{"type":26,"value":48849},"There are some assumptions built in to the object - namely, that we want a div with the class ",{"type":21,"tag":63,"props":48851,"children":48853},{"className":48852},[],[48854],{"type":26,"value":48855},"map-info-window",{"type":26,"value":48857}," feel free to change this however you please. There's one other element addressed by class name, ",{"type":21,"tag":63,"props":48859,"children":48861},{"className":48860},[],[48862],{"type":26,"value":48863},"map-info-close",{"type":26,"value":48865}," this is our close button, obviously.",{"type":21,"tag":22,"props":48867,"children":48868},{},[48869],{"type":26,"value":48870},"The expected markup for our info window looks something like:",{"type":21,"tag":200,"props":48872,"children":48874},{"className":22953,"code":48873,"language":22955,"meta":8,"style":8},"\u003Cdiv class=\"map-info-window\">\n    \u003Cdiv class=\"map-info-close\">x\u003C/div>\n    \u003C!-- The rest of your content -->\n\u003C/div>\n",[48875],{"type":21,"tag":63,"props":48876,"children":48877},{"__ignoreMap":8},[48878,48907,48944,48952],{"type":21,"tag":209,"props":48879,"children":48880},{"class":211,"line":212},[48881,48885,48889,48894,48898,48903],{"type":21,"tag":209,"props":48882,"children":48883},{"style":222},[48884],{"type":26,"value":1985},{"type":21,"tag":209,"props":48886,"children":48887},{"style":1988},[48888],{"type":26,"value":2009},{"type":21,"tag":209,"props":48890,"children":48891},{"style":360},[48892],{"type":26,"value":48893}," class",{"type":21,"tag":209,"props":48895,"children":48896},{"style":222},[48897],{"type":26,"value":1432},{"type":21,"tag":209,"props":48899,"children":48900},{"style":233},[48901],{"type":26,"value":48902},"\"map-info-window\"",{"type":21,"tag":209,"props":48904,"children":48905},{"style":222},[48906],{"type":26,"value":1996},{"type":21,"tag":209,"props":48908,"children":48909},{"class":211,"line":244},[48910,48914,48918,48922,48926,48931,48936,48940],{"type":21,"tag":209,"props":48911,"children":48912},{"style":222},[48913],{"type":26,"value":2004},{"type":21,"tag":209,"props":48915,"children":48916},{"style":1988},[48917],{"type":26,"value":2009},{"type":21,"tag":209,"props":48919,"children":48920},{"style":360},[48921],{"type":26,"value":48893},{"type":21,"tag":209,"props":48923,"children":48924},{"style":222},[48925],{"type":26,"value":1432},{"type":21,"tag":209,"props":48927,"children":48928},{"style":233},[48929],{"type":26,"value":48930},"\"map-info-close\"",{"type":21,"tag":209,"props":48932,"children":48933},{"style":222},[48934],{"type":26,"value":48935},">x\u003C/",{"type":21,"tag":209,"props":48937,"children":48938},{"style":1988},[48939],{"type":26,"value":2009},{"type":21,"tag":209,"props":48941,"children":48942},{"style":222},[48943],{"type":26,"value":1996},{"type":21,"tag":209,"props":48945,"children":48946},{"class":211,"line":254},[48947],{"type":21,"tag":209,"props":48948,"children":48949},{"style":448},[48950],{"type":26,"value":48951},"    \u003C!-- The rest of your content -->\n",{"type":21,"tag":209,"props":48953,"children":48954},{"class":211,"line":279},[48955,48959,48963],{"type":21,"tag":209,"props":48956,"children":48957},{"style":222},[48958],{"type":26,"value":2024},{"type":21,"tag":209,"props":48960,"children":48961},{"style":1988},[48962],{"type":26,"value":2009},{"type":21,"tag":209,"props":48964,"children":48965},{"style":222},[48966],{"type":26,"value":1996},{"type":21,"tag":22,"props":48968,"children":48969},{},[48970],{"type":26,"value":48971},"You can insert arbitrary html content into this div (via setContent), just as you would with a standard infoWindow. This content can then be styled as per usual.",{"type":21,"tag":22,"props":48973,"children":48974},{},[48975],{"type":26,"value":48976},"The absolute minimum required css looks like:",{"type":21,"tag":200,"props":48978,"children":48980},{"className":45051,"code":48979,"language":45053,"meta":8,"style":8},".map-info-window{\n    overflow:hidden;\n    position:absolute;\n}\n\n.map-info-window .map-info-close{\n    float:right;\n    cursor:pointer;\n}\n",[48981],{"type":21,"tag":63,"props":48982,"children":48983},{"__ignoreMap":8},[48984,48996,49017,49038,49045,49052,49068,49089,49110],{"type":21,"tag":209,"props":48985,"children":48986},{"class":211,"line":212},[48987,48992],{"type":21,"tag":209,"props":48988,"children":48989},{"style":360},[48990],{"type":26,"value":48991},".map-info-window",{"type":21,"tag":209,"props":48993,"children":48994},{"style":222},[48995],{"type":26,"value":29353},{"type":21,"tag":209,"props":48997,"children":48998},{"class":211,"line":244},[48999,49004,49008,49013],{"type":21,"tag":209,"props":49000,"children":49001},{"style":263},[49002],{"type":26,"value":49003},"    overflow",{"type":21,"tag":209,"props":49005,"children":49006},{"style":222},[49007],{"type":26,"value":191},{"type":21,"tag":209,"props":49009,"children":49010},{"style":263},[49011],{"type":26,"value":49012},"hidden",{"type":21,"tag":209,"props":49014,"children":49015},{"style":222},[49016],{"type":26,"value":241},{"type":21,"tag":209,"props":49018,"children":49019},{"class":211,"line":254},[49020,49025,49029,49034],{"type":21,"tag":209,"props":49021,"children":49022},{"style":263},[49023],{"type":26,"value":49024},"    position",{"type":21,"tag":209,"props":49026,"children":49027},{"style":222},[49028],{"type":26,"value":191},{"type":21,"tag":209,"props":49030,"children":49031},{"style":263},[49032],{"type":26,"value":49033},"absolute",{"type":21,"tag":209,"props":49035,"children":49036},{"style":222},[49037],{"type":26,"value":241},{"type":21,"tag":209,"props":49039,"children":49040},{"class":211,"line":279},[49041],{"type":21,"tag":209,"props":49042,"children":49043},{"style":222},[49044],{"type":26,"value":4415},{"type":21,"tag":209,"props":49046,"children":49047},{"class":211,"line":288},[49048],{"type":21,"tag":209,"props":49049,"children":49050},{"emptyLinePlaceholder":248},[49051],{"type":26,"value":251},{"type":21,"tag":209,"props":49053,"children":49054},{"class":211,"line":307},[49055,49059,49064],{"type":21,"tag":209,"props":49056,"children":49057},{"style":360},[49058],{"type":26,"value":48991},{"type":21,"tag":209,"props":49060,"children":49061},{"style":360},[49062],{"type":26,"value":49063}," .map-info-close",{"type":21,"tag":209,"props":49065,"children":49066},{"style":222},[49067],{"type":26,"value":29353},{"type":21,"tag":209,"props":49069,"children":49070},{"class":211,"line":325},[49071,49076,49080,49085],{"type":21,"tag":209,"props":49072,"children":49073},{"style":263},[49074],{"type":26,"value":49075},"    float",{"type":21,"tag":209,"props":49077,"children":49078},{"style":222},[49079],{"type":26,"value":191},{"type":21,"tag":209,"props":49081,"children":49082},{"style":263},[49083],{"type":26,"value":49084},"right",{"type":21,"tag":209,"props":49086,"children":49087},{"style":222},[49088],{"type":26,"value":241},{"type":21,"tag":209,"props":49090,"children":49091},{"class":211,"line":334},[49092,49097,49101,49106],{"type":21,"tag":209,"props":49093,"children":49094},{"style":263},[49095],{"type":26,"value":49096},"    cursor",{"type":21,"tag":209,"props":49098,"children":49099},{"style":222},[49100],{"type":26,"value":191},{"type":21,"tag":209,"props":49102,"children":49103},{"style":263},[49104],{"type":26,"value":49105},"pointer",{"type":21,"tag":209,"props":49107,"children":49108},{"style":222},[49109],{"type":26,"value":241},{"type":21,"tag":209,"props":49111,"children":49112},{"class":211,"line":343},[49113],{"type":21,"tag":209,"props":49114,"children":49115},{"style":222},[49116],{"type":26,"value":4415},{"type":21,"tag":22,"props":49118,"children":49119},{},[49120],{"type":26,"value":49121},"In order to get your info window to look something like the top-image example, you'll want a little more than the barebones:",{"type":21,"tag":200,"props":49123,"children":49125},{"className":45051,"code":49124,"language":45053,"meta":8,"style":8},".map-info-window{\n    background:#333;\n    border-radius:4px;\n    box-shadow:8px 8px 16px #222;\n    color:#fff;\n    max-width:200px;\n    max-height:300px;\n    text-align:center;\n    padding:5px 20px 10px;\n    overflow:hidden;\n    position:absolute;\n    text-transform:uppercase;\n}\n.map-info-window .map-info-close{\n    float:right;\n    cursor:pointer;\n    margin-right:-5px;\n    margin-left:5px;\n}\n\n.map-info-window h5{\n    font-weight:bold;\n}\n.map-info-window p{\n    color:#939393;\n}\n",[49126],{"type":21,"tag":63,"props":49127,"children":49128},{"__ignoreMap":8},[49129,49140,49161,49187,49233,49254,49278,49303,49324,49365,49384,49403,49424,49431,49446,49465,49484,49509,49533,49540,49547,49563,49584,49591,49607,49627],{"type":21,"tag":209,"props":49130,"children":49131},{"class":211,"line":212},[49132,49136],{"type":21,"tag":209,"props":49133,"children":49134},{"style":360},[49135],{"type":26,"value":48991},{"type":21,"tag":209,"props":49137,"children":49138},{"style":222},[49139],{"type":26,"value":29353},{"type":21,"tag":209,"props":49141,"children":49142},{"class":211,"line":244},[49143,49148,49152,49157],{"type":21,"tag":209,"props":49144,"children":49145},{"style":263},[49146],{"type":26,"value":49147},"    background",{"type":21,"tag":209,"props":49149,"children":49150},{"style":222},[49151],{"type":26,"value":191},{"type":21,"tag":209,"props":49153,"children":49154},{"style":263},[49155],{"type":26,"value":49156},"#333",{"type":21,"tag":209,"props":49158,"children":49159},{"style":222},[49160],{"type":26,"value":241},{"type":21,"tag":209,"props":49162,"children":49163},{"class":211,"line":254},[49164,49169,49173,49178,49183],{"type":21,"tag":209,"props":49165,"children":49166},{"style":263},[49167],{"type":26,"value":49168},"    border-radius",{"type":21,"tag":209,"props":49170,"children":49171},{"style":222},[49172],{"type":26,"value":191},{"type":21,"tag":209,"props":49174,"children":49175},{"style":263},[49176],{"type":26,"value":49177},"4",{"type":21,"tag":209,"props":49179,"children":49180},{"style":216},[49181],{"type":26,"value":49182},"px",{"type":21,"tag":209,"props":49184,"children":49185},{"style":222},[49186],{"type":26,"value":241},{"type":21,"tag":209,"props":49188,"children":49189},{"class":211,"line":279},[49190,49195,49199,49204,49208,49212,49216,49220,49224,49229],{"type":21,"tag":209,"props":49191,"children":49192},{"style":263},[49193],{"type":26,"value":49194},"    box-shadow",{"type":21,"tag":209,"props":49196,"children":49197},{"style":222},[49198],{"type":26,"value":191},{"type":21,"tag":209,"props":49200,"children":49201},{"style":263},[49202],{"type":26,"value":49203},"8",{"type":21,"tag":209,"props":49205,"children":49206},{"style":216},[49207],{"type":26,"value":49182},{"type":21,"tag":209,"props":49209,"children":49210},{"style":263},[49211],{"type":26,"value":32390},{"type":21,"tag":209,"props":49213,"children":49214},{"style":216},[49215],{"type":26,"value":49182},{"type":21,"tag":209,"props":49217,"children":49218},{"style":263},[49219],{"type":26,"value":32427},{"type":21,"tag":209,"props":49221,"children":49222},{"style":216},[49223],{"type":26,"value":49182},{"type":21,"tag":209,"props":49225,"children":49226},{"style":263},[49227],{"type":26,"value":49228}," #222",{"type":21,"tag":209,"props":49230,"children":49231},{"style":222},[49232],{"type":26,"value":241},{"type":21,"tag":209,"props":49234,"children":49235},{"class":211,"line":288},[49236,49241,49245,49250],{"type":21,"tag":209,"props":49237,"children":49238},{"style":263},[49239],{"type":26,"value":49240},"    color",{"type":21,"tag":209,"props":49242,"children":49243},{"style":222},[49244],{"type":26,"value":191},{"type":21,"tag":209,"props":49246,"children":49247},{"style":263},[49248],{"type":26,"value":49249},"#fff",{"type":21,"tag":209,"props":49251,"children":49252},{"style":222},[49253],{"type":26,"value":241},{"type":21,"tag":209,"props":49255,"children":49256},{"class":211,"line":307},[49257,49262,49266,49270,49274],{"type":21,"tag":209,"props":49258,"children":49259},{"style":263},[49260],{"type":26,"value":49261},"    max-width",{"type":21,"tag":209,"props":49263,"children":49264},{"style":222},[49265],{"type":26,"value":191},{"type":21,"tag":209,"props":49267,"children":49268},{"style":263},[49269],{"type":26,"value":10921},{"type":21,"tag":209,"props":49271,"children":49272},{"style":216},[49273],{"type":26,"value":49182},{"type":21,"tag":209,"props":49275,"children":49276},{"style":222},[49277],{"type":26,"value":241},{"type":21,"tag":209,"props":49279,"children":49280},{"class":211,"line":325},[49281,49286,49290,49295,49299],{"type":21,"tag":209,"props":49282,"children":49283},{"style":263},[49284],{"type":26,"value":49285},"    max-height",{"type":21,"tag":209,"props":49287,"children":49288},{"style":222},[49289],{"type":26,"value":191},{"type":21,"tag":209,"props":49291,"children":49292},{"style":263},[49293],{"type":26,"value":49294},"300",{"type":21,"tag":209,"props":49296,"children":49297},{"style":216},[49298],{"type":26,"value":49182},{"type":21,"tag":209,"props":49300,"children":49301},{"style":222},[49302],{"type":26,"value":241},{"type":21,"tag":209,"props":49304,"children":49305},{"class":211,"line":334},[49306,49311,49315,49320],{"type":21,"tag":209,"props":49307,"children":49308},{"style":263},[49309],{"type":26,"value":49310},"    text-align",{"type":21,"tag":209,"props":49312,"children":49313},{"style":222},[49314],{"type":26,"value":191},{"type":21,"tag":209,"props":49316,"children":49317},{"style":263},[49318],{"type":26,"value":49319},"center",{"type":21,"tag":209,"props":49321,"children":49322},{"style":222},[49323],{"type":26,"value":241},{"type":21,"tag":209,"props":49325,"children":49326},{"class":211,"line":343},[49327,49332,49336,49341,49345,49349,49353,49357,49361],{"type":21,"tag":209,"props":49328,"children":49329},{"style":263},[49330],{"type":26,"value":49331},"    padding",{"type":21,"tag":209,"props":49333,"children":49334},{"style":222},[49335],{"type":26,"value":191},{"type":21,"tag":209,"props":49337,"children":49338},{"style":263},[49339],{"type":26,"value":49340},"5",{"type":21,"tag":209,"props":49342,"children":49343},{"style":216},[49344],{"type":26,"value":49182},{"type":21,"tag":209,"props":49346,"children":49347},{"style":263},[49348],{"type":26,"value":7984},{"type":21,"tag":209,"props":49350,"children":49351},{"style":216},[49352],{"type":26,"value":49182},{"type":21,"tag":209,"props":49354,"children":49355},{"style":263},[49356],{"type":26,"value":47713},{"type":21,"tag":209,"props":49358,"children":49359},{"style":216},[49360],{"type":26,"value":49182},{"type":21,"tag":209,"props":49362,"children":49363},{"style":222},[49364],{"type":26,"value":241},{"type":21,"tag":209,"props":49366,"children":49367},{"class":211,"line":351},[49368,49372,49376,49380],{"type":21,"tag":209,"props":49369,"children":49370},{"style":263},[49371],{"type":26,"value":49003},{"type":21,"tag":209,"props":49373,"children":49374},{"style":222},[49375],{"type":26,"value":191},{"type":21,"tag":209,"props":49377,"children":49378},{"style":263},[49379],{"type":26,"value":49012},{"type":21,"tag":209,"props":49381,"children":49382},{"style":222},[49383],{"type":26,"value":241},{"type":21,"tag":209,"props":49385,"children":49386},{"class":211,"line":444},[49387,49391,49395,49399],{"type":21,"tag":209,"props":49388,"children":49389},{"style":263},[49390],{"type":26,"value":49024},{"type":21,"tag":209,"props":49392,"children":49393},{"style":222},[49394],{"type":26,"value":191},{"type":21,"tag":209,"props":49396,"children":49397},{"style":263},[49398],{"type":26,"value":49033},{"type":21,"tag":209,"props":49400,"children":49401},{"style":222},[49402],{"type":26,"value":241},{"type":21,"tag":209,"props":49404,"children":49405},{"class":211,"line":454},[49406,49411,49415,49420],{"type":21,"tag":209,"props":49407,"children":49408},{"style":263},[49409],{"type":26,"value":49410},"    text-transform",{"type":21,"tag":209,"props":49412,"children":49413},{"style":222},[49414],{"type":26,"value":191},{"type":21,"tag":209,"props":49416,"children":49417},{"style":263},[49418],{"type":26,"value":49419},"uppercase",{"type":21,"tag":209,"props":49421,"children":49422},{"style":222},[49423],{"type":26,"value":241},{"type":21,"tag":209,"props":49425,"children":49426},{"class":211,"line":463},[49427],{"type":21,"tag":209,"props":49428,"children":49429},{"style":222},[49430],{"type":26,"value":4415},{"type":21,"tag":209,"props":49432,"children":49433},{"class":211,"line":472},[49434,49438,49442],{"type":21,"tag":209,"props":49435,"children":49436},{"style":360},[49437],{"type":26,"value":48991},{"type":21,"tag":209,"props":49439,"children":49440},{"style":360},[49441],{"type":26,"value":49063},{"type":21,"tag":209,"props":49443,"children":49444},{"style":222},[49445],{"type":26,"value":29353},{"type":21,"tag":209,"props":49447,"children":49448},{"class":211,"line":480},[49449,49453,49457,49461],{"type":21,"tag":209,"props":49450,"children":49451},{"style":263},[49452],{"type":26,"value":49075},{"type":21,"tag":209,"props":49454,"children":49455},{"style":222},[49456],{"type":26,"value":191},{"type":21,"tag":209,"props":49458,"children":49459},{"style":263},[49460],{"type":26,"value":49084},{"type":21,"tag":209,"props":49462,"children":49463},{"style":222},[49464],{"type":26,"value":241},{"type":21,"tag":209,"props":49466,"children":49467},{"class":211,"line":489},[49468,49472,49476,49480],{"type":21,"tag":209,"props":49469,"children":49470},{"style":263},[49471],{"type":26,"value":49096},{"type":21,"tag":209,"props":49473,"children":49474},{"style":222},[49475],{"type":26,"value":191},{"type":21,"tag":209,"props":49477,"children":49478},{"style":263},[49479],{"type":26,"value":49105},{"type":21,"tag":209,"props":49481,"children":49482},{"style":222},[49483],{"type":26,"value":241},{"type":21,"tag":209,"props":49485,"children":49486},{"class":211,"line":847},[49487,49492,49496,49501,49505],{"type":21,"tag":209,"props":49488,"children":49489},{"style":263},[49490],{"type":26,"value":49491},"    margin-right",{"type":21,"tag":209,"props":49493,"children":49494},{"style":222},[49495],{"type":26,"value":191},{"type":21,"tag":209,"props":49497,"children":49498},{"style":263},[49499],{"type":26,"value":49500},"-5",{"type":21,"tag":209,"props":49502,"children":49503},{"style":216},[49504],{"type":26,"value":49182},{"type":21,"tag":209,"props":49506,"children":49507},{"style":222},[49508],{"type":26,"value":241},{"type":21,"tag":209,"props":49510,"children":49511},{"class":211,"line":860},[49512,49517,49521,49525,49529],{"type":21,"tag":209,"props":49513,"children":49514},{"style":263},[49515],{"type":26,"value":49516},"    margin-left",{"type":21,"tag":209,"props":49518,"children":49519},{"style":222},[49520],{"type":26,"value":191},{"type":21,"tag":209,"props":49522,"children":49523},{"style":263},[49524],{"type":26,"value":49340},{"type":21,"tag":209,"props":49526,"children":49527},{"style":216},[49528],{"type":26,"value":49182},{"type":21,"tag":209,"props":49530,"children":49531},{"style":222},[49532],{"type":26,"value":241},{"type":21,"tag":209,"props":49534,"children":49535},{"class":211,"line":877},[49536],{"type":21,"tag":209,"props":49537,"children":49538},{"style":222},[49539],{"type":26,"value":4415},{"type":21,"tag":209,"props":49541,"children":49542},{"class":211,"line":889},[49543],{"type":21,"tag":209,"props":49544,"children":49545},{"emptyLinePlaceholder":248},[49546],{"type":26,"value":251},{"type":21,"tag":209,"props":49548,"children":49549},{"class":211,"line":902},[49550,49554,49559],{"type":21,"tag":209,"props":49551,"children":49552},{"style":360},[49553],{"type":26,"value":48991},{"type":21,"tag":209,"props":49555,"children":49556},{"style":1988},[49557],{"type":26,"value":49558}," h5",{"type":21,"tag":209,"props":49560,"children":49561},{"style":222},[49562],{"type":26,"value":29353},{"type":21,"tag":209,"props":49564,"children":49565},{"class":211,"line":914},[49566,49571,49575,49580],{"type":21,"tag":209,"props":49567,"children":49568},{"style":263},[49569],{"type":26,"value":49570},"    font-weight",{"type":21,"tag":209,"props":49572,"children":49573},{"style":222},[49574],{"type":26,"value":191},{"type":21,"tag":209,"props":49576,"children":49577},{"style":263},[49578],{"type":26,"value":49579},"bold",{"type":21,"tag":209,"props":49581,"children":49582},{"style":222},[49583],{"type":26,"value":241},{"type":21,"tag":209,"props":49585,"children":49586},{"class":211,"line":922},[49587],{"type":21,"tag":209,"props":49588,"children":49589},{"style":222},[49590],{"type":26,"value":4415},{"type":21,"tag":209,"props":49592,"children":49593},{"class":211,"line":2312},[49594,49598,49603],{"type":21,"tag":209,"props":49595,"children":49596},{"style":360},[49597],{"type":26,"value":48991},{"type":21,"tag":209,"props":49599,"children":49600},{"style":1988},[49601],{"type":26,"value":49602}," p",{"type":21,"tag":209,"props":49604,"children":49605},{"style":222},[49606],{"type":26,"value":29353},{"type":21,"tag":209,"props":49608,"children":49609},{"class":211,"line":2321},[49610,49614,49618,49623],{"type":21,"tag":209,"props":49611,"children":49612},{"style":263},[49613],{"type":26,"value":49240},{"type":21,"tag":209,"props":49615,"children":49616},{"style":222},[49617],{"type":26,"value":191},{"type":21,"tag":209,"props":49619,"children":49620},{"style":263},[49621],{"type":26,"value":49622},"#939393",{"type":21,"tag":209,"props":49624,"children":49625},{"style":222},[49626],{"type":26,"value":241},{"type":21,"tag":209,"props":49628,"children":49629},{"class":211,"line":2372},[49630],{"type":21,"tag":209,"props":49631,"children":49632},{"style":222},[49633],{"type":26,"value":4415},{"type":21,"tag":22,"props":49635,"children":49636},{},[49637],{"type":26,"value":49638},"Of course, the info window itself and all content can be styled however you please.",{"type":21,"tag":51,"props":49640,"children":49642},{"id":49641},"marker-prerequisites",[49643],{"type":26,"value":49644},"Marker Prerequisites",{"type":21,"tag":22,"props":49646,"children":49647},{},[49648,49650,49656],{"type":26,"value":49649},"There are some prerequisites to your marker setup, however - namely, you need to specify an icon, with the ",{"type":21,"tag":63,"props":49651,"children":49653},{"className":49652},[],[49654],{"type":26,"value":49655},"scaledSize",{"type":26,"value":49657}," set appropriately. You can still use the generic google maps icon image, if so desired:",{"type":21,"tag":200,"props":49659,"children":49661},{"className":16138,"code":49660,"language":16140,"meta":8,"style":8},"var marker = new google.maps.Marker({\n    icon:{\n        url:http://maps.google.com/mapfiles/ms/icons/red-dot.png,\n        size:new google.maps.Size(32, 32),\n        scaledSize:new google.maps.Size(32, 32)\n    };\n});\n",[49662],{"type":21,"tag":63,"props":49663,"children":49664},{"__ignoreMap":8},[49665,49698,49706,49719,49761,49801,49808],{"type":21,"tag":209,"props":49666,"children":49667},{"class":211,"line":212},[49668,49672,49677,49681,49685,49689,49694],{"type":21,"tag":209,"props":49669,"children":49670},{"style":216},[49671],{"type":26,"value":3909},{"type":21,"tag":209,"props":49673,"children":49674},{"style":222},[49675],{"type":26,"value":49676}," marker ",{"type":21,"tag":209,"props":49678,"children":49679},{"style":216},[49680],{"type":26,"value":1432},{"type":21,"tag":209,"props":49682,"children":49683},{"style":216},[49684],{"type":26,"value":6371},{"type":21,"tag":209,"props":49686,"children":49687},{"style":222},[49688],{"type":26,"value":43638},{"type":21,"tag":209,"props":49690,"children":49691},{"style":360},[49692],{"type":26,"value":49693},"Marker",{"type":21,"tag":209,"props":49695,"children":49696},{"style":222},[49697],{"type":26,"value":7767},{"type":21,"tag":209,"props":49699,"children":49700},{"class":211,"line":244},[49701],{"type":21,"tag":209,"props":49702,"children":49703},{"style":222},[49704],{"type":26,"value":49705},"    icon:{\n",{"type":21,"tag":209,"props":49707,"children":49708},{"class":211,"line":254},[49709,49714],{"type":21,"tag":209,"props":49710,"children":49711},{"style":222},[49712],{"type":26,"value":49713},"        url:http:",{"type":21,"tag":209,"props":49715,"children":49716},{"style":448},[49717],{"type":26,"value":49718},"//maps.google.com/mapfiles/ms/icons/red-dot.png,\n",{"type":21,"tag":209,"props":49720,"children":49721},{"class":211,"line":279},[49722,49727,49731,49735,49740,49744,49749,49753,49757],{"type":21,"tag":209,"props":49723,"children":49724},{"style":222},[49725],{"type":26,"value":49726},"        size:",{"type":21,"tag":209,"props":49728,"children":49729},{"style":216},[49730],{"type":26,"value":32573},{"type":21,"tag":209,"props":49732,"children":49733},{"style":222},[49734],{"type":26,"value":43638},{"type":21,"tag":209,"props":49736,"children":49737},{"style":360},[49738],{"type":26,"value":49739},"Size",{"type":21,"tag":209,"props":49741,"children":49742},{"style":222},[49743],{"type":26,"value":368},{"type":21,"tag":209,"props":49745,"children":49746},{"style":263},[49747],{"type":26,"value":49748},"32",{"type":21,"tag":209,"props":49750,"children":49751},{"style":222},[49752],{"type":26,"value":408},{"type":21,"tag":209,"props":49754,"children":49755},{"style":263},[49756],{"type":26,"value":49748},{"type":21,"tag":209,"props":49758,"children":49759},{"style":222},[49760],{"type":26,"value":5404},{"type":21,"tag":209,"props":49762,"children":49763},{"class":211,"line":288},[49764,49769,49773,49777,49781,49785,49789,49793,49797],{"type":21,"tag":209,"props":49765,"children":49766},{"style":222},[49767],{"type":26,"value":49768},"        scaledSize:",{"type":21,"tag":209,"props":49770,"children":49771},{"style":216},[49772],{"type":26,"value":32573},{"type":21,"tag":209,"props":49774,"children":49775},{"style":222},[49776],{"type":26,"value":43638},{"type":21,"tag":209,"props":49778,"children":49779},{"style":360},[49780],{"type":26,"value":49739},{"type":21,"tag":209,"props":49782,"children":49783},{"style":222},[49784],{"type":26,"value":368},{"type":21,"tag":209,"props":49786,"children":49787},{"style":263},[49788],{"type":26,"value":49748},{"type":21,"tag":209,"props":49790,"children":49791},{"style":222},[49792],{"type":26,"value":408},{"type":21,"tag":209,"props":49794,"children":49795},{"style":263},[49796],{"type":26,"value":49748},{"type":21,"tag":209,"props":49798,"children":49799},{"style":222},[49800],{"type":26,"value":8924},{"type":21,"tag":209,"props":49802,"children":49803},{"class":211,"line":307},[49804],{"type":21,"tag":209,"props":49805,"children":49806},{"style":222},[49807],{"type":26,"value":13439},{"type":21,"tag":209,"props":49809,"children":49810},{"class":211,"line":325},[49811],{"type":21,"tag":209,"props":49812,"children":49813},{"style":222},[49814],{"type":26,"value":469},{"type":21,"tag":51,"props":49816,"children":49818},{"id":49817},"calling-the-custom-window",[49819],{"type":26,"value":49820},"Calling the Custom Window",{"type":21,"tag":22,"props":49822,"children":49823},{},[49824],{"type":26,"value":49825},"This works exactly the same as calling the standard info window. Assuming our infoWindow is living in GMaps as this.infoWindow, and we're inside the GMaps 'class':",{"type":21,"tag":200,"props":49827,"children":49829},{"className":16138,"code":49828,"language":16140,"meta":8,"style":8},"google.maps.event.addListener(marker, 'click', function(){\n    this.infoWindow.setContent('your html content');\n    this.infoWindow.open(map, marker);\n}.bind(this));\n",[49830],{"type":21,"tag":63,"props":49831,"children":49832},{"__ignoreMap":8},[49833,49867,49896,49916],{"type":21,"tag":209,"props":49834,"children":49835},{"class":211,"line":212},[49836,49841,49846,49851,49855,49859,49863],{"type":21,"tag":209,"props":49837,"children":49838},{"style":222},[49839],{"type":26,"value":49840},"google.maps.event.",{"type":21,"tag":209,"props":49842,"children":49843},{"style":360},[49844],{"type":26,"value":49845},"addListener",{"type":21,"tag":209,"props":49847,"children":49848},{"style":222},[49849],{"type":26,"value":49850},"(marker, ",{"type":21,"tag":209,"props":49852,"children":49853},{"style":233},[49854],{"type":26,"value":14925},{"type":21,"tag":209,"props":49856,"children":49857},{"style":222},[49858],{"type":26,"value":408},{"type":21,"tag":209,"props":49860,"children":49861},{"style":216},[49862],{"type":26,"value":4622},{"type":21,"tag":209,"props":49864,"children":49865},{"style":222},[49866],{"type":26,"value":2561},{"type":21,"tag":209,"props":49868,"children":49869},{"class":211,"line":244},[49870,49874,49879,49883,49887,49892],{"type":21,"tag":209,"props":49871,"children":49872},{"style":263},[49873],{"type":26,"value":46760},{"type":21,"tag":209,"props":49875,"children":49876},{"style":222},[49877],{"type":26,"value":49878},".infoWindow.",{"type":21,"tag":209,"props":49880,"children":49881},{"style":360},[49882],{"type":26,"value":48092},{"type":21,"tag":209,"props":49884,"children":49885},{"style":222},[49886],{"type":26,"value":368},{"type":21,"tag":209,"props":49888,"children":49889},{"style":233},[49890],{"type":26,"value":49891},"'your html content'",{"type":21,"tag":209,"props":49893,"children":49894},{"style":222},[49895],{"type":26,"value":2608},{"type":21,"tag":209,"props":49897,"children":49898},{"class":211,"line":254},[49899,49903,49907,49911],{"type":21,"tag":209,"props":49900,"children":49901},{"style":263},[49902],{"type":26,"value":46760},{"type":21,"tag":209,"props":49904,"children":49905},{"style":222},[49906],{"type":26,"value":49878},{"type":21,"tag":209,"props":49908,"children":49909},{"style":360},[49910],{"type":26,"value":20680},{"type":21,"tag":209,"props":49912,"children":49913},{"style":222},[49914],{"type":26,"value":49915},"(map, marker);\n",{"type":21,"tag":209,"props":49917,"children":49918},{"class":211,"line":279},[49919,49924,49928,49932,49936],{"type":21,"tag":209,"props":49920,"children":49921},{"style":222},[49922],{"type":26,"value":49923},"}.",{"type":21,"tag":209,"props":49925,"children":49926},{"style":360},[49927],{"type":26,"value":20189},{"type":21,"tag":209,"props":49929,"children":49930},{"style":222},[49931],{"type":26,"value":368},{"type":21,"tag":209,"props":49933,"children":49934},{"style":263},[49935],{"type":26,"value":2508},{"type":21,"tag":209,"props":49937,"children":49938},{"style":222},[49939],{"type":26,"value":4212},{"type":21,"tag":51,"props":49941,"children":49943},{"id":49942},"jquery-free",[49944],{"type":26,"value":49945},"jQuery Free",{"type":21,"tag":22,"props":49947,"children":49948},{},[49949],{"type":26,"value":49950},"This isn't a jQuery plugin, so if we want to do without jQuery, we certainly can:",{"type":21,"tag":200,"props":49952,"children":49954},{"className":16138,"code":49953,"language":16140,"meta":8,"style":8},"/**\n * Create a custom overlay for our window marker display, extending google.maps.OverlayView.\n * This is somewhat complicated by needing to async load the google.maps api first - thus, we\n * wrap CustomWindow into a closure, and when instantiating CustomNativeWindow, we first execute the closure\n * (to create our CustomNativeWindow function, now properly extending the newly loaded google.maps.OverlayView),\n * and then instantiate said function.\n * @type {Function}\n * @see _mapView.onRender\n */\n(function(){\n    var CustomWindow = function(){\n        this.container = document.createElement('div');\n        this.container.classList.add('map-info-window');\n        this.layer = null;\n        this.marker = null;\n        this.position = null;\n    };\n    /**\n     * Inherit from OverlayView\n     * @type {google.maps.OverlayView}\n     */\n    CustomWindow.prototype = new google.maps.OverlayView();\n    /**\n     * Called when this overlay is set to a map via this.setMap. Get the appropriate map pane\n     * to add the window to, append the container, bind to close element.\n     * @see CustomWindow.open\n     */\n    CustomWindow.prototype.onAdd = function(){\n        this.layer = this.getPanes().floatPane;\n        this.layer.appendChild(this.container);\n        this.container.getElementsByClassName('map-info-close')[0].addEventListener('click', function(){\n            // Close info window on click\n            this.close();\n        }.bind(this), false);\n    };\n    /**\n     * Called after onAdd, and every time the map is moved, zoomed, or anything else that\n     * would effect positions, to redraw this overlay.\n     */\n    CustomWindow.prototype.draw = function(){\n        var markerIcon = this.marker.getIcon(),\n            cBounds = this.container.getBoundingClientRect(),\n            cHeight = cBounds.height + markerIcon.scaledSize.height + 10,\n            cWidth = cBounds.width / 2;\n        this.position = this.getProjection().fromLatLngToDivPixel(this.marker.getPosition());\n        this.container.style.top = this.position.y - cHeight+'px';\n        this.container.style.left = this.position.x - cWidth+'px';\n    };\n    /**\n     * Called when this overlay has its map set to null.\n     * @see CustomWindow.close\n     */\n    CustomWindow.prototype.onRemove = function(){\n        this.layer.removeChild(this.container);\n    };\n    /**\n     * Sets the contents of this overlay.\n     * @param {string} html\n     */\n    CustomWindow.prototype.setContent = function(html){\n        this.container.innerHTML = html;\n    };\n    /**\n     * Sets the map and relevant marker for this overlay.\n     * @param {google.maps.Map} map\n     * @param {google.maps.Marker} marker\n     */\n    CustomWindow.prototype.open = function(map, marker){\n        this.marker = marker;\n        this.setMap(map);\n    };\n    /**\n     * Close this overlay by setting its map to null.\n     */\n    CustomWindow.prototype.close = function(){\n        this.setMap(null);\n    };\n    return CustomWindow;\n});\n",[49955],{"type":21,"tag":63,"props":49956,"children":49957},{"__ignoreMap":8},[49958,49965,49973,49981,49989,49997,50005,50020,50036,50043,50058,50081,50117,50147,50170,50193,50216,50223,50230,50237,50252,50259,50294,50301,50308,50315,50330,50337,50372,50404,50431,50493,50500,50519,50551,50558,50565,50572,50579,50586,50621,50652,50681,50717,50745,50800,50846,50891,50898,50905,50912,50927,50934,50969,50996,51003,51010,51017,51036,51043,51086,51107,51114,51121,51128,51147,51166,51173,51224,51243,51262,51269,51276,51283,51290,51325,51352,51359,51370],{"type":21,"tag":209,"props":49959,"children":49960},{"class":211,"line":212},[49961],{"type":21,"tag":209,"props":49962,"children":49963},{"style":448},[49964],{"type":26,"value":731},{"type":21,"tag":209,"props":49966,"children":49967},{"class":211,"line":244},[49968],{"type":21,"tag":209,"props":49969,"children":49970},{"style":448},[49971],{"type":26,"value":49972}," * Create a custom overlay for our window marker display, extending google.maps.OverlayView.\n",{"type":21,"tag":209,"props":49974,"children":49975},{"class":211,"line":254},[49976],{"type":21,"tag":209,"props":49977,"children":49978},{"style":448},[49979],{"type":26,"value":49980}," * This is somewhat complicated by needing to async load the google.maps api first - thus, we\n",{"type":21,"tag":209,"props":49982,"children":49983},{"class":211,"line":279},[49984],{"type":21,"tag":209,"props":49985,"children":49986},{"style":448},[49987],{"type":26,"value":49988}," * wrap CustomWindow into a closure, and when instantiating CustomNativeWindow, we first execute the closure\n",{"type":21,"tag":209,"props":49990,"children":49991},{"class":211,"line":288},[49992],{"type":21,"tag":209,"props":49993,"children":49994},{"style":448},[49995],{"type":26,"value":49996}," * (to create our CustomNativeWindow function, now properly extending the newly loaded google.maps.OverlayView),\n",{"type":21,"tag":209,"props":49998,"children":49999},{"class":211,"line":307},[50000],{"type":21,"tag":209,"props":50001,"children":50002},{"style":448},[50003],{"type":26,"value":50004}," * and then instantiate said function.\n",{"type":21,"tag":209,"props":50006,"children":50007},{"class":211,"line":325},[50008,50012,50016],{"type":21,"tag":209,"props":50009,"children":50010},{"style":448},[50011],{"type":26,"value":39750},{"type":21,"tag":209,"props":50013,"children":50014},{"style":216},[50015],{"type":26,"value":47062},{"type":21,"tag":209,"props":50017,"children":50018},{"style":360},[50019],{"type":26,"value":47067},{"type":21,"tag":209,"props":50021,"children":50022},{"class":211,"line":334},[50023,50027,50031],{"type":21,"tag":209,"props":50024,"children":50025},{"style":448},[50026],{"type":26,"value":39750},{"type":21,"tag":209,"props":50028,"children":50029},{"style":216},[50030],{"type":26,"value":47336},{"type":21,"tag":209,"props":50032,"children":50033},{"style":360},[50034],{"type":26,"value":50035}," _mapView.onRender\n",{"type":21,"tag":209,"props":50037,"children":50038},{"class":211,"line":343},[50039],{"type":21,"tag":209,"props":50040,"children":50041},{"style":448},[50042],{"type":26,"value":755},{"type":21,"tag":209,"props":50044,"children":50045},{"class":211,"line":351},[50046,50050,50054],{"type":21,"tag":209,"props":50047,"children":50048},{"style":222},[50049],{"type":26,"value":368},{"type":21,"tag":209,"props":50051,"children":50052},{"style":216},[50053],{"type":26,"value":4622},{"type":21,"tag":209,"props":50055,"children":50056},{"style":222},[50057],{"type":26,"value":2561},{"type":21,"tag":209,"props":50059,"children":50060},{"class":211,"line":444},[50061,50065,50069,50073,50077],{"type":21,"tag":209,"props":50062,"children":50063},{"style":216},[50064],{"type":26,"value":16994},{"type":21,"tag":209,"props":50066,"children":50067},{"style":360},[50068],{"type":26,"value":47101},{"type":21,"tag":209,"props":50070,"children":50071},{"style":216},[50072],{"type":26,"value":271},{"type":21,"tag":209,"props":50074,"children":50075},{"style":216},[50076],{"type":26,"value":4789},{"type":21,"tag":209,"props":50078,"children":50079},{"style":222},[50080],{"type":26,"value":2561},{"type":21,"tag":209,"props":50082,"children":50083},{"class":211,"line":454},[50084,50088,50092,50096,50100,50104,50108,50113],{"type":21,"tag":209,"props":50085,"children":50086},{"style":263},[50087],{"type":26,"value":47121},{"type":21,"tag":209,"props":50089,"children":50090},{"style":222},[50091],{"type":26,"value":47126},{"type":21,"tag":209,"props":50093,"children":50094},{"style":216},[50095],{"type":26,"value":1432},{"type":21,"tag":209,"props":50097,"children":50098},{"style":222},[50099],{"type":26,"value":16365},{"type":21,"tag":209,"props":50101,"children":50102},{"style":360},[50103],{"type":26,"value":16370},{"type":21,"tag":209,"props":50105,"children":50106},{"style":222},[50107],{"type":26,"value":368},{"type":21,"tag":209,"props":50109,"children":50110},{"style":233},[50111],{"type":26,"value":50112},"'div'",{"type":21,"tag":209,"props":50114,"children":50115},{"style":222},[50116],{"type":26,"value":2608},{"type":21,"tag":209,"props":50118,"children":50119},{"class":211,"line":463},[50120,50124,50129,50134,50138,50143],{"type":21,"tag":209,"props":50121,"children":50122},{"style":263},[50123],{"type":26,"value":47121},{"type":21,"tag":209,"props":50125,"children":50126},{"style":222},[50127],{"type":26,"value":50128},".container.classList.",{"type":21,"tag":209,"props":50130,"children":50131},{"style":360},[50132],{"type":26,"value":50133},"add",{"type":21,"tag":209,"props":50135,"children":50136},{"style":222},[50137],{"type":26,"value":368},{"type":21,"tag":209,"props":50139,"children":50140},{"style":233},[50141],{"type":26,"value":50142},"'map-info-window'",{"type":21,"tag":209,"props":50144,"children":50145},{"style":222},[50146],{"type":26,"value":2608},{"type":21,"tag":209,"props":50148,"children":50149},{"class":211,"line":472},[50150,50154,50158,50162,50166],{"type":21,"tag":209,"props":50151,"children":50152},{"style":263},[50153],{"type":26,"value":47121},{"type":21,"tag":209,"props":50155,"children":50156},{"style":222},[50157],{"type":26,"value":47159},{"type":21,"tag":209,"props":50159,"children":50160},{"style":216},[50161],{"type":26,"value":1432},{"type":21,"tag":209,"props":50163,"children":50164},{"style":263},[50165],{"type":26,"value":8282},{"type":21,"tag":209,"props":50167,"children":50168},{"style":222},[50169],{"type":26,"value":241},{"type":21,"tag":209,"props":50171,"children":50172},{"class":211,"line":480},[50173,50177,50181,50185,50189],{"type":21,"tag":209,"props":50174,"children":50175},{"style":263},[50176],{"type":26,"value":47121},{"type":21,"tag":209,"props":50178,"children":50179},{"style":222},[50180],{"type":26,"value":47183},{"type":21,"tag":209,"props":50182,"children":50183},{"style":216},[50184],{"type":26,"value":1432},{"type":21,"tag":209,"props":50186,"children":50187},{"style":263},[50188],{"type":26,"value":8282},{"type":21,"tag":209,"props":50190,"children":50191},{"style":222},[50192],{"type":26,"value":241},{"type":21,"tag":209,"props":50194,"children":50195},{"class":211,"line":489},[50196,50200,50204,50208,50212],{"type":21,"tag":209,"props":50197,"children":50198},{"style":263},[50199],{"type":26,"value":47121},{"type":21,"tag":209,"props":50201,"children":50202},{"style":222},[50203],{"type":26,"value":47207},{"type":21,"tag":209,"props":50205,"children":50206},{"style":216},[50207],{"type":26,"value":1432},{"type":21,"tag":209,"props":50209,"children":50210},{"style":263},[50211],{"type":26,"value":8282},{"type":21,"tag":209,"props":50213,"children":50214},{"style":222},[50215],{"type":26,"value":241},{"type":21,"tag":209,"props":50217,"children":50218},{"class":211,"line":847},[50219],{"type":21,"tag":209,"props":50220,"children":50221},{"style":222},[50222],{"type":26,"value":13439},{"type":21,"tag":209,"props":50224,"children":50225},{"class":211,"line":860},[50226],{"type":21,"tag":209,"props":50227,"children":50228},{"style":448},[50229],{"type":26,"value":13290},{"type":21,"tag":209,"props":50231,"children":50232},{"class":211,"line":877},[50233],{"type":21,"tag":209,"props":50234,"children":50235},{"style":448},[50236],{"type":26,"value":47241},{"type":21,"tag":209,"props":50238,"children":50239},{"class":211,"line":889},[50240,50244,50248],{"type":21,"tag":209,"props":50241,"children":50242},{"style":448},[50243],{"type":26,"value":13306},{"type":21,"tag":209,"props":50245,"children":50246},{"style":216},[50247],{"type":26,"value":47062},{"type":21,"tag":209,"props":50249,"children":50250},{"style":360},[50251],{"type":26,"value":47257},{"type":21,"tag":209,"props":50253,"children":50254},{"class":211,"line":902},[50255],{"type":21,"tag":209,"props":50256,"children":50257},{"style":448},[50258],{"type":26,"value":13346},{"type":21,"tag":209,"props":50260,"children":50261},{"class":211,"line":914},[50262,50266,50270,50274,50278,50282,50286,50290],{"type":21,"tag":209,"props":50263,"children":50264},{"style":263},[50265],{"type":26,"value":47272},{"type":21,"tag":209,"props":50267,"children":50268},{"style":222},[50269],{"type":26,"value":378},{"type":21,"tag":209,"props":50271,"children":50272},{"style":263},[50273],{"type":26,"value":32662},{"type":21,"tag":209,"props":50275,"children":50276},{"style":216},[50277],{"type":26,"value":271},{"type":21,"tag":209,"props":50279,"children":50280},{"style":216},[50281],{"type":26,"value":6371},{"type":21,"tag":209,"props":50283,"children":50284},{"style":222},[50285],{"type":26,"value":43638},{"type":21,"tag":209,"props":50287,"children":50288},{"style":360},[50289],{"type":26,"value":47297},{"type":21,"tag":209,"props":50291,"children":50292},{"style":222},[50293],{"type":26,"value":4123},{"type":21,"tag":209,"props":50295,"children":50296},{"class":211,"line":922},[50297],{"type":21,"tag":209,"props":50298,"children":50299},{"style":448},[50300],{"type":26,"value":13290},{"type":21,"tag":209,"props":50302,"children":50303},{"class":211,"line":2312},[50304],{"type":21,"tag":209,"props":50305,"children":50306},{"style":448},[50307],{"type":26,"value":47316},{"type":21,"tag":209,"props":50309,"children":50310},{"class":211,"line":2321},[50311],{"type":21,"tag":209,"props":50312,"children":50313},{"style":448},[50314],{"type":26,"value":47324},{"type":21,"tag":209,"props":50316,"children":50317},{"class":211,"line":2372},[50318,50322,50326],{"type":21,"tag":209,"props":50319,"children":50320},{"style":448},[50321],{"type":26,"value":13306},{"type":21,"tag":209,"props":50323,"children":50324},{"style":216},[50325],{"type":26,"value":47336},{"type":21,"tag":209,"props":50327,"children":50328},{"style":360},[50329],{"type":26,"value":47341},{"type":21,"tag":209,"props":50331,"children":50332},{"class":211,"line":2381},[50333],{"type":21,"tag":209,"props":50334,"children":50335},{"style":448},[50336],{"type":26,"value":13346},{"type":21,"tag":209,"props":50338,"children":50339},{"class":211,"line":2389},[50340,50344,50348,50352,50356,50360,50364,50368],{"type":21,"tag":209,"props":50341,"children":50342},{"style":263},[50343],{"type":26,"value":47272},{"type":21,"tag":209,"props":50345,"children":50346},{"style":222},[50347],{"type":26,"value":378},{"type":21,"tag":209,"props":50349,"children":50350},{"style":263},[50351],{"type":26,"value":32662},{"type":21,"tag":209,"props":50353,"children":50354},{"style":222},[50355],{"type":26,"value":378},{"type":21,"tag":209,"props":50357,"children":50358},{"style":360},[50359],{"type":26,"value":47372},{"type":21,"tag":209,"props":50361,"children":50362},{"style":216},[50363],{"type":26,"value":271},{"type":21,"tag":209,"props":50365,"children":50366},{"style":216},[50367],{"type":26,"value":4789},{"type":21,"tag":209,"props":50369,"children":50370},{"style":222},[50371],{"type":26,"value":2561},{"type":21,"tag":209,"props":50373,"children":50374},{"class":211,"line":2397},[50375,50379,50383,50387,50391,50395,50399],{"type":21,"tag":209,"props":50376,"children":50377},{"style":263},[50378],{"type":26,"value":47121},{"type":21,"tag":209,"props":50380,"children":50381},{"style":222},[50382],{"type":26,"value":47159},{"type":21,"tag":209,"props":50384,"children":50385},{"style":216},[50386],{"type":26,"value":1432},{"type":21,"tag":209,"props":50388,"children":50389},{"style":263},[50390],{"type":26,"value":20502},{"type":21,"tag":209,"props":50392,"children":50393},{"style":222},[50394],{"type":26,"value":378},{"type":21,"tag":209,"props":50396,"children":50397},{"style":360},[50398],{"type":26,"value":47420},{"type":21,"tag":209,"props":50400,"children":50401},{"style":222},[50402],{"type":26,"value":50403},"().floatPane;\n",{"type":21,"tag":209,"props":50405,"children":50406},{"class":211,"line":2406},[50407,50411,50415,50419,50423,50427],{"type":21,"tag":209,"props":50408,"children":50409},{"style":263},[50410],{"type":26,"value":47121},{"type":21,"tag":209,"props":50412,"children":50413},{"style":222},[50414],{"type":26,"value":47437},{"type":21,"tag":209,"props":50416,"children":50417},{"style":360},[50418],{"type":26,"value":16467},{"type":21,"tag":209,"props":50420,"children":50421},{"style":222},[50422],{"type":26,"value":368},{"type":21,"tag":209,"props":50424,"children":50425},{"style":263},[50426],{"type":26,"value":2508},{"type":21,"tag":209,"props":50428,"children":50429},{"style":222},[50430],{"type":26,"value":47455},{"type":21,"tag":209,"props":50432,"children":50433},{"class":211,"line":2415},[50434,50438,50442,50447,50451,50456,50460,50464,50469,50473,50477,50481,50485,50489],{"type":21,"tag":209,"props":50435,"children":50436},{"style":263},[50437],{"type":26,"value":47121},{"type":21,"tag":209,"props":50439,"children":50440},{"style":222},[50441],{"type":26,"value":47467},{"type":21,"tag":209,"props":50443,"children":50444},{"style":360},[50445],{"type":26,"value":50446},"getElementsByClassName",{"type":21,"tag":209,"props":50448,"children":50449},{"style":222},[50450],{"type":26,"value":368},{"type":21,"tag":209,"props":50452,"children":50453},{"style":233},[50454],{"type":26,"value":50455},"'map-info-close'",{"type":21,"tag":209,"props":50457,"children":50458},{"style":222},[50459],{"type":26,"value":22804},{"type":21,"tag":209,"props":50461,"children":50462},{"style":263},[50463],{"type":26,"value":8554},{"type":21,"tag":209,"props":50465,"children":50466},{"style":222},[50467],{"type":26,"value":50468},"].",{"type":21,"tag":209,"props":50470,"children":50471},{"style":360},[50472],{"type":26,"value":14995},{"type":21,"tag":209,"props":50474,"children":50475},{"style":222},[50476],{"type":26,"value":368},{"type":21,"tag":209,"props":50478,"children":50479},{"style":233},[50480],{"type":26,"value":14925},{"type":21,"tag":209,"props":50482,"children":50483},{"style":222},[50484],{"type":26,"value":408},{"type":21,"tag":209,"props":50486,"children":50487},{"style":216},[50488],{"type":26,"value":4622},{"type":21,"tag":209,"props":50490,"children":50491},{"style":222},[50492],{"type":26,"value":2561},{"type":21,"tag":209,"props":50494,"children":50495},{"class":211,"line":2424},[50496],{"type":21,"tag":209,"props":50497,"children":50498},{"style":448},[50499],{"type":26,"value":47525},{"type":21,"tag":209,"props":50501,"children":50502},{"class":211,"line":2433},[50503,50507,50511,50515],{"type":21,"tag":209,"props":50504,"children":50505},{"style":263},[50506],{"type":26,"value":2570},{"type":21,"tag":209,"props":50508,"children":50509},{"style":222},[50510],{"type":26,"value":378},{"type":21,"tag":209,"props":50512,"children":50513},{"style":360},[50514],{"type":26,"value":10540},{"type":21,"tag":209,"props":50516,"children":50517},{"style":222},[50518],{"type":26,"value":4123},{"type":21,"tag":209,"props":50520,"children":50521},{"class":211,"line":2442},[50522,50526,50530,50534,50538,50543,50547],{"type":21,"tag":209,"props":50523,"children":50524},{"style":222},[50525],{"type":26,"value":22852},{"type":21,"tag":209,"props":50527,"children":50528},{"style":360},[50529],{"type":26,"value":20189},{"type":21,"tag":209,"props":50531,"children":50532},{"style":222},[50533],{"type":26,"value":368},{"type":21,"tag":209,"props":50535,"children":50536},{"style":263},[50537],{"type":26,"value":2508},{"type":21,"tag":209,"props":50539,"children":50540},{"style":222},[50541],{"type":26,"value":50542},"), ",{"type":21,"tag":209,"props":50544,"children":50545},{"style":263},[50546],{"type":26,"value":4243},{"type":21,"tag":209,"props":50548,"children":50549},{"style":222},[50550],{"type":26,"value":2608},{"type":21,"tag":209,"props":50552,"children":50553},{"class":211,"line":2471},[50554],{"type":21,"tag":209,"props":50555,"children":50556},{"style":222},[50557],{"type":26,"value":13439},{"type":21,"tag":209,"props":50559,"children":50560},{"class":211,"line":2480},[50561],{"type":21,"tag":209,"props":50562,"children":50563},{"style":448},[50564],{"type":26,"value":13290},{"type":21,"tag":209,"props":50566,"children":50567},{"class":211,"line":2489},[50568],{"type":21,"tag":209,"props":50569,"children":50570},{"style":448},[50571],{"type":26,"value":47582},{"type":21,"tag":209,"props":50573,"children":50574},{"class":211,"line":2516},[50575],{"type":21,"tag":209,"props":50576,"children":50577},{"style":448},[50578],{"type":26,"value":47590},{"type":21,"tag":209,"props":50580,"children":50581},{"class":211,"line":2525},[50582],{"type":21,"tag":209,"props":50583,"children":50584},{"style":448},[50585],{"type":26,"value":13346},{"type":21,"tag":209,"props":50587,"children":50588},{"class":211,"line":2533},[50589,50593,50597,50601,50605,50609,50613,50617],{"type":21,"tag":209,"props":50590,"children":50591},{"style":263},[50592],{"type":26,"value":47272},{"type":21,"tag":209,"props":50594,"children":50595},{"style":222},[50596],{"type":26,"value":378},{"type":21,"tag":209,"props":50598,"children":50599},{"style":263},[50600],{"type":26,"value":32662},{"type":21,"tag":209,"props":50602,"children":50603},{"style":222},[50604],{"type":26,"value":378},{"type":21,"tag":209,"props":50606,"children":50607},{"style":360},[50608],{"type":26,"value":47621},{"type":21,"tag":209,"props":50610,"children":50611},{"style":216},[50612],{"type":26,"value":271},{"type":21,"tag":209,"props":50614,"children":50615},{"style":216},[50616],{"type":26,"value":4789},{"type":21,"tag":209,"props":50618,"children":50619},{"style":222},[50620],{"type":26,"value":2561},{"type":21,"tag":209,"props":50622,"children":50623},{"class":211,"line":2542},[50624,50628,50632,50636,50640,50644,50648],{"type":21,"tag":209,"props":50625,"children":50626},{"style":216},[50627],{"type":26,"value":14505},{"type":21,"tag":209,"props":50629,"children":50630},{"style":222},[50631],{"type":26,"value":47645},{"type":21,"tag":209,"props":50633,"children":50634},{"style":216},[50635],{"type":26,"value":1432},{"type":21,"tag":209,"props":50637,"children":50638},{"style":263},[50639],{"type":26,"value":20502},{"type":21,"tag":209,"props":50641,"children":50642},{"style":222},[50643],{"type":26,"value":42558},{"type":21,"tag":209,"props":50645,"children":50646},{"style":360},[50647],{"type":26,"value":47662},{"type":21,"tag":209,"props":50649,"children":50650},{"style":222},[50651],{"type":26,"value":13988},{"type":21,"tag":209,"props":50653,"children":50654},{"class":211,"line":2550},[50655,50660,50664,50668,50672,50677],{"type":21,"tag":209,"props":50656,"children":50657},{"style":222},[50658],{"type":26,"value":50659},"            cBounds ",{"type":21,"tag":209,"props":50661,"children":50662},{"style":216},[50663],{"type":26,"value":1432},{"type":21,"tag":209,"props":50665,"children":50666},{"style":263},[50667],{"type":26,"value":20502},{"type":21,"tag":209,"props":50669,"children":50670},{"style":222},[50671],{"type":26,"value":47467},{"type":21,"tag":209,"props":50673,"children":50674},{"style":360},[50675],{"type":26,"value":50676},"getBoundingClientRect",{"type":21,"tag":209,"props":50678,"children":50679},{"style":222},[50680],{"type":26,"value":13988},{"type":21,"tag":209,"props":50682,"children":50683},{"class":211,"line":2564},[50684,50688,50692,50697,50701,50705,50709,50713],{"type":21,"tag":209,"props":50685,"children":50686},{"style":222},[50687],{"type":26,"value":47674},{"type":21,"tag":209,"props":50689,"children":50690},{"style":216},[50691],{"type":26,"value":1432},{"type":21,"tag":209,"props":50693,"children":50694},{"style":222},[50695],{"type":26,"value":50696}," cBounds.height ",{"type":21,"tag":209,"props":50698,"children":50699},{"style":216},[50700],{"type":26,"value":17170},{"type":21,"tag":209,"props":50702,"children":50703},{"style":222},[50704],{"type":26,"value":47704},{"type":21,"tag":209,"props":50706,"children":50707},{"style":216},[50708],{"type":26,"value":17170},{"type":21,"tag":209,"props":50710,"children":50711},{"style":263},[50712],{"type":26,"value":47713},{"type":21,"tag":209,"props":50714,"children":50715},{"style":222},[50716],{"type":26,"value":304},{"type":21,"tag":209,"props":50718,"children":50719},{"class":211,"line":2611},[50720,50724,50728,50733,50737,50741],{"type":21,"tag":209,"props":50721,"children":50722},{"style":222},[50723],{"type":26,"value":47725},{"type":21,"tag":209,"props":50725,"children":50726},{"style":216},[50727],{"type":26,"value":1432},{"type":21,"tag":209,"props":50729,"children":50730},{"style":222},[50731],{"type":26,"value":50732}," cBounds.width ",{"type":21,"tag":209,"props":50734,"children":50735},{"style":216},[50736],{"type":26,"value":6460},{"type":21,"tag":209,"props":50738,"children":50739},{"style":263},[50740],{"type":26,"value":6354},{"type":21,"tag":209,"props":50742,"children":50743},{"style":222},[50744],{"type":26,"value":241},{"type":21,"tag":209,"props":50746,"children":50747},{"class":211,"line":2619},[50748,50752,50756,50760,50764,50768,50772,50776,50780,50784,50788,50792,50796],{"type":21,"tag":209,"props":50749,"children":50750},{"style":263},[50751],{"type":26,"value":47121},{"type":21,"tag":209,"props":50753,"children":50754},{"style":222},[50755],{"type":26,"value":47207},{"type":21,"tag":209,"props":50757,"children":50758},{"style":216},[50759],{"type":26,"value":1432},{"type":21,"tag":209,"props":50761,"children":50762},{"style":263},[50763],{"type":26,"value":20502},{"type":21,"tag":209,"props":50765,"children":50766},{"style":222},[50767],{"type":26,"value":378},{"type":21,"tag":209,"props":50769,"children":50770},{"style":360},[50771],{"type":26,"value":47803},{"type":21,"tag":209,"props":50773,"children":50774},{"style":222},[50775],{"type":26,"value":17096},{"type":21,"tag":209,"props":50777,"children":50778},{"style":360},[50779],{"type":26,"value":47812},{"type":21,"tag":209,"props":50781,"children":50782},{"style":222},[50783],{"type":26,"value":368},{"type":21,"tag":209,"props":50785,"children":50786},{"style":263},[50787],{"type":26,"value":2508},{"type":21,"tag":209,"props":50789,"children":50790},{"style":222},[50791],{"type":26,"value":42558},{"type":21,"tag":209,"props":50793,"children":50794},{"style":360},[50795],{"type":26,"value":42563},{"type":21,"tag":209,"props":50797,"children":50798},{"style":222},[50799],{"type":26,"value":4161},{"type":21,"tag":209,"props":50801,"children":50802},{"class":211,"line":2627},[50803,50807,50812,50816,50820,50824,50828,50833,50837,50842],{"type":21,"tag":209,"props":50804,"children":50805},{"style":263},[50806],{"type":26,"value":47121},{"type":21,"tag":209,"props":50808,"children":50809},{"style":222},[50810],{"type":26,"value":50811},".container.style.top ",{"type":21,"tag":209,"props":50813,"children":50814},{"style":216},[50815],{"type":26,"value":1432},{"type":21,"tag":209,"props":50817,"children":50818},{"style":263},[50819],{"type":26,"value":20502},{"type":21,"tag":209,"props":50821,"children":50822},{"style":222},[50823],{"type":26,"value":47872},{"type":21,"tag":209,"props":50825,"children":50826},{"style":216},[50827],{"type":26,"value":42628},{"type":21,"tag":209,"props":50829,"children":50830},{"style":222},[50831],{"type":26,"value":50832}," cHeight",{"type":21,"tag":209,"props":50834,"children":50835},{"style":216},[50836],{"type":26,"value":17170},{"type":21,"tag":209,"props":50838,"children":50839},{"style":233},[50840],{"type":26,"value":50841},"'px'",{"type":21,"tag":209,"props":50843,"children":50844},{"style":222},[50845],{"type":26,"value":241},{"type":21,"tag":209,"props":50847,"children":50848},{"class":211,"line":2636},[50849,50853,50858,50862,50866,50870,50874,50879,50883,50887],{"type":21,"tag":209,"props":50850,"children":50851},{"style":263},[50852],{"type":26,"value":47121},{"type":21,"tag":209,"props":50854,"children":50855},{"style":222},[50856],{"type":26,"value":50857},".container.style.left ",{"type":21,"tag":209,"props":50859,"children":50860},{"style":216},[50861],{"type":26,"value":1432},{"type":21,"tag":209,"props":50863,"children":50864},{"style":263},[50865],{"type":26,"value":20502},{"type":21,"tag":209,"props":50867,"children":50868},{"style":222},[50869],{"type":26,"value":47902},{"type":21,"tag":209,"props":50871,"children":50872},{"style":216},[50873],{"type":26,"value":42628},{"type":21,"tag":209,"props":50875,"children":50876},{"style":222},[50877],{"type":26,"value":50878}," cWidth",{"type":21,"tag":209,"props":50880,"children":50881},{"style":216},[50882],{"type":26,"value":17170},{"type":21,"tag":209,"props":50884,"children":50885},{"style":233},[50886],{"type":26,"value":50841},{"type":21,"tag":209,"props":50888,"children":50889},{"style":222},[50890],{"type":26,"value":241},{"type":21,"tag":209,"props":50892,"children":50893},{"class":211,"line":2644},[50894],{"type":21,"tag":209,"props":50895,"children":50896},{"style":222},[50897],{"type":26,"value":13439},{"type":21,"tag":209,"props":50899,"children":50900},{"class":211,"line":2657},[50901],{"type":21,"tag":209,"props":50902,"children":50903},{"style":448},[50904],{"type":26,"value":13290},{"type":21,"tag":209,"props":50906,"children":50907},{"class":211,"line":2728},[50908],{"type":21,"tag":209,"props":50909,"children":50910},{"style":448},[50911],{"type":26,"value":47940},{"type":21,"tag":209,"props":50913,"children":50914},{"class":211,"line":2758},[50915,50919,50923],{"type":21,"tag":209,"props":50916,"children":50917},{"style":448},[50918],{"type":26,"value":13306},{"type":21,"tag":209,"props":50920,"children":50921},{"style":216},[50922],{"type":26,"value":47336},{"type":21,"tag":209,"props":50924,"children":50925},{"style":360},[50926],{"type":26,"value":47956},{"type":21,"tag":209,"props":50928,"children":50929},{"class":211,"line":2776},[50930],{"type":21,"tag":209,"props":50931,"children":50932},{"style":448},[50933],{"type":26,"value":13346},{"type":21,"tag":209,"props":50935,"children":50936},{"class":211,"line":2785},[50937,50941,50945,50949,50953,50957,50961,50965],{"type":21,"tag":209,"props":50938,"children":50939},{"style":263},[50940],{"type":26,"value":47272},{"type":21,"tag":209,"props":50942,"children":50943},{"style":222},[50944],{"type":26,"value":378},{"type":21,"tag":209,"props":50946,"children":50947},{"style":263},[50948],{"type":26,"value":32662},{"type":21,"tag":209,"props":50950,"children":50951},{"style":222},[50952],{"type":26,"value":378},{"type":21,"tag":209,"props":50954,"children":50955},{"style":360},[50956],{"type":26,"value":47987},{"type":21,"tag":209,"props":50958,"children":50959},{"style":216},[50960],{"type":26,"value":271},{"type":21,"tag":209,"props":50962,"children":50963},{"style":216},[50964],{"type":26,"value":4789},{"type":21,"tag":209,"props":50966,"children":50967},{"style":222},[50968],{"type":26,"value":2561},{"type":21,"tag":209,"props":50970,"children":50971},{"class":211,"line":2793},[50972,50976,50980,50984,50988,50992],{"type":21,"tag":209,"props":50973,"children":50974},{"style":263},[50975],{"type":26,"value":47121},{"type":21,"tag":209,"props":50977,"children":50978},{"style":222},[50979],{"type":26,"value":47437},{"type":21,"tag":209,"props":50981,"children":50982},{"style":360},[50983],{"type":26,"value":16555},{"type":21,"tag":209,"props":50985,"children":50986},{"style":222},[50987],{"type":26,"value":368},{"type":21,"tag":209,"props":50989,"children":50990},{"style":263},[50991],{"type":26,"value":2508},{"type":21,"tag":209,"props":50993,"children":50994},{"style":222},[50995],{"type":26,"value":47455},{"type":21,"tag":209,"props":50997,"children":50998},{"class":211,"line":2801},[50999],{"type":21,"tag":209,"props":51000,"children":51001},{"style":222},[51002],{"type":26,"value":13439},{"type":21,"tag":209,"props":51004,"children":51005},{"class":211,"line":2809},[51006],{"type":21,"tag":209,"props":51007,"children":51008},{"style":448},[51009],{"type":26,"value":13290},{"type":21,"tag":209,"props":51011,"children":51012},{"class":211,"line":10937},[51013],{"type":21,"tag":209,"props":51014,"children":51015},{"style":448},[51016],{"type":26,"value":48041},{"type":21,"tag":209,"props":51018,"children":51019},{"class":211,"line":10967},[51020,51024,51028,51032],{"type":21,"tag":209,"props":51021,"children":51022},{"style":448},[51023],{"type":26,"value":13306},{"type":21,"tag":209,"props":51025,"children":51026},{"style":216},[51027],{"type":26,"value":13311},{"type":21,"tag":209,"props":51029,"children":51030},{"style":360},[51031],{"type":26,"value":13316},{"type":21,"tag":209,"props":51033,"children":51034},{"style":222},[51035],{"type":26,"value":48061},{"type":21,"tag":209,"props":51037,"children":51038},{"class":211,"line":11003},[51039],{"type":21,"tag":209,"props":51040,"children":51041},{"style":448},[51042],{"type":26,"value":13346},{"type":21,"tag":209,"props":51044,"children":51045},{"class":211,"line":11038},[51046,51050,51054,51058,51062,51066,51070,51074,51078,51082],{"type":21,"tag":209,"props":51047,"children":51048},{"style":263},[51049],{"type":26,"value":47272},{"type":21,"tag":209,"props":51051,"children":51052},{"style":222},[51053],{"type":26,"value":378},{"type":21,"tag":209,"props":51055,"children":51056},{"style":263},[51057],{"type":26,"value":32662},{"type":21,"tag":209,"props":51059,"children":51060},{"style":222},[51061],{"type":26,"value":378},{"type":21,"tag":209,"props":51063,"children":51064},{"style":360},[51065],{"type":26,"value":48092},{"type":21,"tag":209,"props":51067,"children":51068},{"style":216},[51069],{"type":26,"value":271},{"type":21,"tag":209,"props":51071,"children":51072},{"style":216},[51073],{"type":26,"value":4789},{"type":21,"tag":209,"props":51075,"children":51076},{"style":222},[51077],{"type":26,"value":368},{"type":21,"tag":209,"props":51079,"children":51080},{"style":400},[51081],{"type":26,"value":22955},{"type":21,"tag":209,"props":51083,"children":51084},{"style":222},[51085],{"type":26,"value":2369},{"type":21,"tag":209,"props":51087,"children":51088},{"class":211,"line":11072},[51089,51093,51098,51102],{"type":21,"tag":209,"props":51090,"children":51091},{"style":263},[51092],{"type":26,"value":47121},{"type":21,"tag":209,"props":51094,"children":51095},{"style":222},[51096],{"type":26,"value":51097},".container.innerHTML ",{"type":21,"tag":209,"props":51099,"children":51100},{"style":216},[51101],{"type":26,"value":1432},{"type":21,"tag":209,"props":51103,"children":51104},{"style":222},[51105],{"type":26,"value":51106}," html;\n",{"type":21,"tag":209,"props":51108,"children":51109},{"class":211,"line":11106},[51110],{"type":21,"tag":209,"props":51111,"children":51112},{"style":222},[51113],{"type":26,"value":13439},{"type":21,"tag":209,"props":51115,"children":51116},{"class":211,"line":11114},[51117],{"type":21,"tag":209,"props":51118,"children":51119},{"style":448},[51120],{"type":26,"value":13290},{"type":21,"tag":209,"props":51122,"children":51123},{"class":211,"line":14940},[51124],{"type":21,"tag":209,"props":51125,"children":51126},{"style":448},[51127],{"type":26,"value":48154},{"type":21,"tag":209,"props":51129,"children":51130},{"class":211,"line":14949},[51131,51135,51139,51143],{"type":21,"tag":209,"props":51132,"children":51133},{"style":448},[51134],{"type":26,"value":13306},{"type":21,"tag":209,"props":51136,"children":51137},{"style":216},[51138],{"type":26,"value":13311},{"type":21,"tag":209,"props":51140,"children":51141},{"style":360},[51142],{"type":26,"value":48170},{"type":21,"tag":209,"props":51144,"children":51145},{"style":222},[51146],{"type":26,"value":48175},{"type":21,"tag":209,"props":51148,"children":51149},{"class":211,"line":14958},[51150,51154,51158,51162],{"type":21,"tag":209,"props":51151,"children":51152},{"style":448},[51153],{"type":26,"value":13306},{"type":21,"tag":209,"props":51155,"children":51156},{"style":216},[51157],{"type":26,"value":13311},{"type":21,"tag":209,"props":51159,"children":51160},{"style":360},[51161],{"type":26,"value":48191},{"type":21,"tag":209,"props":51163,"children":51164},{"style":222},[51165],{"type":26,"value":48196},{"type":21,"tag":209,"props":51167,"children":51168},{"class":211,"line":14966},[51169],{"type":21,"tag":209,"props":51170,"children":51171},{"style":448},[51172],{"type":26,"value":13346},{"type":21,"tag":209,"props":51174,"children":51175},{"class":211,"line":14975},[51176,51180,51184,51188,51192,51196,51200,51204,51208,51212,51216,51220],{"type":21,"tag":209,"props":51177,"children":51178},{"style":263},[51179],{"type":26,"value":47272},{"type":21,"tag":209,"props":51181,"children":51182},{"style":222},[51183],{"type":26,"value":378},{"type":21,"tag":209,"props":51185,"children":51186},{"style":263},[51187],{"type":26,"value":32662},{"type":21,"tag":209,"props":51189,"children":51190},{"style":222},[51191],{"type":26,"value":378},{"type":21,"tag":209,"props":51193,"children":51194},{"style":360},[51195],{"type":26,"value":20680},{"type":21,"tag":209,"props":51197,"children":51198},{"style":216},[51199],{"type":26,"value":271},{"type":21,"tag":209,"props":51201,"children":51202},{"style":216},[51203],{"type":26,"value":4789},{"type":21,"tag":209,"props":51205,"children":51206},{"style":222},[51207],{"type":26,"value":368},{"type":21,"tag":209,"props":51209,"children":51210},{"style":400},[51211],{"type":26,"value":48243},{"type":21,"tag":209,"props":51213,"children":51214},{"style":222},[51215],{"type":26,"value":408},{"type":21,"tag":209,"props":51217,"children":51218},{"style":400},[51219],{"type":26,"value":48252},{"type":21,"tag":209,"props":51221,"children":51222},{"style":222},[51223],{"type":26,"value":2369},{"type":21,"tag":209,"props":51225,"children":51226},{"class":211,"line":14984},[51227,51231,51235,51239],{"type":21,"tag":209,"props":51228,"children":51229},{"style":263},[51230],{"type":26,"value":47121},{"type":21,"tag":209,"props":51232,"children":51233},{"style":222},[51234],{"type":26,"value":47183},{"type":21,"tag":209,"props":51236,"children":51237},{"style":216},[51238],{"type":26,"value":1432},{"type":21,"tag":209,"props":51240,"children":51241},{"style":222},[51242],{"type":26,"value":48276},{"type":21,"tag":209,"props":51244,"children":51245},{"class":211,"line":15018},[51246,51250,51254,51258],{"type":21,"tag":209,"props":51247,"children":51248},{"style":263},[51249],{"type":26,"value":47121},{"type":21,"tag":209,"props":51251,"children":51252},{"style":222},[51253],{"type":26,"value":378},{"type":21,"tag":209,"props":51255,"children":51256},{"style":360},[51257],{"type":26,"value":48292},{"type":21,"tag":209,"props":51259,"children":51260},{"style":222},[51261],{"type":26,"value":48297},{"type":21,"tag":209,"props":51263,"children":51264},{"class":211,"line":15050},[51265],{"type":21,"tag":209,"props":51266,"children":51267},{"style":222},[51268],{"type":26,"value":13439},{"type":21,"tag":209,"props":51270,"children":51271},{"class":211,"line":15082},[51272],{"type":21,"tag":209,"props":51273,"children":51274},{"style":448},[51275],{"type":26,"value":13290},{"type":21,"tag":209,"props":51277,"children":51278},{"class":211,"line":15090},[51279],{"type":21,"tag":209,"props":51280,"children":51281},{"style":448},[51282],{"type":26,"value":48319},{"type":21,"tag":209,"props":51284,"children":51285},{"class":211,"line":15098},[51286],{"type":21,"tag":209,"props":51287,"children":51288},{"style":448},[51289],{"type":26,"value":13346},{"type":21,"tag":209,"props":51291,"children":51292},{"class":211,"line":15106},[51293,51297,51301,51305,51309,51313,51317,51321],{"type":21,"tag":209,"props":51294,"children":51295},{"style":263},[51296],{"type":26,"value":47272},{"type":21,"tag":209,"props":51298,"children":51299},{"style":222},[51300],{"type":26,"value":378},{"type":21,"tag":209,"props":51302,"children":51303},{"style":263},[51304],{"type":26,"value":32662},{"type":21,"tag":209,"props":51306,"children":51307},{"style":222},[51308],{"type":26,"value":378},{"type":21,"tag":209,"props":51310,"children":51311},{"style":360},[51312],{"type":26,"value":10540},{"type":21,"tag":209,"props":51314,"children":51315},{"style":216},[51316],{"type":26,"value":271},{"type":21,"tag":209,"props":51318,"children":51319},{"style":216},[51320],{"type":26,"value":4789},{"type":21,"tag":209,"props":51322,"children":51323},{"style":222},[51324],{"type":26,"value":2561},{"type":21,"tag":209,"props":51326,"children":51327},{"class":211,"line":15114},[51328,51332,51336,51340,51344,51348],{"type":21,"tag":209,"props":51329,"children":51330},{"style":263},[51331],{"type":26,"value":47121},{"type":21,"tag":209,"props":51333,"children":51334},{"style":222},[51335],{"type":26,"value":378},{"type":21,"tag":209,"props":51337,"children":51338},{"style":360},[51339],{"type":26,"value":48292},{"type":21,"tag":209,"props":51341,"children":51342},{"style":222},[51343],{"type":26,"value":368},{"type":21,"tag":209,"props":51345,"children":51346},{"style":263},[51347],{"type":26,"value":20198},{"type":21,"tag":209,"props":51349,"children":51350},{"style":222},[51351],{"type":26,"value":2608},{"type":21,"tag":209,"props":51353,"children":51354},{"class":211,"line":15123},[51355],{"type":21,"tag":209,"props":51356,"children":51357},{"style":222},[51358],{"type":26,"value":13439},{"type":21,"tag":209,"props":51360,"children":51361},{"class":211,"line":15143},[51362,51366],{"type":21,"tag":209,"props":51363,"children":51364},{"style":216},[51365],{"type":26,"value":1298},{"type":21,"tag":209,"props":51367,"children":51368},{"style":222},[51369],{"type":26,"value":48407},{"type":21,"tag":209,"props":51371,"children":51372},{"class":211,"line":15160},[51373],{"type":21,"tag":209,"props":51374,"children":51375},{"style":222},[51376],{"type":26,"value":469},{"type":21,"tag":22,"props":51378,"children":51379},{},[51380],{"type":26,"value":51381},"That's it.",{"type":21,"tag":3490,"props":51383,"children":51384},{},[51385],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":51387},[51388,51389,51390,51391,51392,51393],{"id":46600,"depth":254,"text":46603},{"id":46981,"depth":254,"text":42483},{"id":48841,"depth":254,"text":48844},{"id":49641,"depth":254,"text":49644},{"id":49817,"depth":254,"text":49820},{"id":49942,"depth":254,"text":49945},"content:ckeefer:2014-3:customgmapsinfowindow.md","ckeefer/2014-3/customgmapsinfowindow.md","ckeefer/2014-3/customgmapsinfowindow",{"user":3518,"name":3519},{"_path":51399,"_dir":51400,"_draft":7,"_partial":7,"_locale":8,"title":51401,"description":51402,"publishDate":51403,"tags":51404,"image":51406,"excerpt":51402,"body":51407,"_type":3511,"_id":54067,"_source":3513,"_file":54068,"_stem":54069,"_extension":3516,"author":54070},"/ckeefer/2013-5/ajax-uploader","2013-5","Ajax Upload XHR2, Take 2","It's a pleasure to be able to interact with files in the browser at long last, isn't it? Reading files in without needing to bounce them against the server first opens up a lot of possibilities - and getting progress from a chunked ajax upload is miles away from the indeterminate form uploads of days past.","2014-02-19",[16600,12,51405],"xhr2","/ckeefer/2013-5/img/html5.jpg",{"type":18,"children":51408,"toc":54062},[51409,51413,51423,51437,51443,51457,51470,52001,52006,52011,52016,52021,52737,52758,52763,54014,54020,54025,54030,54036,54058],{"type":21,"tag":22,"props":51410,"children":51411},{},[51412],{"type":26,"value":51402},{"type":21,"tag":22,"props":51414,"children":51415},{},[51416,51421],{"type":21,"tag":29,"props":51417,"children":51419},{"href":51418},"/search/ajax/upload/filereader/user:ckeefer",[51420],{"type":26,"value":16611},{"type":26,"value":51422}," we touched this subject, I shared an (admittedly rough) jQuery plugin that allowed you to enjoy HTML5 ajax uploading and file reading with the familiar event interface, and convert any element into a drag-and-drop target.",{"type":21,"tag":22,"props":51424,"children":51425},{},[51426,51428,51435],{"type":26,"value":51427},"At the request of reader ",{"type":21,"tag":29,"props":51429,"children":51432},{"href":51430,"rel":51431},"https://github.com/SaneMethod/HUp/issues/1",[93],[51433],{"type":26,"value":51434},"Mateusz",{"type":26,"value":51436},", let's revisit our HUp plugin, and polish it up a little by adding a new feature - the ability to filter files to be read/uploaded by their file size, and/or their mime-type.",{"type":21,"tag":3596,"props":51438,"children":51440},{"id":51439},"filtering-by-type",[51441],{"type":26,"value":51442},"Filtering By Type",{"type":21,"tag":22,"props":51444,"children":51445},{},[51446,51448,51455],{"type":26,"value":51447},"This can get tricky, given the wide variety of files and their associated mime types. We want to be able to specify something similar to the ",{"type":21,"tag":29,"props":51449,"children":51452},{"href":51450,"rel":51451},"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#Specifications",[93],[51453],{"type":26,"value":51454},"accept attribute",{"type":26,"value":51456}," on file inputs - but a little looser and friendlier, allowing just the extension to be specified, with the plugin handling the hard work of mapping that to a mime-type - at least, when we know the extension.",{"type":21,"tag":22,"props":51458,"children":51459},{},[51460,51462,51468],{"type":26,"value":51461},"The logic for this is split up within ",{"type":21,"tag":63,"props":51463,"children":51465},{"className":51464},[],[51466],{"type":26,"value":51467},"hup.js",{"type":26,"value":51469},". To begin with, we need to create an array of known mime-types, and a mapping between extensions and their mime-types.",{"type":21,"tag":200,"props":51471,"children":51473},{"className":16138,"code":51472,"language":16140,"meta":8,"style":8},"var filters = {},\n    fileTypes = [];\n    /**\n    * Populate the filters and fileTypes object and array, with the former containing a mapping between\n    * file extensions and their mime types, and the latter the mimetypes themselves.\n    */\n(function(mimetypes){\n    var mimes = mimetypes.split(/,/),\n        exts = [];\n    for (var i=0, len=mimes.length; i \u003C len; i+=2)\n    {\n        fileTypes.push(mimes[i]);\n        exts = mimes[i+1].split(/ /);\n        for (var j=0, jlen = exts.length; j \u003C jlen; j++)\n        {\n            filters[exts[j]] = mimes[i];\n        }\n    }\n})(\n        \"application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,\" +\n        \"ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,\" +\n        \"ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/x-javascript,js,\" +\n        \"application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,\" +\n        \"image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,\" +\n        \"image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,\" +\n        \"csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,\" +\n        \"video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,\" +\n        \"application/octet-stream,exe\"\n    );\n",[51474],{"type":21,"tag":63,"props":51475,"children":51476},{"__ignoreMap":8},[51477,51497,51514,51521,51529,51537,51544,51568,51614,51630,51702,51709,51727,51776,51844,51851,51868,51875,51882,51890,51902,51914,51926,51938,51950,51962,51974,51986,51994],{"type":21,"tag":209,"props":51478,"children":51479},{"class":211,"line":212},[51480,51484,51489,51493],{"type":21,"tag":209,"props":51481,"children":51482},{"style":216},[51483],{"type":26,"value":3909},{"type":21,"tag":209,"props":51485,"children":51486},{"style":222},[51487],{"type":26,"value":51488}," filters ",{"type":21,"tag":209,"props":51490,"children":51491},{"style":216},[51492],{"type":26,"value":1432},{"type":21,"tag":209,"props":51494,"children":51495},{"style":222},[51496],{"type":26,"value":42791},{"type":21,"tag":209,"props":51498,"children":51499},{"class":211,"line":244},[51500,51505,51509],{"type":21,"tag":209,"props":51501,"children":51502},{"style":222},[51503],{"type":26,"value":51504},"    fileTypes ",{"type":21,"tag":209,"props":51506,"children":51507},{"style":216},[51508],{"type":26,"value":1432},{"type":21,"tag":209,"props":51510,"children":51511},{"style":222},[51512],{"type":26,"value":51513}," [];\n",{"type":21,"tag":209,"props":51515,"children":51516},{"class":211,"line":254},[51517],{"type":21,"tag":209,"props":51518,"children":51519},{"style":448},[51520],{"type":26,"value":13290},{"type":21,"tag":209,"props":51522,"children":51523},{"class":211,"line":279},[51524],{"type":21,"tag":209,"props":51525,"children":51526},{"style":448},[51527],{"type":26,"value":51528},"    * Populate the filters and fileTypes object and array, with the former containing a mapping between\n",{"type":21,"tag":209,"props":51530,"children":51531},{"class":211,"line":288},[51532],{"type":21,"tag":209,"props":51533,"children":51534},{"style":448},[51535],{"type":26,"value":51536},"    * file extensions and their mime types, and the latter the mimetypes themselves.\n",{"type":21,"tag":209,"props":51538,"children":51539},{"class":211,"line":307},[51540],{"type":21,"tag":209,"props":51541,"children":51542},{"style":448},[51543],{"type":26,"value":16934},{"type":21,"tag":209,"props":51545,"children":51546},{"class":211,"line":325},[51547,51551,51555,51559,51564],{"type":21,"tag":209,"props":51548,"children":51549},{"style":222},[51550],{"type":26,"value":368},{"type":21,"tag":209,"props":51552,"children":51553},{"style":216},[51554],{"type":26,"value":4622},{"type":21,"tag":209,"props":51556,"children":51557},{"style":222},[51558],{"type":26,"value":368},{"type":21,"tag":209,"props":51560,"children":51561},{"style":400},[51562],{"type":26,"value":51563},"mimetypes",{"type":21,"tag":209,"props":51565,"children":51566},{"style":222},[51567],{"type":26,"value":2369},{"type":21,"tag":209,"props":51569,"children":51570},{"class":211,"line":334},[51571,51575,51580,51584,51589,51593,51597,51601,51606,51610],{"type":21,"tag":209,"props":51572,"children":51573},{"style":216},[51574],{"type":26,"value":16994},{"type":21,"tag":209,"props":51576,"children":51577},{"style":222},[51578],{"type":26,"value":51579}," mimes ",{"type":21,"tag":209,"props":51581,"children":51582},{"style":216},[51583],{"type":26,"value":1432},{"type":21,"tag":209,"props":51585,"children":51586},{"style":222},[51587],{"type":26,"value":51588}," mimetypes.",{"type":21,"tag":209,"props":51590,"children":51591},{"style":360},[51592],{"type":26,"value":6313},{"type":21,"tag":209,"props":51594,"children":51595},{"style":222},[51596],{"type":26,"value":368},{"type":21,"tag":209,"props":51598,"children":51599},{"style":233},[51600],{"type":26,"value":6460},{"type":21,"tag":209,"props":51602,"children":51603},{"style":6468},[51604],{"type":26,"value":51605},",",{"type":21,"tag":209,"props":51607,"children":51608},{"style":233},[51609],{"type":26,"value":6460},{"type":21,"tag":209,"props":51611,"children":51612},{"style":222},[51613],{"type":26,"value":5404},{"type":21,"tag":209,"props":51615,"children":51616},{"class":211,"line":343},[51617,51622,51626],{"type":21,"tag":209,"props":51618,"children":51619},{"style":222},[51620],{"type":26,"value":51621},"        exts ",{"type":21,"tag":209,"props":51623,"children":51624},{"style":216},[51625],{"type":26,"value":1432},{"type":21,"tag":209,"props":51627,"children":51628},{"style":222},[51629],{"type":26,"value":51513},{"type":21,"tag":209,"props":51631,"children":51632},{"class":211,"line":351},[51633,51638,51642,51646,51650,51654,51658,51663,51667,51672,51676,51680,51684,51689,51694,51698],{"type":21,"tag":209,"props":51634,"children":51635},{"style":216},[51636],{"type":26,"value":51637},"    for",{"type":21,"tag":209,"props":51639,"children":51640},{"style":222},[51641],{"type":26,"value":5569},{"type":21,"tag":209,"props":51643,"children":51644},{"style":216},[51645],{"type":26,"value":3909},{"type":21,"tag":209,"props":51647,"children":51648},{"style":222},[51649],{"type":26,"value":32266},{"type":21,"tag":209,"props":51651,"children":51652},{"style":216},[51653],{"type":26,"value":1432},{"type":21,"tag":209,"props":51655,"children":51656},{"style":263},[51657],{"type":26,"value":8554},{"type":21,"tag":209,"props":51659,"children":51660},{"style":222},[51661],{"type":26,"value":51662},", len",{"type":21,"tag":209,"props":51664,"children":51665},{"style":216},[51666],{"type":26,"value":1432},{"type":21,"tag":209,"props":51668,"children":51669},{"style":222},[51670],{"type":26,"value":51671},"mimes.",{"type":21,"tag":209,"props":51673,"children":51674},{"style":263},[51675],{"type":26,"value":6344},{"type":21,"tag":209,"props":51677,"children":51678},{"style":222},[51679],{"type":26,"value":32292},{"type":21,"tag":209,"props":51681,"children":51682},{"style":216},[51683],{"type":26,"value":1985},{"type":21,"tag":209,"props":51685,"children":51686},{"style":222},[51687],{"type":26,"value":51688}," len; i",{"type":21,"tag":209,"props":51690,"children":51691},{"style":216},[51692],{"type":26,"value":51693},"+=",{"type":21,"tag":209,"props":51695,"children":51696},{"style":263},[51697],{"type":26,"value":3233},{"type":21,"tag":209,"props":51699,"children":51700},{"style":222},[51701],{"type":26,"value":8924},{"type":21,"tag":209,"props":51703,"children":51704},{"class":211,"line":444},[51705],{"type":21,"tag":209,"props":51706,"children":51707},{"style":222},[51708],{"type":26,"value":32675},{"type":21,"tag":209,"props":51710,"children":51711},{"class":211,"line":454},[51712,51717,51722],{"type":21,"tag":209,"props":51713,"children":51714},{"style":222},[51715],{"type":26,"value":51716},"        fileTypes.",{"type":21,"tag":209,"props":51718,"children":51719},{"style":360},[51720],{"type":26,"value":51721},"push",{"type":21,"tag":209,"props":51723,"children":51724},{"style":222},[51725],{"type":26,"value":51726},"(mimes[i]);\n",{"type":21,"tag":209,"props":51728,"children":51729},{"class":211,"line":463},[51730,51734,51738,51743,51747,51751,51755,51759,51763,51767,51772],{"type":21,"tag":209,"props":51731,"children":51732},{"style":222},[51733],{"type":26,"value":51621},{"type":21,"tag":209,"props":51735,"children":51736},{"style":216},[51737],{"type":26,"value":1432},{"type":21,"tag":209,"props":51739,"children":51740},{"style":222},[51741],{"type":26,"value":51742}," mimes[i",{"type":21,"tag":209,"props":51744,"children":51745},{"style":216},[51746],{"type":26,"value":17170},{"type":21,"tag":209,"props":51748,"children":51749},{"style":263},[51750],{"type":26,"value":3224},{"type":21,"tag":209,"props":51752,"children":51753},{"style":222},[51754],{"type":26,"value":50468},{"type":21,"tag":209,"props":51756,"children":51757},{"style":360},[51758],{"type":26,"value":6313},{"type":21,"tag":209,"props":51760,"children":51761},{"style":222},[51762],{"type":26,"value":368},{"type":21,"tag":209,"props":51764,"children":51765},{"style":233},[51766],{"type":26,"value":6460},{"type":21,"tag":209,"props":51768,"children":51769},{"style":233},[51770],{"type":26,"value":51771}," /",{"type":21,"tag":209,"props":51773,"children":51774},{"style":222},[51775],{"type":26,"value":2608},{"type":21,"tag":209,"props":51777,"children":51778},{"class":211,"line":472},[51779,51783,51787,51791,51796,51800,51804,51809,51813,51818,51822,51827,51831,51836,51840],{"type":21,"tag":209,"props":51780,"children":51781},{"style":216},[51782],{"type":26,"value":32253},{"type":21,"tag":209,"props":51784,"children":51785},{"style":222},[51786],{"type":26,"value":5569},{"type":21,"tag":209,"props":51788,"children":51789},{"style":216},[51790],{"type":26,"value":3909},{"type":21,"tag":209,"props":51792,"children":51793},{"style":222},[51794],{"type":26,"value":51795}," j",{"type":21,"tag":209,"props":51797,"children":51798},{"style":216},[51799],{"type":26,"value":1432},{"type":21,"tag":209,"props":51801,"children":51802},{"style":263},[51803],{"type":26,"value":8554},{"type":21,"tag":209,"props":51805,"children":51806},{"style":222},[51807],{"type":26,"value":51808},", jlen ",{"type":21,"tag":209,"props":51810,"children":51811},{"style":216},[51812],{"type":26,"value":1432},{"type":21,"tag":209,"props":51814,"children":51815},{"style":222},[51816],{"type":26,"value":51817}," exts.",{"type":21,"tag":209,"props":51819,"children":51820},{"style":263},[51821],{"type":26,"value":6344},{"type":21,"tag":209,"props":51823,"children":51824},{"style":222},[51825],{"type":26,"value":51826},"; j ",{"type":21,"tag":209,"props":51828,"children":51829},{"style":216},[51830],{"type":26,"value":1985},{"type":21,"tag":209,"props":51832,"children":51833},{"style":222},[51834],{"type":26,"value":51835}," jlen; j",{"type":21,"tag":209,"props":51837,"children":51838},{"style":216},[51839],{"type":26,"value":32306},{"type":21,"tag":209,"props":51841,"children":51842},{"style":222},[51843],{"type":26,"value":8924},{"type":21,"tag":209,"props":51845,"children":51846},{"class":211,"line":480},[51847],{"type":21,"tag":209,"props":51848,"children":51849},{"style":222},[51850],{"type":26,"value":17555},{"type":21,"tag":209,"props":51852,"children":51853},{"class":211,"line":489},[51854,51859,51863],{"type":21,"tag":209,"props":51855,"children":51856},{"style":222},[51857],{"type":26,"value":51858},"            filters[exts[j]] ",{"type":21,"tag":209,"props":51860,"children":51861},{"style":216},[51862],{"type":26,"value":1432},{"type":21,"tag":209,"props":51864,"children":51865},{"style":222},[51866],{"type":26,"value":51867}," mimes[i];\n",{"type":21,"tag":209,"props":51869,"children":51870},{"class":211,"line":847},[51871],{"type":21,"tag":209,"props":51872,"children":51873},{"style":222},[51874],{"type":26,"value":2235},{"type":21,"tag":209,"props":51876,"children":51877},{"class":211,"line":860},[51878],{"type":21,"tag":209,"props":51879,"children":51880},{"style":222},[51881],{"type":26,"value":331},{"type":21,"tag":209,"props":51883,"children":51884},{"class":211,"line":877},[51885],{"type":21,"tag":209,"props":51886,"children":51887},{"style":222},[51888],{"type":26,"value":51889},"})(\n",{"type":21,"tag":209,"props":51891,"children":51892},{"class":211,"line":889},[51893,51898],{"type":21,"tag":209,"props":51894,"children":51895},{"style":233},[51896],{"type":26,"value":51897},"        \"application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,\"",{"type":21,"tag":209,"props":51899,"children":51900},{"style":216},[51901],{"type":26,"value":18445},{"type":21,"tag":209,"props":51903,"children":51904},{"class":211,"line":902},[51905,51910],{"type":21,"tag":209,"props":51906,"children":51907},{"style":233},[51908],{"type":26,"value":51909},"        \"ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,\"",{"type":21,"tag":209,"props":51911,"children":51912},{"style":216},[51913],{"type":26,"value":18445},{"type":21,"tag":209,"props":51915,"children":51916},{"class":211,"line":914},[51917,51922],{"type":21,"tag":209,"props":51918,"children":51919},{"style":233},[51920],{"type":26,"value":51921},"        \"ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/x-javascript,js,\"",{"type":21,"tag":209,"props":51923,"children":51924},{"style":216},[51925],{"type":26,"value":18445},{"type":21,"tag":209,"props":51927,"children":51928},{"class":211,"line":922},[51929,51934],{"type":21,"tag":209,"props":51930,"children":51931},{"style":233},[51932],{"type":26,"value":51933},"        \"application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,\"",{"type":21,"tag":209,"props":51935,"children":51936},{"style":216},[51937],{"type":26,"value":18445},{"type":21,"tag":209,"props":51939,"children":51940},{"class":211,"line":2312},[51941,51946],{"type":21,"tag":209,"props":51942,"children":51943},{"style":233},[51944],{"type":26,"value":51945},"        \"image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,\"",{"type":21,"tag":209,"props":51947,"children":51948},{"style":216},[51949],{"type":26,"value":18445},{"type":21,"tag":209,"props":51951,"children":51952},{"class":211,"line":2321},[51953,51958],{"type":21,"tag":209,"props":51954,"children":51955},{"style":233},[51956],{"type":26,"value":51957},"        \"image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,\"",{"type":21,"tag":209,"props":51959,"children":51960},{"style":216},[51961],{"type":26,"value":18445},{"type":21,"tag":209,"props":51963,"children":51964},{"class":211,"line":2372},[51965,51970],{"type":21,"tag":209,"props":51966,"children":51967},{"style":233},[51968],{"type":26,"value":51969},"        \"csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,\"",{"type":21,"tag":209,"props":51971,"children":51972},{"style":216},[51973],{"type":26,"value":18445},{"type":21,"tag":209,"props":51975,"children":51976},{"class":211,"line":2381},[51977,51982],{"type":21,"tag":209,"props":51978,"children":51979},{"style":233},[51980],{"type":26,"value":51981},"        \"video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,\"",{"type":21,"tag":209,"props":51983,"children":51984},{"style":216},[51985],{"type":26,"value":18445},{"type":21,"tag":209,"props":51987,"children":51988},{"class":211,"line":2389},[51989],{"type":21,"tag":209,"props":51990,"children":51991},{"style":233},[51992],{"type":26,"value":51993},"        \"application/octet-stream,exe\"\n",{"type":21,"tag":209,"props":51995,"children":51996},{"class":211,"line":2397},[51997],{"type":21,"tag":209,"props":51998,"children":51999},{"style":222},[52000],{"type":26,"value":17631},{"type":21,"tag":22,"props":52002,"children":52003},{},[52004],{"type":26,"value":52005},"You're probably wincing a bit at the two var declarations at the top, but remember this is in a closure - those aren't global, they're local to the closure. The function that populates the array and object will run once, when the plugin closure itself first executes.",{"type":21,"tag":22,"props":52007,"children":52008},{},[52009],{"type":26,"value":52010},"So what's happening here? We have a mixed comma and space delimited list of known mime-types and extensions, with the extensions always next to their relevant mime-type. We first split the list on commas and push the first element (the mime-type), to our fileTypes array. Then, we split the i+1 element (the file extensions) on space, and create a key for each of the extensions with the value the mime-type.",{"type":21,"tag":22,"props":52012,"children":52013},{},[52014],{"type":26,"value":52015},"Why build our array and object from a string like this, instead of just specifying them statically? Well, besides the advantage of being able to build two objects for the price of one (that is, both the array and filter), this allows for easy editing and extension of our admittedly incomplete mime-type and file extension list. Need to add another file extension that should be considered application/octet-stream? Just add a space and the new extension next to exe there. Want to have .md files considered as text/plain? Just drop the extension in next to log.",{"type":21,"tag":22,"props":52017,"children":52018},{},[52019],{"type":26,"value":52020},"Next, when the plugin is called on an element with accept set in its options:",{"type":21,"tag":200,"props":52022,"children":52024},{"className":16138,"code":52023,"language":16140,"meta":8,"style":8},"/**\n* Translate the accept string or array into an array of mime types, based on the mime types in filters.\n* Input should look like the expected extensions:\n* \"swf, wmv, mp4\" or ['swf', 'wmv', 'mp4']\n* Or like mime type categories, or the mime types themselves:\n* \"application/*, application/pdf\" or ['image/\u003Cem>', 'plain/text']\n* @param {array|string} accept\n*/\nHup.prototype.acceptFilters = function(accept){\n    var mimes = [];\n    // Ensure accept is an array of extensions or mime types\n    if (typeof accept === 'string' || accept instanceof String)\n    {\n        accept = accept.split(/,/);\n    }\n    for (var i=0, len = accept.length; i \u003C len; i++)\n    {\n        var mime = accept[i].trim().split(///);\n        if (mime.length > 1)\n        {\n            if (mime[1] === '\u003C/em>')\n            {\n                // Every mime-type that begins with mime[0] now needs to be pushed into the mimes array\n                for (var j=0, jlen = fileTypes.length; j \u003C jlen; j++)\n                {\n                    var fileType = fileTypes[j].split(///);\n                    if (mime[0] === fileType[0]) mimes.push(fileTypes[j]);\n                }\n            } else {\n                // Pass the mime type through unmolested\n                mimes.push(mime.join('/'));\n            }\n        } else {\n            // Only an extension has been specified - map to the mime type\n            if (mime[0] in filters) mimes.push(filters[mime[0]]);\n        }\n    }\n    return mimes;\n};\n",[52025],{"type":21,"tag":63,"props":52026,"children":52027},{"__ignoreMap":8},[52028,52035,52043,52051,52059,52067,52075,52097,52104,52150,52169,52177,52227,52234,52275,52282,52346,52353,52395,52424,52431,52469,52476,52484,52549,52557,52591,52638,52645,52653,52661,52677,52684,52692,52700,52708,52715,52722,52730],{"type":21,"tag":209,"props":52029,"children":52030},{"class":211,"line":212},[52031],{"type":21,"tag":209,"props":52032,"children":52033},{"style":448},[52034],{"type":26,"value":731},{"type":21,"tag":209,"props":52036,"children":52037},{"class":211,"line":244},[52038],{"type":21,"tag":209,"props":52039,"children":52040},{"style":448},[52041],{"type":26,"value":52042},"* Translate the accept string or array into an array of mime types, based on the mime types in filters.\n",{"type":21,"tag":209,"props":52044,"children":52045},{"class":211,"line":254},[52046],{"type":21,"tag":209,"props":52047,"children":52048},{"style":448},[52049],{"type":26,"value":52050},"* Input should look like the expected extensions:\n",{"type":21,"tag":209,"props":52052,"children":52053},{"class":211,"line":279},[52054],{"type":21,"tag":209,"props":52055,"children":52056},{"style":448},[52057],{"type":26,"value":52058},"* \"swf, wmv, mp4\" or ['swf', 'wmv', 'mp4']\n",{"type":21,"tag":209,"props":52060,"children":52061},{"class":211,"line":288},[52062],{"type":21,"tag":209,"props":52063,"children":52064},{"style":448},[52065],{"type":26,"value":52066},"* Or like mime type categories, or the mime types themselves:\n",{"type":21,"tag":209,"props":52068,"children":52069},{"class":211,"line":307},[52070],{"type":21,"tag":209,"props":52071,"children":52072},{"style":448},[52073],{"type":26,"value":52074},"* \"application/*, application/pdf\" or ['image/\u003Cem>', 'plain/text']\n",{"type":21,"tag":209,"props":52076,"children":52077},{"class":211,"line":325},[52078,52083,52087,52092],{"type":21,"tag":209,"props":52079,"children":52080},{"style":448},[52081],{"type":26,"value":52082},"* ",{"type":21,"tag":209,"props":52084,"children":52085},{"style":216},[52086],{"type":26,"value":13311},{"type":21,"tag":209,"props":52088,"children":52089},{"style":360},[52090],{"type":26,"value":52091}," {array|string}",{"type":21,"tag":209,"props":52093,"children":52094},{"style":222},[52095],{"type":26,"value":52096}," accept\n",{"type":21,"tag":209,"props":52098,"children":52099},{"class":211,"line":334},[52100],{"type":21,"tag":209,"props":52101,"children":52102},{"style":448},[52103],{"type":26,"value":46822},{"type":21,"tag":209,"props":52105,"children":52106},{"class":211,"line":343},[52107,52112,52116,52120,52124,52129,52133,52137,52141,52146],{"type":21,"tag":209,"props":52108,"children":52109},{"style":263},[52110],{"type":26,"value":52111},"Hup",{"type":21,"tag":209,"props":52113,"children":52114},{"style":222},[52115],{"type":26,"value":378},{"type":21,"tag":209,"props":52117,"children":52118},{"style":263},[52119],{"type":26,"value":32662},{"type":21,"tag":209,"props":52121,"children":52122},{"style":222},[52123],{"type":26,"value":378},{"type":21,"tag":209,"props":52125,"children":52126},{"style":360},[52127],{"type":26,"value":52128},"acceptFilters",{"type":21,"tag":209,"props":52130,"children":52131},{"style":216},[52132],{"type":26,"value":271},{"type":21,"tag":209,"props":52134,"children":52135},{"style":216},[52136],{"type":26,"value":4789},{"type":21,"tag":209,"props":52138,"children":52139},{"style":222},[52140],{"type":26,"value":368},{"type":21,"tag":209,"props":52142,"children":52143},{"style":400},[52144],{"type":26,"value":52145},"accept",{"type":21,"tag":209,"props":52147,"children":52148},{"style":222},[52149],{"type":26,"value":2369},{"type":21,"tag":209,"props":52151,"children":52152},{"class":211,"line":351},[52153,52157,52161,52165],{"type":21,"tag":209,"props":52154,"children":52155},{"style":216},[52156],{"type":26,"value":16994},{"type":21,"tag":209,"props":52158,"children":52159},{"style":222},[52160],{"type":26,"value":51579},{"type":21,"tag":209,"props":52162,"children":52163},{"style":216},[52164],{"type":26,"value":1432},{"type":21,"tag":209,"props":52166,"children":52167},{"style":222},[52168],{"type":26,"value":51513},{"type":21,"tag":209,"props":52170,"children":52171},{"class":211,"line":444},[52172],{"type":21,"tag":209,"props":52173,"children":52174},{"style":448},[52175],{"type":26,"value":52176},"    // Ensure accept is an array of extensions or mime types\n",{"type":21,"tag":209,"props":52178,"children":52179},{"class":211,"line":454},[52180,52184,52188,52192,52197,52201,52206,52210,52214,52218,52223],{"type":21,"tag":209,"props":52181,"children":52182},{"style":216},[52183],{"type":26,"value":9249},{"type":21,"tag":209,"props":52185,"children":52186},{"style":222},[52187],{"type":26,"value":5569},{"type":21,"tag":209,"props":52189,"children":52190},{"style":216},[52191],{"type":26,"value":8036},{"type":21,"tag":209,"props":52193,"children":52194},{"style":222},[52195],{"type":26,"value":52196}," accept ",{"type":21,"tag":209,"props":52198,"children":52199},{"style":216},[52200],{"type":26,"value":14680},{"type":21,"tag":209,"props":52202,"children":52203},{"style":233},[52204],{"type":26,"value":52205}," 'string'",{"type":21,"tag":209,"props":52207,"children":52208},{"style":216},[52209],{"type":26,"value":4608},{"type":21,"tag":209,"props":52211,"children":52212},{"style":222},[52213],{"type":26,"value":52196},{"type":21,"tag":209,"props":52215,"children":52216},{"style":216},[52217],{"type":26,"value":45611},{"type":21,"tag":209,"props":52219,"children":52220},{"style":360},[52221],{"type":26,"value":52222}," String",{"type":21,"tag":209,"props":52224,"children":52225},{"style":222},[52226],{"type":26,"value":8924},{"type":21,"tag":209,"props":52228,"children":52229},{"class":211,"line":463},[52230],{"type":21,"tag":209,"props":52231,"children":52232},{"style":222},[52233],{"type":26,"value":32675},{"type":21,"tag":209,"props":52235,"children":52236},{"class":211,"line":472},[52237,52242,52246,52251,52255,52259,52263,52267,52271],{"type":21,"tag":209,"props":52238,"children":52239},{"style":222},[52240],{"type":26,"value":52241},"        accept ",{"type":21,"tag":209,"props":52243,"children":52244},{"style":216},[52245],{"type":26,"value":1432},{"type":21,"tag":209,"props":52247,"children":52248},{"style":222},[52249],{"type":26,"value":52250}," accept.",{"type":21,"tag":209,"props":52252,"children":52253},{"style":360},[52254],{"type":26,"value":6313},{"type":21,"tag":209,"props":52256,"children":52257},{"style":222},[52258],{"type":26,"value":368},{"type":21,"tag":209,"props":52260,"children":52261},{"style":233},[52262],{"type":26,"value":6460},{"type":21,"tag":209,"props":52264,"children":52265},{"style":6468},[52266],{"type":26,"value":51605},{"type":21,"tag":209,"props":52268,"children":52269},{"style":233},[52270],{"type":26,"value":6460},{"type":21,"tag":209,"props":52272,"children":52273},{"style":222},[52274],{"type":26,"value":2608},{"type":21,"tag":209,"props":52276,"children":52277},{"class":211,"line":480},[52278],{"type":21,"tag":209,"props":52279,"children":52280},{"style":222},[52281],{"type":26,"value":331},{"type":21,"tag":209,"props":52283,"children":52284},{"class":211,"line":489},[52285,52289,52293,52297,52301,52305,52309,52314,52318,52322,52326,52330,52334,52338,52342],{"type":21,"tag":209,"props":52286,"children":52287},{"style":216},[52288],{"type":26,"value":51637},{"type":21,"tag":209,"props":52290,"children":52291},{"style":222},[52292],{"type":26,"value":5569},{"type":21,"tag":209,"props":52294,"children":52295},{"style":216},[52296],{"type":26,"value":3909},{"type":21,"tag":209,"props":52298,"children":52299},{"style":222},[52300],{"type":26,"value":32266},{"type":21,"tag":209,"props":52302,"children":52303},{"style":216},[52304],{"type":26,"value":1432},{"type":21,"tag":209,"props":52306,"children":52307},{"style":263},[52308],{"type":26,"value":8554},{"type":21,"tag":209,"props":52310,"children":52311},{"style":222},[52312],{"type":26,"value":52313},", len ",{"type":21,"tag":209,"props":52315,"children":52316},{"style":216},[52317],{"type":26,"value":1432},{"type":21,"tag":209,"props":52319,"children":52320},{"style":222},[52321],{"type":26,"value":52250},{"type":21,"tag":209,"props":52323,"children":52324},{"style":263},[52325],{"type":26,"value":6344},{"type":21,"tag":209,"props":52327,"children":52328},{"style":222},[52329],{"type":26,"value":32292},{"type":21,"tag":209,"props":52331,"children":52332},{"style":216},[52333],{"type":26,"value":1985},{"type":21,"tag":209,"props":52335,"children":52336},{"style":222},[52337],{"type":26,"value":51688},{"type":21,"tag":209,"props":52339,"children":52340},{"style":216},[52341],{"type":26,"value":32306},{"type":21,"tag":209,"props":52343,"children":52344},{"style":222},[52345],{"type":26,"value":8924},{"type":21,"tag":209,"props":52347,"children":52348},{"class":211,"line":847},[52349],{"type":21,"tag":209,"props":52350,"children":52351},{"style":222},[52352],{"type":26,"value":32675},{"type":21,"tag":209,"props":52354,"children":52355},{"class":211,"line":860},[52356,52360,52365,52369,52374,52378,52382,52386,52390],{"type":21,"tag":209,"props":52357,"children":52358},{"style":216},[52359],{"type":26,"value":14505},{"type":21,"tag":209,"props":52361,"children":52362},{"style":222},[52363],{"type":26,"value":52364}," mime ",{"type":21,"tag":209,"props":52366,"children":52367},{"style":216},[52368],{"type":26,"value":1432},{"type":21,"tag":209,"props":52370,"children":52371},{"style":222},[52372],{"type":26,"value":52373}," accept[i].",{"type":21,"tag":209,"props":52375,"children":52376},{"style":360},[52377],{"type":26,"value":37982},{"type":21,"tag":209,"props":52379,"children":52380},{"style":222},[52381],{"type":26,"value":17096},{"type":21,"tag":209,"props":52383,"children":52384},{"style":360},[52385],{"type":26,"value":6313},{"type":21,"tag":209,"props":52387,"children":52388},{"style":222},[52389],{"type":26,"value":368},{"type":21,"tag":209,"props":52391,"children":52392},{"style":448},[52393],{"type":26,"value":52394},"///);\n",{"type":21,"tag":209,"props":52396,"children":52397},{"class":211,"line":877},[52398,52402,52407,52411,52416,52420],{"type":21,"tag":209,"props":52399,"children":52400},{"style":360},[52401],{"type":26,"value":6334},{"type":21,"tag":209,"props":52403,"children":52404},{"style":222},[52405],{"type":26,"value":52406}," (mime.",{"type":21,"tag":209,"props":52408,"children":52409},{"style":263},[52410],{"type":26,"value":6344},{"type":21,"tag":209,"props":52412,"children":52413},{"style":216},[52414],{"type":26,"value":52415}," >",{"type":21,"tag":209,"props":52417,"children":52418},{"style":263},[52419],{"type":26,"value":35439},{"type":21,"tag":209,"props":52421,"children":52422},{"style":222},[52423],{"type":26,"value":8924},{"type":21,"tag":209,"props":52425,"children":52426},{"class":211,"line":889},[52427],{"type":21,"tag":209,"props":52428,"children":52429},{"style":222},[52430],{"type":26,"value":17555},{"type":21,"tag":209,"props":52432,"children":52433},{"class":211,"line":902},[52434,52438,52442,52447,52451,52455,52460,52465],{"type":21,"tag":209,"props":52435,"children":52436},{"style":360},[52437],{"type":26,"value":14662},{"type":21,"tag":209,"props":52439,"children":52440},{"style":222},[52441],{"type":26,"value":5569},{"type":21,"tag":209,"props":52443,"children":52444},{"style":400},[52445],{"type":26,"value":52446},"mime",{"type":21,"tag":209,"props":52448,"children":52449},{"style":222},[52450],{"type":26,"value":28501},{"type":21,"tag":209,"props":52452,"children":52453},{"style":263},[52454],{"type":26,"value":3224},{"type":21,"tag":209,"props":52456,"children":52457},{"style":222},[52458],{"type":26,"value":52459},"] === ",{"type":21,"tag":209,"props":52461,"children":52462},{"style":233},[52463],{"type":26,"value":52464},"'\u003C/em>'",{"type":21,"tag":209,"props":52466,"children":52467},{"style":222},[52468],{"type":26,"value":8924},{"type":21,"tag":209,"props":52470,"children":52471},{"class":211,"line":914},[52472],{"type":21,"tag":209,"props":52473,"children":52474},{"style":222},[52475],{"type":26,"value":19379},{"type":21,"tag":209,"props":52477,"children":52478},{"class":211,"line":922},[52479],{"type":21,"tag":209,"props":52480,"children":52481},{"style":448},[52482],{"type":26,"value":52483},"                // Every mime-type that begins with mime[0] now needs to be pushed into the mimes array\n",{"type":21,"tag":209,"props":52485,"children":52486},{"class":211,"line":2312},[52487,52492,52496,52500,52504,52508,52512,52516,52520,52525,52529,52533,52537,52541,52545],{"type":21,"tag":209,"props":52488,"children":52489},{"style":216},[52490],{"type":26,"value":52491},"                for",{"type":21,"tag":209,"props":52493,"children":52494},{"style":222},[52495],{"type":26,"value":5569},{"type":21,"tag":209,"props":52497,"children":52498},{"style":216},[52499],{"type":26,"value":3909},{"type":21,"tag":209,"props":52501,"children":52502},{"style":222},[52503],{"type":26,"value":51795},{"type":21,"tag":209,"props":52505,"children":52506},{"style":216},[52507],{"type":26,"value":1432},{"type":21,"tag":209,"props":52509,"children":52510},{"style":263},[52511],{"type":26,"value":8554},{"type":21,"tag":209,"props":52513,"children":52514},{"style":222},[52515],{"type":26,"value":51808},{"type":21,"tag":209,"props":52517,"children":52518},{"style":216},[52519],{"type":26,"value":1432},{"type":21,"tag":209,"props":52521,"children":52522},{"style":222},[52523],{"type":26,"value":52524}," fileTypes.",{"type":21,"tag":209,"props":52526,"children":52527},{"style":263},[52528],{"type":26,"value":6344},{"type":21,"tag":209,"props":52530,"children":52531},{"style":222},[52532],{"type":26,"value":51826},{"type":21,"tag":209,"props":52534,"children":52535},{"style":216},[52536],{"type":26,"value":1985},{"type":21,"tag":209,"props":52538,"children":52539},{"style":222},[52540],{"type":26,"value":51835},{"type":21,"tag":209,"props":52542,"children":52543},{"style":216},[52544],{"type":26,"value":32306},{"type":21,"tag":209,"props":52546,"children":52547},{"style":222},[52548],{"type":26,"value":8924},{"type":21,"tag":209,"props":52550,"children":52551},{"class":211,"line":2321},[52552],{"type":21,"tag":209,"props":52553,"children":52554},{"style":222},[52555],{"type":26,"value":52556},"                {\n",{"type":21,"tag":209,"props":52558,"children":52559},{"class":211,"line":2372},[52560,52565,52570,52574,52579,52583,52587],{"type":21,"tag":209,"props":52561,"children":52562},{"style":216},[52563],{"type":26,"value":52564},"                    var",{"type":21,"tag":209,"props":52566,"children":52567},{"style":222},[52568],{"type":26,"value":52569}," fileType ",{"type":21,"tag":209,"props":52571,"children":52572},{"style":216},[52573],{"type":26,"value":1432},{"type":21,"tag":209,"props":52575,"children":52576},{"style":222},[52577],{"type":26,"value":52578}," fileTypes[j].",{"type":21,"tag":209,"props":52580,"children":52581},{"style":360},[52582],{"type":26,"value":6313},{"type":21,"tag":209,"props":52584,"children":52585},{"style":222},[52586],{"type":26,"value":368},{"type":21,"tag":209,"props":52588,"children":52589},{"style":448},[52590],{"type":26,"value":52394},{"type":21,"tag":209,"props":52592,"children":52593},{"class":211,"line":2381},[52594,52598,52603,52607,52611,52615,52620,52624,52629,52633],{"type":21,"tag":209,"props":52595,"children":52596},{"style":360},[52597],{"type":26,"value":30311},{"type":21,"tag":209,"props":52599,"children":52600},{"style":222},[52601],{"type":26,"value":52602}," (mime[",{"type":21,"tag":209,"props":52604,"children":52605},{"style":263},[52606],{"type":26,"value":8554},{"type":21,"tag":209,"props":52608,"children":52609},{"style":222},[52610],{"type":26,"value":1427},{"type":21,"tag":209,"props":52612,"children":52613},{"style":216},[52614],{"type":26,"value":14680},{"type":21,"tag":209,"props":52616,"children":52617},{"style":222},[52618],{"type":26,"value":52619}," fileType[",{"type":21,"tag":209,"props":52621,"children":52622},{"style":263},[52623],{"type":26,"value":8554},{"type":21,"tag":209,"props":52625,"children":52626},{"style":222},[52627],{"type":26,"value":52628},"]) mimes.",{"type":21,"tag":209,"props":52630,"children":52631},{"style":360},[52632],{"type":26,"value":51721},{"type":21,"tag":209,"props":52634,"children":52635},{"style":222},[52636],{"type":26,"value":52637},"(fileTypes[j]);\n",{"type":21,"tag":209,"props":52639,"children":52640},{"class":211,"line":2389},[52641],{"type":21,"tag":209,"props":52642,"children":52643},{"style":222},[52644],{"type":26,"value":19439},{"type":21,"tag":209,"props":52646,"children":52647},{"class":211,"line":2397},[52648],{"type":21,"tag":209,"props":52649,"children":52650},{"style":222},[52651],{"type":26,"value":52652},"            } else {\n",{"type":21,"tag":209,"props":52654,"children":52655},{"class":211,"line":2406},[52656],{"type":21,"tag":209,"props":52657,"children":52658},{"style":448},[52659],{"type":26,"value":52660},"                // Pass the mime type through unmolested\n",{"type":21,"tag":209,"props":52662,"children":52663},{"class":211,"line":2415},[52664,52669,52673],{"type":21,"tag":209,"props":52665,"children":52666},{"style":222},[52667],{"type":26,"value":52668},"                mimes.push(mime.join(",{"type":21,"tag":209,"props":52670,"children":52671},{"style":233},[52672],{"type":26,"value":7645},{"type":21,"tag":209,"props":52674,"children":52675},{"style":222},[52676],{"type":26,"value":4212},{"type":21,"tag":209,"props":52678,"children":52679},{"class":211,"line":2424},[52680],{"type":21,"tag":209,"props":52681,"children":52682},{"style":222},[52683],{"type":26,"value":14714},{"type":21,"tag":209,"props":52685,"children":52686},{"class":211,"line":2433},[52687],{"type":21,"tag":209,"props":52688,"children":52689},{"style":222},[52690],{"type":26,"value":52691},"        } else {\n",{"type":21,"tag":209,"props":52693,"children":52694},{"class":211,"line":2442},[52695],{"type":21,"tag":209,"props":52696,"children":52697},{"style":448},[52698],{"type":26,"value":52699},"            // Only an extension has been specified - map to the mime type\n",{"type":21,"tag":209,"props":52701,"children":52702},{"class":211,"line":2471},[52703],{"type":21,"tag":209,"props":52704,"children":52705},{"style":222},[52706],{"type":26,"value":52707},"            if (mime[0] in filters) mimes.push(filters[mime[0]]);\n",{"type":21,"tag":209,"props":52709,"children":52710},{"class":211,"line":2480},[52711],{"type":21,"tag":209,"props":52712,"children":52713},{"style":222},[52714],{"type":26,"value":2235},{"type":21,"tag":209,"props":52716,"children":52717},{"class":211,"line":2489},[52718],{"type":21,"tag":209,"props":52719,"children":52720},{"style":222},[52721],{"type":26,"value":331},{"type":21,"tag":209,"props":52723,"children":52724},{"class":211,"line":2516},[52725],{"type":21,"tag":209,"props":52726,"children":52727},{"style":222},[52728],{"type":26,"value":52729},"    return mimes;\n",{"type":21,"tag":209,"props":52731,"children":52732},{"class":211,"line":2525},[52733],{"type":21,"tag":209,"props":52734,"children":52735},{"style":222},[52736],{"type":26,"value":340},{"type":21,"tag":22,"props":52738,"children":52739},{},[52740,52742,52748,52750,52756],{"type":26,"value":52741},"Here, we allow the plugin user to set accept on the plugin as either a string or an array, and generate our mimes filter array from it. This allows us to be more permissive than the standard accept filter, with: ",{"type":21,"tag":63,"props":52743,"children":52745},{"className":52744},[],[52746],{"type":26,"value":52747},"\"wmv, audio/_, swf\" or ['wmv', 'audio/_', 'swf']",{"type":26,"value":52749}," both being valid. Notice the wildcard in the above example? In acceptFilters, we split on the forward slash and if the second part is a wildcard, we add every mime-type that matches the first part to the mimes filter array. If both parts are specified (ie. 'plain/text'), we pass it through unchanged (save for trimming any whitespace) - this allows the user to add mime-types that aren't in our list (ie. video/ogg, audio/flac, etc.). These can be combined - so if you want to allow any audio type, and include ones that aren't explicit in our list, you can specify ",{"type":21,"tag":63,"props":52751,"children":52753},{"className":52752},[],[52754],{"type":26,"value":52755},"['audio/*', 'audio/flac', 'audio/alac', 'audio/ogg']",{"type":26,"value":52757}," to do just that.",{"type":21,"tag":22,"props":52759,"children":52760},{},[52761],{"type":26,"value":52762},"Finally, when we're iterating through the fileList, we make our checks against the mimetype of the file in the fileList and, if its not in our accept filter, we fire a new event of type FILE_TYPE_ERROR and continue on to the next file in the list.",{"type":21,"tag":200,"props":52764,"children":52766},{"className":16138,"code":52765,"language":16140,"meta":8,"style":8}," /**\n* Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n* memory and passing them on to be used in the browser.\n* @param files\n* @param upload\n*/\nHup.prototype.processFiles = function(files, upload){\n    var that = this,\n        processed = 0,\n        accept = this.options.accept,\n        accepted = false,\n        maxSize = this.options.max_file_size,\n        fprocess;\n\nfor (var i=0, len = files.length; i &lt; len; i++)\n{\n    // Check file against mime accept restrictions if any restrictions are set\n    if (accept.length)\n    {\n        accepted = false;\n        for (var j=0, jlen = accept.length; j &lt; jlen; j++)\n        {\n            accepted = (files[i].type === accept[j]);\n            if (accepted) break;\n        }\n        if (!accepted)\n        {\n            this.input.trigger(Hup.state.FILE_TYPE_ERROR,\n                {state:Hup.state.FILE_TYPE_ERROR,\n                    error:'File type is '+files[i].type+', accepted types are '+\n                        accept.join(',')+'.'});\n            continue;\n        }\n    }\n    // Check file against size restrictions\n    if (maxSize &amp;&amp; files[i].size &gt; maxSize)\n    {\n        this.input.trigger(Hup.state.FILE_SIZE_ERROR,\n            {state:Hup.state.FILE_SIZE_ERROR,\n                error:'File size is '+files[i].size+', max file size is '+maxSize+'.'});\n        continue;\n    }\n    // Create new DeferXhr or DeferReader and listen on its progression and completion to fire the appropriate\n    // events for interested listeners on our input\n    fprocess = (upload) ? new DeferXhr(this.options, files[i]) :\n        new DeferReader(this.options.read_method, files[i]);\n\n    fprocess.progress(function(progress){\n        that.input.trigger(progress.state, progress);\n    }).done(function(res){\n        that.input.trigger(res.state, res);\n        processed++;\n        if (processed &gt;= len){\n            that.input.trigger((upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL ,\n                {state:(upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL, files:len});\n        }\n    }).fail(function(res)\n    {\n        that.input.trigger(res.state, res);\n    });\n}\n\n};\n",[52767],{"type":21,"tag":63,"props":52768,"children":52769},{"__ignoreMap":8},[52770,52778,52786,52794,52810,52826,52833,52886,52910,52930,52950,52970,52991,52999,53006,53072,53079,53087,53107,53114,53133,53197,53204,53230,53251,53258,53278,53285,53315,53331,53366,53405,53417,53424,53431,53439,53478,53485,53513,53529,53581,53593,53600,53608,53616,53663,53689,53696,53729,53746,53777,53793,53809,53839,53889,53926,53933,53964,53971,53986,53993,54000,54007],{"type":21,"tag":209,"props":52771,"children":52772},{"class":211,"line":212},[52773],{"type":21,"tag":209,"props":52774,"children":52775},{"style":448},[52776],{"type":26,"value":52777}," /**\n",{"type":21,"tag":209,"props":52779,"children":52780},{"class":211,"line":244},[52781],{"type":21,"tag":209,"props":52782,"children":52783},{"style":448},[52784],{"type":26,"value":52785},"* Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n",{"type":21,"tag":209,"props":52787,"children":52788},{"class":211,"line":254},[52789],{"type":21,"tag":209,"props":52790,"children":52791},{"style":448},[52792],{"type":26,"value":52793},"* memory and passing them on to be used in the browser.\n",{"type":21,"tag":209,"props":52795,"children":52796},{"class":211,"line":279},[52797,52801,52805],{"type":21,"tag":209,"props":52798,"children":52799},{"style":448},[52800],{"type":26,"value":52082},{"type":21,"tag":209,"props":52802,"children":52803},{"style":216},[52804],{"type":26,"value":13311},{"type":21,"tag":209,"props":52806,"children":52807},{"style":222},[52808],{"type":26,"value":52809}," files\n",{"type":21,"tag":209,"props":52811,"children":52812},{"class":211,"line":288},[52813,52817,52821],{"type":21,"tag":209,"props":52814,"children":52815},{"style":448},[52816],{"type":26,"value":52082},{"type":21,"tag":209,"props":52818,"children":52819},{"style":216},[52820],{"type":26,"value":13311},{"type":21,"tag":209,"props":52822,"children":52823},{"style":222},[52824],{"type":26,"value":52825}," upload\n",{"type":21,"tag":209,"props":52827,"children":52828},{"class":211,"line":307},[52829],{"type":21,"tag":209,"props":52830,"children":52831},{"style":448},[52832],{"type":26,"value":46822},{"type":21,"tag":209,"props":52834,"children":52835},{"class":211,"line":325},[52836,52840,52844,52848,52852,52857,52861,52865,52869,52874,52878,52882],{"type":21,"tag":209,"props":52837,"children":52838},{"style":263},[52839],{"type":26,"value":52111},{"type":21,"tag":209,"props":52841,"children":52842},{"style":222},[52843],{"type":26,"value":378},{"type":21,"tag":209,"props":52845,"children":52846},{"style":263},[52847],{"type":26,"value":32662},{"type":21,"tag":209,"props":52849,"children":52850},{"style":222},[52851],{"type":26,"value":378},{"type":21,"tag":209,"props":52853,"children":52854},{"style":360},[52855],{"type":26,"value":52856},"processFiles",{"type":21,"tag":209,"props":52858,"children":52859},{"style":216},[52860],{"type":26,"value":271},{"type":21,"tag":209,"props":52862,"children":52863},{"style":216},[52864],{"type":26,"value":4789},{"type":21,"tag":209,"props":52866,"children":52867},{"style":222},[52868],{"type":26,"value":368},{"type":21,"tag":209,"props":52870,"children":52871},{"style":400},[52872],{"type":26,"value":52873},"files",{"type":21,"tag":209,"props":52875,"children":52876},{"style":222},[52877],{"type":26,"value":408},{"type":21,"tag":209,"props":52879,"children":52880},{"style":400},[52881],{"type":26,"value":31175},{"type":21,"tag":209,"props":52883,"children":52884},{"style":222},[52885],{"type":26,"value":2369},{"type":21,"tag":209,"props":52887,"children":52888},{"class":211,"line":334},[52889,52893,52898,52902,52906],{"type":21,"tag":209,"props":52890,"children":52891},{"style":216},[52892],{"type":26,"value":16994},{"type":21,"tag":209,"props":52894,"children":52895},{"style":222},[52896],{"type":26,"value":52897}," that ",{"type":21,"tag":209,"props":52899,"children":52900},{"style":216},[52901],{"type":26,"value":1432},{"type":21,"tag":209,"props":52903,"children":52904},{"style":263},[52905],{"type":26,"value":20502},{"type":21,"tag":209,"props":52907,"children":52908},{"style":222},[52909],{"type":26,"value":304},{"type":21,"tag":209,"props":52911,"children":52912},{"class":211,"line":343},[52913,52918,52922,52926],{"type":21,"tag":209,"props":52914,"children":52915},{"style":222},[52916],{"type":26,"value":52917},"        processed ",{"type":21,"tag":209,"props":52919,"children":52920},{"style":216},[52921],{"type":26,"value":1432},{"type":21,"tag":209,"props":52923,"children":52924},{"style":263},[52925],{"type":26,"value":8009},{"type":21,"tag":209,"props":52927,"children":52928},{"style":222},[52929],{"type":26,"value":304},{"type":21,"tag":209,"props":52931,"children":52932},{"class":211,"line":351},[52933,52937,52941,52945],{"type":21,"tag":209,"props":52934,"children":52935},{"style":222},[52936],{"type":26,"value":52241},{"type":21,"tag":209,"props":52938,"children":52939},{"style":216},[52940],{"type":26,"value":1432},{"type":21,"tag":209,"props":52942,"children":52943},{"style":263},[52944],{"type":26,"value":20502},{"type":21,"tag":209,"props":52946,"children":52947},{"style":222},[52948],{"type":26,"value":52949},".options.accept,\n",{"type":21,"tag":209,"props":52951,"children":52952},{"class":211,"line":444},[52953,52958,52962,52966],{"type":21,"tag":209,"props":52954,"children":52955},{"style":222},[52956],{"type":26,"value":52957},"        accepted ",{"type":21,"tag":209,"props":52959,"children":52960},{"style":216},[52961],{"type":26,"value":1432},{"type":21,"tag":209,"props":52963,"children":52964},{"style":263},[52965],{"type":26,"value":14038},{"type":21,"tag":209,"props":52967,"children":52968},{"style":222},[52969],{"type":26,"value":304},{"type":21,"tag":209,"props":52971,"children":52972},{"class":211,"line":454},[52973,52978,52982,52986],{"type":21,"tag":209,"props":52974,"children":52975},{"style":222},[52976],{"type":26,"value":52977},"        maxSize ",{"type":21,"tag":209,"props":52979,"children":52980},{"style":216},[52981],{"type":26,"value":1432},{"type":21,"tag":209,"props":52983,"children":52984},{"style":263},[52985],{"type":26,"value":20502},{"type":21,"tag":209,"props":52987,"children":52988},{"style":222},[52989],{"type":26,"value":52990},".options.max_file_size,\n",{"type":21,"tag":209,"props":52992,"children":52993},{"class":211,"line":463},[52994],{"type":21,"tag":209,"props":52995,"children":52996},{"style":222},[52997],{"type":26,"value":52998},"        fprocess;\n",{"type":21,"tag":209,"props":53000,"children":53001},{"class":211,"line":472},[53002],{"type":21,"tag":209,"props":53003,"children":53004},{"emptyLinePlaceholder":248},[53005],{"type":26,"value":251},{"type":21,"tag":209,"props":53007,"children":53008},{"class":211,"line":480},[53009,53014,53018,53022,53026,53030,53034,53038,53042,53047,53051,53055,53059,53064,53068],{"type":21,"tag":209,"props":53010,"children":53011},{"style":216},[53012],{"type":26,"value":53013},"for",{"type":21,"tag":209,"props":53015,"children":53016},{"style":222},[53017],{"type":26,"value":5569},{"type":21,"tag":209,"props":53019,"children":53020},{"style":216},[53021],{"type":26,"value":3909},{"type":21,"tag":209,"props":53023,"children":53024},{"style":222},[53025],{"type":26,"value":32266},{"type":21,"tag":209,"props":53027,"children":53028},{"style":216},[53029],{"type":26,"value":1432},{"type":21,"tag":209,"props":53031,"children":53032},{"style":263},[53033],{"type":26,"value":8554},{"type":21,"tag":209,"props":53035,"children":53036},{"style":222},[53037],{"type":26,"value":52313},{"type":21,"tag":209,"props":53039,"children":53040},{"style":216},[53041],{"type":26,"value":1432},{"type":21,"tag":209,"props":53043,"children":53044},{"style":222},[53045],{"type":26,"value":53046}," files.",{"type":21,"tag":209,"props":53048,"children":53049},{"style":263},[53050],{"type":26,"value":6344},{"type":21,"tag":209,"props":53052,"children":53053},{"style":222},[53054],{"type":26,"value":32292},{"type":21,"tag":209,"props":53056,"children":53057},{"style":216},[53058],{"type":26,"value":32229},{"type":21,"tag":209,"props":53060,"children":53061},{"style":222},[53062],{"type":26,"value":53063},"lt; len; i",{"type":21,"tag":209,"props":53065,"children":53066},{"style":216},[53067],{"type":26,"value":32306},{"type":21,"tag":209,"props":53069,"children":53070},{"style":222},[53071],{"type":26,"value":8924},{"type":21,"tag":209,"props":53073,"children":53074},{"class":211,"line":489},[53075],{"type":21,"tag":209,"props":53076,"children":53077},{"style":222},[53078],{"type":26,"value":29353},{"type":21,"tag":209,"props":53080,"children":53081},{"class":211,"line":847},[53082],{"type":21,"tag":209,"props":53083,"children":53084},{"style":448},[53085],{"type":26,"value":53086},"    // Check file against mime accept restrictions if any restrictions are set\n",{"type":21,"tag":209,"props":53088,"children":53089},{"class":211,"line":860},[53090,53094,53099,53103],{"type":21,"tag":209,"props":53091,"children":53092},{"style":216},[53093],{"type":26,"value":9249},{"type":21,"tag":209,"props":53095,"children":53096},{"style":222},[53097],{"type":26,"value":53098}," (accept.",{"type":21,"tag":209,"props":53100,"children":53101},{"style":263},[53102],{"type":26,"value":6344},{"type":21,"tag":209,"props":53104,"children":53105},{"style":222},[53106],{"type":26,"value":8924},{"type":21,"tag":209,"props":53108,"children":53109},{"class":211,"line":877},[53110],{"type":21,"tag":209,"props":53111,"children":53112},{"style":222},[53113],{"type":26,"value":32675},{"type":21,"tag":209,"props":53115,"children":53116},{"class":211,"line":889},[53117,53121,53125,53129],{"type":21,"tag":209,"props":53118,"children":53119},{"style":222},[53120],{"type":26,"value":52957},{"type":21,"tag":209,"props":53122,"children":53123},{"style":216},[53124],{"type":26,"value":1432},{"type":21,"tag":209,"props":53126,"children":53127},{"style":263},[53128],{"type":26,"value":14038},{"type":21,"tag":209,"props":53130,"children":53131},{"style":222},[53132],{"type":26,"value":241},{"type":21,"tag":209,"props":53134,"children":53135},{"class":211,"line":902},[53136,53140,53144,53148,53152,53156,53160,53164,53168,53172,53176,53180,53184,53189,53193],{"type":21,"tag":209,"props":53137,"children":53138},{"style":216},[53139],{"type":26,"value":32253},{"type":21,"tag":209,"props":53141,"children":53142},{"style":222},[53143],{"type":26,"value":5569},{"type":21,"tag":209,"props":53145,"children":53146},{"style":216},[53147],{"type":26,"value":3909},{"type":21,"tag":209,"props":53149,"children":53150},{"style":222},[53151],{"type":26,"value":51795},{"type":21,"tag":209,"props":53153,"children":53154},{"style":216},[53155],{"type":26,"value":1432},{"type":21,"tag":209,"props":53157,"children":53158},{"style":263},[53159],{"type":26,"value":8554},{"type":21,"tag":209,"props":53161,"children":53162},{"style":222},[53163],{"type":26,"value":51808},{"type":21,"tag":209,"props":53165,"children":53166},{"style":216},[53167],{"type":26,"value":1432},{"type":21,"tag":209,"props":53169,"children":53170},{"style":222},[53171],{"type":26,"value":52250},{"type":21,"tag":209,"props":53173,"children":53174},{"style":263},[53175],{"type":26,"value":6344},{"type":21,"tag":209,"props":53177,"children":53178},{"style":222},[53179],{"type":26,"value":51826},{"type":21,"tag":209,"props":53181,"children":53182},{"style":216},[53183],{"type":26,"value":32229},{"type":21,"tag":209,"props":53185,"children":53186},{"style":222},[53187],{"type":26,"value":53188},"lt; jlen; j",{"type":21,"tag":209,"props":53190,"children":53191},{"style":216},[53192],{"type":26,"value":32306},{"type":21,"tag":209,"props":53194,"children":53195},{"style":222},[53196],{"type":26,"value":8924},{"type":21,"tag":209,"props":53198,"children":53199},{"class":211,"line":914},[53200],{"type":21,"tag":209,"props":53201,"children":53202},{"style":222},[53203],{"type":26,"value":17555},{"type":21,"tag":209,"props":53205,"children":53206},{"class":211,"line":922},[53207,53212,53216,53221,53225],{"type":21,"tag":209,"props":53208,"children":53209},{"style":222},[53210],{"type":26,"value":53211},"            accepted ",{"type":21,"tag":209,"props":53213,"children":53214},{"style":216},[53215],{"type":26,"value":1432},{"type":21,"tag":209,"props":53217,"children":53218},{"style":222},[53219],{"type":26,"value":53220}," (files[i].type ",{"type":21,"tag":209,"props":53222,"children":53223},{"style":216},[53224],{"type":26,"value":14680},{"type":21,"tag":209,"props":53226,"children":53227},{"style":222},[53228],{"type":26,"value":53229}," accept[j]);\n",{"type":21,"tag":209,"props":53231,"children":53232},{"class":211,"line":2312},[53233,53237,53242,53247],{"type":21,"tag":209,"props":53234,"children":53235},{"style":216},[53236],{"type":26,"value":14662},{"type":21,"tag":209,"props":53238,"children":53239},{"style":222},[53240],{"type":26,"value":53241}," (accepted) ",{"type":21,"tag":209,"props":53243,"children":53244},{"style":216},[53245],{"type":26,"value":53246},"break",{"type":21,"tag":209,"props":53248,"children":53249},{"style":222},[53250],{"type":26,"value":241},{"type":21,"tag":209,"props":53252,"children":53253},{"class":211,"line":2321},[53254],{"type":21,"tag":209,"props":53255,"children":53256},{"style":222},[53257],{"type":26,"value":2235},{"type":21,"tag":209,"props":53259,"children":53260},{"class":211,"line":2372},[53261,53265,53269,53273],{"type":21,"tag":209,"props":53262,"children":53263},{"style":216},[53264],{"type":26,"value":6334},{"type":21,"tag":209,"props":53266,"children":53267},{"style":222},[53268],{"type":26,"value":5569},{"type":21,"tag":209,"props":53270,"children":53271},{"style":216},[53272],{"type":26,"value":6455},{"type":21,"tag":209,"props":53274,"children":53275},{"style":222},[53276],{"type":26,"value":53277},"accepted)\n",{"type":21,"tag":209,"props":53279,"children":53280},{"class":211,"line":2381},[53281],{"type":21,"tag":209,"props":53282,"children":53283},{"style":222},[53284],{"type":26,"value":17555},{"type":21,"tag":209,"props":53286,"children":53287},{"class":211,"line":2389},[53288,53292,53297,53301,53306,53311],{"type":21,"tag":209,"props":53289,"children":53290},{"style":263},[53291],{"type":26,"value":2570},{"type":21,"tag":209,"props":53293,"children":53294},{"style":222},[53295],{"type":26,"value":53296},".input.",{"type":21,"tag":209,"props":53298,"children":53299},{"style":360},[53300],{"type":26,"value":499},{"type":21,"tag":209,"props":53302,"children":53303},{"style":222},[53304],{"type":26,"value":53305},"(Hup.state.",{"type":21,"tag":209,"props":53307,"children":53308},{"style":263},[53309],{"type":26,"value":53310},"FILE_TYPE_ERROR",{"type":21,"tag":209,"props":53312,"children":53313},{"style":222},[53314],{"type":26,"value":304},{"type":21,"tag":209,"props":53316,"children":53317},{"class":211,"line":2397},[53318,53323,53327],{"type":21,"tag":209,"props":53319,"children":53320},{"style":222},[53321],{"type":26,"value":53322},"                {state:Hup.state.",{"type":21,"tag":209,"props":53324,"children":53325},{"style":263},[53326],{"type":26,"value":53310},{"type":21,"tag":209,"props":53328,"children":53329},{"style":222},[53330],{"type":26,"value":304},{"type":21,"tag":209,"props":53332,"children":53333},{"class":211,"line":2406},[53334,53339,53344,53348,53353,53357,53362],{"type":21,"tag":209,"props":53335,"children":53336},{"style":222},[53337],{"type":26,"value":53338},"                    error:",{"type":21,"tag":209,"props":53340,"children":53341},{"style":233},[53342],{"type":26,"value":53343},"'File type is '",{"type":21,"tag":209,"props":53345,"children":53346},{"style":216},[53347],{"type":26,"value":17170},{"type":21,"tag":209,"props":53349,"children":53350},{"style":222},[53351],{"type":26,"value":53352},"files[i].type",{"type":21,"tag":209,"props":53354,"children":53355},{"style":216},[53356],{"type":26,"value":17170},{"type":21,"tag":209,"props":53358,"children":53359},{"style":233},[53360],{"type":26,"value":53361},"', accepted types are '",{"type":21,"tag":209,"props":53363,"children":53364},{"style":216},[53365],{"type":26,"value":43443},{"type":21,"tag":209,"props":53367,"children":53368},{"class":211,"line":2415},[53369,53374,53379,53383,53387,53392,53396,53401],{"type":21,"tag":209,"props":53370,"children":53371},{"style":222},[53372],{"type":26,"value":53373},"                        accept.",{"type":21,"tag":209,"props":53375,"children":53376},{"style":360},[53377],{"type":26,"value":53378},"join",{"type":21,"tag":209,"props":53380,"children":53381},{"style":222},[53382],{"type":26,"value":368},{"type":21,"tag":209,"props":53384,"children":53385},{"style":233},[53386],{"type":26,"value":32079},{"type":21,"tag":209,"props":53388,"children":53389},{"style":222},[53390],{"type":26,"value":53391},")",{"type":21,"tag":209,"props":53393,"children":53394},{"style":216},[53395],{"type":26,"value":17170},{"type":21,"tag":209,"props":53397,"children":53398},{"style":233},[53399],{"type":26,"value":53400},"'.'",{"type":21,"tag":209,"props":53402,"children":53403},{"style":222},[53404],{"type":26,"value":469},{"type":21,"tag":209,"props":53406,"children":53407},{"class":211,"line":2424},[53408,53413],{"type":21,"tag":209,"props":53409,"children":53410},{"style":216},[53411],{"type":26,"value":53412},"            continue",{"type":21,"tag":209,"props":53414,"children":53415},{"style":222},[53416],{"type":26,"value":241},{"type":21,"tag":209,"props":53418,"children":53419},{"class":211,"line":2433},[53420],{"type":21,"tag":209,"props":53421,"children":53422},{"style":222},[53423],{"type":26,"value":2235},{"type":21,"tag":209,"props":53425,"children":53426},{"class":211,"line":2442},[53427],{"type":21,"tag":209,"props":53428,"children":53429},{"style":222},[53430],{"type":26,"value":331},{"type":21,"tag":209,"props":53432,"children":53433},{"class":211,"line":2471},[53434],{"type":21,"tag":209,"props":53435,"children":53436},{"style":448},[53437],{"type":26,"value":53438},"    // Check file against size restrictions\n",{"type":21,"tag":209,"props":53440,"children":53441},{"class":211,"line":2480},[53442,53446,53451,53455,53460,53464,53469,53473],{"type":21,"tag":209,"props":53443,"children":53444},{"style":216},[53445],{"type":26,"value":9249},{"type":21,"tag":209,"props":53447,"children":53448},{"style":222},[53449],{"type":26,"value":53450}," (maxSize ",{"type":21,"tag":209,"props":53452,"children":53453},{"style":216},[53454],{"type":26,"value":32229},{"type":21,"tag":209,"props":53456,"children":53457},{"style":222},[53458],{"type":26,"value":53459},"amp;",{"type":21,"tag":209,"props":53461,"children":53462},{"style":216},[53463],{"type":26,"value":32229},{"type":21,"tag":209,"props":53465,"children":53466},{"style":222},[53467],{"type":26,"value":53468},"amp; files[i].size ",{"type":21,"tag":209,"props":53470,"children":53471},{"style":216},[53472],{"type":26,"value":32229},{"type":21,"tag":209,"props":53474,"children":53475},{"style":222},[53476],{"type":26,"value":53477},"gt; maxSize)\n",{"type":21,"tag":209,"props":53479,"children":53480},{"class":211,"line":2489},[53481],{"type":21,"tag":209,"props":53482,"children":53483},{"style":222},[53484],{"type":26,"value":32675},{"type":21,"tag":209,"props":53486,"children":53487},{"class":211,"line":2516},[53488,53492,53496,53500,53504,53509],{"type":21,"tag":209,"props":53489,"children":53490},{"style":263},[53491],{"type":26,"value":47121},{"type":21,"tag":209,"props":53493,"children":53494},{"style":222},[53495],{"type":26,"value":53296},{"type":21,"tag":209,"props":53497,"children":53498},{"style":360},[53499],{"type":26,"value":499},{"type":21,"tag":209,"props":53501,"children":53502},{"style":222},[53503],{"type":26,"value":53305},{"type":21,"tag":209,"props":53505,"children":53506},{"style":263},[53507],{"type":26,"value":53508},"FILE_SIZE_ERROR",{"type":21,"tag":209,"props":53510,"children":53511},{"style":222},[53512],{"type":26,"value":304},{"type":21,"tag":209,"props":53514,"children":53515},{"class":211,"line":2525},[53516,53521,53525],{"type":21,"tag":209,"props":53517,"children":53518},{"style":222},[53519],{"type":26,"value":53520},"            {state:Hup.state.",{"type":21,"tag":209,"props":53522,"children":53523},{"style":263},[53524],{"type":26,"value":53508},{"type":21,"tag":209,"props":53526,"children":53527},{"style":222},[53528],{"type":26,"value":304},{"type":21,"tag":209,"props":53530,"children":53531},{"class":211,"line":2533},[53532,53537,53542,53546,53551,53555,53560,53564,53569,53573,53577],{"type":21,"tag":209,"props":53533,"children":53534},{"style":222},[53535],{"type":26,"value":53536},"                error:",{"type":21,"tag":209,"props":53538,"children":53539},{"style":233},[53540],{"type":26,"value":53541},"'File size is '",{"type":21,"tag":209,"props":53543,"children":53544},{"style":216},[53545],{"type":26,"value":17170},{"type":21,"tag":209,"props":53547,"children":53548},{"style":222},[53549],{"type":26,"value":53550},"files[i].size",{"type":21,"tag":209,"props":53552,"children":53553},{"style":216},[53554],{"type":26,"value":17170},{"type":21,"tag":209,"props":53556,"children":53557},{"style":233},[53558],{"type":26,"value":53559},"', max file size is '",{"type":21,"tag":209,"props":53561,"children":53562},{"style":216},[53563],{"type":26,"value":17170},{"type":21,"tag":209,"props":53565,"children":53566},{"style":222},[53567],{"type":26,"value":53568},"maxSize",{"type":21,"tag":209,"props":53570,"children":53571},{"style":216},[53572],{"type":26,"value":17170},{"type":21,"tag":209,"props":53574,"children":53575},{"style":233},[53576],{"type":26,"value":53400},{"type":21,"tag":209,"props":53578,"children":53579},{"style":222},[53580],{"type":26,"value":469},{"type":21,"tag":209,"props":53582,"children":53583},{"class":211,"line":2542},[53584,53589],{"type":21,"tag":209,"props":53585,"children":53586},{"style":216},[53587],{"type":26,"value":53588},"        continue",{"type":21,"tag":209,"props":53590,"children":53591},{"style":222},[53592],{"type":26,"value":241},{"type":21,"tag":209,"props":53594,"children":53595},{"class":211,"line":2550},[53596],{"type":21,"tag":209,"props":53597,"children":53598},{"style":222},[53599],{"type":26,"value":331},{"type":21,"tag":209,"props":53601,"children":53602},{"class":211,"line":2564},[53603],{"type":21,"tag":209,"props":53604,"children":53605},{"style":448},[53606],{"type":26,"value":53607},"    // Create new DeferXhr or DeferReader and listen on its progression and completion to fire the appropriate\n",{"type":21,"tag":209,"props":53609,"children":53610},{"class":211,"line":2611},[53611],{"type":21,"tag":209,"props":53612,"children":53613},{"style":448},[53614],{"type":26,"value":53615},"    // events for interested listeners on our input\n",{"type":21,"tag":209,"props":53617,"children":53618},{"class":211,"line":2619},[53619,53624,53628,53633,53637,53641,53646,53650,53654,53659],{"type":21,"tag":209,"props":53620,"children":53621},{"style":222},[53622],{"type":26,"value":53623},"    fprocess ",{"type":21,"tag":209,"props":53625,"children":53626},{"style":216},[53627],{"type":26,"value":1432},{"type":21,"tag":209,"props":53629,"children":53630},{"style":222},[53631],{"type":26,"value":53632}," (upload) ",{"type":21,"tag":209,"props":53634,"children":53635},{"style":216},[53636],{"type":26,"value":8258},{"type":21,"tag":209,"props":53638,"children":53639},{"style":216},[53640],{"type":26,"value":6371},{"type":21,"tag":209,"props":53642,"children":53643},{"style":360},[53644],{"type":26,"value":53645}," DeferXhr",{"type":21,"tag":209,"props":53647,"children":53648},{"style":222},[53649],{"type":26,"value":368},{"type":21,"tag":209,"props":53651,"children":53652},{"style":263},[53653],{"type":26,"value":2508},{"type":21,"tag":209,"props":53655,"children":53656},{"style":222},[53657],{"type":26,"value":53658},".options, files[i]) ",{"type":21,"tag":209,"props":53660,"children":53661},{"style":216},[53662],{"type":26,"value":844},{"type":21,"tag":209,"props":53664,"children":53665},{"class":211,"line":2627},[53666,53671,53676,53680,53684],{"type":21,"tag":209,"props":53667,"children":53668},{"style":216},[53669],{"type":26,"value":53670},"        new",{"type":21,"tag":209,"props":53672,"children":53673},{"style":360},[53674],{"type":26,"value":53675}," DeferReader",{"type":21,"tag":209,"props":53677,"children":53678},{"style":222},[53679],{"type":26,"value":368},{"type":21,"tag":209,"props":53681,"children":53682},{"style":263},[53683],{"type":26,"value":2508},{"type":21,"tag":209,"props":53685,"children":53686},{"style":222},[53687],{"type":26,"value":53688},".options.read_method, files[i]);\n",{"type":21,"tag":209,"props":53690,"children":53691},{"class":211,"line":2636},[53692],{"type":21,"tag":209,"props":53693,"children":53694},{"emptyLinePlaceholder":248},[53695],{"type":26,"value":251},{"type":21,"tag":209,"props":53697,"children":53698},{"class":211,"line":2644},[53699,53704,53709,53713,53717,53721,53725],{"type":21,"tag":209,"props":53700,"children":53701},{"style":222},[53702],{"type":26,"value":53703},"    fprocess.",{"type":21,"tag":209,"props":53705,"children":53706},{"style":360},[53707],{"type":26,"value":53708},"progress",{"type":21,"tag":209,"props":53710,"children":53711},{"style":222},[53712],{"type":26,"value":368},{"type":21,"tag":209,"props":53714,"children":53715},{"style":216},[53716],{"type":26,"value":4622},{"type":21,"tag":209,"props":53718,"children":53719},{"style":222},[53720],{"type":26,"value":368},{"type":21,"tag":209,"props":53722,"children":53723},{"style":400},[53724],{"type":26,"value":53708},{"type":21,"tag":209,"props":53726,"children":53727},{"style":222},[53728],{"type":26,"value":2369},{"type":21,"tag":209,"props":53730,"children":53731},{"class":211,"line":2657},[53732,53737,53741],{"type":21,"tag":209,"props":53733,"children":53734},{"style":222},[53735],{"type":26,"value":53736},"        that.input.",{"type":21,"tag":209,"props":53738,"children":53739},{"style":360},[53740],{"type":26,"value":499},{"type":21,"tag":209,"props":53742,"children":53743},{"style":222},[53744],{"type":26,"value":53745},"(progress.state, progress);\n",{"type":21,"tag":209,"props":53747,"children":53748},{"class":211,"line":2728},[53749,53753,53757,53761,53765,53769,53773],{"type":21,"tag":209,"props":53750,"children":53751},{"style":222},[53752],{"type":26,"value":9062},{"type":21,"tag":209,"props":53754,"children":53755},{"style":360},[53756],{"type":26,"value":20845},{"type":21,"tag":209,"props":53758,"children":53759},{"style":222},[53760],{"type":26,"value":368},{"type":21,"tag":209,"props":53762,"children":53763},{"style":216},[53764],{"type":26,"value":4622},{"type":21,"tag":209,"props":53766,"children":53767},{"style":222},[53768],{"type":26,"value":368},{"type":21,"tag":209,"props":53770,"children":53771},{"style":400},[53772],{"type":26,"value":1385},{"type":21,"tag":209,"props":53774,"children":53775},{"style":222},[53776],{"type":26,"value":2369},{"type":21,"tag":209,"props":53778,"children":53779},{"class":211,"line":2758},[53780,53784,53788],{"type":21,"tag":209,"props":53781,"children":53782},{"style":222},[53783],{"type":26,"value":53736},{"type":21,"tag":209,"props":53785,"children":53786},{"style":360},[53787],{"type":26,"value":499},{"type":21,"tag":209,"props":53789,"children":53790},{"style":222},[53791],{"type":26,"value":53792},"(res.state, res);\n",{"type":21,"tag":209,"props":53794,"children":53795},{"class":211,"line":2776},[53796,53801,53805],{"type":21,"tag":209,"props":53797,"children":53798},{"style":222},[53799],{"type":26,"value":53800},"        processed",{"type":21,"tag":209,"props":53802,"children":53803},{"style":216},[53804],{"type":26,"value":32306},{"type":21,"tag":209,"props":53806,"children":53807},{"style":222},[53808],{"type":26,"value":241},{"type":21,"tag":209,"props":53810,"children":53811},{"class":211,"line":2785},[53812,53816,53821,53825,53830,53834],{"type":21,"tag":209,"props":53813,"children":53814},{"style":216},[53815],{"type":26,"value":6334},{"type":21,"tag":209,"props":53817,"children":53818},{"style":222},[53819],{"type":26,"value":53820}," (processed ",{"type":21,"tag":209,"props":53822,"children":53823},{"style":216},[53824],{"type":26,"value":32229},{"type":21,"tag":209,"props":53826,"children":53827},{"style":222},[53828],{"type":26,"value":53829},"gt;",{"type":21,"tag":209,"props":53831,"children":53832},{"style":216},[53833],{"type":26,"value":1432},{"type":21,"tag":209,"props":53835,"children":53836},{"style":222},[53837],{"type":26,"value":53838}," len){\n",{"type":21,"tag":209,"props":53840,"children":53841},{"class":211,"line":2793},[53842,53847,53851,53856,53860,53865,53870,53875,53879,53884],{"type":21,"tag":209,"props":53843,"children":53844},{"style":222},[53845],{"type":26,"value":53846},"            that.input.",{"type":21,"tag":209,"props":53848,"children":53849},{"style":360},[53850],{"type":26,"value":499},{"type":21,"tag":209,"props":53852,"children":53853},{"style":222},[53854],{"type":26,"value":53855},"((upload) ",{"type":21,"tag":209,"props":53857,"children":53858},{"style":216},[53859],{"type":26,"value":8258},{"type":21,"tag":209,"props":53861,"children":53862},{"style":222},[53863],{"type":26,"value":53864}," Hup.state.",{"type":21,"tag":209,"props":53866,"children":53867},{"style":263},[53868],{"type":26,"value":53869},"FILE_UPLOAD_ALL",{"type":21,"tag":209,"props":53871,"children":53872},{"style":216},[53873],{"type":26,"value":53874}," :",{"type":21,"tag":209,"props":53876,"children":53877},{"style":222},[53878],{"type":26,"value":53864},{"type":21,"tag":209,"props":53880,"children":53881},{"style":263},[53882],{"type":26,"value":53883},"FILE_READ_ALL",{"type":21,"tag":209,"props":53885,"children":53886},{"style":222},[53887],{"type":26,"value":53888}," ,\n",{"type":21,"tag":209,"props":53890,"children":53891},{"class":211,"line":2801},[53892,53897,53901,53905,53909,53913,53917,53921],{"type":21,"tag":209,"props":53893,"children":53894},{"style":222},[53895],{"type":26,"value":53896},"                {state:(upload) ",{"type":21,"tag":209,"props":53898,"children":53899},{"style":216},[53900],{"type":26,"value":8258},{"type":21,"tag":209,"props":53902,"children":53903},{"style":222},[53904],{"type":26,"value":53864},{"type":21,"tag":209,"props":53906,"children":53907},{"style":263},[53908],{"type":26,"value":53869},{"type":21,"tag":209,"props":53910,"children":53911},{"style":216},[53912],{"type":26,"value":53874},{"type":21,"tag":209,"props":53914,"children":53915},{"style":222},[53916],{"type":26,"value":53864},{"type":21,"tag":209,"props":53918,"children":53919},{"style":263},[53920],{"type":26,"value":53883},{"type":21,"tag":209,"props":53922,"children":53923},{"style":222},[53924],{"type":26,"value":53925},", files:len});\n",{"type":21,"tag":209,"props":53927,"children":53928},{"class":211,"line":2809},[53929],{"type":21,"tag":209,"props":53930,"children":53931},{"style":222},[53932],{"type":26,"value":2235},{"type":21,"tag":209,"props":53934,"children":53935},{"class":211,"line":10937},[53936,53940,53944,53948,53952,53956,53960],{"type":21,"tag":209,"props":53937,"children":53938},{"style":222},[53939],{"type":26,"value":9062},{"type":21,"tag":209,"props":53941,"children":53942},{"style":360},[53943],{"type":26,"value":20894},{"type":21,"tag":209,"props":53945,"children":53946},{"style":222},[53947],{"type":26,"value":368},{"type":21,"tag":209,"props":53949,"children":53950},{"style":216},[53951],{"type":26,"value":4622},{"type":21,"tag":209,"props":53953,"children":53954},{"style":222},[53955],{"type":26,"value":368},{"type":21,"tag":209,"props":53957,"children":53958},{"style":400},[53959],{"type":26,"value":1385},{"type":21,"tag":209,"props":53961,"children":53962},{"style":222},[53963],{"type":26,"value":8924},{"type":21,"tag":209,"props":53965,"children":53966},{"class":211,"line":10967},[53967],{"type":21,"tag":209,"props":53968,"children":53969},{"style":222},[53970],{"type":26,"value":32675},{"type":21,"tag":209,"props":53972,"children":53973},{"class":211,"line":11003},[53974,53978,53982],{"type":21,"tag":209,"props":53975,"children":53976},{"style":222},[53977],{"type":26,"value":53736},{"type":21,"tag":209,"props":53979,"children":53980},{"style":360},[53981],{"type":26,"value":499},{"type":21,"tag":209,"props":53983,"children":53984},{"style":222},[53985],{"type":26,"value":53792},{"type":21,"tag":209,"props":53987,"children":53988},{"class":211,"line":11038},[53989],{"type":21,"tag":209,"props":53990,"children":53991},{"style":222},[53992],{"type":26,"value":3391},{"type":21,"tag":209,"props":53994,"children":53995},{"class":211,"line":11072},[53996],{"type":21,"tag":209,"props":53997,"children":53998},{"style":222},[53999],{"type":26,"value":4415},{"type":21,"tag":209,"props":54001,"children":54002},{"class":211,"line":11106},[54003],{"type":21,"tag":209,"props":54004,"children":54005},{"emptyLinePlaceholder":248},[54006],{"type":26,"value":251},{"type":21,"tag":209,"props":54008,"children":54009},{"class":211,"line":11114},[54010],{"type":21,"tag":209,"props":54011,"children":54012},{"style":222},[54013],{"type":26,"value":340},{"type":21,"tag":3596,"props":54015,"children":54017},{"id":54016},"filtering-by-size",[54018],{"type":26,"value":54019},"Filtering By Size",{"type":21,"tag":22,"props":54021,"children":54022},{},[54023],{"type":26,"value":54024},"This is absurdly simple by comparison - the code above makes it clear we simply test the file size against the max size that the plugin user has set, and if we're above that, fire an event of type FILE_SIZE_ERROR with a meaningful error message.",{"type":21,"tag":22,"props":54026,"children":54027},{},[54028],{"type":26,"value":54029},"The test against maxSize before testing the fileSize is to allow the default value (0) to mean no maximum file size has been set - relying on js to understand 0 as a 'falsey' value. If max size is 0, then we skip the file size test entirely. Similarly, if no mime-types are in the accept array, we skip filtering the files by their type.",{"type":21,"tag":3596,"props":54031,"children":54033},{"id":54032},"better-docs",[54034],{"type":26,"value":54035},"Better Docs",{"type":21,"tag":22,"props":54037,"children":54038},{},[54039,54041,54048,54050,54056],{"type":26,"value":54040},"The documentation for HUp was a bit rushed. I followed the lead of my (still very alpha) ",{"type":21,"tag":29,"props":54042,"children":54045},{"href":54043,"rel":54044},"https://github.com/SaneMethod/KisKit",[93],[54046],{"type":26,"value":54047},"PHP Framework KisKit",{"type":26,"value":54049}," End Shameless Plug and tidied it up a bit. ",{"type":21,"tag":29,"props":54051,"children":54053},{"href":31113,"rel":54052},[93],[54054],{"type":26,"value":54055},"Take a look for yourself",{"type":26,"value":54057},", and feel free to open up an issue if you find bugs / want enhancements - your request might well make for a good future post. ;)",{"type":21,"tag":3490,"props":54059,"children":54060},{},[54061],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":54063},[54064,54065,54066],{"id":51439,"depth":244,"text":51442},{"id":54016,"depth":244,"text":54019},{"id":54032,"depth":244,"text":54035},"content:ckeefer:2013-5:ajax-uploader.md","ckeefer/2013-5/ajax-uploader.md","ckeefer/2013-5/ajax-uploader",{"user":3518,"name":3519},{"_path":54072,"_dir":54073,"_draft":7,"_partial":7,"_locale":8,"title":54074,"description":54075,"publishDate":54076,"tags":54077,"excerpt":54075,"body":54078,"_type":3511,"_id":56903,"_source":3513,"_file":56904,"_stem":56905,"_extension":3516,"author":56906},"/ckeefer/2013-11/jquery-ajax-blobs","2013-11","jQuery Ajax Blobs and Array Buffers","A big part of what makes jQuery a regular part of so many web projects is the clean interface it offers us for a number of sometimes messy built-in aspects of javascript. The most obvious is the DOM interface; and in second place, jquery ajax and its various shorthand methods. Abstracting away the difference between ActiveXObject and XMLHttpRequest is one of the most obvious benefits - but even if you don't need to worry about supporting old versions of IE, you might well enjoy the clean, object-based, promise-returning interface that jquery ajax offers.","2013-11-21",[12,16600],{"type":18,"children":54079,"toc":56901},[54080,54084,54105,54110,54115,54315,54343,54454,54477,54482,54546,54558,54563,54723,54728,54751,54756,54761,55208,55226,55240,55245,55250,55685,55713,55718,55723,55728,56886,56897],{"type":21,"tag":22,"props":54081,"children":54082},{},[54083],{"type":26,"value":54075},{"type":21,"tag":22,"props":54085,"children":54086},{},[54087,54089,54095,54096,54103],{"type":26,"value":54088},"It's a shame then, that if you want to take advantage of XMLHttpRequest Level 2 features like ",{"type":21,"tag":29,"props":54090,"children":54093},{"href":54091,"rel":54092},"https://developer.mozilla.org/en-US/docs/Web/API/Blob",[93],[54094],{"type":26,"value":15999},{"type":26,"value":5997},{"type":21,"tag":29,"props":54097,"children":54100},{"href":54098,"rel":54099},"https://developer.mozilla.org/en-US/docs/Web/API/ArrayBuffer",[93],[54101],{"type":26,"value":54102},"ArrayBuffer",{"type":26,"value":54104}," uploading/downloading, you have to fall back to the standard javascript api.",{"type":21,"tag":22,"props":54106,"children":54107},{},[54108],{"type":26,"value":54109},"Let's fix that, shall we?",{"type":21,"tag":22,"props":54111,"children":54112},{},[54113],{"type":26,"value":54114},"First, let's have an example of what recieving a Blob might look like with the standard api:",{"type":21,"tag":200,"props":54116,"children":54118},{"className":16138,"code":54117,"language":16140,"meta":8,"style":8},"var xhr = new XMLHttpRequest();\n\nxhr.addEventListener('load', function(){\n    if (xhr.status == 200){\n        //Do something with xhr.response (not responseText), which should be a Blob\n    }\n});\n\nxhr.open('GET', 'http://target.url');\nxhr.responseType = 'blob';\nxhr.send(null);\n",[54119],{"type":21,"tag":63,"props":54120,"children":54121},{"__ignoreMap":8},[54122,54149,54156,54187,54211,54219,54226,54233,54240,54272,54292],{"type":21,"tag":209,"props":54123,"children":54124},{"class":211,"line":212},[54125,54129,54133,54137,54141,54145],{"type":21,"tag":209,"props":54126,"children":54127},{"style":216},[54128],{"type":26,"value":3909},{"type":21,"tag":209,"props":54130,"children":54131},{"style":222},[54132],{"type":26,"value":20424},{"type":21,"tag":209,"props":54134,"children":54135},{"style":216},[54136],{"type":26,"value":1432},{"type":21,"tag":209,"props":54138,"children":54139},{"style":216},[54140],{"type":26,"value":6371},{"type":21,"tag":209,"props":54142,"children":54143},{"style":360},[54144],{"type":26,"value":20437},{"type":21,"tag":209,"props":54146,"children":54147},{"style":222},[54148],{"type":26,"value":4123},{"type":21,"tag":209,"props":54150,"children":54151},{"class":211,"line":244},[54152],{"type":21,"tag":209,"props":54153,"children":54154},{"emptyLinePlaceholder":248},[54155],{"type":26,"value":251},{"type":21,"tag":209,"props":54157,"children":54158},{"class":211,"line":254},[54159,54163,54167,54171,54175,54179,54183],{"type":21,"tag":209,"props":54160,"children":54161},{"style":222},[54162],{"type":26,"value":20456},{"type":21,"tag":209,"props":54164,"children":54165},{"style":360},[54166],{"type":26,"value":14995},{"type":21,"tag":209,"props":54168,"children":54169},{"style":222},[54170],{"type":26,"value":368},{"type":21,"tag":209,"props":54172,"children":54173},{"style":233},[54174],{"type":26,"value":20469},{"type":21,"tag":209,"props":54176,"children":54177},{"style":222},[54178],{"type":26,"value":408},{"type":21,"tag":209,"props":54180,"children":54181},{"style":216},[54182],{"type":26,"value":4622},{"type":21,"tag":209,"props":54184,"children":54185},{"style":222},[54186],{"type":26,"value":2561},{"type":21,"tag":209,"props":54188,"children":54189},{"class":211,"line":279},[54190,54194,54199,54203,54207],{"type":21,"tag":209,"props":54191,"children":54192},{"style":216},[54193],{"type":26,"value":9249},{"type":21,"tag":209,"props":54195,"children":54196},{"style":222},[54197],{"type":26,"value":54198}," (xhr.status ",{"type":21,"tag":209,"props":54200,"children":54201},{"style":216},[54202],{"type":26,"value":23855},{"type":21,"tag":209,"props":54204,"children":54205},{"style":263},[54206],{"type":26,"value":21517},{"type":21,"tag":209,"props":54208,"children":54209},{"style":222},[54210],{"type":26,"value":2369},{"type":21,"tag":209,"props":54212,"children":54213},{"class":211,"line":288},[54214],{"type":21,"tag":209,"props":54215,"children":54216},{"style":448},[54217],{"type":26,"value":54218},"        //Do something with xhr.response (not responseText), which should be a Blob\n",{"type":21,"tag":209,"props":54220,"children":54221},{"class":211,"line":307},[54222],{"type":21,"tag":209,"props":54223,"children":54224},{"style":222},[54225],{"type":26,"value":331},{"type":21,"tag":209,"props":54227,"children":54228},{"class":211,"line":325},[54229],{"type":21,"tag":209,"props":54230,"children":54231},{"style":222},[54232],{"type":26,"value":469},{"type":21,"tag":209,"props":54234,"children":54235},{"class":211,"line":334},[54236],{"type":21,"tag":209,"props":54237,"children":54238},{"emptyLinePlaceholder":248},[54239],{"type":26,"value":251},{"type":21,"tag":209,"props":54241,"children":54242},{"class":211,"line":343},[54243,54247,54251,54255,54259,54263,54268],{"type":21,"tag":209,"props":54244,"children":54245},{"style":222},[54246],{"type":26,"value":20456},{"type":21,"tag":209,"props":54248,"children":54249},{"style":360},[54250],{"type":26,"value":20680},{"type":21,"tag":209,"props":54252,"children":54253},{"style":222},[54254],{"type":26,"value":368},{"type":21,"tag":209,"props":54256,"children":54257},{"style":233},[54258],{"type":26,"value":7780},{"type":21,"tag":209,"props":54260,"children":54261},{"style":222},[54262],{"type":26,"value":408},{"type":21,"tag":209,"props":54264,"children":54265},{"style":233},[54266],{"type":26,"value":54267},"'http://target.url'",{"type":21,"tag":209,"props":54269,"children":54270},{"style":222},[54271],{"type":26,"value":2608},{"type":21,"tag":209,"props":54273,"children":54274},{"class":211,"line":351},[54275,54279,54283,54288],{"type":21,"tag":209,"props":54276,"children":54277},{"style":222},[54278],{"type":26,"value":20655},{"type":21,"tag":209,"props":54280,"children":54281},{"style":216},[54282],{"type":26,"value":1432},{"type":21,"tag":209,"props":54284,"children":54285},{"style":233},[54286],{"type":26,"value":54287}," 'blob'",{"type":21,"tag":209,"props":54289,"children":54290},{"style":222},[54291],{"type":26,"value":241},{"type":21,"tag":209,"props":54293,"children":54294},{"class":211,"line":444},[54295,54299,54303,54307,54311],{"type":21,"tag":209,"props":54296,"children":54297},{"style":222},[54298],{"type":26,"value":20456},{"type":21,"tag":209,"props":54300,"children":54301},{"style":360},[54302],{"type":26,"value":6696},{"type":21,"tag":209,"props":54304,"children":54305},{"style":222},[54306],{"type":26,"value":368},{"type":21,"tag":209,"props":54308,"children":54309},{"style":263},[54310],{"type":26,"value":20198},{"type":21,"tag":209,"props":54312,"children":54313},{"style":222},[54314],{"type":26,"value":2608},{"type":21,"tag":22,"props":54316,"children":54317},{},[54318,54320,54326,54327,54333,54335,54341],{"type":26,"value":54319},"It's not terrible, but we're sure to miss being able to dangle our ",{"type":21,"tag":63,"props":54321,"children":54323},{"className":54322},[],[54324],{"type":26,"value":54325},".done",{"type":26,"value":5997},{"type":21,"tag":63,"props":54328,"children":54330},{"className":54329},[],[54331],{"type":26,"value":54332},".fail",{"type":26,"value":54334}," blocks off of our nice, compact ",{"type":21,"tag":63,"props":54336,"children":54338},{"className":54337},[],[54339],{"type":26,"value":54340},"$.ajax",{"type":26,"value":54342}," request. What we want is to be able to do something like this:",{"type":21,"tag":200,"props":54344,"children":54346},{"className":16138,"code":54345,"language":16140,"meta":8,"style":8},"$.ajax({\n    dataType:'blob',\n    type:'GET',\n    url:'http://target.url'\n}).done(function(blob){\n    // Do something with the Blob returned to us from the ajax request\n});\n",[54347],{"type":21,"tag":63,"props":54348,"children":54349},{"__ignoreMap":8},[54350,54365,54381,54396,54408,54439,54447],{"type":21,"tag":209,"props":54351,"children":54352},{"class":211,"line":212},[54353,54357,54361],{"type":21,"tag":209,"props":54354,"children":54355},{"style":222},[54356],{"type":26,"value":20778},{"type":21,"tag":209,"props":54358,"children":54359},{"style":360},[54360],{"type":26,"value":20783},{"type":21,"tag":209,"props":54362,"children":54363},{"style":222},[54364],{"type":26,"value":7767},{"type":21,"tag":209,"props":54366,"children":54367},{"class":211,"line":244},[54368,54372,54377],{"type":21,"tag":209,"props":54369,"children":54370},{"style":222},[54371],{"type":26,"value":20827},{"type":21,"tag":209,"props":54373,"children":54374},{"style":233},[54375],{"type":26,"value":54376},"'blob'",{"type":21,"tag":209,"props":54378,"children":54379},{"style":222},[54380],{"type":26,"value":304},{"type":21,"tag":209,"props":54382,"children":54383},{"class":211,"line":254},[54384,54388,54392],{"type":21,"tag":209,"props":54385,"children":54386},{"style":222},[54387],{"type":26,"value":20795},{"type":21,"tag":209,"props":54389,"children":54390},{"style":233},[54391],{"type":26,"value":7780},{"type":21,"tag":209,"props":54393,"children":54394},{"style":222},[54395],{"type":26,"value":304},{"type":21,"tag":209,"props":54397,"children":54398},{"class":211,"line":279},[54399,54403],{"type":21,"tag":209,"props":54400,"children":54401},{"style":222},[54402],{"type":26,"value":20811},{"type":21,"tag":209,"props":54404,"children":54405},{"style":233},[54406],{"type":26,"value":54407},"'http://target.url'\n",{"type":21,"tag":209,"props":54409,"children":54410},{"class":211,"line":288},[54411,54415,54419,54423,54427,54431,54435],{"type":21,"tag":209,"props":54412,"children":54413},{"style":222},[54414],{"type":26,"value":20840},{"type":21,"tag":209,"props":54416,"children":54417},{"style":360},[54418],{"type":26,"value":20845},{"type":21,"tag":209,"props":54420,"children":54421},{"style":222},[54422],{"type":26,"value":368},{"type":21,"tag":209,"props":54424,"children":54425},{"style":216},[54426],{"type":26,"value":4622},{"type":21,"tag":209,"props":54428,"children":54429},{"style":222},[54430],{"type":26,"value":368},{"type":21,"tag":209,"props":54432,"children":54433},{"style":400},[54434],{"type":26,"value":21238},{"type":21,"tag":209,"props":54436,"children":54437},{"style":222},[54438],{"type":26,"value":2369},{"type":21,"tag":209,"props":54440,"children":54441},{"class":211,"line":307},[54442],{"type":21,"tag":209,"props":54443,"children":54444},{"style":448},[54445],{"type":26,"value":54446},"    // Do something with the Blob returned to us from the ajax request\n",{"type":21,"tag":209,"props":54448,"children":54449},{"class":211,"line":325},[54450],{"type":21,"tag":209,"props":54451,"children":54452},{"style":222},[54453],{"type":26,"value":469},{"type":21,"tag":22,"props":54455,"children":54456},{},[54457,54459,54466,54468,54475],{"type":26,"value":54458},"So, we're going to borrow a trick we discussed back in our ",{"type":21,"tag":29,"props":54460,"children":54463},{"href":54461,"rel":54462},"http://www.alproduction.local/blog/2013/06/ajax-caching-transports-compatible-with-jquery-deferred/",[93],[54464],{"type":26,"value":54465},"Ajax Caching",{"type":26,"value":54467}," article, and create an ",{"type":21,"tag":29,"props":54469,"children":54472},{"href":54470,"rel":54471},"http://api.jquery.com/jQuery.ajaxTransport/",[93],[54473],{"type":26,"value":54474},"Ajax Transport",{"type":26,"value":54476}," to handle sending and receiving Blobs and ArrayBuffers.",{"type":21,"tag":22,"props":54478,"children":54479},{},[54480],{"type":26,"value":54481},"Final code is included at the end of the article (for those who want to get straight to the good stuff), but let's walk through it and discuss what's happening.",{"type":21,"tag":200,"props":54483,"children":54485},{"className":16138,"code":54484,"language":16140,"meta":8,"style":8},"$.ajaxTransport('+*', function(options, originalOptions, jqXHR){\n",[54486],{"type":21,"tag":63,"props":54487,"children":54488},{"__ignoreMap":8},[54489],{"type":21,"tag":209,"props":54490,"children":54491},{"class":211,"line":212},[54492,54496,54500,54504,54509,54513,54517,54521,54525,54529,54534,54538,54542],{"type":21,"tag":209,"props":54493,"children":54494},{"style":222},[54495],{"type":26,"value":20778},{"type":21,"tag":209,"props":54497,"children":54498},{"style":360},[54499],{"type":26,"value":30492},{"type":21,"tag":209,"props":54501,"children":54502},{"style":222},[54503],{"type":26,"value":368},{"type":21,"tag":209,"props":54505,"children":54506},{"style":233},[54507],{"type":26,"value":54508},"'+*'",{"type":21,"tag":209,"props":54510,"children":54511},{"style":222},[54512],{"type":26,"value":408},{"type":21,"tag":209,"props":54514,"children":54515},{"style":216},[54516],{"type":26,"value":4622},{"type":21,"tag":209,"props":54518,"children":54519},{"style":222},[54520],{"type":26,"value":368},{"type":21,"tag":209,"props":54522,"children":54523},{"style":400},[54524],{"type":26,"value":28349},{"type":21,"tag":209,"props":54526,"children":54527},{"style":222},[54528],{"type":26,"value":408},{"type":21,"tag":209,"props":54530,"children":54531},{"style":400},[54532],{"type":26,"value":54533},"originalOptions",{"type":21,"tag":209,"props":54535,"children":54536},{"style":222},[54537],{"type":26,"value":408},{"type":21,"tag":209,"props":54539,"children":54540},{"style":400},[54541],{"type":26,"value":20911},{"type":21,"tag":209,"props":54543,"children":54544},{"style":222},[54545],{"type":26,"value":2369},{"type":21,"tag":22,"props":54547,"children":54548},{},[54549,54551,54556],{"type":26,"value":54550},"Notice the \"+",{"type":21,"tag":1084,"props":54552,"children":54553},{},[54554],{"type":26,"value":54555},"\" string? If you recall from our Ajax Caching article, this string indicates what dataType we want to match against when considering whether to use the transports defined in the following function. There we set type 'json', since we only wanted to cache json replies. Here though, we set '",{"type":26,"value":54557},"' to match all types (we'll narrow our definition down inside the function proper - we just want to make sure that our function gets a crack at providing the transport whenever appropriate, and the expected return dataType could be anything if we're sending a blob or arraybuffer).",{"type":21,"tag":22,"props":54559,"children":54560},{},[54561],{"type":26,"value":54562},"But what's with the '+' preceeding the '*'? That's a little (undocumented) trick found from perusing the jquery source - it indicates we want our transport to be prepended to the list of available transports, as opposed to appended. When matching against all types, we need to include this to prevent the standard transport factory from hogging the request.",{"type":21,"tag":200,"props":54564,"children":54566},{"className":16138,"code":54565,"language":16140,"meta":8,"style":8},"if (window.FormData && ((options.dataType && (options.dataType == 'blob' || options.dataType == 'arraybuffer'))\n        || (options.data && ((window.Blob && options.data instanceof Blob)\n            || (window.ArrayBuffer && options.data instanceof ArrayBuffer)))\n        ))\n    {\n",[54567],{"type":21,"tag":63,"props":54568,"children":54569},{"__ignoreMap":8},[54570,54631,54673,54708,54716],{"type":21,"tag":209,"props":54571,"children":54572},{"class":211,"line":212},[54573,54577,54582,54586,54591,54595,54600,54604,54608,54612,54617,54621,54626],{"type":21,"tag":209,"props":54574,"children":54575},{"style":216},[54576],{"type":26,"value":4301},{"type":21,"tag":209,"props":54578,"children":54579},{"style":222},[54580],{"type":26,"value":54581}," (window.FormData ",{"type":21,"tag":209,"props":54583,"children":54584},{"style":216},[54585],{"type":26,"value":18381},{"type":21,"tag":209,"props":54587,"children":54588},{"style":222},[54589],{"type":26,"value":54590}," ((options.dataType ",{"type":21,"tag":209,"props":54592,"children":54593},{"style":216},[54594],{"type":26,"value":18381},{"type":21,"tag":209,"props":54596,"children":54597},{"style":222},[54598],{"type":26,"value":54599}," (options.dataType ",{"type":21,"tag":209,"props":54601,"children":54602},{"style":216},[54603],{"type":26,"value":23855},{"type":21,"tag":209,"props":54605,"children":54606},{"style":233},[54607],{"type":26,"value":54287},{"type":21,"tag":209,"props":54609,"children":54610},{"style":216},[54611],{"type":26,"value":4608},{"type":21,"tag":209,"props":54613,"children":54614},{"style":222},[54615],{"type":26,"value":54616}," options.dataType ",{"type":21,"tag":209,"props":54618,"children":54619},{"style":216},[54620],{"type":26,"value":23855},{"type":21,"tag":209,"props":54622,"children":54623},{"style":233},[54624],{"type":26,"value":54625}," 'arraybuffer'",{"type":21,"tag":209,"props":54627,"children":54628},{"style":222},[54629],{"type":26,"value":54630},"))\n",{"type":21,"tag":209,"props":54632,"children":54633},{"class":211,"line":244},[54634,54639,54643,54647,54652,54656,54661,54665,54669],{"type":21,"tag":209,"props":54635,"children":54636},{"style":216},[54637],{"type":26,"value":54638},"        ||",{"type":21,"tag":209,"props":54640,"children":54641},{"style":222},[54642],{"type":26,"value":28582},{"type":21,"tag":209,"props":54644,"children":54645},{"style":216},[54646],{"type":26,"value":18381},{"type":21,"tag":209,"props":54648,"children":54649},{"style":222},[54650],{"type":26,"value":54651}," ((window.Blob ",{"type":21,"tag":209,"props":54653,"children":54654},{"style":216},[54655],{"type":26,"value":18381},{"type":21,"tag":209,"props":54657,"children":54658},{"style":222},[54659],{"type":26,"value":54660}," options.data ",{"type":21,"tag":209,"props":54662,"children":54663},{"style":216},[54664],{"type":26,"value":45611},{"type":21,"tag":209,"props":54666,"children":54667},{"style":360},[54668],{"type":26,"value":16108},{"type":21,"tag":209,"props":54670,"children":54671},{"style":222},[54672],{"type":26,"value":8924},{"type":21,"tag":209,"props":54674,"children":54675},{"class":211,"line":254},[54676,54681,54686,54690,54694,54698,54703],{"type":21,"tag":209,"props":54677,"children":54678},{"style":216},[54679],{"type":26,"value":54680},"            ||",{"type":21,"tag":209,"props":54682,"children":54683},{"style":222},[54684],{"type":26,"value":54685}," (window.ArrayBuffer ",{"type":21,"tag":209,"props":54687,"children":54688},{"style":216},[54689],{"type":26,"value":18381},{"type":21,"tag":209,"props":54691,"children":54692},{"style":222},[54693],{"type":26,"value":54660},{"type":21,"tag":209,"props":54695,"children":54696},{"style":216},[54697],{"type":26,"value":45611},{"type":21,"tag":209,"props":54699,"children":54700},{"style":360},[54701],{"type":26,"value":54702}," ArrayBuffer",{"type":21,"tag":209,"props":54704,"children":54705},{"style":222},[54706],{"type":26,"value":54707},")))\n",{"type":21,"tag":209,"props":54709,"children":54710},{"class":211,"line":279},[54711],{"type":21,"tag":209,"props":54712,"children":54713},{"style":222},[54714],{"type":26,"value":54715},"        ))\n",{"type":21,"tag":209,"props":54717,"children":54718},{"class":211,"line":288},[54719],{"type":21,"tag":209,"props":54720,"children":54721},{"style":222},[54722],{"type":26,"value":32675},{"type":21,"tag":22,"props":54724,"children":54725},{},[54726],{"type":26,"value":54727},"I told you we'd narrow down our definition. :)",{"type":21,"tag":22,"props":54729,"children":54730},{},[54731,54733,54740,54742,54749],{"type":26,"value":54732},"So what's this monster if statement checking against? First, we check against ",{"type":21,"tag":29,"props":54734,"children":54737},{"href":54735,"rel":54736},"https://developer.mozilla.org/en-US/docs/Web/API/FormData",[93],[54738],{"type":26,"value":54739},"window.FormData",{"type":26,"value":54741},"; as a feature of ",{"type":21,"tag":29,"props":54743,"children":54746},{"href":54744,"rel":54745},"http://www.w3.org/TR/XMLHttpRequest2/#interface-formdata",[93],[54747],{"type":26,"value":54748},"XMLHttpRequest Level 2",{"type":26,"value":54750},", its a reasonable way to feature detect whether the browser is ready to provide us the necessary features for blob/arraybuffer sending/receiving.",{"type":21,"tag":22,"props":54752,"children":54753},{},[54754],{"type":26,"value":54755},"Next, we check to see whether a dataType has been defined, and if so, whether the dataType is blob or arraybuffer, indicating we're expecting our request to return us one of these data types.",{"type":21,"tag":22,"props":54757,"children":54758},{},[54759],{"type":26,"value":54760},"Otherwise, we check to see whether data has been defined, and if so, whether the browser supports Blobs and our data is an instance of Blob, or the same for array buffers. If the browser supports XMLHttpRequest 2 and we're either sending or receiving a blob/arraybuffer (or sending AND receiving), then we provide the transport. Remember, for $.ajaxTransport, we indicate we're providing the transport by returning something. Returning nothing indicates that the next transport factory should try to handle this request.",{"type":21,"tag":200,"props":54762,"children":54764},{"className":16138,"code":54763,"language":16140,"meta":8,"style":8},"        return {\n            send: function(headers, completeCallback){\n                var xhr = new XMLHttpRequest(),\n                    url = options.url || window.location.href,\n                    type = options.type || 'GET',\n                    dataType = options.dataType || 'text',\n                    data = options.data || null,\n                    async = options.async || true;\n\n                xhr.addEventListener('load', function(){\n                    var res = {};\n\n                    res[dataType] = xhr.response;\n                    completeCallback(xhr.status, xhr.statusText, res, xhr.getAllResponseHeaders());\n                });\n\n                xhr.open(type, url, async);\n                xhr.responseType = dataType;\n                xhr.send(data);\n            },\n            abort: function(){\n                jqXHR.abort();\n            }\n        };\n",[54765],{"type":21,"tag":63,"props":54766,"children":54767},{"__ignoreMap":8},[54768,54779,54815,54842,54868,54897,54926,54954,54983,54990,55022,55041,55048,55065,55087,55094,55101,55117,55134,55150,55157,55177,55194,55201],{"type":21,"tag":209,"props":54769,"children":54770},{"class":211,"line":212},[54771,54775],{"type":21,"tag":209,"props":54772,"children":54773},{"style":216},[54774],{"type":26,"value":3069},{"type":21,"tag":209,"props":54776,"children":54777},{"style":222},[54778],{"type":26,"value":276},{"type":21,"tag":209,"props":54780,"children":54781},{"class":211,"line":244},[54782,54787,54791,54795,54799,54803,54807,54811],{"type":21,"tag":209,"props":54783,"children":54784},{"style":360},[54785],{"type":26,"value":54786},"            send",{"type":21,"tag":209,"props":54788,"children":54789},{"style":222},[54790],{"type":26,"value":7821},{"type":21,"tag":209,"props":54792,"children":54793},{"style":216},[54794],{"type":26,"value":4622},{"type":21,"tag":209,"props":54796,"children":54797},{"style":222},[54798],{"type":26,"value":368},{"type":21,"tag":209,"props":54800,"children":54801},{"style":400},[54802],{"type":26,"value":17980},{"type":21,"tag":209,"props":54804,"children":54805},{"style":222},[54806],{"type":26,"value":408},{"type":21,"tag":209,"props":54808,"children":54809},{"style":400},[54810],{"type":26,"value":30733},{"type":21,"tag":209,"props":54812,"children":54813},{"style":222},[54814],{"type":26,"value":2369},{"type":21,"tag":209,"props":54816,"children":54817},{"class":211,"line":254},[54818,54822,54826,54830,54834,54838],{"type":21,"tag":209,"props":54819,"children":54820},{"style":216},[54821],{"type":26,"value":30208},{"type":21,"tag":209,"props":54823,"children":54824},{"style":222},[54825],{"type":26,"value":20424},{"type":21,"tag":209,"props":54827,"children":54828},{"style":216},[54829],{"type":26,"value":1432},{"type":21,"tag":209,"props":54831,"children":54832},{"style":216},[54833],{"type":26,"value":6371},{"type":21,"tag":209,"props":54835,"children":54836},{"style":360},[54837],{"type":26,"value":20437},{"type":21,"tag":209,"props":54839,"children":54840},{"style":222},[54841],{"type":26,"value":13988},{"type":21,"tag":209,"props":54843,"children":54844},{"class":211,"line":279},[54845,54850,54854,54859,54863],{"type":21,"tag":209,"props":54846,"children":54847},{"style":222},[54848],{"type":26,"value":54849},"                    url ",{"type":21,"tag":209,"props":54851,"children":54852},{"style":216},[54853],{"type":26,"value":1432},{"type":21,"tag":209,"props":54855,"children":54856},{"style":222},[54857],{"type":26,"value":54858}," options.url ",{"type":21,"tag":209,"props":54860,"children":54861},{"style":216},[54862],{"type":26,"value":13270},{"type":21,"tag":209,"props":54864,"children":54865},{"style":222},[54866],{"type":26,"value":54867}," window.location.href,\n",{"type":21,"tag":209,"props":54869,"children":54870},{"class":211,"line":288},[54871,54876,54880,54884,54888,54893],{"type":21,"tag":209,"props":54872,"children":54873},{"style":222},[54874],{"type":26,"value":54875},"                    type ",{"type":21,"tag":209,"props":54877,"children":54878},{"style":216},[54879],{"type":26,"value":1432},{"type":21,"tag":209,"props":54881,"children":54882},{"style":222},[54883],{"type":26,"value":28573},{"type":21,"tag":209,"props":54885,"children":54886},{"style":216},[54887],{"type":26,"value":13270},{"type":21,"tag":209,"props":54889,"children":54890},{"style":233},[54891],{"type":26,"value":54892}," 'GET'",{"type":21,"tag":209,"props":54894,"children":54895},{"style":222},[54896],{"type":26,"value":304},{"type":21,"tag":209,"props":54898,"children":54899},{"class":211,"line":307},[54900,54905,54909,54913,54917,54922],{"type":21,"tag":209,"props":54901,"children":54902},{"style":222},[54903],{"type":26,"value":54904},"                    dataType ",{"type":21,"tag":209,"props":54906,"children":54907},{"style":216},[54908],{"type":26,"value":1432},{"type":21,"tag":209,"props":54910,"children":54911},{"style":222},[54912],{"type":26,"value":54616},{"type":21,"tag":209,"props":54914,"children":54915},{"style":216},[54916],{"type":26,"value":13270},{"type":21,"tag":209,"props":54918,"children":54919},{"style":233},[54920],{"type":26,"value":54921}," 'text'",{"type":21,"tag":209,"props":54923,"children":54924},{"style":222},[54925],{"type":26,"value":304},{"type":21,"tag":209,"props":54927,"children":54928},{"class":211,"line":325},[54929,54934,54938,54942,54946,54950],{"type":21,"tag":209,"props":54930,"children":54931},{"style":222},[54932],{"type":26,"value":54933},"                    data ",{"type":21,"tag":209,"props":54935,"children":54936},{"style":216},[54937],{"type":26,"value":1432},{"type":21,"tag":209,"props":54939,"children":54940},{"style":222},[54941],{"type":26,"value":54660},{"type":21,"tag":209,"props":54943,"children":54944},{"style":216},[54945],{"type":26,"value":13270},{"type":21,"tag":209,"props":54947,"children":54948},{"style":263},[54949],{"type":26,"value":8282},{"type":21,"tag":209,"props":54951,"children":54952},{"style":222},[54953],{"type":26,"value":304},{"type":21,"tag":209,"props":54955,"children":54956},{"class":211,"line":334},[54957,54962,54966,54971,54975,54979],{"type":21,"tag":209,"props":54958,"children":54959},{"style":222},[54960],{"type":26,"value":54961},"                    async ",{"type":21,"tag":209,"props":54963,"children":54964},{"style":216},[54965],{"type":26,"value":1432},{"type":21,"tag":209,"props":54967,"children":54968},{"style":222},[54969],{"type":26,"value":54970}," options.async ",{"type":21,"tag":209,"props":54972,"children":54973},{"style":216},[54974],{"type":26,"value":13270},{"type":21,"tag":209,"props":54976,"children":54977},{"style":263},[54978],{"type":26,"value":14819},{"type":21,"tag":209,"props":54980,"children":54981},{"style":222},[54982],{"type":26,"value":241},{"type":21,"tag":209,"props":54984,"children":54985},{"class":211,"line":343},[54986],{"type":21,"tag":209,"props":54987,"children":54988},{"emptyLinePlaceholder":248},[54989],{"type":26,"value":251},{"type":21,"tag":209,"props":54991,"children":54992},{"class":211,"line":351},[54993,54998,55002,55006,55010,55014,55018],{"type":21,"tag":209,"props":54994,"children":54995},{"style":222},[54996],{"type":26,"value":54997},"                xhr.",{"type":21,"tag":209,"props":54999,"children":55000},{"style":360},[55001],{"type":26,"value":14995},{"type":21,"tag":209,"props":55003,"children":55004},{"style":222},[55005],{"type":26,"value":368},{"type":21,"tag":209,"props":55007,"children":55008},{"style":233},[55009],{"type":26,"value":20469},{"type":21,"tag":209,"props":55011,"children":55012},{"style":222},[55013],{"type":26,"value":408},{"type":21,"tag":209,"props":55015,"children":55016},{"style":216},[55017],{"type":26,"value":4622},{"type":21,"tag":209,"props":55019,"children":55020},{"style":222},[55021],{"type":26,"value":2561},{"type":21,"tag":209,"props":55023,"children":55024},{"class":211,"line":444},[55025,55029,55033,55037],{"type":21,"tag":209,"props":55026,"children":55027},{"style":216},[55028],{"type":26,"value":52564},{"type":21,"tag":209,"props":55030,"children":55031},{"style":222},[55032],{"type":26,"value":23677},{"type":21,"tag":209,"props":55034,"children":55035},{"style":216},[55036],{"type":26,"value":1432},{"type":21,"tag":209,"props":55038,"children":55039},{"style":222},[55040],{"type":26,"value":7963},{"type":21,"tag":209,"props":55042,"children":55043},{"class":211,"line":454},[55044],{"type":21,"tag":209,"props":55045,"children":55046},{"emptyLinePlaceholder":248},[55047],{"type":26,"value":251},{"type":21,"tag":209,"props":55049,"children":55050},{"class":211,"line":463},[55051,55056,55060],{"type":21,"tag":209,"props":55052,"children":55053},{"style":222},[55054],{"type":26,"value":55055},"                    res[dataType] ",{"type":21,"tag":209,"props":55057,"children":55058},{"style":216},[55059],{"type":26,"value":1432},{"type":21,"tag":209,"props":55061,"children":55062},{"style":222},[55063],{"type":26,"value":55064}," xhr.response;\n",{"type":21,"tag":209,"props":55066,"children":55067},{"class":211,"line":472},[55068,55073,55078,55083],{"type":21,"tag":209,"props":55069,"children":55070},{"style":360},[55071],{"type":26,"value":55072},"                    completeCallback",{"type":21,"tag":209,"props":55074,"children":55075},{"style":222},[55076],{"type":26,"value":55077},"(xhr.status, xhr.statusText, res, xhr.",{"type":21,"tag":209,"props":55079,"children":55080},{"style":360},[55081],{"type":26,"value":55082},"getAllResponseHeaders",{"type":21,"tag":209,"props":55084,"children":55085},{"style":222},[55086],{"type":26,"value":4161},{"type":21,"tag":209,"props":55088,"children":55089},{"class":211,"line":480},[55090],{"type":21,"tag":209,"props":55091,"children":55092},{"style":222},[55093],{"type":26,"value":28121},{"type":21,"tag":209,"props":55095,"children":55096},{"class":211,"line":489},[55097],{"type":21,"tag":209,"props":55098,"children":55099},{"emptyLinePlaceholder":248},[55100],{"type":26,"value":251},{"type":21,"tag":209,"props":55102,"children":55103},{"class":211,"line":847},[55104,55108,55112],{"type":21,"tag":209,"props":55105,"children":55106},{"style":222},[55107],{"type":26,"value":54997},{"type":21,"tag":209,"props":55109,"children":55110},{"style":360},[55111],{"type":26,"value":20680},{"type":21,"tag":209,"props":55113,"children":55114},{"style":222},[55115],{"type":26,"value":55116},"(type, url, async);\n",{"type":21,"tag":209,"props":55118,"children":55119},{"class":211,"line":860},[55120,55125,55129],{"type":21,"tag":209,"props":55121,"children":55122},{"style":222},[55123],{"type":26,"value":55124},"                xhr.responseType ",{"type":21,"tag":209,"props":55126,"children":55127},{"style":216},[55128],{"type":26,"value":1432},{"type":21,"tag":209,"props":55130,"children":55131},{"style":222},[55132],{"type":26,"value":55133}," dataType;\n",{"type":21,"tag":209,"props":55135,"children":55136},{"class":211,"line":877},[55137,55141,55145],{"type":21,"tag":209,"props":55138,"children":55139},{"style":222},[55140],{"type":26,"value":54997},{"type":21,"tag":209,"props":55142,"children":55143},{"style":360},[55144],{"type":26,"value":6696},{"type":21,"tag":209,"props":55146,"children":55147},{"style":222},[55148],{"type":26,"value":55149},"(data);\n",{"type":21,"tag":209,"props":55151,"children":55152},{"class":211,"line":889},[55153],{"type":21,"tag":209,"props":55154,"children":55155},{"style":222},[55156],{"type":26,"value":34436},{"type":21,"tag":209,"props":55158,"children":55159},{"class":211,"line":902},[55160,55165,55169,55173],{"type":21,"tag":209,"props":55161,"children":55162},{"style":360},[55163],{"type":26,"value":55164},"            abort",{"type":21,"tag":209,"props":55166,"children":55167},{"style":222},[55168],{"type":26,"value":7821},{"type":21,"tag":209,"props":55170,"children":55171},{"style":216},[55172],{"type":26,"value":4622},{"type":21,"tag":209,"props":55174,"children":55175},{"style":222},[55176],{"type":26,"value":2561},{"type":21,"tag":209,"props":55178,"children":55179},{"class":211,"line":914},[55180,55185,55190],{"type":21,"tag":209,"props":55181,"children":55182},{"style":222},[55183],{"type":26,"value":55184},"                jqXHR.",{"type":21,"tag":209,"props":55186,"children":55187},{"style":360},[55188],{"type":26,"value":55189},"abort",{"type":21,"tag":209,"props":55191,"children":55192},{"style":222},[55193],{"type":26,"value":4123},{"type":21,"tag":209,"props":55195,"children":55196},{"class":211,"line":922},[55197],{"type":21,"tag":209,"props":55198,"children":55199},{"style":222},[55200],{"type":26,"value":14714},{"type":21,"tag":209,"props":55202,"children":55203},{"class":211,"line":2312},[55204],{"type":21,"tag":209,"props":55205,"children":55206},{"style":222},[55207],{"type":26,"value":14955},{"type":21,"tag":22,"props":55209,"children":55210},{},[55211,55213,55218,55219,55224],{"type":26,"value":55212},"As you'll recall from our Ajax Caching article, we need to provide two functions for a transport - ",{"type":21,"tag":63,"props":55214,"children":55216},{"className":55215},[],[55217],{"type":26,"value":6696},{"type":26,"value":12851},{"type":21,"tag":63,"props":55220,"children":55222},{"className":55221},[],[55223],{"type":26,"value":55189},{"type":26,"value":55225},". The body of send should look familiar here - we consider the options set in the ajax options block, and set reasonable defaults if the needed options aren't set, instantiate a new XMLHttpRequest object, open the request, set the appropriate response type, and send data as appropriate. In abort, we simply call abort on the jqXHR object passed to the transport factory function.",{"type":21,"tag":22,"props":55227,"children":55228},{},[55229,55231,55238],{"type":26,"value":55230},"So where is this useful? You remember our ",{"type":21,"tag":29,"props":55232,"children":55235},{"href":55233,"rel":55234},"http://www.alproduction.local/blog/2013/04/ajax-upload-part-ii-xhr2-and-filereader/",[93],[55236],{"type":26,"value":55237},"FileReader/XHR2",{"type":26,"value":55239}," plugin, right? This is a complement (and partial replacement, if desired) to that - now we can receive blobs/arraybuffers from the server, as well as send them up, all within the comfortably familiar jQuery interface. Neat, huh?",{"type":21,"tag":22,"props":55241,"children":55242},{},[55243],{"type":26,"value":55244},"But wait! The plugin gives us feedback on upload progress! Can we do that with this ajax transport?",{"type":21,"tag":22,"props":55246,"children":55247},{},[55248],{"type":26,"value":55249},"Of course! Take a look at our xhr2 plugin post again, and you'll see where we're listening in on the 'progress' event on our XMLHttpRequest object. The relevant handler function looks like:",{"type":21,"tag":200,"props":55251,"children":55253},{"className":16138,"code":55252,"language":16140,"meta":8,"style":8},"DeferXhr.prototype.uploadProgress = function(event){\n        if (event.lengthComputable)\n        {\n            this.progress = (event.loaded/event.total);\n            if (this.options.chunked)\n            {\n                this.progress *= (this.end/this.file.size);\n            }\n            this.time.end = +new Date();\n            this.time.speed = (this.file.size*this.progress)/(this.time.end-this.time.start)*1000;\n            console.log('time:', this.time.end-this.time.start, 'speed:', this.time.speed);\n            this.defer.notify({state:Hup.state.FILE_UPLOAD_PROGRESS, file_name:this.file.name, speed:this.time.speed,\n                progress:this.progress});\n        }\n    };\n",[55254],{"type":21,"tag":63,"props":55255,"children":55256},{"__ignoreMap":8},[55257,55302,55314,55321,55351,55371,55378,55421,55428,55456,55541,55604,55654,55671,55678],{"type":21,"tag":209,"props":55258,"children":55259},{"class":211,"line":212},[55260,55265,55269,55273,55277,55282,55286,55290,55294,55298],{"type":21,"tag":209,"props":55261,"children":55262},{"style":263},[55263],{"type":26,"value":55264},"DeferXhr",{"type":21,"tag":209,"props":55266,"children":55267},{"style":222},[55268],{"type":26,"value":378},{"type":21,"tag":209,"props":55270,"children":55271},{"style":263},[55272],{"type":26,"value":32662},{"type":21,"tag":209,"props":55274,"children":55275},{"style":222},[55276],{"type":26,"value":378},{"type":21,"tag":209,"props":55278,"children":55279},{"style":360},[55280],{"type":26,"value":55281},"uploadProgress",{"type":21,"tag":209,"props":55283,"children":55284},{"style":216},[55285],{"type":26,"value":271},{"type":21,"tag":209,"props":55287,"children":55288},{"style":216},[55289],{"type":26,"value":4789},{"type":21,"tag":209,"props":55291,"children":55292},{"style":222},[55293],{"type":26,"value":368},{"type":21,"tag":209,"props":55295,"children":55296},{"style":400},[55297],{"type":26,"value":25805},{"type":21,"tag":209,"props":55299,"children":55300},{"style":222},[55301],{"type":26,"value":2369},{"type":21,"tag":209,"props":55303,"children":55304},{"class":211,"line":244},[55305,55309],{"type":21,"tag":209,"props":55306,"children":55307},{"style":216},[55308],{"type":26,"value":6334},{"type":21,"tag":209,"props":55310,"children":55311},{"style":222},[55312],{"type":26,"value":55313}," (event.lengthComputable)\n",{"type":21,"tag":209,"props":55315,"children":55316},{"class":211,"line":254},[55317],{"type":21,"tag":209,"props":55318,"children":55319},{"style":222},[55320],{"type":26,"value":17555},{"type":21,"tag":209,"props":55322,"children":55323},{"class":211,"line":279},[55324,55328,55333,55337,55342,55346],{"type":21,"tag":209,"props":55325,"children":55326},{"style":263},[55327],{"type":26,"value":2570},{"type":21,"tag":209,"props":55329,"children":55330},{"style":222},[55331],{"type":26,"value":55332},".progress ",{"type":21,"tag":209,"props":55334,"children":55335},{"style":216},[55336],{"type":26,"value":1432},{"type":21,"tag":209,"props":55338,"children":55339},{"style":222},[55340],{"type":26,"value":55341}," (event.loaded",{"type":21,"tag":209,"props":55343,"children":55344},{"style":216},[55345],{"type":26,"value":6460},{"type":21,"tag":209,"props":55347,"children":55348},{"style":222},[55349],{"type":26,"value":55350},"event.total);\n",{"type":21,"tag":209,"props":55352,"children":55353},{"class":211,"line":288},[55354,55358,55362,55366],{"type":21,"tag":209,"props":55355,"children":55356},{"style":216},[55357],{"type":26,"value":14662},{"type":21,"tag":209,"props":55359,"children":55360},{"style":222},[55361],{"type":26,"value":5569},{"type":21,"tag":209,"props":55363,"children":55364},{"style":263},[55365],{"type":26,"value":2508},{"type":21,"tag":209,"props":55367,"children":55368},{"style":222},[55369],{"type":26,"value":55370},".options.chunked)\n",{"type":21,"tag":209,"props":55372,"children":55373},{"class":211,"line":307},[55374],{"type":21,"tag":209,"props":55375,"children":55376},{"style":222},[55377],{"type":26,"value":19379},{"type":21,"tag":209,"props":55379,"children":55380},{"class":211,"line":325},[55381,55386,55390,55395,55399,55403,55408,55412,55416],{"type":21,"tag":209,"props":55382,"children":55383},{"style":263},[55384],{"type":26,"value":55385},"                this",{"type":21,"tag":209,"props":55387,"children":55388},{"style":222},[55389],{"type":26,"value":55332},{"type":21,"tag":209,"props":55391,"children":55392},{"style":216},[55393],{"type":26,"value":55394},"*=",{"type":21,"tag":209,"props":55396,"children":55397},{"style":222},[55398],{"type":26,"value":5569},{"type":21,"tag":209,"props":55400,"children":55401},{"style":263},[55402],{"type":26,"value":2508},{"type":21,"tag":209,"props":55404,"children":55405},{"style":222},[55406],{"type":26,"value":55407},".end",{"type":21,"tag":209,"props":55409,"children":55410},{"style":216},[55411],{"type":26,"value":6460},{"type":21,"tag":209,"props":55413,"children":55414},{"style":263},[55415],{"type":26,"value":2508},{"type":21,"tag":209,"props":55417,"children":55418},{"style":222},[55419],{"type":26,"value":55420},".file.size);\n",{"type":21,"tag":209,"props":55422,"children":55423},{"class":211,"line":334},[55424],{"type":21,"tag":209,"props":55425,"children":55426},{"style":222},[55427],{"type":26,"value":14714},{"type":21,"tag":209,"props":55429,"children":55430},{"class":211,"line":343},[55431,55435,55440,55444,55448,55452],{"type":21,"tag":209,"props":55432,"children":55433},{"style":263},[55434],{"type":26,"value":2570},{"type":21,"tag":209,"props":55436,"children":55437},{"style":222},[55438],{"type":26,"value":55439},".time.end ",{"type":21,"tag":209,"props":55441,"children":55442},{"style":216},[55443],{"type":26,"value":1432},{"type":21,"tag":209,"props":55445,"children":55446},{"style":216},[55447],{"type":26,"value":20050},{"type":21,"tag":209,"props":55449,"children":55450},{"style":360},[55451],{"type":26,"value":17189},{"type":21,"tag":209,"props":55453,"children":55454},{"style":222},[55455],{"type":26,"value":4123},{"type":21,"tag":209,"props":55457,"children":55458},{"class":211,"line":351},[55459,55463,55468,55472,55476,55480,55485,55489,55493,55498,55502,55506,55510,55515,55519,55523,55528,55532,55537],{"type":21,"tag":209,"props":55460,"children":55461},{"style":263},[55462],{"type":26,"value":2570},{"type":21,"tag":209,"props":55464,"children":55465},{"style":222},[55466],{"type":26,"value":55467},".time.speed ",{"type":21,"tag":209,"props":55469,"children":55470},{"style":216},[55471],{"type":26,"value":1432},{"type":21,"tag":209,"props":55473,"children":55474},{"style":222},[55475],{"type":26,"value":5569},{"type":21,"tag":209,"props":55477,"children":55478},{"style":263},[55479],{"type":26,"value":2508},{"type":21,"tag":209,"props":55481,"children":55482},{"style":222},[55483],{"type":26,"value":55484},".file.size",{"type":21,"tag":209,"props":55486,"children":55487},{"style":216},[55488],{"type":26,"value":944},{"type":21,"tag":209,"props":55490,"children":55491},{"style":263},[55492],{"type":26,"value":2508},{"type":21,"tag":209,"props":55494,"children":55495},{"style":222},[55496],{"type":26,"value":55497},".progress)",{"type":21,"tag":209,"props":55499,"children":55500},{"style":216},[55501],{"type":26,"value":6460},{"type":21,"tag":209,"props":55503,"children":55504},{"style":222},[55505],{"type":26,"value":368},{"type":21,"tag":209,"props":55507,"children":55508},{"style":263},[55509],{"type":26,"value":2508},{"type":21,"tag":209,"props":55511,"children":55512},{"style":222},[55513],{"type":26,"value":55514},".time.end",{"type":21,"tag":209,"props":55516,"children":55517},{"style":216},[55518],{"type":26,"value":42628},{"type":21,"tag":209,"props":55520,"children":55521},{"style":263},[55522],{"type":26,"value":2508},{"type":21,"tag":209,"props":55524,"children":55525},{"style":222},[55526],{"type":26,"value":55527},".time.start)",{"type":21,"tag":209,"props":55529,"children":55530},{"style":216},[55531],{"type":26,"value":944},{"type":21,"tag":209,"props":55533,"children":55534},{"style":263},[55535],{"type":26,"value":55536},"1000",{"type":21,"tag":209,"props":55538,"children":55539},{"style":222},[55540],{"type":26,"value":241},{"type":21,"tag":209,"props":55542,"children":55543},{"class":211,"line":444},[55544,55548,55552,55556,55561,55565,55569,55573,55577,55581,55586,55591,55595,55599],{"type":21,"tag":209,"props":55545,"children":55546},{"style":222},[55547],{"type":26,"value":2495},{"type":21,"tag":209,"props":55549,"children":55550},{"style":360},[55551],{"type":26,"value":1059},{"type":21,"tag":209,"props":55553,"children":55554},{"style":222},[55555],{"type":26,"value":368},{"type":21,"tag":209,"props":55557,"children":55558},{"style":233},[55559],{"type":26,"value":55560},"'time:'",{"type":21,"tag":209,"props":55562,"children":55563},{"style":222},[55564],{"type":26,"value":408},{"type":21,"tag":209,"props":55566,"children":55567},{"style":263},[55568],{"type":26,"value":2508},{"type":21,"tag":209,"props":55570,"children":55571},{"style":222},[55572],{"type":26,"value":55514},{"type":21,"tag":209,"props":55574,"children":55575},{"style":216},[55576],{"type":26,"value":42628},{"type":21,"tag":209,"props":55578,"children":55579},{"style":263},[55580],{"type":26,"value":2508},{"type":21,"tag":209,"props":55582,"children":55583},{"style":222},[55584],{"type":26,"value":55585},".time.start, ",{"type":21,"tag":209,"props":55587,"children":55588},{"style":233},[55589],{"type":26,"value":55590},"'speed:'",{"type":21,"tag":209,"props":55592,"children":55593},{"style":222},[55594],{"type":26,"value":408},{"type":21,"tag":209,"props":55596,"children":55597},{"style":263},[55598],{"type":26,"value":2508},{"type":21,"tag":209,"props":55600,"children":55601},{"style":222},[55602],{"type":26,"value":55603},".time.speed);\n",{"type":21,"tag":209,"props":55605,"children":55606},{"class":211,"line":454},[55607,55611,55616,55621,55626,55631,55636,55640,55645,55649],{"type":21,"tag":209,"props":55608,"children":55609},{"style":263},[55610],{"type":26,"value":2570},{"type":21,"tag":209,"props":55612,"children":55613},{"style":222},[55614],{"type":26,"value":55615},".defer.",{"type":21,"tag":209,"props":55617,"children":55618},{"style":360},[55619],{"type":26,"value":55620},"notify",{"type":21,"tag":209,"props":55622,"children":55623},{"style":222},[55624],{"type":26,"value":55625},"({state:Hup.state.",{"type":21,"tag":209,"props":55627,"children":55628},{"style":263},[55629],{"type":26,"value":55630},"FILE_UPLOAD_PROGRESS",{"type":21,"tag":209,"props":55632,"children":55633},{"style":222},[55634],{"type":26,"value":55635},", file_name:",{"type":21,"tag":209,"props":55637,"children":55638},{"style":263},[55639],{"type":26,"value":2508},{"type":21,"tag":209,"props":55641,"children":55642},{"style":222},[55643],{"type":26,"value":55644},".file.name, speed:",{"type":21,"tag":209,"props":55646,"children":55647},{"style":263},[55648],{"type":26,"value":2508},{"type":21,"tag":209,"props":55650,"children":55651},{"style":222},[55652],{"type":26,"value":55653},".time.speed,\n",{"type":21,"tag":209,"props":55655,"children":55656},{"class":211,"line":463},[55657,55662,55666],{"type":21,"tag":209,"props":55658,"children":55659},{"style":222},[55660],{"type":26,"value":55661},"                progress:",{"type":21,"tag":209,"props":55663,"children":55664},{"style":263},[55665],{"type":26,"value":2508},{"type":21,"tag":209,"props":55667,"children":55668},{"style":222},[55669],{"type":26,"value":55670},".progress});\n",{"type":21,"tag":209,"props":55672,"children":55673},{"class":211,"line":472},[55674],{"type":21,"tag":209,"props":55675,"children":55676},{"style":222},[55677],{"type":26,"value":2235},{"type":21,"tag":209,"props":55679,"children":55680},{"class":211,"line":480},[55681],{"type":21,"tag":209,"props":55682,"children":55683},{"style":222},[55684],{"type":26,"value":13439},{"type":21,"tag":22,"props":55686,"children":55687},{},[55688,55690,55696,55698,55705,55707,55712],{"type":26,"value":55689},"By adding a similar handler function with our ajax transport factory on the progress event, we can make calls to ",{"type":21,"tag":63,"props":55691,"children":55693},{"className":55692},[],[55694],{"type":26,"value":55695},"jqXHR.notify",{"type":26,"value":55697}," to send progress events and data to any listening ",{"type":21,"tag":29,"props":55699,"children":55702},{"href":55700,"rel":55701},"http://api.jquery.com/deferred.progress/",[93],[55703],{"type":26,"value":55704},".progress",{"type":26,"value":55706}," handlers dangling from our ",{"type":21,"tag":63,"props":55708,"children":55710},{"className":55709},[],[55711],{"type":26,"value":54340},{"type":26,"value":20758},{"type":21,"tag":22,"props":55714,"children":55715},{},[55716],{"type":26,"value":55717},"This, however, I leave as an exercise for the reader. :)",{"type":21,"tag":22,"props":55719,"children":55720},{},[55721],{"type":26,"value":55722},"If you like, please feel free to push the relevant changes to the gist in question.",{"type":21,"tag":22,"props":55724,"children":55725},{},[55726],{"type":26,"value":55727},"Here's the promised code:",{"type":21,"tag":200,"props":55729,"children":55731},{"className":16138,"code":55730,"language":16140,"meta":8,"style":8},"(function($){\n    /**\n     * Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2\n     * within the comfortable framework of the jquery ajax request, with full support for promises.\n     *\n     * Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list\n     * of potential transports (so it gets first dibs if the request passes the conditions within to provide the\n     * ajax transport, preventing the standard transport from hogging the request), and the * indicates that\n     * potentially any request with any dataType might want to use the transports provided herein.\n     *\n     * Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -\n     * otherwise jquery will try (and fail) to convert the blob or buffer into a query string.\n     *\n     * This revision now includes sending headers, resolves the stack overflow in abort(), and sets the status text\n     * into the response if the request is unsuccessful.\n     */\n    $.ajaxTransport(\"+*\", function(options, originalOptions, jqXHR){\n        // Test for the conditions that mean we can/want to send/receive blobs or arraybuffers - we need XMLHttpRequest\n        // level 2 (so feature-detect against window.FormData), feature detect against window.Blob or window.ArrayBuffer,\n        // and then check to see if the dataType is blob/arraybuffer or the data itself is a Blob/ArrayBuffer\n        if (window.FormData && ((options.dataType && (options.dataType == 'blob' || options.dataType == 'arraybuffer'))\n            || (options.data && ((window.Blob && options.data instanceof Blob)\n                || (window.ArrayBuffer && options.data instanceof ArrayBuffer)))\n            ))\n        {\n            var xhr;\n\n            return {\n                /**\n                 * Return a transport capable of sending and/or receiving blobs - in this case, we instantiate\n                 * a new XMLHttpRequest and use it to actually perform the request, and funnel the result back\n                 * into the jquery complete callback (such as the success function, done blocks, etc.)\n                 *\n                 * @param headers\n                 * @param completeCallback\n                 */\n                send: function(headers, completeCallback){\n                    var url = options.url || window.location.href,\n                        type = options.type || 'GET',\n                        dataType = options.dataType || 'text',\n                        data = options.data || null,\n                        async = options.async || true;\n\n                    xhr = new XMLHttpRequest();\n                    xhr.addEventListener('load', function(){\n                        var res = {},\n                            success = xhr.status >= 200 && xhr.status \u003C 300 || xhr.status === 304;\n\n                        if (success){\n                            res[dataType] = xhr.response;\n                        } else {\n                            res.text = xhr.statusText;\n                        }\n\n                        completeCallback(xhr.status, xhr.statusText, res, xhr.getAllResponseHeaders());\n                    });\n\n                    xhr.open(type, url, async);\n                    xhr.responseType = dataType;\n\n                    for (var key in headers){\n                        if (headers.hasOwnProperty(key)){\n                            xhr.setRequestHeader(key, headers[key]);\n                        }\n                    }\n\n                    xhr.send(data);\n                },\n                abort: function(){\n                    if (xhr){\n                        xhr.abort();\n                    }\n                }\n            };\n        }\n    });\n})(jQuery);\n",[55732],{"type":21,"tag":63,"props":55733,"children":55734},{"__ignoreMap":8},[55735,55758,55765,55773,55781,55788,55796,55804,55812,55820,55827,55835,55843,55850,55858,55866,55873,55928,55936,55944,55952,56007,56046,56078,56086,56093,56105,56112,56123,56130,56138,56146,56154,56162,56179,56195,56202,56238,56265,56293,56321,56349,56377,56384,56408,56440,56460,56524,56531,56544,56560,56576,56593,56601,56608,56628,56636,56643,56658,56674,56681,56712,56734,56752,56759,56766,56773,56788,56796,56816,56828,56844,56851,56858,56865,56872,56879],{"type":21,"tag":209,"props":55736,"children":55737},{"class":211,"line":212},[55738,55742,55746,55750,55754],{"type":21,"tag":209,"props":55739,"children":55740},{"style":222},[55741],{"type":26,"value":368},{"type":21,"tag":209,"props":55743,"children":55744},{"style":216},[55745],{"type":26,"value":4622},{"type":21,"tag":209,"props":55747,"children":55748},{"style":222},[55749],{"type":26,"value":368},{"type":21,"tag":209,"props":55751,"children":55752},{"style":400},[55753],{"type":26,"value":6476},{"type":21,"tag":209,"props":55755,"children":55756},{"style":222},[55757],{"type":26,"value":2369},{"type":21,"tag":209,"props":55759,"children":55760},{"class":211,"line":244},[55761],{"type":21,"tag":209,"props":55762,"children":55763},{"style":448},[55764],{"type":26,"value":13290},{"type":21,"tag":209,"props":55766,"children":55767},{"class":211,"line":254},[55768],{"type":21,"tag":209,"props":55769,"children":55770},{"style":448},[55771],{"type":26,"value":55772},"     * Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2\n",{"type":21,"tag":209,"props":55774,"children":55775},{"class":211,"line":279},[55776],{"type":21,"tag":209,"props":55777,"children":55778},{"style":448},[55779],{"type":26,"value":55780},"     * within the comfortable framework of the jquery ajax request, with full support for promises.\n",{"type":21,"tag":209,"props":55782,"children":55783},{"class":211,"line":288},[55784],{"type":21,"tag":209,"props":55785,"children":55786},{"style":448},[55787],{"type":26,"value":17907},{"type":21,"tag":209,"props":55789,"children":55790},{"class":211,"line":307},[55791],{"type":21,"tag":209,"props":55792,"children":55793},{"style":448},[55794],{"type":26,"value":55795},"     * Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list\n",{"type":21,"tag":209,"props":55797,"children":55798},{"class":211,"line":325},[55799],{"type":21,"tag":209,"props":55800,"children":55801},{"style":448},[55802],{"type":26,"value":55803},"     * of potential transports (so it gets first dibs if the request passes the conditions within to provide the\n",{"type":21,"tag":209,"props":55805,"children":55806},{"class":211,"line":334},[55807],{"type":21,"tag":209,"props":55808,"children":55809},{"style":448},[55810],{"type":26,"value":55811},"     * ajax transport, preventing the standard transport from hogging the request), and the * indicates that\n",{"type":21,"tag":209,"props":55813,"children":55814},{"class":211,"line":343},[55815],{"type":21,"tag":209,"props":55816,"children":55817},{"style":448},[55818],{"type":26,"value":55819},"     * potentially any request with any dataType might want to use the transports provided herein.\n",{"type":21,"tag":209,"props":55821,"children":55822},{"class":211,"line":351},[55823],{"type":21,"tag":209,"props":55824,"children":55825},{"style":448},[55826],{"type":26,"value":17907},{"type":21,"tag":209,"props":55828,"children":55829},{"class":211,"line":444},[55830],{"type":21,"tag":209,"props":55831,"children":55832},{"style":448},[55833],{"type":26,"value":55834},"     * Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -\n",{"type":21,"tag":209,"props":55836,"children":55837},{"class":211,"line":454},[55838],{"type":21,"tag":209,"props":55839,"children":55840},{"style":448},[55841],{"type":26,"value":55842},"     * otherwise jquery will try (and fail) to convert the blob or buffer into a query string.\n",{"type":21,"tag":209,"props":55844,"children":55845},{"class":211,"line":463},[55846],{"type":21,"tag":209,"props":55847,"children":55848},{"style":448},[55849],{"type":26,"value":17907},{"type":21,"tag":209,"props":55851,"children":55852},{"class":211,"line":472},[55853],{"type":21,"tag":209,"props":55854,"children":55855},{"style":448},[55856],{"type":26,"value":55857},"     * This revision now includes sending headers, resolves the stack overflow in abort(), and sets the status text\n",{"type":21,"tag":209,"props":55859,"children":55860},{"class":211,"line":480},[55861],{"type":21,"tag":209,"props":55862,"children":55863},{"style":448},[55864],{"type":26,"value":55865},"     * into the response if the request is unsuccessful.\n",{"type":21,"tag":209,"props":55867,"children":55868},{"class":211,"line":489},[55869],{"type":21,"tag":209,"props":55870,"children":55871},{"style":448},[55872],{"type":26,"value":13346},{"type":21,"tag":209,"props":55874,"children":55875},{"class":211,"line":847},[55876,55880,55884,55888,55892,55896,55900,55904,55908,55912,55916,55920,55924],{"type":21,"tag":209,"props":55877,"children":55878},{"style":222},[55879],{"type":26,"value":29649},{"type":21,"tag":209,"props":55881,"children":55882},{"style":360},[55883],{"type":26,"value":30492},{"type":21,"tag":209,"props":55885,"children":55886},{"style":222},[55887],{"type":26,"value":368},{"type":21,"tag":209,"props":55889,"children":55890},{"style":233},[55891],{"type":26,"value":30501},{"type":21,"tag":209,"props":55893,"children":55894},{"style":222},[55895],{"type":26,"value":408},{"type":21,"tag":209,"props":55897,"children":55898},{"style":216},[55899],{"type":26,"value":4622},{"type":21,"tag":209,"props":55901,"children":55902},{"style":222},[55903],{"type":26,"value":368},{"type":21,"tag":209,"props":55905,"children":55906},{"style":400},[55907],{"type":26,"value":28349},{"type":21,"tag":209,"props":55909,"children":55910},{"style":222},[55911],{"type":26,"value":408},{"type":21,"tag":209,"props":55913,"children":55914},{"style":400},[55915],{"type":26,"value":54533},{"type":21,"tag":209,"props":55917,"children":55918},{"style":222},[55919],{"type":26,"value":408},{"type":21,"tag":209,"props":55921,"children":55922},{"style":400},[55923],{"type":26,"value":20911},{"type":21,"tag":209,"props":55925,"children":55926},{"style":222},[55927],{"type":26,"value":2369},{"type":21,"tag":209,"props":55929,"children":55930},{"class":211,"line":860},[55931],{"type":21,"tag":209,"props":55932,"children":55933},{"style":448},[55934],{"type":26,"value":55935},"        // Test for the conditions that mean we can/want to send/receive blobs or arraybuffers - we need XMLHttpRequest\n",{"type":21,"tag":209,"props":55937,"children":55938},{"class":211,"line":877},[55939],{"type":21,"tag":209,"props":55940,"children":55941},{"style":448},[55942],{"type":26,"value":55943},"        // level 2 (so feature-detect against window.FormData), feature detect against window.Blob or window.ArrayBuffer,\n",{"type":21,"tag":209,"props":55945,"children":55946},{"class":211,"line":889},[55947],{"type":21,"tag":209,"props":55948,"children":55949},{"style":448},[55950],{"type":26,"value":55951},"        // and then check to see if the dataType is blob/arraybuffer or the data itself is a Blob/ArrayBuffer\n",{"type":21,"tag":209,"props":55953,"children":55954},{"class":211,"line":902},[55955,55959,55963,55967,55971,55975,55979,55983,55987,55991,55995,55999,56003],{"type":21,"tag":209,"props":55956,"children":55957},{"style":216},[55958],{"type":26,"value":6334},{"type":21,"tag":209,"props":55960,"children":55961},{"style":222},[55962],{"type":26,"value":54581},{"type":21,"tag":209,"props":55964,"children":55965},{"style":216},[55966],{"type":26,"value":18381},{"type":21,"tag":209,"props":55968,"children":55969},{"style":222},[55970],{"type":26,"value":54590},{"type":21,"tag":209,"props":55972,"children":55973},{"style":216},[55974],{"type":26,"value":18381},{"type":21,"tag":209,"props":55976,"children":55977},{"style":222},[55978],{"type":26,"value":54599},{"type":21,"tag":209,"props":55980,"children":55981},{"style":216},[55982],{"type":26,"value":23855},{"type":21,"tag":209,"props":55984,"children":55985},{"style":233},[55986],{"type":26,"value":54287},{"type":21,"tag":209,"props":55988,"children":55989},{"style":216},[55990],{"type":26,"value":4608},{"type":21,"tag":209,"props":55992,"children":55993},{"style":222},[55994],{"type":26,"value":54616},{"type":21,"tag":209,"props":55996,"children":55997},{"style":216},[55998],{"type":26,"value":23855},{"type":21,"tag":209,"props":56000,"children":56001},{"style":233},[56002],{"type":26,"value":54625},{"type":21,"tag":209,"props":56004,"children":56005},{"style":222},[56006],{"type":26,"value":54630},{"type":21,"tag":209,"props":56008,"children":56009},{"class":211,"line":914},[56010,56014,56018,56022,56026,56030,56034,56038,56042],{"type":21,"tag":209,"props":56011,"children":56012},{"style":216},[56013],{"type":26,"value":54680},{"type":21,"tag":209,"props":56015,"children":56016},{"style":222},[56017],{"type":26,"value":28582},{"type":21,"tag":209,"props":56019,"children":56020},{"style":216},[56021],{"type":26,"value":18381},{"type":21,"tag":209,"props":56023,"children":56024},{"style":222},[56025],{"type":26,"value":54651},{"type":21,"tag":209,"props":56027,"children":56028},{"style":216},[56029],{"type":26,"value":18381},{"type":21,"tag":209,"props":56031,"children":56032},{"style":222},[56033],{"type":26,"value":54660},{"type":21,"tag":209,"props":56035,"children":56036},{"style":216},[56037],{"type":26,"value":45611},{"type":21,"tag":209,"props":56039,"children":56040},{"style":360},[56041],{"type":26,"value":16108},{"type":21,"tag":209,"props":56043,"children":56044},{"style":222},[56045],{"type":26,"value":8924},{"type":21,"tag":209,"props":56047,"children":56048},{"class":211,"line":922},[56049,56054,56058,56062,56066,56070,56074],{"type":21,"tag":209,"props":56050,"children":56051},{"style":216},[56052],{"type":26,"value":56053},"                ||",{"type":21,"tag":209,"props":56055,"children":56056},{"style":222},[56057],{"type":26,"value":54685},{"type":21,"tag":209,"props":56059,"children":56060},{"style":216},[56061],{"type":26,"value":18381},{"type":21,"tag":209,"props":56063,"children":56064},{"style":222},[56065],{"type":26,"value":54660},{"type":21,"tag":209,"props":56067,"children":56068},{"style":216},[56069],{"type":26,"value":45611},{"type":21,"tag":209,"props":56071,"children":56072},{"style":360},[56073],{"type":26,"value":54702},{"type":21,"tag":209,"props":56075,"children":56076},{"style":222},[56077],{"type":26,"value":54707},{"type":21,"tag":209,"props":56079,"children":56080},{"class":211,"line":2312},[56081],{"type":21,"tag":209,"props":56082,"children":56083},{"style":222},[56084],{"type":26,"value":56085},"            ))\n",{"type":21,"tag":209,"props":56087,"children":56088},{"class":211,"line":2321},[56089],{"type":21,"tag":209,"props":56090,"children":56091},{"style":222},[56092],{"type":26,"value":17555},{"type":21,"tag":209,"props":56094,"children":56095},{"class":211,"line":2372},[56096,56100],{"type":21,"tag":209,"props":56097,"children":56098},{"style":216},[56099],{"type":26,"value":14539},{"type":21,"tag":209,"props":56101,"children":56102},{"style":222},[56103],{"type":26,"value":56104}," xhr;\n",{"type":21,"tag":209,"props":56106,"children":56107},{"class":211,"line":2381},[56108],{"type":21,"tag":209,"props":56109,"children":56110},{"emptyLinePlaceholder":248},[56111],{"type":26,"value":251},{"type":21,"tag":209,"props":56113,"children":56114},{"class":211,"line":2389},[56115,56119],{"type":21,"tag":209,"props":56116,"children":56117},{"style":216},[56118],{"type":26,"value":13689},{"type":21,"tag":209,"props":56120,"children":56121},{"style":222},[56122],{"type":26,"value":276},{"type":21,"tag":209,"props":56124,"children":56125},{"class":211,"line":2397},[56126],{"type":21,"tag":209,"props":56127,"children":56128},{"style":448},[56129],{"type":26,"value":30657},{"type":21,"tag":209,"props":56131,"children":56132},{"class":211,"line":2406},[56133],{"type":21,"tag":209,"props":56134,"children":56135},{"style":448},[56136],{"type":26,"value":56137},"                 * Return a transport capable of sending and/or receiving blobs - in this case, we instantiate\n",{"type":21,"tag":209,"props":56139,"children":56140},{"class":211,"line":2415},[56141],{"type":21,"tag":209,"props":56142,"children":56143},{"style":448},[56144],{"type":26,"value":56145},"                 * a new XMLHttpRequest and use it to actually perform the request, and funnel the result back\n",{"type":21,"tag":209,"props":56147,"children":56148},{"class":211,"line":2424},[56149],{"type":21,"tag":209,"props":56150,"children":56151},{"style":448},[56152],{"type":26,"value":56153},"                 * into the jquery complete callback (such as the success function, done blocks, etc.)\n",{"type":21,"tag":209,"props":56155,"children":56156},{"class":211,"line":2433},[56157],{"type":21,"tag":209,"props":56158,"children":56159},{"style":448},[56160],{"type":26,"value":56161},"                 *\n",{"type":21,"tag":209,"props":56163,"children":56164},{"class":211,"line":2442},[56165,56170,56174],{"type":21,"tag":209,"props":56166,"children":56167},{"style":448},[56168],{"type":26,"value":56169},"                 * ",{"type":21,"tag":209,"props":56171,"children":56172},{"style":216},[56173],{"type":26,"value":13311},{"type":21,"tag":209,"props":56175,"children":56176},{"style":222},[56177],{"type":26,"value":56178}," headers\n",{"type":21,"tag":209,"props":56180,"children":56181},{"class":211,"line":2471},[56182,56186,56190],{"type":21,"tag":209,"props":56183,"children":56184},{"style":448},[56185],{"type":26,"value":56169},{"type":21,"tag":209,"props":56187,"children":56188},{"style":216},[56189],{"type":26,"value":13311},{"type":21,"tag":209,"props":56191,"children":56192},{"style":222},[56193],{"type":26,"value":56194}," completeCallback\n",{"type":21,"tag":209,"props":56196,"children":56197},{"class":211,"line":2480},[56198],{"type":21,"tag":209,"props":56199,"children":56200},{"style":448},[56201],{"type":26,"value":30689},{"type":21,"tag":209,"props":56203,"children":56204},{"class":211,"line":2489},[56205,56210,56214,56218,56222,56226,56230,56234],{"type":21,"tag":209,"props":56206,"children":56207},{"style":360},[56208],{"type":26,"value":56209},"                send",{"type":21,"tag":209,"props":56211,"children":56212},{"style":222},[56213],{"type":26,"value":7821},{"type":21,"tag":209,"props":56215,"children":56216},{"style":216},[56217],{"type":26,"value":4622},{"type":21,"tag":209,"props":56219,"children":56220},{"style":222},[56221],{"type":26,"value":368},{"type":21,"tag":209,"props":56223,"children":56224},{"style":400},[56225],{"type":26,"value":17980},{"type":21,"tag":209,"props":56227,"children":56228},{"style":222},[56229],{"type":26,"value":408},{"type":21,"tag":209,"props":56231,"children":56232},{"style":400},[56233],{"type":26,"value":30733},{"type":21,"tag":209,"props":56235,"children":56236},{"style":222},[56237],{"type":26,"value":2369},{"type":21,"tag":209,"props":56239,"children":56240},{"class":211,"line":2516},[56241,56245,56249,56253,56257,56261],{"type":21,"tag":209,"props":56242,"children":56243},{"style":216},[56244],{"type":26,"value":52564},{"type":21,"tag":209,"props":56246,"children":56247},{"style":222},[56248],{"type":26,"value":18080},{"type":21,"tag":209,"props":56250,"children":56251},{"style":216},[56252],{"type":26,"value":1432},{"type":21,"tag":209,"props":56254,"children":56255},{"style":222},[56256],{"type":26,"value":54858},{"type":21,"tag":209,"props":56258,"children":56259},{"style":216},[56260],{"type":26,"value":13270},{"type":21,"tag":209,"props":56262,"children":56263},{"style":222},[56264],{"type":26,"value":54867},{"type":21,"tag":209,"props":56266,"children":56267},{"class":211,"line":2525},[56268,56273,56277,56281,56285,56289],{"type":21,"tag":209,"props":56269,"children":56270},{"style":222},[56271],{"type":26,"value":56272},"                        type ",{"type":21,"tag":209,"props":56274,"children":56275},{"style":216},[56276],{"type":26,"value":1432},{"type":21,"tag":209,"props":56278,"children":56279},{"style":222},[56280],{"type":26,"value":28573},{"type":21,"tag":209,"props":56282,"children":56283},{"style":216},[56284],{"type":26,"value":13270},{"type":21,"tag":209,"props":56286,"children":56287},{"style":233},[56288],{"type":26,"value":54892},{"type":21,"tag":209,"props":56290,"children":56291},{"style":222},[56292],{"type":26,"value":304},{"type":21,"tag":209,"props":56294,"children":56295},{"class":211,"line":2533},[56296,56301,56305,56309,56313,56317],{"type":21,"tag":209,"props":56297,"children":56298},{"style":222},[56299],{"type":26,"value":56300},"                        dataType ",{"type":21,"tag":209,"props":56302,"children":56303},{"style":216},[56304],{"type":26,"value":1432},{"type":21,"tag":209,"props":56306,"children":56307},{"style":222},[56308],{"type":26,"value":54616},{"type":21,"tag":209,"props":56310,"children":56311},{"style":216},[56312],{"type":26,"value":13270},{"type":21,"tag":209,"props":56314,"children":56315},{"style":233},[56316],{"type":26,"value":54921},{"type":21,"tag":209,"props":56318,"children":56319},{"style":222},[56320],{"type":26,"value":304},{"type":21,"tag":209,"props":56322,"children":56323},{"class":211,"line":2542},[56324,56329,56333,56337,56341,56345],{"type":21,"tag":209,"props":56325,"children":56326},{"style":222},[56327],{"type":26,"value":56328},"                        data ",{"type":21,"tag":209,"props":56330,"children":56331},{"style":216},[56332],{"type":26,"value":1432},{"type":21,"tag":209,"props":56334,"children":56335},{"style":222},[56336],{"type":26,"value":54660},{"type":21,"tag":209,"props":56338,"children":56339},{"style":216},[56340],{"type":26,"value":13270},{"type":21,"tag":209,"props":56342,"children":56343},{"style":263},[56344],{"type":26,"value":8282},{"type":21,"tag":209,"props":56346,"children":56347},{"style":222},[56348],{"type":26,"value":304},{"type":21,"tag":209,"props":56350,"children":56351},{"class":211,"line":2550},[56352,56357,56361,56365,56369,56373],{"type":21,"tag":209,"props":56353,"children":56354},{"style":222},[56355],{"type":26,"value":56356},"                        async ",{"type":21,"tag":209,"props":56358,"children":56359},{"style":216},[56360],{"type":26,"value":1432},{"type":21,"tag":209,"props":56362,"children":56363},{"style":222},[56364],{"type":26,"value":54970},{"type":21,"tag":209,"props":56366,"children":56367},{"style":216},[56368],{"type":26,"value":13270},{"type":21,"tag":209,"props":56370,"children":56371},{"style":263},[56372],{"type":26,"value":14819},{"type":21,"tag":209,"props":56374,"children":56375},{"style":222},[56376],{"type":26,"value":241},{"type":21,"tag":209,"props":56378,"children":56379},{"class":211,"line":2564},[56380],{"type":21,"tag":209,"props":56381,"children":56382},{"emptyLinePlaceholder":248},[56383],{"type":26,"value":251},{"type":21,"tag":209,"props":56385,"children":56386},{"class":211,"line":2611},[56387,56392,56396,56400,56404],{"type":21,"tag":209,"props":56388,"children":56389},{"style":222},[56390],{"type":26,"value":56391},"                    xhr ",{"type":21,"tag":209,"props":56393,"children":56394},{"style":216},[56395],{"type":26,"value":1432},{"type":21,"tag":209,"props":56397,"children":56398},{"style":216},[56399],{"type":26,"value":6371},{"type":21,"tag":209,"props":56401,"children":56402},{"style":360},[56403],{"type":26,"value":20437},{"type":21,"tag":209,"props":56405,"children":56406},{"style":222},[56407],{"type":26,"value":4123},{"type":21,"tag":209,"props":56409,"children":56410},{"class":211,"line":2619},[56411,56416,56420,56424,56428,56432,56436],{"type":21,"tag":209,"props":56412,"children":56413},{"style":222},[56414],{"type":26,"value":56415},"                    xhr.",{"type":21,"tag":209,"props":56417,"children":56418},{"style":360},[56419],{"type":26,"value":14995},{"type":21,"tag":209,"props":56421,"children":56422},{"style":222},[56423],{"type":26,"value":368},{"type":21,"tag":209,"props":56425,"children":56426},{"style":233},[56427],{"type":26,"value":20469},{"type":21,"tag":209,"props":56429,"children":56430},{"style":222},[56431],{"type":26,"value":408},{"type":21,"tag":209,"props":56433,"children":56434},{"style":216},[56435],{"type":26,"value":4622},{"type":21,"tag":209,"props":56437,"children":56438},{"style":222},[56439],{"type":26,"value":2561},{"type":21,"tag":209,"props":56441,"children":56442},{"class":211,"line":2627},[56443,56448,56452,56456],{"type":21,"tag":209,"props":56444,"children":56445},{"style":216},[56446],{"type":26,"value":56447},"                        var",{"type":21,"tag":209,"props":56449,"children":56450},{"style":222},[56451],{"type":26,"value":23677},{"type":21,"tag":209,"props":56453,"children":56454},{"style":216},[56455],{"type":26,"value":1432},{"type":21,"tag":209,"props":56457,"children":56458},{"style":222},[56459],{"type":26,"value":42791},{"type":21,"tag":209,"props":56461,"children":56462},{"class":211,"line":2636},[56463,56468,56472,56477,56482,56486,56490,56494,56498,56503,56507,56511,56515,56520],{"type":21,"tag":209,"props":56464,"children":56465},{"style":222},[56466],{"type":26,"value":56467},"                            success ",{"type":21,"tag":209,"props":56469,"children":56470},{"style":216},[56471],{"type":26,"value":1432},{"type":21,"tag":209,"props":56473,"children":56474},{"style":222},[56475],{"type":26,"value":56476}," xhr.status ",{"type":21,"tag":209,"props":56478,"children":56479},{"style":216},[56480],{"type":26,"value":56481},">=",{"type":21,"tag":209,"props":56483,"children":56484},{"style":263},[56485],{"type":26,"value":21517},{"type":21,"tag":209,"props":56487,"children":56488},{"style":216},[56489],{"type":26,"value":18342},{"type":21,"tag":209,"props":56491,"children":56492},{"style":222},[56493],{"type":26,"value":56476},{"type":21,"tag":209,"props":56495,"children":56496},{"style":216},[56497],{"type":26,"value":1985},{"type":21,"tag":209,"props":56499,"children":56500},{"style":263},[56501],{"type":26,"value":56502}," 300",{"type":21,"tag":209,"props":56504,"children":56505},{"style":216},[56506],{"type":26,"value":4608},{"type":21,"tag":209,"props":56508,"children":56509},{"style":222},[56510],{"type":26,"value":56476},{"type":21,"tag":209,"props":56512,"children":56513},{"style":216},[56514],{"type":26,"value":14680},{"type":21,"tag":209,"props":56516,"children":56517},{"style":263},[56518],{"type":26,"value":56519}," 304",{"type":21,"tag":209,"props":56521,"children":56522},{"style":222},[56523],{"type":26,"value":241},{"type":21,"tag":209,"props":56525,"children":56526},{"class":211,"line":2644},[56527],{"type":21,"tag":209,"props":56528,"children":56529},{"emptyLinePlaceholder":248},[56530],{"type":26,"value":251},{"type":21,"tag":209,"props":56532,"children":56533},{"class":211,"line":2657},[56534,56539],{"type":21,"tag":209,"props":56535,"children":56536},{"style":216},[56537],{"type":26,"value":56538},"                        if",{"type":21,"tag":209,"props":56540,"children":56541},{"style":222},[56542],{"type":26,"value":56543}," (success){\n",{"type":21,"tag":209,"props":56545,"children":56546},{"class":211,"line":2728},[56547,56552,56556],{"type":21,"tag":209,"props":56548,"children":56549},{"style":222},[56550],{"type":26,"value":56551},"                            res[dataType] ",{"type":21,"tag":209,"props":56553,"children":56554},{"style":216},[56555],{"type":26,"value":1432},{"type":21,"tag":209,"props":56557,"children":56558},{"style":222},[56559],{"type":26,"value":55064},{"type":21,"tag":209,"props":56561,"children":56562},{"class":211,"line":2758},[56563,56568,56572],{"type":21,"tag":209,"props":56564,"children":56565},{"style":222},[56566],{"type":26,"value":56567},"                        } ",{"type":21,"tag":209,"props":56569,"children":56570},{"style":216},[56571],{"type":26,"value":4346},{"type":21,"tag":209,"props":56573,"children":56574},{"style":222},[56575],{"type":26,"value":276},{"type":21,"tag":209,"props":56577,"children":56578},{"class":211,"line":2776},[56579,56584,56588],{"type":21,"tag":209,"props":56580,"children":56581},{"style":222},[56582],{"type":26,"value":56583},"                            res.text ",{"type":21,"tag":209,"props":56585,"children":56586},{"style":216},[56587],{"type":26,"value":1432},{"type":21,"tag":209,"props":56589,"children":56590},{"style":222},[56591],{"type":26,"value":56592}," xhr.statusText;\n",{"type":21,"tag":209,"props":56594,"children":56595},{"class":211,"line":2785},[56596],{"type":21,"tag":209,"props":56597,"children":56598},{"style":222},[56599],{"type":26,"value":56600},"                        }\n",{"type":21,"tag":209,"props":56602,"children":56603},{"class":211,"line":2793},[56604],{"type":21,"tag":209,"props":56605,"children":56606},{"emptyLinePlaceholder":248},[56607],{"type":26,"value":251},{"type":21,"tag":209,"props":56609,"children":56610},{"class":211,"line":2801},[56611,56616,56620,56624],{"type":21,"tag":209,"props":56612,"children":56613},{"style":360},[56614],{"type":26,"value":56615},"                        completeCallback",{"type":21,"tag":209,"props":56617,"children":56618},{"style":222},[56619],{"type":26,"value":55077},{"type":21,"tag":209,"props":56621,"children":56622},{"style":360},[56623],{"type":26,"value":55082},{"type":21,"tag":209,"props":56625,"children":56626},{"style":222},[56627],{"type":26,"value":4161},{"type":21,"tag":209,"props":56629,"children":56630},{"class":211,"line":2809},[56631],{"type":21,"tag":209,"props":56632,"children":56633},{"style":222},[56634],{"type":26,"value":56635},"                    });\n",{"type":21,"tag":209,"props":56637,"children":56638},{"class":211,"line":10937},[56639],{"type":21,"tag":209,"props":56640,"children":56641},{"emptyLinePlaceholder":248},[56642],{"type":26,"value":251},{"type":21,"tag":209,"props":56644,"children":56645},{"class":211,"line":10967},[56646,56650,56654],{"type":21,"tag":209,"props":56647,"children":56648},{"style":222},[56649],{"type":26,"value":56415},{"type":21,"tag":209,"props":56651,"children":56652},{"style":360},[56653],{"type":26,"value":20680},{"type":21,"tag":209,"props":56655,"children":56656},{"style":222},[56657],{"type":26,"value":55116},{"type":21,"tag":209,"props":56659,"children":56660},{"class":211,"line":11003},[56661,56666,56670],{"type":21,"tag":209,"props":56662,"children":56663},{"style":222},[56664],{"type":26,"value":56665},"                    xhr.responseType ",{"type":21,"tag":209,"props":56667,"children":56668},{"style":216},[56669],{"type":26,"value":1432},{"type":21,"tag":209,"props":56671,"children":56672},{"style":222},[56673],{"type":26,"value":55133},{"type":21,"tag":209,"props":56675,"children":56676},{"class":211,"line":11038},[56677],{"type":21,"tag":209,"props":56678,"children":56679},{"emptyLinePlaceholder":248},[56680],{"type":26,"value":251},{"type":21,"tag":209,"props":56682,"children":56683},{"class":211,"line":11072},[56684,56689,56693,56697,56702,56707],{"type":21,"tag":209,"props":56685,"children":56686},{"style":216},[56687],{"type":26,"value":56688},"                    for",{"type":21,"tag":209,"props":56690,"children":56691},{"style":222},[56692],{"type":26,"value":5569},{"type":21,"tag":209,"props":56694,"children":56695},{"style":216},[56696],{"type":26,"value":3909},{"type":21,"tag":209,"props":56698,"children":56699},{"style":222},[56700],{"type":26,"value":56701}," key ",{"type":21,"tag":209,"props":56703,"children":56704},{"style":216},[56705],{"type":26,"value":56706},"in",{"type":21,"tag":209,"props":56708,"children":56709},{"style":222},[56710],{"type":26,"value":56711}," headers){\n",{"type":21,"tag":209,"props":56713,"children":56714},{"class":211,"line":11106},[56715,56719,56724,56729],{"type":21,"tag":209,"props":56716,"children":56717},{"style":216},[56718],{"type":26,"value":56538},{"type":21,"tag":209,"props":56720,"children":56721},{"style":222},[56722],{"type":26,"value":56723}," (headers.",{"type":21,"tag":209,"props":56725,"children":56726},{"style":360},[56727],{"type":26,"value":56728},"hasOwnProperty",{"type":21,"tag":209,"props":56730,"children":56731},{"style":222},[56732],{"type":26,"value":56733},"(key)){\n",{"type":21,"tag":209,"props":56735,"children":56736},{"class":211,"line":11114},[56737,56742,56747],{"type":21,"tag":209,"props":56738,"children":56739},{"style":222},[56740],{"type":26,"value":56741},"                            xhr.",{"type":21,"tag":209,"props":56743,"children":56744},{"style":360},[56745],{"type":26,"value":56746},"setRequestHeader",{"type":21,"tag":209,"props":56748,"children":56749},{"style":222},[56750],{"type":26,"value":56751},"(key, headers[key]);\n",{"type":21,"tag":209,"props":56753,"children":56754},{"class":211,"line":14940},[56755],{"type":21,"tag":209,"props":56756,"children":56757},{"style":222},[56758],{"type":26,"value":56600},{"type":21,"tag":209,"props":56760,"children":56761},{"class":211,"line":14949},[56762],{"type":21,"tag":209,"props":56763,"children":56764},{"style":222},[56765],{"type":26,"value":30995},{"type":21,"tag":209,"props":56767,"children":56768},{"class":211,"line":14958},[56769],{"type":21,"tag":209,"props":56770,"children":56771},{"emptyLinePlaceholder":248},[56772],{"type":26,"value":251},{"type":21,"tag":209,"props":56774,"children":56775},{"class":211,"line":14966},[56776,56780,56784],{"type":21,"tag":209,"props":56777,"children":56778},{"style":222},[56779],{"type":26,"value":56415},{"type":21,"tag":209,"props":56781,"children":56782},{"style":360},[56783],{"type":26,"value":6696},{"type":21,"tag":209,"props":56785,"children":56786},{"style":222},[56787],{"type":26,"value":55149},{"type":21,"tag":209,"props":56789,"children":56790},{"class":211,"line":14975},[56791],{"type":21,"tag":209,"props":56792,"children":56793},{"style":222},[56794],{"type":26,"value":56795},"                },\n",{"type":21,"tag":209,"props":56797,"children":56798},{"class":211,"line":14984},[56799,56804,56808,56812],{"type":21,"tag":209,"props":56800,"children":56801},{"style":360},[56802],{"type":26,"value":56803},"                abort",{"type":21,"tag":209,"props":56805,"children":56806},{"style":222},[56807],{"type":26,"value":7821},{"type":21,"tag":209,"props":56809,"children":56810},{"style":216},[56811],{"type":26,"value":4622},{"type":21,"tag":209,"props":56813,"children":56814},{"style":222},[56815],{"type":26,"value":2561},{"type":21,"tag":209,"props":56817,"children":56818},{"class":211,"line":15018},[56819,56823],{"type":21,"tag":209,"props":56820,"children":56821},{"style":216},[56822],{"type":26,"value":30311},{"type":21,"tag":209,"props":56824,"children":56825},{"style":222},[56826],{"type":26,"value":56827}," (xhr){\n",{"type":21,"tag":209,"props":56829,"children":56830},{"class":211,"line":15050},[56831,56836,56840],{"type":21,"tag":209,"props":56832,"children":56833},{"style":222},[56834],{"type":26,"value":56835},"                        xhr.",{"type":21,"tag":209,"props":56837,"children":56838},{"style":360},[56839],{"type":26,"value":55189},{"type":21,"tag":209,"props":56841,"children":56842},{"style":222},[56843],{"type":26,"value":4123},{"type":21,"tag":209,"props":56845,"children":56846},{"class":211,"line":15082},[56847],{"type":21,"tag":209,"props":56848,"children":56849},{"style":222},[56850],{"type":26,"value":30995},{"type":21,"tag":209,"props":56852,"children":56853},{"class":211,"line":15090},[56854],{"type":21,"tag":209,"props":56855,"children":56856},{"style":222},[56857],{"type":26,"value":19439},{"type":21,"tag":209,"props":56859,"children":56860},{"class":211,"line":15098},[56861],{"type":21,"tag":209,"props":56862,"children":56863},{"style":222},[56864],{"type":26,"value":14946},{"type":21,"tag":209,"props":56866,"children":56867},{"class":211,"line":15106},[56868],{"type":21,"tag":209,"props":56869,"children":56870},{"style":222},[56871],{"type":26,"value":2235},{"type":21,"tag":209,"props":56873,"children":56874},{"class":211,"line":15114},[56875],{"type":21,"tag":209,"props":56876,"children":56877},{"style":222},[56878],{"type":26,"value":3391},{"type":21,"tag":209,"props":56880,"children":56881},{"class":211,"line":15123},[56882],{"type":21,"tag":209,"props":56883,"children":56884},{"style":222},[56885],{"type":26,"value":46369},{"type":21,"tag":22,"props":56887,"children":56888},{},[56889,56896],{"type":21,"tag":29,"props":56890,"children":56894},{"href":56891,"rel":56892,"title":56893},"https://gist.github.com/SaneMethod/7548768/",[93],"You can also find it here",[56895],{"type":26,"value":56893},{"type":26,"value":378},{"type":21,"tag":3490,"props":56898,"children":56899},{},[56900],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":56902},[],"content:ckeefer:2013-11:jquery-ajax-blobs.md","ckeefer/2013-11/jquery-ajax-blobs.md","ckeefer/2013-11/jquery-ajax-blobs",{"user":3518,"name":3519},{"_path":56908,"_dir":56909,"_draft":7,"_partial":7,"_locale":8,"title":56910,"description":56911,"publishDate":56912,"tags":56913,"excerpt":56911,"body":56914,"_type":3511,"_id":59327,"_source":3513,"_file":59328,"_stem":59329,"_extension":3516,"author":59330},"/ckeefer/2013-1/misc","2013-1","JS Hints & Shortcuts","During the course of any complex project (and even many simple ones), on the way to accomplish the actual goal, you're certain to encounter any number of small hurdles along the way - little problems which need to be resolved for the bigger picture to come into focus.","2013-09-01",[12],{"type":18,"children":56915,"toc":59317},[56916,56928,56933,56937,56943,56966,56971,57099,57105,57118,57131,57217,57222,57267,57280,57293,57465,57478,57598,57603,57714,57727,57944,57950,57955,57960,58024,58029,58098,58112,58118,58136,58149,59301,59313],{"type":21,"tag":22,"props":56917,"children":56918},{},[56919,56921,56926],{"type":26,"value":56920},"During the course of any complex project (and even many simple ones), on the way to accomplish the ",{"type":21,"tag":1084,"props":56922,"children":56923},{},[56924],{"type":26,"value":56925},"actual",{"type":26,"value":56927}," goal, you're certain to encounter any number of small hurdles along the way - little problems which need to be resolved for the bigger picture to come into focus.",{"type":21,"tag":22,"props":56929,"children":56930},{},[56931],{"type":26,"value":56932},"Below, in no particular order, are some of the 'little' problems I've encountered, and solutions thereto - hopefully giving you a leg up so that when and if you encounter something similar, you can jump it without breaking stride.",{"type":21,"tag":56934,"props":56935,"children":56936},"toc",{},[],{"type":21,"tag":3596,"props":56938,"children":56940},{"id":56939},"is-that-a-promise",[56941],{"type":26,"value":56942},"Is that a Promise?",{"type":21,"tag":22,"props":56944,"children":56945},{},[56946,56948,56955,56957,56964],{"type":26,"value":56947},"To determine whether a Javascript object implements the ",{"type":21,"tag":29,"props":56949,"children":56952},{"href":56950,"rel":56951},"http://wiki.commonjs.org/wiki/Promises/A",[93],[56953],{"type":26,"value":56954},"promise interface",{"type":26,"value":56956},", we'll have to rely on ",{"type":21,"tag":29,"props":56958,"children":56961},{"href":56959,"rel":56960},"http://en.wikipedia.org/wiki/Duck_typing",[93],[56962],{"type":26,"value":56963},"duck typing",{"type":26,"value":56965},". This is generally safe (outside of a potentially hostile environment), and if you're suspicious that tested objects might return false positives, you can add/change what is tested tailored to the specific implementation you're using.",{"type":21,"tag":22,"props":56967,"children":56968},{},[56969],{"type":26,"value":56970},"For instance, you might add a test on functions like 'promise' and 'pipe' being present for jQuery Deferred. This could also be stretched to try and tell one implementation apart from another, if you're mixing them for whatever reason.",{"type":21,"tag":200,"props":56972,"children":56974},{"className":16138,"code":56973,"language":16140,"meta":8,"style":8},"    /**\n     * Determine whether object implements promises.\n     * @param object\n     * @returns {*}\n     */\n    isPromise:function(object){\n        return (typeof object.then === 'function');\n    }\n",[56975],{"type":21,"tag":63,"props":56976,"children":56977},{"__ignoreMap":8},[56978,56985,56993,57009,57024,57031,57060,57092],{"type":21,"tag":209,"props":56979,"children":56980},{"class":211,"line":212},[56981],{"type":21,"tag":209,"props":56982,"children":56983},{"style":448},[56984],{"type":26,"value":13290},{"type":21,"tag":209,"props":56986,"children":56987},{"class":211,"line":244},[56988],{"type":21,"tag":209,"props":56989,"children":56990},{"style":448},[56991],{"type":26,"value":56992},"     * Determine whether object implements promises.\n",{"type":21,"tag":209,"props":56994,"children":56995},{"class":211,"line":254},[56996,57000,57004],{"type":21,"tag":209,"props":56997,"children":56998},{"style":448},[56999],{"type":26,"value":13306},{"type":21,"tag":209,"props":57001,"children":57002},{"style":216},[57003],{"type":26,"value":13311},{"type":21,"tag":209,"props":57005,"children":57006},{"style":222},[57007],{"type":26,"value":57008}," object\n",{"type":21,"tag":209,"props":57010,"children":57011},{"class":211,"line":279},[57012,57016,57020],{"type":21,"tag":209,"props":57013,"children":57014},{"style":448},[57015],{"type":26,"value":13306},{"type":21,"tag":209,"props":57017,"children":57018},{"style":216},[57019],{"type":26,"value":13333},{"type":21,"tag":209,"props":57021,"children":57022},{"style":360},[57023],{"type":26,"value":25635},{"type":21,"tag":209,"props":57025,"children":57026},{"class":211,"line":288},[57027],{"type":21,"tag":209,"props":57028,"children":57029},{"style":448},[57030],{"type":26,"value":13346},{"type":21,"tag":209,"props":57032,"children":57033},{"class":211,"line":307},[57034,57039,57043,57047,57051,57056],{"type":21,"tag":209,"props":57035,"children":57036},{"style":360},[57037],{"type":26,"value":57038},"    isPromise",{"type":21,"tag":209,"props":57040,"children":57041},{"style":222},[57042],{"type":26,"value":191},{"type":21,"tag":209,"props":57044,"children":57045},{"style":216},[57046],{"type":26,"value":4622},{"type":21,"tag":209,"props":57048,"children":57049},{"style":222},[57050],{"type":26,"value":368},{"type":21,"tag":209,"props":57052,"children":57053},{"style":400},[57054],{"type":26,"value":57055},"object",{"type":21,"tag":209,"props":57057,"children":57058},{"style":222},[57059],{"type":26,"value":2369},{"type":21,"tag":209,"props":57061,"children":57062},{"class":211,"line":325},[57063,57067,57071,57075,57080,57084,57088],{"type":21,"tag":209,"props":57064,"children":57065},{"style":216},[57066],{"type":26,"value":3069},{"type":21,"tag":209,"props":57068,"children":57069},{"style":222},[57070],{"type":26,"value":5569},{"type":21,"tag":209,"props":57072,"children":57073},{"style":216},[57074],{"type":26,"value":8036},{"type":21,"tag":209,"props":57076,"children":57077},{"style":222},[57078],{"type":26,"value":57079}," object.then ",{"type":21,"tag":209,"props":57081,"children":57082},{"style":216},[57083],{"type":26,"value":14680},{"type":21,"tag":209,"props":57085,"children":57086},{"style":233},[57087],{"type":26,"value":14685},{"type":21,"tag":209,"props":57089,"children":57090},{"style":222},[57091],{"type":26,"value":2608},{"type":21,"tag":209,"props":57093,"children":57094},{"class":211,"line":334},[57095],{"type":21,"tag":209,"props":57096,"children":57097},{"style":222},[57098],{"type":26,"value":331},{"type":21,"tag":3596,"props":57100,"children":57102},{"id":57101},"ie-console-woes-log-only-in-debug-mode",[57103],{"type":26,"value":57104},"IE Console woes, log only in debug mode",{"type":21,"tag":22,"props":57106,"children":57107},{},[57108,57110,57116],{"type":26,"value":57109},"It's extremely common to litter your js with some ",{"type":21,"tag":63,"props":57111,"children":57113},{"className":57112},[],[57114],{"type":26,"value":57115},"console.log",{"type":26,"value":57117}," calls while developing, in order to get a better handle on inputs, outpus, variable states, etc. Some of these calls are obviated by the incresingly powerful built-in browser tools, but inevitably your code will pick up a few.",{"type":21,"tag":22,"props":57119,"children":57120},{},[57121,57123,57129],{"type":26,"value":57122},"Suddenly, you realize that you need to port that code to an IE version \u003C= 8. The code breaks. You open up devtools. The code works. What's going on? The ",{"type":21,"tag":63,"props":57124,"children":57126},{"className":57125},[],[57127],{"type":26,"value":57128},"console",{"type":26,"value":57130}," object doesn't exist until you open up devtools - its tricky the first time you stumble into it. Here's the quick fix:",{"type":21,"tag":200,"props":57132,"children":57134},{"className":16138,"code":57133,"language":16140,"meta":8,"style":8},"window.console = window.console || {\n    /** @param {...*} args */\n    log:function(){};\n};\n",[57135],{"type":21,"tag":63,"props":57136,"children":57137},{"__ignoreMap":8},[57138,57163,57189,57210],{"type":21,"tag":209,"props":57139,"children":57140},{"class":211,"line":212},[57141,57146,57150,57155,57159],{"type":21,"tag":209,"props":57142,"children":57143},{"style":222},[57144],{"type":26,"value":57145},"window.console ",{"type":21,"tag":209,"props":57147,"children":57148},{"style":216},[57149],{"type":26,"value":1432},{"type":21,"tag":209,"props":57151,"children":57152},{"style":222},[57153],{"type":26,"value":57154}," window.console ",{"type":21,"tag":209,"props":57156,"children":57157},{"style":216},[57158],{"type":26,"value":13270},{"type":21,"tag":209,"props":57160,"children":57161},{"style":222},[57162],{"type":26,"value":276},{"type":21,"tag":209,"props":57164,"children":57165},{"class":211,"line":244},[57166,57171,57175,57180,57185],{"type":21,"tag":209,"props":57167,"children":57168},{"style":448},[57169],{"type":26,"value":57170},"    /** ",{"type":21,"tag":209,"props":57172,"children":57173},{"style":216},[57174],{"type":26,"value":13311},{"type":21,"tag":209,"props":57176,"children":57177},{"style":360},[57178],{"type":26,"value":57179}," {...*}",{"type":21,"tag":209,"props":57181,"children":57182},{"style":222},[57183],{"type":26,"value":57184}," args",{"type":21,"tag":209,"props":57186,"children":57187},{"style":448},[57188],{"type":26,"value":755},{"type":21,"tag":209,"props":57190,"children":57191},{"class":211,"line":254},[57192,57197,57201,57205],{"type":21,"tag":209,"props":57193,"children":57194},{"style":360},[57195],{"type":26,"value":57196},"    log",{"type":21,"tag":209,"props":57198,"children":57199},{"style":222},[57200],{"type":26,"value":191},{"type":21,"tag":209,"props":57202,"children":57203},{"style":216},[57204],{"type":26,"value":4622},{"type":21,"tag":209,"props":57206,"children":57207},{"style":222},[57208],{"type":26,"value":57209},"(){};\n",{"type":21,"tag":209,"props":57211,"children":57212},{"class":211,"line":279},[57213],{"type":21,"tag":209,"props":57214,"children":57215},{"style":222},[57216],{"type":26,"value":340},{"type":21,"tag":22,"props":57218,"children":57219},{},[57220],{"type":26,"value":57221},"Have code that needs to be tested on a production server, but want to leave those console.log calls in for future debugging use - but not have them output when you're on the production server? Set a variable (either global if you must, or better, in an init call to a function, on the function prototype, etc.) to indicate 'debug mode' and call console.log like so:",{"type":21,"tag":200,"props":57223,"children":57225},{"className":16138,"code":57224,"language":16140,"meta":8,"style":8},"this.debug && console.log(\"Console output.\");\n",[57226],{"type":21,"tag":63,"props":57227,"children":57228},{"__ignoreMap":8},[57229],{"type":21,"tag":209,"props":57230,"children":57231},{"class":211,"line":212},[57232,57236,57241,57245,57250,57254,57258,57263],{"type":21,"tag":209,"props":57233,"children":57234},{"style":263},[57235],{"type":26,"value":2508},{"type":21,"tag":209,"props":57237,"children":57238},{"style":222},[57239],{"type":26,"value":57240},".debug ",{"type":21,"tag":209,"props":57242,"children":57243},{"style":216},[57244],{"type":26,"value":18381},{"type":21,"tag":209,"props":57246,"children":57247},{"style":222},[57248],{"type":26,"value":57249}," console.",{"type":21,"tag":209,"props":57251,"children":57252},{"style":360},[57253],{"type":26,"value":1059},{"type":21,"tag":209,"props":57255,"children":57256},{"style":222},[57257],{"type":26,"value":368},{"type":21,"tag":209,"props":57259,"children":57260},{"style":233},[57261],{"type":26,"value":57262},"\"Console output.\"",{"type":21,"tag":209,"props":57264,"children":57265},{"style":222},[57266],{"type":26,"value":2608},{"type":21,"tag":3596,"props":57268,"children":57270},{"id":57269},"getting-a-trim-capitals-and-splitting-camelcase",[57271,57273,57278],{"type":26,"value":57272},"Getting a ",{"type":21,"tag":63,"props":57274,"children":57276},{"className":57275},[],[57277],{"type":26,"value":37982},{"type":26,"value":57279},", Capitals and splitting camelCase",{"type":21,"tag":22,"props":57281,"children":57282},{},[57283,57285,57291],{"type":26,"value":57284},"It seems that even libraries purporting to support older browsers expect the ",{"type":21,"tag":63,"props":57286,"children":57288},{"className":57287},[],[57289],{"type":26,"value":57290},"String.prototype.trim",{"type":26,"value":57292}," function to be present (see the Google Maps v3 api, for instance). Unfortunately, IE versions \u003C= 8 and Safari \u003C= 5 don't. We'll just quickly pop that in to place, then:",{"type":21,"tag":200,"props":57294,"children":57296},{"className":16138,"code":57295,"language":16140,"meta":8,"style":8},"if (typeof String.prototype.trim !== 'function'){\n    String.prototype.trim = function(){\n        return this.replace(/^s+|s+$/g, '');\n    };\n}\n",[57297],{"type":21,"tag":63,"props":57298,"children":57299},{"__ignoreMap":8},[57300,57344,57380,57451,57458],{"type":21,"tag":209,"props":57301,"children":57302},{"class":211,"line":212},[57303,57307,57311,57315,57319,57323,57327,57332,57336,57340],{"type":21,"tag":209,"props":57304,"children":57305},{"style":216},[57306],{"type":26,"value":4301},{"type":21,"tag":209,"props":57308,"children":57309},{"style":222},[57310],{"type":26,"value":5569},{"type":21,"tag":209,"props":57312,"children":57313},{"style":216},[57314],{"type":26,"value":8036},{"type":21,"tag":209,"props":57316,"children":57317},{"style":263},[57318],{"type":26,"value":52222},{"type":21,"tag":209,"props":57320,"children":57321},{"style":222},[57322],{"type":26,"value":378},{"type":21,"tag":209,"props":57324,"children":57325},{"style":263},[57326],{"type":26,"value":32662},{"type":21,"tag":209,"props":57328,"children":57329},{"style":222},[57330],{"type":26,"value":57331},".trim ",{"type":21,"tag":209,"props":57333,"children":57334},{"style":216},[57335],{"type":26,"value":8046},{"type":21,"tag":209,"props":57337,"children":57338},{"style":233},[57339],{"type":26,"value":14685},{"type":21,"tag":209,"props":57341,"children":57342},{"style":222},[57343],{"type":26,"value":2369},{"type":21,"tag":209,"props":57345,"children":57346},{"class":211,"line":244},[57347,57352,57356,57360,57364,57368,57372,57376],{"type":21,"tag":209,"props":57348,"children":57349},{"style":263},[57350],{"type":26,"value":57351},"    String",{"type":21,"tag":209,"props":57353,"children":57354},{"style":222},[57355],{"type":26,"value":378},{"type":21,"tag":209,"props":57357,"children":57358},{"style":263},[57359],{"type":26,"value":32662},{"type":21,"tag":209,"props":57361,"children":57362},{"style":222},[57363],{"type":26,"value":378},{"type":21,"tag":209,"props":57365,"children":57366},{"style":360},[57367],{"type":26,"value":37982},{"type":21,"tag":209,"props":57369,"children":57370},{"style":216},[57371],{"type":26,"value":271},{"type":21,"tag":209,"props":57373,"children":57374},{"style":216},[57375],{"type":26,"value":4789},{"type":21,"tag":209,"props":57377,"children":57378},{"style":222},[57379],{"type":26,"value":2561},{"type":21,"tag":209,"props":57381,"children":57382},{"class":211,"line":254},[57383,57387,57391,57395,57399,57403,57407,57411,57416,57421,57425,57430,57434,57439,57443,57447],{"type":21,"tag":209,"props":57384,"children":57385},{"style":216},[57386],{"type":26,"value":3069},{"type":21,"tag":209,"props":57388,"children":57389},{"style":263},[57390],{"type":26,"value":20502},{"type":21,"tag":209,"props":57392,"children":57393},{"style":222},[57394],{"type":26,"value":378},{"type":21,"tag":209,"props":57396,"children":57397},{"style":360},[57398],{"type":26,"value":28378},{"type":21,"tag":209,"props":57400,"children":57401},{"style":222},[57402],{"type":26,"value":368},{"type":21,"tag":209,"props":57404,"children":57405},{"style":233},[57406],{"type":26,"value":6460},{"type":21,"tag":209,"props":57408,"children":57409},{"style":216},[57410],{"type":26,"value":6465},{"type":21,"tag":209,"props":57412,"children":57413},{"style":6468},[57414],{"type":26,"value":57415},"s",{"type":21,"tag":209,"props":57417,"children":57418},{"style":216},[57419],{"type":26,"value":57420},"+|",{"type":21,"tag":209,"props":57422,"children":57423},{"style":6468},[57424],{"type":26,"value":57415},{"type":21,"tag":209,"props":57426,"children":57427},{"style":216},[57428],{"type":26,"value":57429},"+$",{"type":21,"tag":209,"props":57431,"children":57432},{"style":233},[57433],{"type":26,"value":6460},{"type":21,"tag":209,"props":57435,"children":57436},{"style":216},[57437],{"type":26,"value":57438},"g",{"type":21,"tag":209,"props":57440,"children":57441},{"style":222},[57442],{"type":26,"value":408},{"type":21,"tag":209,"props":57444,"children":57445},{"style":233},[57446],{"type":26,"value":10775},{"type":21,"tag":209,"props":57448,"children":57449},{"style":222},[57450],{"type":26,"value":2608},{"type":21,"tag":209,"props":57452,"children":57453},{"class":211,"line":279},[57454],{"type":21,"tag":209,"props":57455,"children":57456},{"style":222},[57457],{"type":26,"value":13439},{"type":21,"tag":209,"props":57459,"children":57460},{"class":211,"line":288},[57461],{"type":21,"tag":209,"props":57462,"children":57463},{"style":222},[57464],{"type":26,"value":4415},{"type":21,"tag":22,"props":57466,"children":57467},{},[57468,57470,57476],{"type":26,"value":57469},"If you have input strings that you know will need capitalizing (say database column names that will end up in the ",{"type":21,"tag":63,"props":57471,"children":57473},{"className":57472},[],[57474],{"type":26,"value":57475},"th",{"type":26,"value":57477}," of an html table), best to wrap that in an easily callable, chainable function:",{"type":21,"tag":200,"props":57479,"children":57481},{"className":16138,"code":57480,"language":16140,"meta":8,"style":8},"String.prototype.capitalize = function(){\n    return this.charAt(0).toUpperCase() + this.slice(1);\n};\n",[57482],{"type":21,"tag":63,"props":57483,"children":57484},{"__ignoreMap":8},[57485,57522,57591],{"type":21,"tag":209,"props":57486,"children":57487},{"class":211,"line":212},[57488,57493,57497,57501,57505,57510,57514,57518],{"type":21,"tag":209,"props":57489,"children":57490},{"style":263},[57491],{"type":26,"value":57492},"String",{"type":21,"tag":209,"props":57494,"children":57495},{"style":222},[57496],{"type":26,"value":378},{"type":21,"tag":209,"props":57498,"children":57499},{"style":263},[57500],{"type":26,"value":32662},{"type":21,"tag":209,"props":57502,"children":57503},{"style":222},[57504],{"type":26,"value":378},{"type":21,"tag":209,"props":57506,"children":57507},{"style":360},[57508],{"type":26,"value":57509},"capitalize",{"type":21,"tag":209,"props":57511,"children":57512},{"style":216},[57513],{"type":26,"value":271},{"type":21,"tag":209,"props":57515,"children":57516},{"style":216},[57517],{"type":26,"value":4789},{"type":21,"tag":209,"props":57519,"children":57520},{"style":222},[57521],{"type":26,"value":2561},{"type":21,"tag":209,"props":57523,"children":57524},{"class":211,"line":244},[57525,57529,57533,57537,57542,57546,57550,57554,57559,57563,57567,57571,57575,57579,57583,57587],{"type":21,"tag":209,"props":57526,"children":57527},{"style":216},[57528],{"type":26,"value":1298},{"type":21,"tag":209,"props":57530,"children":57531},{"style":263},[57532],{"type":26,"value":20502},{"type":21,"tag":209,"props":57534,"children":57535},{"style":222},[57536],{"type":26,"value":378},{"type":21,"tag":209,"props":57538,"children":57539},{"style":360},[57540],{"type":26,"value":57541},"charAt",{"type":21,"tag":209,"props":57543,"children":57544},{"style":222},[57545],{"type":26,"value":368},{"type":21,"tag":209,"props":57547,"children":57548},{"style":263},[57549],{"type":26,"value":8554},{"type":21,"tag":209,"props":57551,"children":57552},{"style":222},[57553],{"type":26,"value":2699},{"type":21,"tag":209,"props":57555,"children":57556},{"style":360},[57557],{"type":26,"value":57558},"toUpperCase",{"type":21,"tag":209,"props":57560,"children":57561},{"style":222},[57562],{"type":26,"value":17194},{"type":21,"tag":209,"props":57564,"children":57565},{"style":216},[57566],{"type":26,"value":17170},{"type":21,"tag":209,"props":57568,"children":57569},{"style":263},[57570],{"type":26,"value":20502},{"type":21,"tag":209,"props":57572,"children":57573},{"style":222},[57574],{"type":26,"value":378},{"type":21,"tag":209,"props":57576,"children":57577},{"style":360},[57578],{"type":26,"value":42188},{"type":21,"tag":209,"props":57580,"children":57581},{"style":222},[57582],{"type":26,"value":368},{"type":21,"tag":209,"props":57584,"children":57585},{"style":263},[57586],{"type":26,"value":3224},{"type":21,"tag":209,"props":57588,"children":57589},{"style":222},[57590],{"type":26,"value":2608},{"type":21,"tag":209,"props":57592,"children":57593},{"class":211,"line":254},[57594],{"type":21,"tag":209,"props":57595,"children":57596},{"style":222},[57597],{"type":26,"value":340},{"type":21,"tag":22,"props":57599,"children":57600},{},[57601],{"type":26,"value":57602},"We can do something similar if we know we'll need to split a string on camelCaseNames:",{"type":21,"tag":200,"props":57604,"children":57606},{"className":16138,"code":57605,"language":16140,"meta":8,"style":8},"String.prototype.splitCamelCase = function(){\n    return this.replace(/([A-Z])/g, ' $1');\n};\n",[57607],{"type":21,"tag":63,"props":57608,"children":57609},{"__ignoreMap":8},[57610,57646,57707],{"type":21,"tag":209,"props":57611,"children":57612},{"class":211,"line":212},[57613,57617,57621,57625,57629,57634,57638,57642],{"type":21,"tag":209,"props":57614,"children":57615},{"style":263},[57616],{"type":26,"value":57492},{"type":21,"tag":209,"props":57618,"children":57619},{"style":222},[57620],{"type":26,"value":378},{"type":21,"tag":209,"props":57622,"children":57623},{"style":263},[57624],{"type":26,"value":32662},{"type":21,"tag":209,"props":57626,"children":57627},{"style":222},[57628],{"type":26,"value":378},{"type":21,"tag":209,"props":57630,"children":57631},{"style":360},[57632],{"type":26,"value":57633},"splitCamelCase",{"type":21,"tag":209,"props":57635,"children":57636},{"style":216},[57637],{"type":26,"value":271},{"type":21,"tag":209,"props":57639,"children":57640},{"style":216},[57641],{"type":26,"value":4789},{"type":21,"tag":209,"props":57643,"children":57644},{"style":222},[57645],{"type":26,"value":2561},{"type":21,"tag":209,"props":57647,"children":57648},{"class":211,"line":244},[57649,57653,57657,57661,57665,57669,57673,57677,57682,57686,57690,57694,57698,57703],{"type":21,"tag":209,"props":57650,"children":57651},{"style":216},[57652],{"type":26,"value":1298},{"type":21,"tag":209,"props":57654,"children":57655},{"style":263},[57656],{"type":26,"value":20502},{"type":21,"tag":209,"props":57658,"children":57659},{"style":222},[57660],{"type":26,"value":378},{"type":21,"tag":209,"props":57662,"children":57663},{"style":360},[57664],{"type":26,"value":28378},{"type":21,"tag":209,"props":57666,"children":57667},{"style":222},[57668],{"type":26,"value":368},{"type":21,"tag":209,"props":57670,"children":57671},{"style":233},[57672],{"type":26,"value":6460},{"type":21,"tag":209,"props":57674,"children":57675},{"style":6468},[57676],{"type":26,"value":368},{"type":21,"tag":209,"props":57678,"children":57679},{"style":263},[57680],{"type":26,"value":57681},"[A-Z]",{"type":21,"tag":209,"props":57683,"children":57684},{"style":6468},[57685],{"type":26,"value":53391},{"type":21,"tag":209,"props":57687,"children":57688},{"style":233},[57689],{"type":26,"value":6460},{"type":21,"tag":209,"props":57691,"children":57692},{"style":216},[57693],{"type":26,"value":57438},{"type":21,"tag":209,"props":57695,"children":57696},{"style":222},[57697],{"type":26,"value":408},{"type":21,"tag":209,"props":57699,"children":57700},{"style":233},[57701],{"type":26,"value":57702},"' $1'",{"type":21,"tag":209,"props":57704,"children":57705},{"style":222},[57706],{"type":26,"value":2608},{"type":21,"tag":209,"props":57708,"children":57709},{"class":211,"line":254},[57710],{"type":21,"tag":209,"props":57711,"children":57712},{"style":222},[57713],{"type":26,"value":340},{"type":21,"tag":22,"props":57715,"children":57716},{},[57717,57719,57725],{"type":26,"value":57718},"If you cringe at the idea of adding to the built-in prototypes, we can do something similar with, for example ",{"type":21,"tag":29,"props":57720,"children":57722},{"href":34009,"rel":57721},[93],[57723],{"type":26,"value":57724},"underscore's",{"type":26,"value":57726}," mixins:",{"type":21,"tag":200,"props":57728,"children":57730},{"className":16138,"code":57729,"language":16140,"meta":8,"style":8},"_.mixin({\n    capitalize:function(string){\n        return string.charAt(0).toUpperCase() + string.slice(1);\n    },\n    splitCamelCase:function(string){\n        return string.replace(/([A-Z])/g, ' $1');\n    }\n});\n",[57731],{"type":21,"tag":63,"props":57732,"children":57733},{"__ignoreMap":8},[57734,57751,57780,57840,57847,57875,57930,57937],{"type":21,"tag":209,"props":57735,"children":57736},{"class":211,"line":212},[57737,57742,57747],{"type":21,"tag":209,"props":57738,"children":57739},{"style":222},[57740],{"type":26,"value":57741},"_.",{"type":21,"tag":209,"props":57743,"children":57744},{"style":360},[57745],{"type":26,"value":57746},"mixin",{"type":21,"tag":209,"props":57748,"children":57749},{"style":222},[57750],{"type":26,"value":7767},{"type":21,"tag":209,"props":57752,"children":57753},{"class":211,"line":244},[57754,57759,57763,57767,57771,57776],{"type":21,"tag":209,"props":57755,"children":57756},{"style":360},[57757],{"type":26,"value":57758},"    capitalize",{"type":21,"tag":209,"props":57760,"children":57761},{"style":222},[57762],{"type":26,"value":191},{"type":21,"tag":209,"props":57764,"children":57765},{"style":216},[57766],{"type":26,"value":4622},{"type":21,"tag":209,"props":57768,"children":57769},{"style":222},[57770],{"type":26,"value":368},{"type":21,"tag":209,"props":57772,"children":57773},{"style":400},[57774],{"type":26,"value":57775},"string",{"type":21,"tag":209,"props":57777,"children":57778},{"style":222},[57779],{"type":26,"value":2369},{"type":21,"tag":209,"props":57781,"children":57782},{"class":211,"line":254},[57783,57787,57792,57796,57800,57804,57808,57812,57816,57820,57824,57828,57832,57836],{"type":21,"tag":209,"props":57784,"children":57785},{"style":216},[57786],{"type":26,"value":3069},{"type":21,"tag":209,"props":57788,"children":57789},{"style":222},[57790],{"type":26,"value":57791}," string.",{"type":21,"tag":209,"props":57793,"children":57794},{"style":360},[57795],{"type":26,"value":57541},{"type":21,"tag":209,"props":57797,"children":57798},{"style":222},[57799],{"type":26,"value":368},{"type":21,"tag":209,"props":57801,"children":57802},{"style":263},[57803],{"type":26,"value":8554},{"type":21,"tag":209,"props":57805,"children":57806},{"style":222},[57807],{"type":26,"value":2699},{"type":21,"tag":209,"props":57809,"children":57810},{"style":360},[57811],{"type":26,"value":57558},{"type":21,"tag":209,"props":57813,"children":57814},{"style":222},[57815],{"type":26,"value":17194},{"type":21,"tag":209,"props":57817,"children":57818},{"style":216},[57819],{"type":26,"value":17170},{"type":21,"tag":209,"props":57821,"children":57822},{"style":222},[57823],{"type":26,"value":57791},{"type":21,"tag":209,"props":57825,"children":57826},{"style":360},[57827],{"type":26,"value":42188},{"type":21,"tag":209,"props":57829,"children":57830},{"style":222},[57831],{"type":26,"value":368},{"type":21,"tag":209,"props":57833,"children":57834},{"style":263},[57835],{"type":26,"value":3224},{"type":21,"tag":209,"props":57837,"children":57838},{"style":222},[57839],{"type":26,"value":2608},{"type":21,"tag":209,"props":57841,"children":57842},{"class":211,"line":279},[57843],{"type":21,"tag":209,"props":57844,"children":57845},{"style":222},[57846],{"type":26,"value":2251},{"type":21,"tag":209,"props":57848,"children":57849},{"class":211,"line":288},[57850,57855,57859,57863,57867,57871],{"type":21,"tag":209,"props":57851,"children":57852},{"style":360},[57853],{"type":26,"value":57854},"    splitCamelCase",{"type":21,"tag":209,"props":57856,"children":57857},{"style":222},[57858],{"type":26,"value":191},{"type":21,"tag":209,"props":57860,"children":57861},{"style":216},[57862],{"type":26,"value":4622},{"type":21,"tag":209,"props":57864,"children":57865},{"style":222},[57866],{"type":26,"value":368},{"type":21,"tag":209,"props":57868,"children":57869},{"style":400},[57870],{"type":26,"value":57775},{"type":21,"tag":209,"props":57872,"children":57873},{"style":222},[57874],{"type":26,"value":2369},{"type":21,"tag":209,"props":57876,"children":57877},{"class":211,"line":307},[57878,57882,57886,57890,57894,57898,57902,57906,57910,57914,57918,57922,57926],{"type":21,"tag":209,"props":57879,"children":57880},{"style":216},[57881],{"type":26,"value":3069},{"type":21,"tag":209,"props":57883,"children":57884},{"style":222},[57885],{"type":26,"value":57791},{"type":21,"tag":209,"props":57887,"children":57888},{"style":360},[57889],{"type":26,"value":28378},{"type":21,"tag":209,"props":57891,"children":57892},{"style":222},[57893],{"type":26,"value":368},{"type":21,"tag":209,"props":57895,"children":57896},{"style":233},[57897],{"type":26,"value":6460},{"type":21,"tag":209,"props":57899,"children":57900},{"style":6468},[57901],{"type":26,"value":368},{"type":21,"tag":209,"props":57903,"children":57904},{"style":263},[57905],{"type":26,"value":57681},{"type":21,"tag":209,"props":57907,"children":57908},{"style":6468},[57909],{"type":26,"value":53391},{"type":21,"tag":209,"props":57911,"children":57912},{"style":233},[57913],{"type":26,"value":6460},{"type":21,"tag":209,"props":57915,"children":57916},{"style":216},[57917],{"type":26,"value":57438},{"type":21,"tag":209,"props":57919,"children":57920},{"style":222},[57921],{"type":26,"value":408},{"type":21,"tag":209,"props":57923,"children":57924},{"style":233},[57925],{"type":26,"value":57702},{"type":21,"tag":209,"props":57927,"children":57928},{"style":222},[57929],{"type":26,"value":2608},{"type":21,"tag":209,"props":57931,"children":57932},{"class":211,"line":325},[57933],{"type":21,"tag":209,"props":57934,"children":57935},{"style":222},[57936],{"type":26,"value":331},{"type":21,"tag":209,"props":57938,"children":57939},{"class":211,"line":334},[57940],{"type":21,"tag":209,"props":57941,"children":57942},{"style":222},[57943],{"type":26,"value":469},{"type":21,"tag":51,"props":57945,"children":57947},{"id":57946},"this-space-reserved",[57948],{"type":26,"value":57949},"This Space Reserved",{"type":21,"tag":22,"props":57951,"children":57952},{},[57953],{"type":26,"value":57954},"So, you've created an object somewhere in your code, probably something with meaningful names given the function their value is expected to be used for/perform, and run it, only to be met with an error: 'Expected identifier, string or number'. Chances are you've accidentally used a reserved keyword in your object keys.",{"type":21,"tag":22,"props":57956,"children":57957},{},[57958],{"type":26,"value":57959},"Something like this:",{"type":21,"tag":200,"props":57961,"children":57963},{"className":16138,"code":57962,"language":16140,"meta":8,"style":8},"var ob = {\n    for:12,\n    class:15\n};\n",[57964],{"type":21,"tag":63,"props":57965,"children":57966},{"__ignoreMap":8},[57967,57987,58004,58017],{"type":21,"tag":209,"props":57968,"children":57969},{"class":211,"line":212},[57970,57974,57979,57983],{"type":21,"tag":209,"props":57971,"children":57972},{"style":216},[57973],{"type":26,"value":3909},{"type":21,"tag":209,"props":57975,"children":57976},{"style":222},[57977],{"type":26,"value":57978}," ob ",{"type":21,"tag":209,"props":57980,"children":57981},{"style":216},[57982],{"type":26,"value":1432},{"type":21,"tag":209,"props":57984,"children":57985},{"style":222},[57986],{"type":26,"value":276},{"type":21,"tag":209,"props":57988,"children":57989},{"class":211,"line":244},[57990,57995,58000],{"type":21,"tag":209,"props":57991,"children":57992},{"style":222},[57993],{"type":26,"value":57994},"    for:",{"type":21,"tag":209,"props":57996,"children":57997},{"style":263},[57998],{"type":26,"value":57999},"12",{"type":21,"tag":209,"props":58001,"children":58002},{"style":222},[58003],{"type":26,"value":304},{"type":21,"tag":209,"props":58005,"children":58006},{"class":211,"line":254},[58007,58012],{"type":21,"tag":209,"props":58008,"children":58009},{"style":222},[58010],{"type":26,"value":58011},"    class:",{"type":21,"tag":209,"props":58013,"children":58014},{"style":263},[58015],{"type":26,"value":58016},"15\n",{"type":21,"tag":209,"props":58018,"children":58019},{"class":211,"line":279},[58020],{"type":21,"tag":209,"props":58021,"children":58022},{"style":222},[58023],{"type":26,"value":340},{"type":21,"tag":22,"props":58025,"children":58026},{},[58027],{"type":26,"value":58028},"Needs to be altered to this:",{"type":21,"tag":200,"props":58030,"children":58032},{"className":16138,"code":58031,"language":16140,"meta":8,"style":8},"var ob = {\n    'for':12,\n    'class':15\n};\n",[58033],{"type":21,"tag":63,"props":58034,"children":58035},{"__ignoreMap":8},[58036,58055,58075,58091],{"type":21,"tag":209,"props":58037,"children":58038},{"class":211,"line":212},[58039,58043,58047,58051],{"type":21,"tag":209,"props":58040,"children":58041},{"style":216},[58042],{"type":26,"value":3909},{"type":21,"tag":209,"props":58044,"children":58045},{"style":222},[58046],{"type":26,"value":57978},{"type":21,"tag":209,"props":58048,"children":58049},{"style":216},[58050],{"type":26,"value":1432},{"type":21,"tag":209,"props":58052,"children":58053},{"style":222},[58054],{"type":26,"value":276},{"type":21,"tag":209,"props":58056,"children":58057},{"class":211,"line":244},[58058,58063,58067,58071],{"type":21,"tag":209,"props":58059,"children":58060},{"style":233},[58061],{"type":26,"value":58062},"    'for'",{"type":21,"tag":209,"props":58064,"children":58065},{"style":222},[58066],{"type":26,"value":191},{"type":21,"tag":209,"props":58068,"children":58069},{"style":263},[58070],{"type":26,"value":57999},{"type":21,"tag":209,"props":58072,"children":58073},{"style":222},[58074],{"type":26,"value":304},{"type":21,"tag":209,"props":58076,"children":58077},{"class":211,"line":254},[58078,58083,58087],{"type":21,"tag":209,"props":58079,"children":58080},{"style":233},[58081],{"type":26,"value":58082},"    'class'",{"type":21,"tag":209,"props":58084,"children":58085},{"style":222},[58086],{"type":26,"value":191},{"type":21,"tag":209,"props":58088,"children":58089},{"style":263},[58090],{"type":26,"value":58016},{"type":21,"tag":209,"props":58092,"children":58093},{"class":211,"line":279},[58094],{"type":21,"tag":209,"props":58095,"children":58096},{"style":222},[58097],{"type":26,"value":340},{"type":21,"tag":22,"props":58099,"children":58100},{},[58101,58103,58110],{"type":26,"value":58102},"This will keep the js engine in question from seeing a keyword where an object key was intended. Another alternative is, of course, to simply avoid using any of the ",{"type":21,"tag":29,"props":58104,"children":58107},{"href":58105,"rel":58106},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words",[93],[58108],{"type":26,"value":58109},"reserved keywords",{"type":26,"value":58111}," as object keys.",{"type":21,"tag":193,"props":58113,"children":58115},{"id":58114},"expert-timing",[58116],{"type":26,"value":58117},"Expert Timing",{"type":21,"tag":22,"props":58119,"children":58120},{},[58121,58123,58128,58130,58134],{"type":26,"value":58122},"setTimeout/setInterval is not very accurate. It has to compete with ui events and other callbacks, and really only guarantees that ",{"type":21,"tag":1084,"props":58124,"children":58125},{},[58126],{"type":26,"value":58127},"at least",{"type":26,"value":58129}," the specified interval will have passed before it gets called. Usually, its not an issue. If it ",{"type":21,"tag":1084,"props":58131,"children":58132},{},[58133],{"type":26,"value":24539},{"type":26,"value":58135}," important that the timing be accurate, however, we'll have to work a little harder.",{"type":21,"tag":22,"props":58137,"children":58138},{},[58139,58141,58147],{"type":26,"value":58140},"In modern browsers, we can rely on ",{"type":21,"tag":63,"props":58142,"children":58144},{"className":58143},[],[58145],{"type":26,"value":58146},"window.performance.now()",{"type":26,"value":58148}," for a highly accurate (10 us) timestamp. In older browsers, we'll have to make do with ms resolution from Date(). Either way, we'll be altering our desired interval with this number in our next call for the setTimeout, in order to try and keep the callbacks happening as regularly as possible, accounting for delays. This is still subject to variation, and very short intervals likely won't be long enough to allow for us to account for said variation, but the result should still be more accurate than a simple setTimeout/setInterval call, in a way that offers a similar api to the standard setInterval call.",{"type":21,"tag":200,"props":58150,"children":58152},{"className":16138,"code":58151,"language":16140,"meta":8,"style":8},"(function(window){\n    window.performance = window.performance || {};\n    performance.now = performance.now || function(){\n        return +new Date();\n    };\n\n    function AccurateInterval(options){\n        this.startTime = 0;\n        this.elapsed = 0;\n        this.timeout = 0;\n        this.interval = options.interval || 100;\n        this.callback = options.callback;\n\n        if (typeof this.callback !== 'function') throw 'You must specify a callback function.';\n\n        return this;\n    }\n\n    AccurateInterval.prototype.start = function(){\n        this.startTime = performance.now();\n        this.timeout = window.setTimeout(this.tick.bind(this), this.interval);\n\n        return this;\n    };\n\n    AccurateInterval.prototype.tick = function(){\n        this.elapsed += this.interval;\n        var missedTicks = 0,\n            nextInterval = this.interval - ((performance.now() - this.startTime) - this.elapsed);\n\n        if (nextInterval \u003C= 0) {\n            missedTicks = (Math.abs(nextInterval) / this.interval) | 0;\n            this.elapsed += missedTicks * this.interval;\n            this.tick();\n            return;\n        }\n        this.callback();\n        this.timeout = window.setTimeout(this.tick.bind(this), nextInterval);\n    };\n\n    AccurateInterval.prototype.stop = function(){\n        window.clearTimeout(this.timeout);\n\n        return this;\n    };\n\n    window.setAccurateInterval = function(callback, interval){\n        return new AccurateInterval({callback:callback, interval:interval}).start();\n    };\n\n    window.clearAccurateInterval = function(acc){\n        acc.stop();\n    };\n})(window);\n",[58153],{"type":21,"tag":63,"props":58154,"children":58155},{"__ignoreMap":8},[58156,58179,58204,58233,58252,58259,58266,58290,58314,58338,58362,58396,58417,58424,58472,58479,58494,58501,58508,58544,58573,58635,58642,58657,58664,58671,58707,58731,58755,58818,58825,58850,58903,58934,58953,58964,58971,58990,59042,59049,59056,59091,59117,59124,59139,59146,59153,59195,59223,59230,59237,59270,59286,59293],{"type":21,"tag":209,"props":58157,"children":58158},{"class":211,"line":212},[58159,58163,58167,58171,58175],{"type":21,"tag":209,"props":58160,"children":58161},{"style":222},[58162],{"type":26,"value":368},{"type":21,"tag":209,"props":58164,"children":58165},{"style":216},[58166],{"type":26,"value":4622},{"type":21,"tag":209,"props":58168,"children":58169},{"style":222},[58170],{"type":26,"value":368},{"type":21,"tag":209,"props":58172,"children":58173},{"style":400},[58174],{"type":26,"value":25385},{"type":21,"tag":209,"props":58176,"children":58177},{"style":222},[58178],{"type":26,"value":2369},{"type":21,"tag":209,"props":58180,"children":58181},{"class":211,"line":244},[58182,58187,58191,58196,58200],{"type":21,"tag":209,"props":58183,"children":58184},{"style":222},[58185],{"type":26,"value":58186},"    window.performance ",{"type":21,"tag":209,"props":58188,"children":58189},{"style":216},[58190],{"type":26,"value":1432},{"type":21,"tag":209,"props":58192,"children":58193},{"style":222},[58194],{"type":26,"value":58195}," window.performance ",{"type":21,"tag":209,"props":58197,"children":58198},{"style":216},[58199],{"type":26,"value":13270},{"type":21,"tag":209,"props":58201,"children":58202},{"style":222},[58203],{"type":26,"value":7963},{"type":21,"tag":209,"props":58205,"children":58206},{"class":211,"line":254},[58207,58212,58216,58221,58225,58229],{"type":21,"tag":209,"props":58208,"children":58209},{"style":222},[58210],{"type":26,"value":58211},"    performance.now ",{"type":21,"tag":209,"props":58213,"children":58214},{"style":216},[58215],{"type":26,"value":1432},{"type":21,"tag":209,"props":58217,"children":58218},{"style":222},[58219],{"type":26,"value":58220}," performance.now ",{"type":21,"tag":209,"props":58222,"children":58223},{"style":216},[58224],{"type":26,"value":13270},{"type":21,"tag":209,"props":58226,"children":58227},{"style":216},[58228],{"type":26,"value":4789},{"type":21,"tag":209,"props":58230,"children":58231},{"style":222},[58232],{"type":26,"value":2561},{"type":21,"tag":209,"props":58234,"children":58235},{"class":211,"line":279},[58236,58240,58244,58248],{"type":21,"tag":209,"props":58237,"children":58238},{"style":216},[58239],{"type":26,"value":3069},{"type":21,"tag":209,"props":58241,"children":58242},{"style":216},[58243],{"type":26,"value":20050},{"type":21,"tag":209,"props":58245,"children":58246},{"style":360},[58247],{"type":26,"value":17189},{"type":21,"tag":209,"props":58249,"children":58250},{"style":222},[58251],{"type":26,"value":4123},{"type":21,"tag":209,"props":58253,"children":58254},{"class":211,"line":288},[58255],{"type":21,"tag":209,"props":58256,"children":58257},{"style":222},[58258],{"type":26,"value":13439},{"type":21,"tag":209,"props":58260,"children":58261},{"class":211,"line":307},[58262],{"type":21,"tag":209,"props":58263,"children":58264},{"emptyLinePlaceholder":248},[58265],{"type":26,"value":251},{"type":21,"tag":209,"props":58267,"children":58268},{"class":211,"line":325},[58269,58273,58278,58282,58286],{"type":21,"tag":209,"props":58270,"children":58271},{"style":216},[58272],{"type":26,"value":2981},{"type":21,"tag":209,"props":58274,"children":58275},{"style":360},[58276],{"type":26,"value":58277}," AccurateInterval",{"type":21,"tag":209,"props":58279,"children":58280},{"style":222},[58281],{"type":26,"value":368},{"type":21,"tag":209,"props":58283,"children":58284},{"style":400},[58285],{"type":26,"value":28349},{"type":21,"tag":209,"props":58287,"children":58288},{"style":222},[58289],{"type":26,"value":2369},{"type":21,"tag":209,"props":58291,"children":58292},{"class":211,"line":334},[58293,58297,58302,58306,58310],{"type":21,"tag":209,"props":58294,"children":58295},{"style":263},[58296],{"type":26,"value":47121},{"type":21,"tag":209,"props":58298,"children":58299},{"style":222},[58300],{"type":26,"value":58301},".startTime ",{"type":21,"tag":209,"props":58303,"children":58304},{"style":216},[58305],{"type":26,"value":1432},{"type":21,"tag":209,"props":58307,"children":58308},{"style":263},[58309],{"type":26,"value":8009},{"type":21,"tag":209,"props":58311,"children":58312},{"style":222},[58313],{"type":26,"value":241},{"type":21,"tag":209,"props":58315,"children":58316},{"class":211,"line":343},[58317,58321,58326,58330,58334],{"type":21,"tag":209,"props":58318,"children":58319},{"style":263},[58320],{"type":26,"value":47121},{"type":21,"tag":209,"props":58322,"children":58323},{"style":222},[58324],{"type":26,"value":58325},".elapsed ",{"type":21,"tag":209,"props":58327,"children":58328},{"style":216},[58329],{"type":26,"value":1432},{"type":21,"tag":209,"props":58331,"children":58332},{"style":263},[58333],{"type":26,"value":8009},{"type":21,"tag":209,"props":58335,"children":58336},{"style":222},[58337],{"type":26,"value":241},{"type":21,"tag":209,"props":58339,"children":58340},{"class":211,"line":351},[58341,58345,58350,58354,58358],{"type":21,"tag":209,"props":58342,"children":58343},{"style":263},[58344],{"type":26,"value":47121},{"type":21,"tag":209,"props":58346,"children":58347},{"style":222},[58348],{"type":26,"value":58349},".timeout ",{"type":21,"tag":209,"props":58351,"children":58352},{"style":216},[58353],{"type":26,"value":1432},{"type":21,"tag":209,"props":58355,"children":58356},{"style":263},[58357],{"type":26,"value":8009},{"type":21,"tag":209,"props":58359,"children":58360},{"style":222},[58361],{"type":26,"value":241},{"type":21,"tag":209,"props":58363,"children":58364},{"class":211,"line":444},[58365,58369,58374,58378,58383,58387,58392],{"type":21,"tag":209,"props":58366,"children":58367},{"style":263},[58368],{"type":26,"value":47121},{"type":21,"tag":209,"props":58370,"children":58371},{"style":222},[58372],{"type":26,"value":58373},".interval ",{"type":21,"tag":209,"props":58375,"children":58376},{"style":216},[58377],{"type":26,"value":1432},{"type":21,"tag":209,"props":58379,"children":58380},{"style":222},[58381],{"type":26,"value":58382}," options.interval ",{"type":21,"tag":209,"props":58384,"children":58385},{"style":216},[58386],{"type":26,"value":13270},{"type":21,"tag":209,"props":58388,"children":58389},{"style":263},[58390],{"type":26,"value":58391}," 100",{"type":21,"tag":209,"props":58393,"children":58394},{"style":222},[58395],{"type":26,"value":241},{"type":21,"tag":209,"props":58397,"children":58398},{"class":211,"line":454},[58399,58403,58408,58412],{"type":21,"tag":209,"props":58400,"children":58401},{"style":263},[58402],{"type":26,"value":47121},{"type":21,"tag":209,"props":58404,"children":58405},{"style":222},[58406],{"type":26,"value":58407},".callback ",{"type":21,"tag":209,"props":58409,"children":58410},{"style":216},[58411],{"type":26,"value":1432},{"type":21,"tag":209,"props":58413,"children":58414},{"style":222},[58415],{"type":26,"value":58416}," options.callback;\n",{"type":21,"tag":209,"props":58418,"children":58419},{"class":211,"line":463},[58420],{"type":21,"tag":209,"props":58421,"children":58422},{"emptyLinePlaceholder":248},[58423],{"type":26,"value":251},{"type":21,"tag":209,"props":58425,"children":58426},{"class":211,"line":472},[58427,58431,58435,58439,58443,58447,58451,58455,58459,58463,58468],{"type":21,"tag":209,"props":58428,"children":58429},{"style":216},[58430],{"type":26,"value":6334},{"type":21,"tag":209,"props":58432,"children":58433},{"style":222},[58434],{"type":26,"value":5569},{"type":21,"tag":209,"props":58436,"children":58437},{"style":216},[58438],{"type":26,"value":8036},{"type":21,"tag":209,"props":58440,"children":58441},{"style":263},[58442],{"type":26,"value":20502},{"type":21,"tag":209,"props":58444,"children":58445},{"style":222},[58446],{"type":26,"value":58407},{"type":21,"tag":209,"props":58448,"children":58449},{"style":216},[58450],{"type":26,"value":8046},{"type":21,"tag":209,"props":58452,"children":58453},{"style":233},[58454],{"type":26,"value":14685},{"type":21,"tag":209,"props":58456,"children":58457},{"style":222},[58458],{"type":26,"value":432},{"type":21,"tag":209,"props":58460,"children":58461},{"style":216},[58462],{"type":26,"value":21543},{"type":21,"tag":209,"props":58464,"children":58465},{"style":233},[58466],{"type":26,"value":58467}," 'You must specify a callback function.'",{"type":21,"tag":209,"props":58469,"children":58470},{"style":222},[58471],{"type":26,"value":241},{"type":21,"tag":209,"props":58473,"children":58474},{"class":211,"line":480},[58475],{"type":21,"tag":209,"props":58476,"children":58477},{"emptyLinePlaceholder":248},[58478],{"type":26,"value":251},{"type":21,"tag":209,"props":58480,"children":58481},{"class":211,"line":489},[58482,58486,58490],{"type":21,"tag":209,"props":58483,"children":58484},{"style":216},[58485],{"type":26,"value":3069},{"type":21,"tag":209,"props":58487,"children":58488},{"style":263},[58489],{"type":26,"value":20502},{"type":21,"tag":209,"props":58491,"children":58492},{"style":222},[58493],{"type":26,"value":241},{"type":21,"tag":209,"props":58495,"children":58496},{"class":211,"line":847},[58497],{"type":21,"tag":209,"props":58498,"children":58499},{"style":222},[58500],{"type":26,"value":331},{"type":21,"tag":209,"props":58502,"children":58503},{"class":211,"line":860},[58504],{"type":21,"tag":209,"props":58505,"children":58506},{"emptyLinePlaceholder":248},[58507],{"type":26,"value":251},{"type":21,"tag":209,"props":58509,"children":58510},{"class":211,"line":877},[58511,58516,58520,58524,58528,58532,58536,58540],{"type":21,"tag":209,"props":58512,"children":58513},{"style":263},[58514],{"type":26,"value":58515},"    AccurateInterval",{"type":21,"tag":209,"props":58517,"children":58518},{"style":222},[58519],{"type":26,"value":378},{"type":21,"tag":209,"props":58521,"children":58522},{"style":263},[58523],{"type":26,"value":32662},{"type":21,"tag":209,"props":58525,"children":58526},{"style":222},[58527],{"type":26,"value":378},{"type":21,"tag":209,"props":58529,"children":58530},{"style":360},[58531],{"type":26,"value":13670},{"type":21,"tag":209,"props":58533,"children":58534},{"style":216},[58535],{"type":26,"value":271},{"type":21,"tag":209,"props":58537,"children":58538},{"style":216},[58539],{"type":26,"value":4789},{"type":21,"tag":209,"props":58541,"children":58542},{"style":222},[58543],{"type":26,"value":2561},{"type":21,"tag":209,"props":58545,"children":58546},{"class":211,"line":889},[58547,58551,58555,58559,58564,58569],{"type":21,"tag":209,"props":58548,"children":58549},{"style":263},[58550],{"type":26,"value":47121},{"type":21,"tag":209,"props":58552,"children":58553},{"style":222},[58554],{"type":26,"value":58301},{"type":21,"tag":209,"props":58556,"children":58557},{"style":216},[58558],{"type":26,"value":1432},{"type":21,"tag":209,"props":58560,"children":58561},{"style":222},[58562],{"type":26,"value":58563}," performance.",{"type":21,"tag":209,"props":58565,"children":58566},{"style":360},[58567],{"type":26,"value":58568},"now",{"type":21,"tag":209,"props":58570,"children":58571},{"style":222},[58572],{"type":26,"value":4123},{"type":21,"tag":209,"props":58574,"children":58575},{"class":211,"line":902},[58576,58580,58584,58588,58593,58597,58601,58605,58610,58614,58618,58622,58626,58630],{"type":21,"tag":209,"props":58577,"children":58578},{"style":263},[58579],{"type":26,"value":47121},{"type":21,"tag":209,"props":58581,"children":58582},{"style":222},[58583],{"type":26,"value":58349},{"type":21,"tag":209,"props":58585,"children":58586},{"style":216},[58587],{"type":26,"value":1432},{"type":21,"tag":209,"props":58589,"children":58590},{"style":222},[58591],{"type":26,"value":58592}," window.",{"type":21,"tag":209,"props":58594,"children":58595},{"style":360},[58596],{"type":26,"value":16509},{"type":21,"tag":209,"props":58598,"children":58599},{"style":222},[58600],{"type":26,"value":368},{"type":21,"tag":209,"props":58602,"children":58603},{"style":263},[58604],{"type":26,"value":2508},{"type":21,"tag":209,"props":58606,"children":58607},{"style":222},[58608],{"type":26,"value":58609},".tick.",{"type":21,"tag":209,"props":58611,"children":58612},{"style":360},[58613],{"type":26,"value":20189},{"type":21,"tag":209,"props":58615,"children":58616},{"style":222},[58617],{"type":26,"value":368},{"type":21,"tag":209,"props":58619,"children":58620},{"style":263},[58621],{"type":26,"value":2508},{"type":21,"tag":209,"props":58623,"children":58624},{"style":222},[58625],{"type":26,"value":50542},{"type":21,"tag":209,"props":58627,"children":58628},{"style":263},[58629],{"type":26,"value":2508},{"type":21,"tag":209,"props":58631,"children":58632},{"style":222},[58633],{"type":26,"value":58634},".interval);\n",{"type":21,"tag":209,"props":58636,"children":58637},{"class":211,"line":914},[58638],{"type":21,"tag":209,"props":58639,"children":58640},{"emptyLinePlaceholder":248},[58641],{"type":26,"value":251},{"type":21,"tag":209,"props":58643,"children":58644},{"class":211,"line":922},[58645,58649,58653],{"type":21,"tag":209,"props":58646,"children":58647},{"style":216},[58648],{"type":26,"value":3069},{"type":21,"tag":209,"props":58650,"children":58651},{"style":263},[58652],{"type":26,"value":20502},{"type":21,"tag":209,"props":58654,"children":58655},{"style":222},[58656],{"type":26,"value":241},{"type":21,"tag":209,"props":58658,"children":58659},{"class":211,"line":2312},[58660],{"type":21,"tag":209,"props":58661,"children":58662},{"style":222},[58663],{"type":26,"value":13439},{"type":21,"tag":209,"props":58665,"children":58666},{"class":211,"line":2321},[58667],{"type":21,"tag":209,"props":58668,"children":58669},{"emptyLinePlaceholder":248},[58670],{"type":26,"value":251},{"type":21,"tag":209,"props":58672,"children":58673},{"class":211,"line":2372},[58674,58678,58682,58686,58690,58695,58699,58703],{"type":21,"tag":209,"props":58675,"children":58676},{"style":263},[58677],{"type":26,"value":58515},{"type":21,"tag":209,"props":58679,"children":58680},{"style":222},[58681],{"type":26,"value":378},{"type":21,"tag":209,"props":58683,"children":58684},{"style":263},[58685],{"type":26,"value":32662},{"type":21,"tag":209,"props":58687,"children":58688},{"style":222},[58689],{"type":26,"value":378},{"type":21,"tag":209,"props":58691,"children":58692},{"style":360},[58693],{"type":26,"value":58694},"tick",{"type":21,"tag":209,"props":58696,"children":58697},{"style":216},[58698],{"type":26,"value":271},{"type":21,"tag":209,"props":58700,"children":58701},{"style":216},[58702],{"type":26,"value":4789},{"type":21,"tag":209,"props":58704,"children":58705},{"style":222},[58706],{"type":26,"value":2561},{"type":21,"tag":209,"props":58708,"children":58709},{"class":211,"line":2381},[58710,58714,58718,58722,58726],{"type":21,"tag":209,"props":58711,"children":58712},{"style":263},[58713],{"type":26,"value":47121},{"type":21,"tag":209,"props":58715,"children":58716},{"style":222},[58717],{"type":26,"value":58325},{"type":21,"tag":209,"props":58719,"children":58720},{"style":216},[58721],{"type":26,"value":51693},{"type":21,"tag":209,"props":58723,"children":58724},{"style":263},[58725],{"type":26,"value":20502},{"type":21,"tag":209,"props":58727,"children":58728},{"style":222},[58729],{"type":26,"value":58730},".interval;\n",{"type":21,"tag":209,"props":58732,"children":58733},{"class":211,"line":2389},[58734,58738,58743,58747,58751],{"type":21,"tag":209,"props":58735,"children":58736},{"style":216},[58737],{"type":26,"value":14505},{"type":21,"tag":209,"props":58739,"children":58740},{"style":222},[58741],{"type":26,"value":58742}," missedTicks ",{"type":21,"tag":209,"props":58744,"children":58745},{"style":216},[58746],{"type":26,"value":1432},{"type":21,"tag":209,"props":58748,"children":58749},{"style":263},[58750],{"type":26,"value":8009},{"type":21,"tag":209,"props":58752,"children":58753},{"style":222},[58754],{"type":26,"value":304},{"type":21,"tag":209,"props":58756,"children":58757},{"class":211,"line":2397},[58758,58763,58767,58771,58775,58779,58784,58788,58792,58796,58800,58805,58809,58813],{"type":21,"tag":209,"props":58759,"children":58760},{"style":222},[58761],{"type":26,"value":58762},"            nextInterval ",{"type":21,"tag":209,"props":58764,"children":58765},{"style":216},[58766],{"type":26,"value":1432},{"type":21,"tag":209,"props":58768,"children":58769},{"style":263},[58770],{"type":26,"value":20502},{"type":21,"tag":209,"props":58772,"children":58773},{"style":222},[58774],{"type":26,"value":58373},{"type":21,"tag":209,"props":58776,"children":58777},{"style":216},[58778],{"type":26,"value":42628},{"type":21,"tag":209,"props":58780,"children":58781},{"style":222},[58782],{"type":26,"value":58783}," ((performance.",{"type":21,"tag":209,"props":58785,"children":58786},{"style":360},[58787],{"type":26,"value":58568},{"type":21,"tag":209,"props":58789,"children":58790},{"style":222},[58791],{"type":26,"value":17194},{"type":21,"tag":209,"props":58793,"children":58794},{"style":216},[58795],{"type":26,"value":42628},{"type":21,"tag":209,"props":58797,"children":58798},{"style":263},[58799],{"type":26,"value":20502},{"type":21,"tag":209,"props":58801,"children":58802},{"style":222},[58803],{"type":26,"value":58804},".startTime) ",{"type":21,"tag":209,"props":58806,"children":58807},{"style":216},[58808],{"type":26,"value":42628},{"type":21,"tag":209,"props":58810,"children":58811},{"style":263},[58812],{"type":26,"value":20502},{"type":21,"tag":209,"props":58814,"children":58815},{"style":222},[58816],{"type":26,"value":58817},".elapsed);\n",{"type":21,"tag":209,"props":58819,"children":58820},{"class":211,"line":2406},[58821],{"type":21,"tag":209,"props":58822,"children":58823},{"emptyLinePlaceholder":248},[58824],{"type":26,"value":251},{"type":21,"tag":209,"props":58826,"children":58827},{"class":211,"line":2415},[58828,58832,58837,58842,58846],{"type":21,"tag":209,"props":58829,"children":58830},{"style":216},[58831],{"type":26,"value":6334},{"type":21,"tag":209,"props":58833,"children":58834},{"style":222},[58835],{"type":26,"value":58836}," (nextInterval ",{"type":21,"tag":209,"props":58838,"children":58839},{"style":216},[58840],{"type":26,"value":58841},"\u003C=",{"type":21,"tag":209,"props":58843,"children":58844},{"style":263},[58845],{"type":26,"value":8009},{"type":21,"tag":209,"props":58847,"children":58848},{"style":222},[58849],{"type":26,"value":5588},{"type":21,"tag":209,"props":58851,"children":58852},{"class":211,"line":2424},[58853,58858,58862,58867,58872,58877,58881,58885,58890,58895,58899],{"type":21,"tag":209,"props":58854,"children":58855},{"style":222},[58856],{"type":26,"value":58857},"            missedTicks ",{"type":21,"tag":209,"props":58859,"children":58860},{"style":216},[58861],{"type":26,"value":1432},{"type":21,"tag":209,"props":58863,"children":58864},{"style":222},[58865],{"type":26,"value":58866}," (Math.",{"type":21,"tag":209,"props":58868,"children":58869},{"style":360},[58870],{"type":26,"value":58871},"abs",{"type":21,"tag":209,"props":58873,"children":58874},{"style":222},[58875],{"type":26,"value":58876},"(nextInterval) ",{"type":21,"tag":209,"props":58878,"children":58879},{"style":216},[58880],{"type":26,"value":6460},{"type":21,"tag":209,"props":58882,"children":58883},{"style":263},[58884],{"type":26,"value":20502},{"type":21,"tag":209,"props":58886,"children":58887},{"style":222},[58888],{"type":26,"value":58889},".interval) ",{"type":21,"tag":209,"props":58891,"children":58892},{"style":216},[58893],{"type":26,"value":58894},"|",{"type":21,"tag":209,"props":58896,"children":58897},{"style":263},[58898],{"type":26,"value":8009},{"type":21,"tag":209,"props":58900,"children":58901},{"style":222},[58902],{"type":26,"value":241},{"type":21,"tag":209,"props":58904,"children":58905},{"class":211,"line":2433},[58906,58910,58914,58918,58922,58926,58930],{"type":21,"tag":209,"props":58907,"children":58908},{"style":263},[58909],{"type":26,"value":2570},{"type":21,"tag":209,"props":58911,"children":58912},{"style":222},[58913],{"type":26,"value":58325},{"type":21,"tag":209,"props":58915,"children":58916},{"style":216},[58917],{"type":26,"value":51693},{"type":21,"tag":209,"props":58919,"children":58920},{"style":222},[58921],{"type":26,"value":58742},{"type":21,"tag":209,"props":58923,"children":58924},{"style":216},[58925],{"type":26,"value":944},{"type":21,"tag":209,"props":58927,"children":58928},{"style":263},[58929],{"type":26,"value":20502},{"type":21,"tag":209,"props":58931,"children":58932},{"style":222},[58933],{"type":26,"value":58730},{"type":21,"tag":209,"props":58935,"children":58936},{"class":211,"line":2442},[58937,58941,58945,58949],{"type":21,"tag":209,"props":58938,"children":58939},{"style":263},[58940],{"type":26,"value":2570},{"type":21,"tag":209,"props":58942,"children":58943},{"style":222},[58944],{"type":26,"value":378},{"type":21,"tag":209,"props":58946,"children":58947},{"style":360},[58948],{"type":26,"value":58694},{"type":21,"tag":209,"props":58950,"children":58951},{"style":222},[58952],{"type":26,"value":4123},{"type":21,"tag":209,"props":58954,"children":58955},{"class":211,"line":2471},[58956,58960],{"type":21,"tag":209,"props":58957,"children":58958},{"style":216},[58959],{"type":26,"value":13689},{"type":21,"tag":209,"props":58961,"children":58962},{"style":222},[58963],{"type":26,"value":241},{"type":21,"tag":209,"props":58965,"children":58966},{"class":211,"line":2480},[58967],{"type":21,"tag":209,"props":58968,"children":58969},{"style":222},[58970],{"type":26,"value":2235},{"type":21,"tag":209,"props":58972,"children":58973},{"class":211,"line":2489},[58974,58978,58982,58986],{"type":21,"tag":209,"props":58975,"children":58976},{"style":263},[58977],{"type":26,"value":47121},{"type":21,"tag":209,"props":58979,"children":58980},{"style":222},[58981],{"type":26,"value":378},{"type":21,"tag":209,"props":58983,"children":58984},{"style":360},[58985],{"type":26,"value":31971},{"type":21,"tag":209,"props":58987,"children":58988},{"style":222},[58989],{"type":26,"value":4123},{"type":21,"tag":209,"props":58991,"children":58992},{"class":211,"line":2516},[58993,58997,59001,59005,59009,59013,59017,59021,59025,59029,59033,59037],{"type":21,"tag":209,"props":58994,"children":58995},{"style":263},[58996],{"type":26,"value":47121},{"type":21,"tag":209,"props":58998,"children":58999},{"style":222},[59000],{"type":26,"value":58349},{"type":21,"tag":209,"props":59002,"children":59003},{"style":216},[59004],{"type":26,"value":1432},{"type":21,"tag":209,"props":59006,"children":59007},{"style":222},[59008],{"type":26,"value":58592},{"type":21,"tag":209,"props":59010,"children":59011},{"style":360},[59012],{"type":26,"value":16509},{"type":21,"tag":209,"props":59014,"children":59015},{"style":222},[59016],{"type":26,"value":368},{"type":21,"tag":209,"props":59018,"children":59019},{"style":263},[59020],{"type":26,"value":2508},{"type":21,"tag":209,"props":59022,"children":59023},{"style":222},[59024],{"type":26,"value":58609},{"type":21,"tag":209,"props":59026,"children":59027},{"style":360},[59028],{"type":26,"value":20189},{"type":21,"tag":209,"props":59030,"children":59031},{"style":222},[59032],{"type":26,"value":368},{"type":21,"tag":209,"props":59034,"children":59035},{"style":263},[59036],{"type":26,"value":2508},{"type":21,"tag":209,"props":59038,"children":59039},{"style":222},[59040],{"type":26,"value":59041},"), nextInterval);\n",{"type":21,"tag":209,"props":59043,"children":59044},{"class":211,"line":2525},[59045],{"type":21,"tag":209,"props":59046,"children":59047},{"style":222},[59048],{"type":26,"value":13439},{"type":21,"tag":209,"props":59050,"children":59051},{"class":211,"line":2533},[59052],{"type":21,"tag":209,"props":59053,"children":59054},{"emptyLinePlaceholder":248},[59055],{"type":26,"value":251},{"type":21,"tag":209,"props":59057,"children":59058},{"class":211,"line":2542},[59059,59063,59067,59071,59075,59079,59083,59087],{"type":21,"tag":209,"props":59060,"children":59061},{"style":263},[59062],{"type":26,"value":58515},{"type":21,"tag":209,"props":59064,"children":59065},{"style":222},[59066],{"type":26,"value":378},{"type":21,"tag":209,"props":59068,"children":59069},{"style":263},[59070],{"type":26,"value":32662},{"type":21,"tag":209,"props":59072,"children":59073},{"style":222},[59074],{"type":26,"value":378},{"type":21,"tag":209,"props":59076,"children":59077},{"style":360},[59078],{"type":26,"value":9937},{"type":21,"tag":209,"props":59080,"children":59081},{"style":216},[59082],{"type":26,"value":271},{"type":21,"tag":209,"props":59084,"children":59085},{"style":216},[59086],{"type":26,"value":4789},{"type":21,"tag":209,"props":59088,"children":59089},{"style":222},[59090],{"type":26,"value":2561},{"type":21,"tag":209,"props":59092,"children":59093},{"class":211,"line":2550},[59094,59099,59104,59108,59112],{"type":21,"tag":209,"props":59095,"children":59096},{"style":222},[59097],{"type":26,"value":59098},"        window.",{"type":21,"tag":209,"props":59100,"children":59101},{"style":360},[59102],{"type":26,"value":59103},"clearTimeout",{"type":21,"tag":209,"props":59105,"children":59106},{"style":222},[59107],{"type":26,"value":368},{"type":21,"tag":209,"props":59109,"children":59110},{"style":263},[59111],{"type":26,"value":2508},{"type":21,"tag":209,"props":59113,"children":59114},{"style":222},[59115],{"type":26,"value":59116},".timeout);\n",{"type":21,"tag":209,"props":59118,"children":59119},{"class":211,"line":2564},[59120],{"type":21,"tag":209,"props":59121,"children":59122},{"emptyLinePlaceholder":248},[59123],{"type":26,"value":251},{"type":21,"tag":209,"props":59125,"children":59126},{"class":211,"line":2611},[59127,59131,59135],{"type":21,"tag":209,"props":59128,"children":59129},{"style":216},[59130],{"type":26,"value":3069},{"type":21,"tag":209,"props":59132,"children":59133},{"style":263},[59134],{"type":26,"value":20502},{"type":21,"tag":209,"props":59136,"children":59137},{"style":222},[59138],{"type":26,"value":241},{"type":21,"tag":209,"props":59140,"children":59141},{"class":211,"line":2619},[59142],{"type":21,"tag":209,"props":59143,"children":59144},{"style":222},[59145],{"type":26,"value":13439},{"type":21,"tag":209,"props":59147,"children":59148},{"class":211,"line":2627},[59149],{"type":21,"tag":209,"props":59150,"children":59151},{"emptyLinePlaceholder":248},[59152],{"type":26,"value":251},{"type":21,"tag":209,"props":59154,"children":59155},{"class":211,"line":2636},[59156,59161,59166,59170,59174,59178,59182,59186,59191],{"type":21,"tag":209,"props":59157,"children":59158},{"style":222},[59159],{"type":26,"value":59160},"    window.",{"type":21,"tag":209,"props":59162,"children":59163},{"style":360},[59164],{"type":26,"value":59165},"setAccurateInterval",{"type":21,"tag":209,"props":59167,"children":59168},{"style":216},[59169],{"type":26,"value":271},{"type":21,"tag":209,"props":59171,"children":59172},{"style":216},[59173],{"type":26,"value":4789},{"type":21,"tag":209,"props":59175,"children":59176},{"style":222},[59177],{"type":26,"value":368},{"type":21,"tag":209,"props":59179,"children":59180},{"style":400},[59181],{"type":26,"value":31971},{"type":21,"tag":209,"props":59183,"children":59184},{"style":222},[59185],{"type":26,"value":408},{"type":21,"tag":209,"props":59187,"children":59188},{"style":400},[59189],{"type":26,"value":59190},"interval",{"type":21,"tag":209,"props":59192,"children":59193},{"style":222},[59194],{"type":26,"value":2369},{"type":21,"tag":209,"props":59196,"children":59197},{"class":211,"line":2644},[59198,59202,59206,59210,59215,59219],{"type":21,"tag":209,"props":59199,"children":59200},{"style":216},[59201],{"type":26,"value":3069},{"type":21,"tag":209,"props":59203,"children":59204},{"style":216},[59205],{"type":26,"value":6371},{"type":21,"tag":209,"props":59207,"children":59208},{"style":360},[59209],{"type":26,"value":58277},{"type":21,"tag":209,"props":59211,"children":59212},{"style":222},[59213],{"type":26,"value":59214},"({callback:callback, interval:interval}).",{"type":21,"tag":209,"props":59216,"children":59217},{"style":360},[59218],{"type":26,"value":13670},{"type":21,"tag":209,"props":59220,"children":59221},{"style":222},[59222],{"type":26,"value":4123},{"type":21,"tag":209,"props":59224,"children":59225},{"class":211,"line":2657},[59226],{"type":21,"tag":209,"props":59227,"children":59228},{"style":222},[59229],{"type":26,"value":13439},{"type":21,"tag":209,"props":59231,"children":59232},{"class":211,"line":2728},[59233],{"type":21,"tag":209,"props":59234,"children":59235},{"emptyLinePlaceholder":248},[59236],{"type":26,"value":251},{"type":21,"tag":209,"props":59238,"children":59239},{"class":211,"line":2758},[59240,59244,59249,59253,59257,59261,59266],{"type":21,"tag":209,"props":59241,"children":59242},{"style":222},[59243],{"type":26,"value":59160},{"type":21,"tag":209,"props":59245,"children":59246},{"style":360},[59247],{"type":26,"value":59248},"clearAccurateInterval",{"type":21,"tag":209,"props":59250,"children":59251},{"style":216},[59252],{"type":26,"value":271},{"type":21,"tag":209,"props":59254,"children":59255},{"style":216},[59256],{"type":26,"value":4789},{"type":21,"tag":209,"props":59258,"children":59259},{"style":222},[59260],{"type":26,"value":368},{"type":21,"tag":209,"props":59262,"children":59263},{"style":400},[59264],{"type":26,"value":59265},"acc",{"type":21,"tag":209,"props":59267,"children":59268},{"style":222},[59269],{"type":26,"value":2369},{"type":21,"tag":209,"props":59271,"children":59272},{"class":211,"line":2776},[59273,59278,59282],{"type":21,"tag":209,"props":59274,"children":59275},{"style":222},[59276],{"type":26,"value":59277},"        acc.",{"type":21,"tag":209,"props":59279,"children":59280},{"style":360},[59281],{"type":26,"value":9937},{"type":21,"tag":209,"props":59283,"children":59284},{"style":222},[59285],{"type":26,"value":4123},{"type":21,"tag":209,"props":59287,"children":59288},{"class":211,"line":2785},[59289],{"type":21,"tag":209,"props":59290,"children":59291},{"style":222},[59292],{"type":26,"value":13439},{"type":21,"tag":209,"props":59294,"children":59295},{"class":211,"line":2793},[59296],{"type":21,"tag":209,"props":59297,"children":59298},{"style":222},[59299],{"type":26,"value":59300},"})(window);\n",{"type":21,"tag":22,"props":59302,"children":59303},{},[59304,59306,59311],{"type":26,"value":59305},"Hopefully, one or more of the above offers you a quick solution so you can get back to the ",{"type":21,"tag":1084,"props":59307,"children":59308},{},[59309],{"type":26,"value":59310},"real",{"type":26,"value":59312}," problem you were supposed to be solving... and if not, at least offer you some solace as you struggle - we've all hit a few little hurdles along the way.",{"type":21,"tag":3490,"props":59314,"children":59315},{},[59316],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":59318},[59319,59320,59321],{"id":56939,"depth":244,"text":56942},{"id":57101,"depth":244,"text":57104},{"id":57269,"depth":244,"text":59322,"children":59323},"Getting a trim, Capitals and splitting camelCase",[59324],{"id":57946,"depth":254,"text":57949,"children":59325},[59326],{"id":58114,"depth":279,"text":58117},"content:ckeefer:2013-1:misc.md","ckeefer/2013-1/misc.md","ckeefer/2013-1/misc",{"user":3518,"name":3519},{"_path":59332,"_dir":59333,"_draft":7,"_partial":7,"_locale":8,"title":59334,"description":59335,"publishDate":59336,"tags":59337,"excerpt":59335,"body":59338,"_type":3511,"_id":60121,"_source":3513,"_file":60122,"_stem":60123,"_extension":3516,"author":60124},"/ckeefer/2013-07/anchors-hash","2013-07","Anchors, Hash Sign, javascript:void(0)","So, you've got a link that, in reality, is just a click target for performing some javascript function. You want the appearance of a standard anchor link, but if it's not performing the intended function, should it really be an anchor? And if so, what should we fill that 'href' attribute in with?","2013-07-29",[12],{"type":18,"children":59339,"toc":60116},[59340,59344,59350,59418,59424,59429,59448,59482,59487,59539,59605,59610,59615,59672,59677,59682,59703,59708,59763,59776,59781,59815,59820,59902,60086,60102,60107,60112],{"type":21,"tag":22,"props":59341,"children":59342},{},[59343],{"type":26,"value":59335},{"type":21,"tag":3596,"props":59345,"children":59347},{"id":59346},"lets-begin-with-a-nasty-anti-pattern",[59348],{"type":26,"value":59349},"Let's begin with a nasty anti-pattern:",{"type":21,"tag":200,"props":59351,"children":59353},{"className":22953,"code":59352,"language":22955,"meta":8,"style":8},"\u003Ca onclick=\"alert('Obtrusive!'); return false;\">Click Me\u003C/a>\n",[59354],{"type":21,"tag":63,"props":59355,"children":59356},{"__ignoreMap":8},[59357],{"type":21,"tag":209,"props":59358,"children":59359},{"class":211,"line":212},[59360,59364,59368,59373,59377,59382,59387,59392,59396,59400,59405,59410,59414],{"type":21,"tag":209,"props":59361,"children":59362},{"style":222},[59363],{"type":26,"value":1985},{"type":21,"tag":209,"props":59365,"children":59366},{"style":1988},[59367],{"type":26,"value":29},{"type":21,"tag":209,"props":59369,"children":59370},{"style":360},[59371],{"type":26,"value":59372}," onclick",{"type":21,"tag":209,"props":59374,"children":59375},{"style":222},[59376],{"type":26,"value":1432},{"type":21,"tag":209,"props":59378,"children":59379},{"style":233},[59380],{"type":26,"value":59381},"\"",{"type":21,"tag":209,"props":59383,"children":59384},{"style":360},[59385],{"type":26,"value":59386},"alert",{"type":21,"tag":209,"props":59388,"children":59389},{"style":233},[59390],{"type":26,"value":59391},"('Obtrusive!'); ",{"type":21,"tag":209,"props":59393,"children":59394},{"style":216},[59395],{"type":26,"value":8982},{"type":21,"tag":209,"props":59397,"children":59398},{"style":263},[59399],{"type":26,"value":14038},{"type":21,"tag":209,"props":59401,"children":59402},{"style":233},[59403],{"type":26,"value":59404},";\"",{"type":21,"tag":209,"props":59406,"children":59407},{"style":222},[59408],{"type":26,"value":59409},">Click Me\u003C/",{"type":21,"tag":209,"props":59411,"children":59412},{"style":1988},[59413],{"type":26,"value":29},{"type":21,"tag":209,"props":59415,"children":59416},{"style":222},[59417],{"type":26,"value":1996},{"type":21,"tag":193,"props":59419,"children":59421},{"id":59420},"boo-hiss",[59422],{"type":26,"value":59423},"Boo, hiss!",{"type":21,"tag":22,"props":59425,"children":59426},{},[59427],{"type":26,"value":59428},"Why is this so bad?",{"type":21,"tag":22,"props":59430,"children":59431},{},[59432,59437,59439,59446],{"type":21,"tag":11881,"props":59433,"children":59434},{},[59435],{"type":26,"value":59436},"First",{"type":26,"value":59438},", the onclick handler is a clear violation of ",{"type":21,"tag":29,"props":59440,"children":59443},{"href":59441,"rel":59442},"http://en.wikipedia.org/wiki/Unobtrusive_JavaScript",[93],[59444],{"type":26,"value":59445},"unobtrusive javascript",{"type":26,"value":59447},". The wikipedia article covers in reasonable detail why using this sort of handler is highly discouraged, but in a nutshell, behaviour and structure should be as separate as structure and presentation (ie. html and css).",{"type":21,"tag":22,"props":59449,"children":59450},{},[59451,59456,59458,59464,59466,59472,59474,59480],{"type":21,"tag":11881,"props":59452,"children":59453},{},[59454],{"type":26,"value":59455},"Secondly",{"type":26,"value":59457},", the lack of ",{"type":21,"tag":63,"props":59459,"children":59461},{"className":59460},[],[59462],{"type":26,"value":59463},"href",{"type":26,"value":59465}," attribute would normally indicate this is an anchor element (as opposed to a link) - functionally speaking, it should have an ",{"type":21,"tag":63,"props":59467,"children":59469},{"className":59468},[],[59470],{"type":26,"value":59471},"id",{"type":26,"value":59473}," which corresponds to a ",{"type":21,"tag":63,"props":59475,"children":59477},{"className":59476},[],[59478],{"type":26,"value":59479},"href=\"#id\"",{"type":26,"value":59481}," somewhere on the page. It probably won't break anything (unless you have code or styling that's looking for said attribute), but it won't gain the pointer cursor when you hover over it, and it shoehorns the element into performing a function it was never really intended for.",{"type":21,"tag":22,"props":59483,"children":59484},{},[59485],{"type":26,"value":59486},"This isn't really any better:",{"type":21,"tag":200,"props":59488,"children":59490},{"className":22953,"code":59489,"language":22955,"meta":8,"style":8},"\u003Ca onclick=\"jsfunc();\">Click Me\u003C/a>\n",[59491],{"type":21,"tag":63,"props":59492,"children":59493},{"__ignoreMap":8},[59494],{"type":21,"tag":209,"props":59495,"children":59496},{"class":211,"line":212},[59497,59501,59505,59509,59513,59517,59522,59527,59531,59535],{"type":21,"tag":209,"props":59498,"children":59499},{"style":222},[59500],{"type":26,"value":1985},{"type":21,"tag":209,"props":59502,"children":59503},{"style":1988},[59504],{"type":26,"value":29},{"type":21,"tag":209,"props":59506,"children":59507},{"style":360},[59508],{"type":26,"value":59372},{"type":21,"tag":209,"props":59510,"children":59511},{"style":222},[59512],{"type":26,"value":1432},{"type":21,"tag":209,"props":59514,"children":59515},{"style":233},[59516],{"type":26,"value":59381},{"type":21,"tag":209,"props":59518,"children":59519},{"style":360},[59520],{"type":26,"value":59521},"jsfunc",{"type":21,"tag":209,"props":59523,"children":59524},{"style":233},[59525],{"type":26,"value":59526},"();\"",{"type":21,"tag":209,"props":59528,"children":59529},{"style":222},[59530],{"type":26,"value":59409},{"type":21,"tag":209,"props":59532,"children":59533},{"style":1988},[59534],{"type":26,"value":29},{"type":21,"tag":209,"props":59536,"children":59537},{"style":222},[59538],{"type":26,"value":1996},{"type":21,"tag":200,"props":59540,"children":59542},{"className":16138,"code":59541,"language":16140,"meta":8,"style":8},"function jsfunc(){\n    alert('Still obtrusive');\n    return false;\n}\n",[59543],{"type":21,"tag":63,"props":59544,"children":59545},{"__ignoreMap":8},[59546,59562,59583,59598],{"type":21,"tag":209,"props":59547,"children":59548},{"class":211,"line":212},[59549,59553,59558],{"type":21,"tag":209,"props":59550,"children":59551},{"style":216},[59552],{"type":26,"value":4622},{"type":21,"tag":209,"props":59554,"children":59555},{"style":360},[59556],{"type":26,"value":59557}," jsfunc",{"type":21,"tag":209,"props":59559,"children":59560},{"style":222},[59561],{"type":26,"value":2561},{"type":21,"tag":209,"props":59563,"children":59564},{"class":211,"line":244},[59565,59570,59574,59579],{"type":21,"tag":209,"props":59566,"children":59567},{"style":360},[59568],{"type":26,"value":59569},"    alert",{"type":21,"tag":209,"props":59571,"children":59572},{"style":222},[59573],{"type":26,"value":368},{"type":21,"tag":209,"props":59575,"children":59576},{"style":233},[59577],{"type":26,"value":59578},"'Still obtrusive'",{"type":21,"tag":209,"props":59580,"children":59581},{"style":222},[59582],{"type":26,"value":2608},{"type":21,"tag":209,"props":59584,"children":59585},{"class":211,"line":254},[59586,59590,59594],{"type":21,"tag":209,"props":59587,"children":59588},{"style":216},[59589],{"type":26,"value":1298},{"type":21,"tag":209,"props":59591,"children":59592},{"style":263},[59593],{"type":26,"value":14038},{"type":21,"tag":209,"props":59595,"children":59596},{"style":222},[59597],{"type":26,"value":241},{"type":21,"tag":209,"props":59599,"children":59600},{"class":211,"line":279},[59601],{"type":21,"tag":209,"props":59602,"children":59603},{"style":222},[59604],{"type":26,"value":4415},{"type":21,"tag":22,"props":59606,"children":59607},{},[59608],{"type":26,"value":59609},"We still have the obtrusive onclick handler - the fact that we've shoved the logic into a function doesn't really improve the situation.",{"type":21,"tag":22,"props":59611,"children":59612},{},[59613],{"type":26,"value":59614},"Here's a better example:",{"type":21,"tag":200,"props":59616,"children":59618},{"className":22953,"code":59617,"language":22955,"meta":8,"style":8},"\u003Ca id=\"click_target\" href=\"#\">Click Me\u003C/a>\n",[59619],{"type":21,"tag":63,"props":59620,"children":59621},{"__ignoreMap":8},[59622],{"type":21,"tag":209,"props":59623,"children":59624},{"class":211,"line":212},[59625,59629,59633,59637,59641,59646,59651,59655,59660,59664,59668],{"type":21,"tag":209,"props":59626,"children":59627},{"style":222},[59628],{"type":26,"value":1985},{"type":21,"tag":209,"props":59630,"children":59631},{"style":1988},[59632],{"type":26,"value":29},{"type":21,"tag":209,"props":59634,"children":59635},{"style":360},[59636],{"type":26,"value":23016},{"type":21,"tag":209,"props":59638,"children":59639},{"style":222},[59640],{"type":26,"value":1432},{"type":21,"tag":209,"props":59642,"children":59643},{"style":233},[59644],{"type":26,"value":59645},"\"click_target\"",{"type":21,"tag":209,"props":59647,"children":59648},{"style":360},[59649],{"type":26,"value":59650}," href",{"type":21,"tag":209,"props":59652,"children":59653},{"style":222},[59654],{"type":26,"value":1432},{"type":21,"tag":209,"props":59656,"children":59657},{"style":233},[59658],{"type":26,"value":59659},"\"#\"",{"type":21,"tag":209,"props":59661,"children":59662},{"style":222},[59663],{"type":26,"value":59409},{"type":21,"tag":209,"props":59665,"children":59666},{"style":1988},[59667],{"type":26,"value":29},{"type":21,"tag":209,"props":59669,"children":59670},{"style":222},[59671],{"type":26,"value":1996},{"type":21,"tag":22,"props":59673,"children":59674},{},[59675],{"type":26,"value":59676},"We've added an id to the anchor, along with a simple hash in the href. Now, the mouse will gain the expected pointer cursor on hover, and we can look up the element by its id and attach behaviours to it unobtrusively.",{"type":21,"tag":22,"props":59678,"children":59679},{},[59680],{"type":26,"value":59681},"However, we now have a href that doesn't really point anywhere. If something goes wrong - javascript is disabled, fails to init due to an error, etc. - clicking it will take us back to the top of the page and alter the url. This isn't generally terrible, but it's certainly not desirable either. And what if we're using hash fragements for maintaining state, or routing (such as in Backbone)? Changing the hash could be problematic.",{"type":21,"tag":22,"props":59683,"children":59684},{},[59685,59687,59693,59695,59701],{"type":26,"value":59686},"Moreover, we now need to cancel the default action in our javascript. We could ",{"type":21,"tag":63,"props":59688,"children":59690},{"className":59689},[],[59691],{"type":26,"value":59692},"return false;",{"type":26,"value":59694},", but this is a misuse of the return, which should offer a value to other calling functions, not be used to cancel actions. We can, of course, ",{"type":21,"tag":63,"props":59696,"children":59698},{"className":59697},[],[59699],{"type":26,"value":59700},"preventDefault()",{"type":26,"value":59702}," on the event, and this is the best way to handle this situation, but maybe we want to avoid having to handle a default action altogether?",{"type":21,"tag":22,"props":59704,"children":59705},{},[59706],{"type":26,"value":59707},"A common solution looks like:",{"type":21,"tag":200,"props":59709,"children":59711},{"className":22953,"code":59710,"language":22955,"meta":8,"style":8},"\u003Ca id=\"click_target\" href=\"javascript:void(0);\">Click Me\u003C/a>\n",[59712],{"type":21,"tag":63,"props":59713,"children":59714},{"__ignoreMap":8},[59715],{"type":21,"tag":209,"props":59716,"children":59717},{"class":211,"line":212},[59718,59722,59726,59730,59734,59738,59742,59746,59751,59755,59759],{"type":21,"tag":209,"props":59719,"children":59720},{"style":222},[59721],{"type":26,"value":1985},{"type":21,"tag":209,"props":59723,"children":59724},{"style":1988},[59725],{"type":26,"value":29},{"type":21,"tag":209,"props":59727,"children":59728},{"style":360},[59729],{"type":26,"value":23016},{"type":21,"tag":209,"props":59731,"children":59732},{"style":222},[59733],{"type":26,"value":1432},{"type":21,"tag":209,"props":59735,"children":59736},{"style":233},[59737],{"type":26,"value":59645},{"type":21,"tag":209,"props":59739,"children":59740},{"style":360},[59741],{"type":26,"value":59650},{"type":21,"tag":209,"props":59743,"children":59744},{"style":222},[59745],{"type":26,"value":1432},{"type":21,"tag":209,"props":59747,"children":59748},{"style":233},[59749],{"type":26,"value":59750},"\"javascript:void(0);\"",{"type":21,"tag":209,"props":59752,"children":59753},{"style":222},[59754],{"type":26,"value":59409},{"type":21,"tag":209,"props":59756,"children":59757},{"style":1988},[59758],{"type":26,"value":29},{"type":21,"tag":209,"props":59760,"children":59761},{"style":222},[59762],{"type":26,"value":1996},{"type":21,"tag":22,"props":59764,"children":59765},{},[59766,59768,59774],{"type":26,"value":59767},"Personally, I don't really like this solution, or its cousin ",{"type":21,"tag":63,"props":59769,"children":59771},{"className":59770},[],[59772],{"type":26,"value":59773},"href=\"javascript:;\"",{"type":26,"value":59775}," but it does work well. We now have a click target that will present itself in the expected way, and perform no default action we need to cancel. But use of the javascript psuedo-protocol is a bit messy - it looks a lot less neat than the simple hash.",{"type":21,"tag":22,"props":59777,"children":59778},{},[59779],{"type":26,"value":59780},"Maybe the best solution, then, is not to use a link at all. A button element can be styled to look and function like a link, and performing an arbitrary behaviour is really what a button is all about.",{"type":21,"tag":22,"props":59782,"children":59783},{},[59784,59786,59791,59793,59799,59801,59806,59808,59814],{"type":26,"value":59785},"As an aside, ",{"type":21,"tag":63,"props":59787,"children":59789},{"className":59788},[],[59790],{"type":26,"value":30910},{"type":26,"value":59792}," - even if I don't recommend using it this way - is extremely handy, as its guaranteed to return ",{"type":21,"tag":63,"props":59794,"children":59796},{"className":59795},[],[59797],{"type":26,"value":59798},"undefined",{"type":26,"value":59800},". void 0, void(0), void 'whatever', will all return ",{"type":21,"tag":63,"props":59802,"children":59804},{"className":59803},[],[59805],{"type":26,"value":59798},{"type":26,"value":59807},". This is a great way to avoid testing against the mutable undefined global variable, or needing to use the longer ",{"type":21,"tag":63,"props":59809,"children":59811},{"className":59810},[],[59812],{"type":26,"value":59813},"typeof variable == 'undefined'",{"type":26,"value":378},{"type":21,"tag":22,"props":59816,"children":59817},{},[59818],{"type":26,"value":59819},"Consider this:",{"type":21,"tag":200,"props":59821,"children":59823},{"className":22953,"code":59822,"language":22955,"meta":8,"style":8},"\u003Cbutton id=\"click_target\" type=\"button\" tabindex=\"0\" class=\"link_alike\">Click Me\u003C/button>\n",[59824],{"type":21,"tag":63,"props":59825,"children":59826},{"__ignoreMap":8},[59827],{"type":21,"tag":209,"props":59828,"children":59829},{"class":211,"line":212},[59830,59834,59838,59842,59846,59850,59854,59858,59863,59868,59872,59877,59881,59885,59890,59894,59898],{"type":21,"tag":209,"props":59831,"children":59832},{"style":222},[59833],{"type":26,"value":1985},{"type":21,"tag":209,"props":59835,"children":59836},{"style":1988},[59837],{"type":26,"value":23057},{"type":21,"tag":209,"props":59839,"children":59840},{"style":360},[59841],{"type":26,"value":23016},{"type":21,"tag":209,"props":59843,"children":59844},{"style":222},[59845],{"type":26,"value":1432},{"type":21,"tag":209,"props":59847,"children":59848},{"style":233},[59849],{"type":26,"value":59645},{"type":21,"tag":209,"props":59851,"children":59852},{"style":360},[59853],{"type":26,"value":23062},{"type":21,"tag":209,"props":59855,"children":59856},{"style":222},[59857],{"type":26,"value":1432},{"type":21,"tag":209,"props":59859,"children":59860},{"style":233},[59861],{"type":26,"value":59862},"\"button\"",{"type":21,"tag":209,"props":59864,"children":59865},{"style":360},[59866],{"type":26,"value":59867}," tabindex",{"type":21,"tag":209,"props":59869,"children":59870},{"style":222},[59871],{"type":26,"value":1432},{"type":21,"tag":209,"props":59873,"children":59874},{"style":233},[59875],{"type":26,"value":59876},"\"0\"",{"type":21,"tag":209,"props":59878,"children":59879},{"style":360},[59880],{"type":26,"value":48893},{"type":21,"tag":209,"props":59882,"children":59883},{"style":222},[59884],{"type":26,"value":1432},{"type":21,"tag":209,"props":59886,"children":59887},{"style":233},[59888],{"type":26,"value":59889},"\"link_alike\"",{"type":21,"tag":209,"props":59891,"children":59892},{"style":222},[59893],{"type":26,"value":59409},{"type":21,"tag":209,"props":59895,"children":59896},{"style":1988},[59897],{"type":26,"value":23057},{"type":21,"tag":209,"props":59899,"children":59900},{"style":222},[59901],{"type":26,"value":1996},{"type":21,"tag":200,"props":59903,"children":59905},{"className":45051,"code":59904,"language":45053,"meta":8,"style":8},".link_alike{\n    background:transparent;\n    border-color:transparent;\n    border-radius:0;\n    color:#0088CC;\n    cursor:pointer;\n}\n.link_alike:hover{\n    text-decoration:underline;\n    color:#005580;\n}\n",[59906],{"type":21,"tag":63,"props":59907,"children":59908},{"__ignoreMap":8},[59909,59921,59941,59961,59980,60000,60019,60026,60038,60059,60079],{"type":21,"tag":209,"props":59910,"children":59911},{"class":211,"line":212},[59912,59917],{"type":21,"tag":209,"props":59913,"children":59914},{"style":360},[59915],{"type":26,"value":59916},".link_alike",{"type":21,"tag":209,"props":59918,"children":59919},{"style":222},[59920],{"type":26,"value":29353},{"type":21,"tag":209,"props":59922,"children":59923},{"class":211,"line":244},[59924,59928,59932,59937],{"type":21,"tag":209,"props":59925,"children":59926},{"style":263},[59927],{"type":26,"value":49147},{"type":21,"tag":209,"props":59929,"children":59930},{"style":222},[59931],{"type":26,"value":191},{"type":21,"tag":209,"props":59933,"children":59934},{"style":263},[59935],{"type":26,"value":59936},"transparent",{"type":21,"tag":209,"props":59938,"children":59939},{"style":222},[59940],{"type":26,"value":241},{"type":21,"tag":209,"props":59942,"children":59943},{"class":211,"line":254},[59944,59949,59953,59957],{"type":21,"tag":209,"props":59945,"children":59946},{"style":263},[59947],{"type":26,"value":59948},"    border-color",{"type":21,"tag":209,"props":59950,"children":59951},{"style":222},[59952],{"type":26,"value":191},{"type":21,"tag":209,"props":59954,"children":59955},{"style":263},[59956],{"type":26,"value":59936},{"type":21,"tag":209,"props":59958,"children":59959},{"style":222},[59960],{"type":26,"value":241},{"type":21,"tag":209,"props":59962,"children":59963},{"class":211,"line":279},[59964,59968,59972,59976],{"type":21,"tag":209,"props":59965,"children":59966},{"style":263},[59967],{"type":26,"value":49168},{"type":21,"tag":209,"props":59969,"children":59970},{"style":222},[59971],{"type":26,"value":191},{"type":21,"tag":209,"props":59973,"children":59974},{"style":263},[59975],{"type":26,"value":8554},{"type":21,"tag":209,"props":59977,"children":59978},{"style":222},[59979],{"type":26,"value":241},{"type":21,"tag":209,"props":59981,"children":59982},{"class":211,"line":288},[59983,59987,59991,59996],{"type":21,"tag":209,"props":59984,"children":59985},{"style":263},[59986],{"type":26,"value":49240},{"type":21,"tag":209,"props":59988,"children":59989},{"style":222},[59990],{"type":26,"value":191},{"type":21,"tag":209,"props":59992,"children":59993},{"style":263},[59994],{"type":26,"value":59995},"#0088CC",{"type":21,"tag":209,"props":59997,"children":59998},{"style":222},[59999],{"type":26,"value":241},{"type":21,"tag":209,"props":60001,"children":60002},{"class":211,"line":307},[60003,60007,60011,60015],{"type":21,"tag":209,"props":60004,"children":60005},{"style":263},[60006],{"type":26,"value":49096},{"type":21,"tag":209,"props":60008,"children":60009},{"style":222},[60010],{"type":26,"value":191},{"type":21,"tag":209,"props":60012,"children":60013},{"style":263},[60014],{"type":26,"value":49105},{"type":21,"tag":209,"props":60016,"children":60017},{"style":222},[60018],{"type":26,"value":241},{"type":21,"tag":209,"props":60020,"children":60021},{"class":211,"line":325},[60022],{"type":21,"tag":209,"props":60023,"children":60024},{"style":222},[60025],{"type":26,"value":4415},{"type":21,"tag":209,"props":60027,"children":60028},{"class":211,"line":334},[60029,60034],{"type":21,"tag":209,"props":60030,"children":60031},{"style":360},[60032],{"type":26,"value":60033},".link_alike:hover",{"type":21,"tag":209,"props":60035,"children":60036},{"style":222},[60037],{"type":26,"value":29353},{"type":21,"tag":209,"props":60039,"children":60040},{"class":211,"line":343},[60041,60046,60050,60055],{"type":21,"tag":209,"props":60042,"children":60043},{"style":263},[60044],{"type":26,"value":60045},"    text-decoration",{"type":21,"tag":209,"props":60047,"children":60048},{"style":222},[60049],{"type":26,"value":191},{"type":21,"tag":209,"props":60051,"children":60052},{"style":263},[60053],{"type":26,"value":60054},"underline",{"type":21,"tag":209,"props":60056,"children":60057},{"style":222},[60058],{"type":26,"value":241},{"type":21,"tag":209,"props":60060,"children":60061},{"class":211,"line":351},[60062,60066,60070,60075],{"type":21,"tag":209,"props":60063,"children":60064},{"style":263},[60065],{"type":26,"value":49240},{"type":21,"tag":209,"props":60067,"children":60068},{"style":222},[60069],{"type":26,"value":191},{"type":21,"tag":209,"props":60071,"children":60072},{"style":263},[60073],{"type":26,"value":60074},"#005580",{"type":21,"tag":209,"props":60076,"children":60077},{"style":222},[60078],{"type":26,"value":241},{"type":21,"tag":209,"props":60080,"children":60081},{"class":211,"line":444},[60082],{"type":21,"tag":209,"props":60083,"children":60084},{"style":222},[60085],{"type":26,"value":4415},{"type":21,"tag":22,"props":60087,"children":60088},{},[60089,60091,60095,60096,60100],{"type":26,"value":60090},"You'll likely want to add ",{"type":21,"tag":60092,"props":60093,"children":60094},"focus",{},[],{"type":26,"value":5997},{"type":21,"tag":60097,"props":60098,"children":60099},"active",{},[],{"type":26,"value":60101}," states as well, but the above gives you the basics of a click target with no default behaviour beyond looking and acting like a link - perfect for attaching your javascript to while still presenting your user with a familiar target.",{"type":21,"tag":22,"props":60103,"children":60104},{},[60105],{"type":26,"value":60106},"Now, I won't claim this is my goto solution - I tend to use link's with a simple hash and just cancel the default action. There are some advantages to this approach - the markup is a bit simpler, tabbing via the keyboard is supported without the 'tabindex' attribute, and no additional styling is needed.",{"type":21,"tag":22,"props":60108,"children":60109},{},[60110],{"type":26,"value":60111},"On consideration, though, maybe I've developed a bad habit in doing so - perhaps one that needs to be replaced with a button-based solution. What do you think?",{"type":21,"tag":3490,"props":60113,"children":60114},{},[60115],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":60117},[60118],{"id":59346,"depth":244,"text":59349,"children":60119},[60120],{"id":59420,"depth":279,"text":59423},"content:ckeefer:2013-07:anchors-hash.md","ckeefer/2013-07/anchors-hash.md","ckeefer/2013-07/anchors-hash",{"user":3518,"name":3519},{"_path":60126,"_dir":60127,"_draft":7,"_partial":7,"_locale":8,"title":60128,"description":60129,"publishDate":60130,"tags":60131,"image":60132,"excerpt":60129,"body":60133,"_type":3511,"_id":70225,"_source":3513,"_file":70226,"_stem":70227,"_extension":3516,"author":70228},"/ckeefer/2014-2/ajax-upload-2","2014-2","Ajax Upload Part II: XHR2 (and FileReader)","So, the client has told you their users should be able to upload their drunken party pictures for all the internet to see. \"We want the very best experience possible,\" they tell you. \"Simple, seamless - maybe using that new html5 thing I've heard so much about.\"","2013-04-09",[12,20402],"/ckeefer/2014-2/img/html5.jpg",{"type":18,"children":60134,"toc":70219},[60135,60139,60144,60158,60164,60184,60264,60269,60312,60317,60329,60651,60656,60662,60675,61880,61892,61897,61903,61926,61931,61936,61941,63013,63018,63031,63036,63040,63045,63057,63072,63077,70215],{"type":21,"tag":22,"props":60136,"children":60137},{},[60138],{"type":26,"value":60129},{"type":21,"tag":22,"props":60140,"children":60141},{},[60142],{"type":26,"value":60143},"You choke back a little bit of hope. You've been disappointed so often. Trying hard to sound non-chalant, you say \"only modern browsers, right?\" You hold your breath. They nod, and on the outside, you nod back. On the inside, you giggle. No flash, no iframe hacks - just ajax, as God (well, the W3C) intended. Ah, beautiful.",{"type":21,"tag":22,"props":60145,"children":60146},{},[60147,60149,60156],{"type":26,"value":60148},"As promised in ",{"type":21,"tag":29,"props":60150,"children":60153},{"href":60151,"rel":60152},"http://blog.artlogic.com/2013/03/20/ajax-upload-part-i-framed-and-jquery-deferred/",[93],[60154],{"type":26,"value":60155},"part I",{"type":26,"value":60157},", we're going take a quick walk through what it takes to upload a file with ajax. We're also going to take a look at reading a file into memory to play with in your app.",{"type":21,"tag":3596,"props":60159,"children":60161},{"id":60160},"inputs-and-drop-targets",[60162],{"type":26,"value":60163},"Inputs and Drop Targets",{"type":21,"tag":22,"props":60165,"children":60166},{},[60167,60169,60175,60176,60182],{"type":26,"value":60168},"So, let's say we have two images of some hip twenty-somethings having a good time, ",{"type":21,"tag":63,"props":60170,"children":60172},{"className":60171},[],[60173],{"type":26,"value":60174},"drunk1.png",{"type":26,"value":5997},{"type":21,"tag":63,"props":60177,"children":60179},{"className":60178},[],[60180],{"type":26,"value":60181},"drunk2.jpg",{"type":26,"value":60183},". Our job is to get these files from the user's computer to our server as simply as possible. The standard input is a familiar way of doing this, but we might also want to take advantage of the new drag and drop capabilities in modern browsers. So, we could have something like:",{"type":21,"tag":200,"props":60185,"children":60187},{"className":22953,"code":60186,"language":22955,"meta":8,"style":8},"\u003Cform>\n\u003Cinput id=\"hupinput\" type=\"file\" />\n\u003C/form>\n",[60188],{"type":21,"tag":63,"props":60189,"children":60190},{"__ignoreMap":8},[60191,60206,60249],{"type":21,"tag":209,"props":60192,"children":60193},{"class":211,"line":212},[60194,60198,60202],{"type":21,"tag":209,"props":60195,"children":60196},{"style":222},[60197],{"type":26,"value":1985},{"type":21,"tag":209,"props":60199,"children":60200},{"style":1988},[60201],{"type":26,"value":22995},{"type":21,"tag":209,"props":60203,"children":60204},{"style":222},[60205],{"type":26,"value":1996},{"type":21,"tag":209,"props":60207,"children":60208},{"class":211,"line":244},[60209,60213,60218,60222,60226,60231,60235,60239,60244],{"type":21,"tag":209,"props":60210,"children":60211},{"style":222},[60212],{"type":26,"value":1985},{"type":21,"tag":209,"props":60214,"children":60215},{"style":1988},[60216],{"type":26,"value":60217},"input",{"type":21,"tag":209,"props":60219,"children":60220},{"style":360},[60221],{"type":26,"value":23016},{"type":21,"tag":209,"props":60223,"children":60224},{"style":222},[60225],{"type":26,"value":1432},{"type":21,"tag":209,"props":60227,"children":60228},{"style":233},[60229],{"type":26,"value":60230},"\"hupinput\"",{"type":21,"tag":209,"props":60232,"children":60233},{"style":360},[60234],{"type":26,"value":23062},{"type":21,"tag":209,"props":60236,"children":60237},{"style":222},[60238],{"type":26,"value":1432},{"type":21,"tag":209,"props":60240,"children":60241},{"style":233},[60242],{"type":26,"value":60243},"\"file\"",{"type":21,"tag":209,"props":60245,"children":60246},{"style":222},[60247],{"type":26,"value":60248}," />\n",{"type":21,"tag":209,"props":60250,"children":60251},{"class":211,"line":254},[60252,60256,60260],{"type":21,"tag":209,"props":60253,"children":60254},{"style":222},[60255],{"type":26,"value":2024},{"type":21,"tag":209,"props":60257,"children":60258},{"style":1988},[60259],{"type":26,"value":22995},{"type":21,"tag":209,"props":60261,"children":60262},{"style":222},[60263],{"type":26,"value":1996},{"type":21,"tag":22,"props":60265,"children":60266},{},[60267],{"type":26,"value":60268},"or:",{"type":21,"tag":200,"props":60270,"children":60272},{"className":22953,"code":60271,"language":22955,"meta":8,"style":8},"\u003Cdiv id=\"hupdiv\">\u003C/div>\n",[60273],{"type":21,"tag":63,"props":60274,"children":60275},{"__ignoreMap":8},[60276],{"type":21,"tag":209,"props":60277,"children":60278},{"class":211,"line":212},[60279,60283,60287,60291,60295,60300,60304,60308],{"type":21,"tag":209,"props":60280,"children":60281},{"style":222},[60282],{"type":26,"value":1985},{"type":21,"tag":209,"props":60284,"children":60285},{"style":1988},[60286],{"type":26,"value":2009},{"type":21,"tag":209,"props":60288,"children":60289},{"style":360},[60290],{"type":26,"value":23016},{"type":21,"tag":209,"props":60292,"children":60293},{"style":222},[60294],{"type":26,"value":1432},{"type":21,"tag":209,"props":60296,"children":60297},{"style":233},[60298],{"type":26,"value":60299},"\"hupdiv\"",{"type":21,"tag":209,"props":60301,"children":60302},{"style":222},[60303],{"type":26,"value":23030},{"type":21,"tag":209,"props":60305,"children":60306},{"style":1988},[60307],{"type":26,"value":2009},{"type":21,"tag":209,"props":60309,"children":60310},{"style":222},[60311],{"type":26,"value":1996},{"type":21,"tag":22,"props":60313,"children":60314},{},[60315],{"type":26,"value":60316},"and then just define some styles that will give us a properly sized drop target.",{"type":21,"tag":22,"props":60318,"children":60319},{},[60320,60322,60327],{"type":26,"value":60321},"Now, the drag and drop api in html5 is a little strange. We need to ",{"type":21,"tag":11881,"props":60323,"children":60324},{},[60325],{"type":26,"value":60326},"cancel",{"type":26,"value":60328}," the default action and stop propagation for dragover and drop in order to allow something to be drag and dropped. The idea seems to be that the default action is to not allow anything to be dragged and dropped. You'll just have to swing with it.",{"type":21,"tag":200,"props":60330,"children":60332},{"className":16138,"code":60331,"language":16140,"meta":8,"style":8},"$('inputname').off('dragover').on('dragover', function(event){\n    event = event.originalEvent;\n    event.preventDefault();\n    event.stopPropagation();\n});\n\nvar files;\n$('inputname').off('drop change').on('drop change', function(event){\n    event = event.originalEvent;\n    event.preventDefault();\n    event.stopPropagation();\n    // if drop and drag target\n    files = event.dataTransfer.files;\n    // or if an input\n    files = event.target.files;\n});\n\n",[60333],{"type":21,"tag":63,"props":60334,"children":60335},{"__ignoreMap":8},[60336,60406,60423,60440,60456,60463,60470,60482,60550,60565,60580,60595,60603,60620,60628,60644],{"type":21,"tag":209,"props":60337,"children":60338},{"class":211,"line":212},[60339,60343,60347,60352,60356,60361,60365,60370,60374,60378,60382,60386,60390,60394,60398,60402],{"type":21,"tag":209,"props":60340,"children":60341},{"style":360},[60342],{"type":26,"value":6476},{"type":21,"tag":209,"props":60344,"children":60345},{"style":222},[60346],{"type":26,"value":368},{"type":21,"tag":209,"props":60348,"children":60349},{"style":233},[60350],{"type":26,"value":60351},"'inputname'",{"type":21,"tag":209,"props":60353,"children":60354},{"style":222},[60355],{"type":26,"value":2699},{"type":21,"tag":209,"props":60357,"children":60358},{"style":360},[60359],{"type":26,"value":60360},"off",{"type":21,"tag":209,"props":60362,"children":60363},{"style":222},[60364],{"type":26,"value":368},{"type":21,"tag":209,"props":60366,"children":60367},{"style":233},[60368],{"type":26,"value":60369},"'dragover'",{"type":21,"tag":209,"props":60371,"children":60372},{"style":222},[60373],{"type":26,"value":2699},{"type":21,"tag":209,"props":60375,"children":60376},{"style":360},[60377],{"type":26,"value":363},{"type":21,"tag":209,"props":60379,"children":60380},{"style":222},[60381],{"type":26,"value":368},{"type":21,"tag":209,"props":60383,"children":60384},{"style":233},[60385],{"type":26,"value":60369},{"type":21,"tag":209,"props":60387,"children":60388},{"style":222},[60389],{"type":26,"value":408},{"type":21,"tag":209,"props":60391,"children":60392},{"style":216},[60393],{"type":26,"value":4622},{"type":21,"tag":209,"props":60395,"children":60396},{"style":222},[60397],{"type":26,"value":368},{"type":21,"tag":209,"props":60399,"children":60400},{"style":400},[60401],{"type":26,"value":25805},{"type":21,"tag":209,"props":60403,"children":60404},{"style":222},[60405],{"type":26,"value":2369},{"type":21,"tag":209,"props":60407,"children":60408},{"class":211,"line":244},[60409,60414,60418],{"type":21,"tag":209,"props":60410,"children":60411},{"style":222},[60412],{"type":26,"value":60413},"    event ",{"type":21,"tag":209,"props":60415,"children":60416},{"style":216},[60417],{"type":26,"value":1432},{"type":21,"tag":209,"props":60419,"children":60420},{"style":222},[60421],{"type":26,"value":60422}," event.originalEvent;\n",{"type":21,"tag":209,"props":60424,"children":60425},{"class":211,"line":254},[60426,60431,60436],{"type":21,"tag":209,"props":60427,"children":60428},{"style":222},[60429],{"type":26,"value":60430},"    event.",{"type":21,"tag":209,"props":60432,"children":60433},{"style":360},[60434],{"type":26,"value":60435},"preventDefault",{"type":21,"tag":209,"props":60437,"children":60438},{"style":222},[60439],{"type":26,"value":4123},{"type":21,"tag":209,"props":60441,"children":60442},{"class":211,"line":279},[60443,60447,60452],{"type":21,"tag":209,"props":60444,"children":60445},{"style":222},[60446],{"type":26,"value":60430},{"type":21,"tag":209,"props":60448,"children":60449},{"style":360},[60450],{"type":26,"value":60451},"stopPropagation",{"type":21,"tag":209,"props":60453,"children":60454},{"style":222},[60455],{"type":26,"value":4123},{"type":21,"tag":209,"props":60457,"children":60458},{"class":211,"line":288},[60459],{"type":21,"tag":209,"props":60460,"children":60461},{"style":222},[60462],{"type":26,"value":469},{"type":21,"tag":209,"props":60464,"children":60465},{"class":211,"line":307},[60466],{"type":21,"tag":209,"props":60467,"children":60468},{"emptyLinePlaceholder":248},[60469],{"type":26,"value":251},{"type":21,"tag":209,"props":60471,"children":60472},{"class":211,"line":325},[60473,60477],{"type":21,"tag":209,"props":60474,"children":60475},{"style":216},[60476],{"type":26,"value":3909},{"type":21,"tag":209,"props":60478,"children":60479},{"style":222},[60480],{"type":26,"value":60481}," files;\n",{"type":21,"tag":209,"props":60483,"children":60484},{"class":211,"line":334},[60485,60489,60493,60497,60501,60505,60509,60514,60518,60522,60526,60530,60534,60538,60542,60546],{"type":21,"tag":209,"props":60486,"children":60487},{"style":360},[60488],{"type":26,"value":6476},{"type":21,"tag":209,"props":60490,"children":60491},{"style":222},[60492],{"type":26,"value":368},{"type":21,"tag":209,"props":60494,"children":60495},{"style":233},[60496],{"type":26,"value":60351},{"type":21,"tag":209,"props":60498,"children":60499},{"style":222},[60500],{"type":26,"value":2699},{"type":21,"tag":209,"props":60502,"children":60503},{"style":360},[60504],{"type":26,"value":60360},{"type":21,"tag":209,"props":60506,"children":60507},{"style":222},[60508],{"type":26,"value":368},{"type":21,"tag":209,"props":60510,"children":60511},{"style":233},[60512],{"type":26,"value":60513},"'drop change'",{"type":21,"tag":209,"props":60515,"children":60516},{"style":222},[60517],{"type":26,"value":2699},{"type":21,"tag":209,"props":60519,"children":60520},{"style":360},[60521],{"type":26,"value":363},{"type":21,"tag":209,"props":60523,"children":60524},{"style":222},[60525],{"type":26,"value":368},{"type":21,"tag":209,"props":60527,"children":60528},{"style":233},[60529],{"type":26,"value":60513},{"type":21,"tag":209,"props":60531,"children":60532},{"style":222},[60533],{"type":26,"value":408},{"type":21,"tag":209,"props":60535,"children":60536},{"style":216},[60537],{"type":26,"value":4622},{"type":21,"tag":209,"props":60539,"children":60540},{"style":222},[60541],{"type":26,"value":368},{"type":21,"tag":209,"props":60543,"children":60544},{"style":400},[60545],{"type":26,"value":25805},{"type":21,"tag":209,"props":60547,"children":60548},{"style":222},[60549],{"type":26,"value":2369},{"type":21,"tag":209,"props":60551,"children":60552},{"class":211,"line":343},[60553,60557,60561],{"type":21,"tag":209,"props":60554,"children":60555},{"style":222},[60556],{"type":26,"value":60413},{"type":21,"tag":209,"props":60558,"children":60559},{"style":216},[60560],{"type":26,"value":1432},{"type":21,"tag":209,"props":60562,"children":60563},{"style":222},[60564],{"type":26,"value":60422},{"type":21,"tag":209,"props":60566,"children":60567},{"class":211,"line":351},[60568,60572,60576],{"type":21,"tag":209,"props":60569,"children":60570},{"style":222},[60571],{"type":26,"value":60430},{"type":21,"tag":209,"props":60573,"children":60574},{"style":360},[60575],{"type":26,"value":60435},{"type":21,"tag":209,"props":60577,"children":60578},{"style":222},[60579],{"type":26,"value":4123},{"type":21,"tag":209,"props":60581,"children":60582},{"class":211,"line":444},[60583,60587,60591],{"type":21,"tag":209,"props":60584,"children":60585},{"style":222},[60586],{"type":26,"value":60430},{"type":21,"tag":209,"props":60588,"children":60589},{"style":360},[60590],{"type":26,"value":60451},{"type":21,"tag":209,"props":60592,"children":60593},{"style":222},[60594],{"type":26,"value":4123},{"type":21,"tag":209,"props":60596,"children":60597},{"class":211,"line":454},[60598],{"type":21,"tag":209,"props":60599,"children":60600},{"style":448},[60601],{"type":26,"value":60602},"    // if drop and drag target\n",{"type":21,"tag":209,"props":60604,"children":60605},{"class":211,"line":463},[60606,60611,60615],{"type":21,"tag":209,"props":60607,"children":60608},{"style":222},[60609],{"type":26,"value":60610},"    files ",{"type":21,"tag":209,"props":60612,"children":60613},{"style":216},[60614],{"type":26,"value":1432},{"type":21,"tag":209,"props":60616,"children":60617},{"style":222},[60618],{"type":26,"value":60619}," event.dataTransfer.files;\n",{"type":21,"tag":209,"props":60621,"children":60622},{"class":211,"line":472},[60623],{"type":21,"tag":209,"props":60624,"children":60625},{"style":448},[60626],{"type":26,"value":60627},"    // or if an input\n",{"type":21,"tag":209,"props":60629,"children":60630},{"class":211,"line":480},[60631,60635,60639],{"type":21,"tag":209,"props":60632,"children":60633},{"style":222},[60634],{"type":26,"value":60610},{"type":21,"tag":209,"props":60636,"children":60637},{"style":216},[60638],{"type":26,"value":1432},{"type":21,"tag":209,"props":60640,"children":60641},{"style":222},[60642],{"type":26,"value":60643}," event.target.files;\n",{"type":21,"tag":209,"props":60645,"children":60646},{"class":211,"line":489},[60647],{"type":21,"tag":209,"props":60648,"children":60649},{"style":222},[60650],{"type":26,"value":469},{"type":21,"tag":22,"props":60652,"children":60653},{},[60654],{"type":26,"value":60655},"End result of this is that we'll end up with a FileList object that acts like an array, with each element being a reference to a file. We can then iterate through it to upload or read our files.",{"type":21,"tag":3596,"props":60657,"children":60659},{"id":60658},"uploading",[60660],{"type":26,"value":60661},"Uploading",{"type":21,"tag":22,"props":60663,"children":60664},{},[60665,60667,60673],{"type":26,"value":60666},"XHR2 introduces some new features, with the ones of interest being the new ",{"type":21,"tag":29,"props":60668,"children":60670},{"href":60669},"www.w3.org/TR/XMLHttpRequest/",[60671],{"type":26,"value":60672},"upload attribute on xhr",{"type":26,"value":60674},", which returns an XMLHttpRequestUpload object. This exposes the progress of an upload to us. Otherwise, we'll be using the standard send() call with an ArrayBuffer of the file to upload it. Here's what part of the setup and upload looks like in the plugin we'll be discussing shortly:",{"type":21,"tag":200,"props":60676,"children":60678},{"className":16138,"code":60677,"language":16140,"meta":8,"style":8},"    /**\n     * Deferred wrapper for xhr upload.\n     * @param options\n     * @param file\n     * @returns {Object} promise The deferred promise object.\n     * @constructor\n     */\n    function DeferXhr(options, file){\n        var that = this;\n\n    this.defer = $.Deferred();\n    this.file = file;\n    this.options = options;\n    this.paused = false;\n    this.progress = 0;\n    this.xhr = new XMLHttpRequest();\n\n    if (this.options.chunked)\n    {\n        this.start = 0;\n        this.end = Math.min(this.start+this.options.chunk_size, this.file.size);\n    }\n\n    this.xhr.addEventListener('load', function(){that.complete();}, false);\n    this.xhr.upload.addEventListener('progress', function(event){that.uploadProgress(event);}, false);\n    this.xhr.upload.addEventListener('error', function(event){that.uploadError(event);}, false);\n\n    this.upload();\n\n    return this.defer.promise();\n}\n\n/**\n * Carry out the xhr upload, optionally chunked.\n */\nDeferXhr.prototype.upload = function(){\n\n    this.xhr.open(this.options.type, this.options.url, this.options.async);\n    this.xhr.setRequestHeader('Accept', 'application/json');\n    this.xhr.setRequestHeader('X-File-Name', this.file.name);\n    this.xhr.setRequestHeader('X-File-Type', this.file.type);\n\n    if (this.options.chunked)\n    {\n        this.xhr.overrideMimeType('application/octet-stream');\n        this.xhr.setRequestHeader('Content-Range', 'bytes '+this.start+\"-\"+this.end+'/'+this.file.size);\n        this.xhr.send(this.file.slice(this.start, this.end));\n    }\n    else\n    {\n        this.xhr.overrideMimeType((this.file.type || 'application/octet-stream'));\n        this.xhr.send(this.file);\n    }\n}\n",[60679],{"type":21,"tag":63,"props":60680,"children":60681},{"__ignoreMap":8},[60682,60689,60697,60713,60729,60750,60761,60768,60800,60823,60830,60858,60879,60900,60924,60947,60975,60982,61001,61008,61032,61092,61099,61106,61161,61224,61284,61291,61310,61317,61340,61347,61354,61361,61369,61376,61411,61418,61464,61500,61537,61574,61581,61600,61607,61635,61721,61775,61782,61790,61797,61838,61866,61873],{"type":21,"tag":209,"props":60683,"children":60684},{"class":211,"line":212},[60685],{"type":21,"tag":209,"props":60686,"children":60687},{"style":448},[60688],{"type":26,"value":13290},{"type":21,"tag":209,"props":60690,"children":60691},{"class":211,"line":244},[60692],{"type":21,"tag":209,"props":60693,"children":60694},{"style":448},[60695],{"type":26,"value":60696},"     * Deferred wrapper for xhr upload.\n",{"type":21,"tag":209,"props":60698,"children":60699},{"class":211,"line":254},[60700,60704,60708],{"type":21,"tag":209,"props":60701,"children":60702},{"style":448},[60703],{"type":26,"value":13306},{"type":21,"tag":209,"props":60705,"children":60706},{"style":216},[60707],{"type":26,"value":13311},{"type":21,"tag":209,"props":60709,"children":60710},{"style":222},[60711],{"type":26,"value":60712}," options\n",{"type":21,"tag":209,"props":60714,"children":60715},{"class":211,"line":279},[60716,60720,60724],{"type":21,"tag":209,"props":60717,"children":60718},{"style":448},[60719],{"type":26,"value":13306},{"type":21,"tag":209,"props":60721,"children":60722},{"style":216},[60723],{"type":26,"value":13311},{"type":21,"tag":209,"props":60725,"children":60726},{"style":222},[60727],{"type":26,"value":60728}," file\n",{"type":21,"tag":209,"props":60730,"children":60731},{"class":211,"line":288},[60732,60736,60740,60745],{"type":21,"tag":209,"props":60733,"children":60734},{"style":448},[60735],{"type":26,"value":13306},{"type":21,"tag":209,"props":60737,"children":60738},{"style":216},[60739],{"type":26,"value":13333},{"type":21,"tag":209,"props":60741,"children":60742},{"style":360},[60743],{"type":26,"value":60744}," {Object}",{"type":21,"tag":209,"props":60746,"children":60747},{"style":448},[60748],{"type":26,"value":60749}," promise The deferred promise object.\n",{"type":21,"tag":209,"props":60751,"children":60752},{"class":211,"line":307},[60753,60757],{"type":21,"tag":209,"props":60754,"children":60755},{"style":448},[60756],{"type":26,"value":13306},{"type":21,"tag":209,"props":60758,"children":60759},{"style":216},[60760],{"type":26,"value":41933},{"type":21,"tag":209,"props":60762,"children":60763},{"class":211,"line":325},[60764],{"type":21,"tag":209,"props":60765,"children":60766},{"style":448},[60767],{"type":26,"value":13346},{"type":21,"tag":209,"props":60769,"children":60770},{"class":211,"line":334},[60771,60775,60779,60783,60787,60791,60796],{"type":21,"tag":209,"props":60772,"children":60773},{"style":216},[60774],{"type":26,"value":2981},{"type":21,"tag":209,"props":60776,"children":60777},{"style":360},[60778],{"type":26,"value":53645},{"type":21,"tag":209,"props":60780,"children":60781},{"style":222},[60782],{"type":26,"value":368},{"type":21,"tag":209,"props":60784,"children":60785},{"style":400},[60786],{"type":26,"value":28349},{"type":21,"tag":209,"props":60788,"children":60789},{"style":222},[60790],{"type":26,"value":408},{"type":21,"tag":209,"props":60792,"children":60793},{"style":400},[60794],{"type":26,"value":60795},"file",{"type":21,"tag":209,"props":60797,"children":60798},{"style":222},[60799],{"type":26,"value":2369},{"type":21,"tag":209,"props":60801,"children":60802},{"class":211,"line":343},[60803,60807,60811,60815,60819],{"type":21,"tag":209,"props":60804,"children":60805},{"style":216},[60806],{"type":26,"value":14505},{"type":21,"tag":209,"props":60808,"children":60809},{"style":222},[60810],{"type":26,"value":52897},{"type":21,"tag":209,"props":60812,"children":60813},{"style":216},[60814],{"type":26,"value":1432},{"type":21,"tag":209,"props":60816,"children":60817},{"style":263},[60818],{"type":26,"value":20502},{"type":21,"tag":209,"props":60820,"children":60821},{"style":222},[60822],{"type":26,"value":241},{"type":21,"tag":209,"props":60824,"children":60825},{"class":211,"line":351},[60826],{"type":21,"tag":209,"props":60827,"children":60828},{"emptyLinePlaceholder":248},[60829],{"type":26,"value":251},{"type":21,"tag":209,"props":60831,"children":60832},{"class":211,"line":444},[60833,60837,60842,60846,60850,60854],{"type":21,"tag":209,"props":60834,"children":60835},{"style":263},[60836],{"type":26,"value":46760},{"type":21,"tag":209,"props":60838,"children":60839},{"style":222},[60840],{"type":26,"value":60841},".defer ",{"type":21,"tag":209,"props":60843,"children":60844},{"style":216},[60845],{"type":26,"value":1432},{"type":21,"tag":209,"props":60847,"children":60848},{"style":222},[60849],{"type":26,"value":25427},{"type":21,"tag":209,"props":60851,"children":60852},{"style":360},[60853],{"type":26,"value":25432},{"type":21,"tag":209,"props":60855,"children":60856},{"style":222},[60857],{"type":26,"value":4123},{"type":21,"tag":209,"props":60859,"children":60860},{"class":211,"line":454},[60861,60865,60870,60874],{"type":21,"tag":209,"props":60862,"children":60863},{"style":263},[60864],{"type":26,"value":46760},{"type":21,"tag":209,"props":60866,"children":60867},{"style":222},[60868],{"type":26,"value":60869},".file ",{"type":21,"tag":209,"props":60871,"children":60872},{"style":216},[60873],{"type":26,"value":1432},{"type":21,"tag":209,"props":60875,"children":60876},{"style":222},[60877],{"type":26,"value":60878}," file;\n",{"type":21,"tag":209,"props":60880,"children":60881},{"class":211,"line":463},[60882,60886,60891,60895],{"type":21,"tag":209,"props":60883,"children":60884},{"style":263},[60885],{"type":26,"value":46760},{"type":21,"tag":209,"props":60887,"children":60888},{"style":222},[60889],{"type":26,"value":60890},".options ",{"type":21,"tag":209,"props":60892,"children":60893},{"style":216},[60894],{"type":26,"value":1432},{"type":21,"tag":209,"props":60896,"children":60897},{"style":222},[60898],{"type":26,"value":60899}," options;\n",{"type":21,"tag":209,"props":60901,"children":60902},{"class":211,"line":472},[60903,60907,60912,60916,60920],{"type":21,"tag":209,"props":60904,"children":60905},{"style":263},[60906],{"type":26,"value":46760},{"type":21,"tag":209,"props":60908,"children":60909},{"style":222},[60910],{"type":26,"value":60911},".paused ",{"type":21,"tag":209,"props":60913,"children":60914},{"style":216},[60915],{"type":26,"value":1432},{"type":21,"tag":209,"props":60917,"children":60918},{"style":263},[60919],{"type":26,"value":14038},{"type":21,"tag":209,"props":60921,"children":60922},{"style":222},[60923],{"type":26,"value":241},{"type":21,"tag":209,"props":60925,"children":60926},{"class":211,"line":480},[60927,60931,60935,60939,60943],{"type":21,"tag":209,"props":60928,"children":60929},{"style":263},[60930],{"type":26,"value":46760},{"type":21,"tag":209,"props":60932,"children":60933},{"style":222},[60934],{"type":26,"value":55332},{"type":21,"tag":209,"props":60936,"children":60937},{"style":216},[60938],{"type":26,"value":1432},{"type":21,"tag":209,"props":60940,"children":60941},{"style":263},[60942],{"type":26,"value":8009},{"type":21,"tag":209,"props":60944,"children":60945},{"style":222},[60946],{"type":26,"value":241},{"type":21,"tag":209,"props":60948,"children":60949},{"class":211,"line":489},[60950,60954,60959,60963,60967,60971],{"type":21,"tag":209,"props":60951,"children":60952},{"style":263},[60953],{"type":26,"value":46760},{"type":21,"tag":209,"props":60955,"children":60956},{"style":222},[60957],{"type":26,"value":60958},".xhr ",{"type":21,"tag":209,"props":60960,"children":60961},{"style":216},[60962],{"type":26,"value":1432},{"type":21,"tag":209,"props":60964,"children":60965},{"style":216},[60966],{"type":26,"value":6371},{"type":21,"tag":209,"props":60968,"children":60969},{"style":360},[60970],{"type":26,"value":20437},{"type":21,"tag":209,"props":60972,"children":60973},{"style":222},[60974],{"type":26,"value":4123},{"type":21,"tag":209,"props":60976,"children":60977},{"class":211,"line":847},[60978],{"type":21,"tag":209,"props":60979,"children":60980},{"emptyLinePlaceholder":248},[60981],{"type":26,"value":251},{"type":21,"tag":209,"props":60983,"children":60984},{"class":211,"line":860},[60985,60989,60993,60997],{"type":21,"tag":209,"props":60986,"children":60987},{"style":216},[60988],{"type":26,"value":9249},{"type":21,"tag":209,"props":60990,"children":60991},{"style":222},[60992],{"type":26,"value":5569},{"type":21,"tag":209,"props":60994,"children":60995},{"style":263},[60996],{"type":26,"value":2508},{"type":21,"tag":209,"props":60998,"children":60999},{"style":222},[61000],{"type":26,"value":55370},{"type":21,"tag":209,"props":61002,"children":61003},{"class":211,"line":877},[61004],{"type":21,"tag":209,"props":61005,"children":61006},{"style":222},[61007],{"type":26,"value":32675},{"type":21,"tag":209,"props":61009,"children":61010},{"class":211,"line":889},[61011,61015,61020,61024,61028],{"type":21,"tag":209,"props":61012,"children":61013},{"style":263},[61014],{"type":26,"value":47121},{"type":21,"tag":209,"props":61016,"children":61017},{"style":222},[61018],{"type":26,"value":61019},".start ",{"type":21,"tag":209,"props":61021,"children":61022},{"style":216},[61023],{"type":26,"value":1432},{"type":21,"tag":209,"props":61025,"children":61026},{"style":263},[61027],{"type":26,"value":8009},{"type":21,"tag":209,"props":61029,"children":61030},{"style":222},[61031],{"type":26,"value":241},{"type":21,"tag":209,"props":61033,"children":61034},{"class":211,"line":902},[61035,61039,61044,61048,61053,61058,61062,61066,61071,61075,61079,61084,61088],{"type":21,"tag":209,"props":61036,"children":61037},{"style":263},[61038],{"type":26,"value":47121},{"type":21,"tag":209,"props":61040,"children":61041},{"style":222},[61042],{"type":26,"value":61043},".end ",{"type":21,"tag":209,"props":61045,"children":61046},{"style":216},[61047],{"type":26,"value":1432},{"type":21,"tag":209,"props":61049,"children":61050},{"style":222},[61051],{"type":26,"value":61052}," Math.",{"type":21,"tag":209,"props":61054,"children":61055},{"style":360},[61056],{"type":26,"value":61057},"min",{"type":21,"tag":209,"props":61059,"children":61060},{"style":222},[61061],{"type":26,"value":368},{"type":21,"tag":209,"props":61063,"children":61064},{"style":263},[61065],{"type":26,"value":2508},{"type":21,"tag":209,"props":61067,"children":61068},{"style":222},[61069],{"type":26,"value":61070},".start",{"type":21,"tag":209,"props":61072,"children":61073},{"style":216},[61074],{"type":26,"value":17170},{"type":21,"tag":209,"props":61076,"children":61077},{"style":263},[61078],{"type":26,"value":2508},{"type":21,"tag":209,"props":61080,"children":61081},{"style":222},[61082],{"type":26,"value":61083},".options.chunk_size, ",{"type":21,"tag":209,"props":61085,"children":61086},{"style":263},[61087],{"type":26,"value":2508},{"type":21,"tag":209,"props":61089,"children":61090},{"style":222},[61091],{"type":26,"value":55420},{"type":21,"tag":209,"props":61093,"children":61094},{"class":211,"line":914},[61095],{"type":21,"tag":209,"props":61096,"children":61097},{"style":222},[61098],{"type":26,"value":331},{"type":21,"tag":209,"props":61100,"children":61101},{"class":211,"line":922},[61102],{"type":21,"tag":209,"props":61103,"children":61104},{"emptyLinePlaceholder":248},[61105],{"type":26,"value":251},{"type":21,"tag":209,"props":61107,"children":61108},{"class":211,"line":2312},[61109,61113,61118,61122,61126,61130,61134,61138,61143,61148,61153,61157],{"type":21,"tag":209,"props":61110,"children":61111},{"style":263},[61112],{"type":26,"value":46760},{"type":21,"tag":209,"props":61114,"children":61115},{"style":222},[61116],{"type":26,"value":61117},".xhr.",{"type":21,"tag":209,"props":61119,"children":61120},{"style":360},[61121],{"type":26,"value":14995},{"type":21,"tag":209,"props":61123,"children":61124},{"style":222},[61125],{"type":26,"value":368},{"type":21,"tag":209,"props":61127,"children":61128},{"style":233},[61129],{"type":26,"value":20469},{"type":21,"tag":209,"props":61131,"children":61132},{"style":222},[61133],{"type":26,"value":408},{"type":21,"tag":209,"props":61135,"children":61136},{"style":216},[61137],{"type":26,"value":4622},{"type":21,"tag":209,"props":61139,"children":61140},{"style":222},[61141],{"type":26,"value":61142},"(){that.",{"type":21,"tag":209,"props":61144,"children":61145},{"style":360},[61146],{"type":26,"value":61147},"complete",{"type":21,"tag":209,"props":61149,"children":61150},{"style":222},[61151],{"type":26,"value":61152},"();}, ",{"type":21,"tag":209,"props":61154,"children":61155},{"style":263},[61156],{"type":26,"value":4243},{"type":21,"tag":209,"props":61158,"children":61159},{"style":222},[61160],{"type":26,"value":2608},{"type":21,"tag":209,"props":61162,"children":61163},{"class":211,"line":2321},[61164,61168,61173,61177,61181,61186,61190,61194,61198,61202,61207,61211,61216,61220],{"type":21,"tag":209,"props":61165,"children":61166},{"style":263},[61167],{"type":26,"value":46760},{"type":21,"tag":209,"props":61169,"children":61170},{"style":222},[61171],{"type":26,"value":61172},".xhr.upload.",{"type":21,"tag":209,"props":61174,"children":61175},{"style":360},[61176],{"type":26,"value":14995},{"type":21,"tag":209,"props":61178,"children":61179},{"style":222},[61180],{"type":26,"value":368},{"type":21,"tag":209,"props":61182,"children":61183},{"style":233},[61184],{"type":26,"value":61185},"'progress'",{"type":21,"tag":209,"props":61187,"children":61188},{"style":222},[61189],{"type":26,"value":408},{"type":21,"tag":209,"props":61191,"children":61192},{"style":216},[61193],{"type":26,"value":4622},{"type":21,"tag":209,"props":61195,"children":61196},{"style":222},[61197],{"type":26,"value":368},{"type":21,"tag":209,"props":61199,"children":61200},{"style":400},[61201],{"type":26,"value":25805},{"type":21,"tag":209,"props":61203,"children":61204},{"style":222},[61205],{"type":26,"value":61206},"){that.",{"type":21,"tag":209,"props":61208,"children":61209},{"style":360},[61210],{"type":26,"value":55281},{"type":21,"tag":209,"props":61212,"children":61213},{"style":222},[61214],{"type":26,"value":61215},"(event);}, ",{"type":21,"tag":209,"props":61217,"children":61218},{"style":263},[61219],{"type":26,"value":4243},{"type":21,"tag":209,"props":61221,"children":61222},{"style":222},[61223],{"type":26,"value":2608},{"type":21,"tag":209,"props":61225,"children":61226},{"class":211,"line":2372},[61227,61231,61235,61239,61243,61247,61251,61255,61259,61263,61267,61272,61276,61280],{"type":21,"tag":209,"props":61228,"children":61229},{"style":263},[61230],{"type":26,"value":46760},{"type":21,"tag":209,"props":61232,"children":61233},{"style":222},[61234],{"type":26,"value":61172},{"type":21,"tag":209,"props":61236,"children":61237},{"style":360},[61238],{"type":26,"value":14995},{"type":21,"tag":209,"props":61240,"children":61241},{"style":222},[61242],{"type":26,"value":368},{"type":21,"tag":209,"props":61244,"children":61245},{"style":233},[61246],{"type":26,"value":20588},{"type":21,"tag":209,"props":61248,"children":61249},{"style":222},[61250],{"type":26,"value":408},{"type":21,"tag":209,"props":61252,"children":61253},{"style":216},[61254],{"type":26,"value":4622},{"type":21,"tag":209,"props":61256,"children":61257},{"style":222},[61258],{"type":26,"value":368},{"type":21,"tag":209,"props":61260,"children":61261},{"style":400},[61262],{"type":26,"value":25805},{"type":21,"tag":209,"props":61264,"children":61265},{"style":222},[61266],{"type":26,"value":61206},{"type":21,"tag":209,"props":61268,"children":61269},{"style":360},[61270],{"type":26,"value":61271},"uploadError",{"type":21,"tag":209,"props":61273,"children":61274},{"style":222},[61275],{"type":26,"value":61215},{"type":21,"tag":209,"props":61277,"children":61278},{"style":263},[61279],{"type":26,"value":4243},{"type":21,"tag":209,"props":61281,"children":61282},{"style":222},[61283],{"type":26,"value":2608},{"type":21,"tag":209,"props":61285,"children":61286},{"class":211,"line":2381},[61287],{"type":21,"tag":209,"props":61288,"children":61289},{"emptyLinePlaceholder":248},[61290],{"type":26,"value":251},{"type":21,"tag":209,"props":61292,"children":61293},{"class":211,"line":2389},[61294,61298,61302,61306],{"type":21,"tag":209,"props":61295,"children":61296},{"style":263},[61297],{"type":26,"value":46760},{"type":21,"tag":209,"props":61299,"children":61300},{"style":222},[61301],{"type":26,"value":378},{"type":21,"tag":209,"props":61303,"children":61304},{"style":360},[61305],{"type":26,"value":31175},{"type":21,"tag":209,"props":61307,"children":61308},{"style":222},[61309],{"type":26,"value":4123},{"type":21,"tag":209,"props":61311,"children":61312},{"class":211,"line":2397},[61313],{"type":21,"tag":209,"props":61314,"children":61315},{"emptyLinePlaceholder":248},[61316],{"type":26,"value":251},{"type":21,"tag":209,"props":61318,"children":61319},{"class":211,"line":2406},[61320,61324,61328,61332,61336],{"type":21,"tag":209,"props":61321,"children":61322},{"style":216},[61323],{"type":26,"value":1298},{"type":21,"tag":209,"props":61325,"children":61326},{"style":263},[61327],{"type":26,"value":20502},{"type":21,"tag":209,"props":61329,"children":61330},{"style":222},[61331],{"type":26,"value":55615},{"type":21,"tag":209,"props":61333,"children":61334},{"style":360},[61335],{"type":26,"value":26332},{"type":21,"tag":209,"props":61337,"children":61338},{"style":222},[61339],{"type":26,"value":4123},{"type":21,"tag":209,"props":61341,"children":61342},{"class":211,"line":2415},[61343],{"type":21,"tag":209,"props":61344,"children":61345},{"style":222},[61346],{"type":26,"value":4415},{"type":21,"tag":209,"props":61348,"children":61349},{"class":211,"line":2424},[61350],{"type":21,"tag":209,"props":61351,"children":61352},{"emptyLinePlaceholder":248},[61353],{"type":26,"value":251},{"type":21,"tag":209,"props":61355,"children":61356},{"class":211,"line":2433},[61357],{"type":21,"tag":209,"props":61358,"children":61359},{"style":448},[61360],{"type":26,"value":731},{"type":21,"tag":209,"props":61362,"children":61363},{"class":211,"line":2442},[61364],{"type":21,"tag":209,"props":61365,"children":61366},{"style":448},[61367],{"type":26,"value":61368}," * Carry out the xhr upload, optionally chunked.\n",{"type":21,"tag":209,"props":61370,"children":61371},{"class":211,"line":2471},[61372],{"type":21,"tag":209,"props":61373,"children":61374},{"style":448},[61375],{"type":26,"value":755},{"type":21,"tag":209,"props":61377,"children":61378},{"class":211,"line":2480},[61379,61383,61387,61391,61395,61399,61403,61407],{"type":21,"tag":209,"props":61380,"children":61381},{"style":263},[61382],{"type":26,"value":55264},{"type":21,"tag":209,"props":61384,"children":61385},{"style":222},[61386],{"type":26,"value":378},{"type":21,"tag":209,"props":61388,"children":61389},{"style":263},[61390],{"type":26,"value":32662},{"type":21,"tag":209,"props":61392,"children":61393},{"style":222},[61394],{"type":26,"value":378},{"type":21,"tag":209,"props":61396,"children":61397},{"style":360},[61398],{"type":26,"value":31175},{"type":21,"tag":209,"props":61400,"children":61401},{"style":216},[61402],{"type":26,"value":271},{"type":21,"tag":209,"props":61404,"children":61405},{"style":216},[61406],{"type":26,"value":4789},{"type":21,"tag":209,"props":61408,"children":61409},{"style":222},[61410],{"type":26,"value":2561},{"type":21,"tag":209,"props":61412,"children":61413},{"class":211,"line":2489},[61414],{"type":21,"tag":209,"props":61415,"children":61416},{"emptyLinePlaceholder":248},[61417],{"type":26,"value":251},{"type":21,"tag":209,"props":61419,"children":61420},{"class":211,"line":2516},[61421,61425,61429,61433,61437,61441,61446,61450,61455,61459],{"type":21,"tag":209,"props":61422,"children":61423},{"style":263},[61424],{"type":26,"value":46760},{"type":21,"tag":209,"props":61426,"children":61427},{"style":222},[61428],{"type":26,"value":61117},{"type":21,"tag":209,"props":61430,"children":61431},{"style":360},[61432],{"type":26,"value":20680},{"type":21,"tag":209,"props":61434,"children":61435},{"style":222},[61436],{"type":26,"value":368},{"type":21,"tag":209,"props":61438,"children":61439},{"style":263},[61440],{"type":26,"value":2508},{"type":21,"tag":209,"props":61442,"children":61443},{"style":222},[61444],{"type":26,"value":61445},".options.type, ",{"type":21,"tag":209,"props":61447,"children":61448},{"style":263},[61449],{"type":26,"value":2508},{"type":21,"tag":209,"props":61451,"children":61452},{"style":222},[61453],{"type":26,"value":61454},".options.url, ",{"type":21,"tag":209,"props":61456,"children":61457},{"style":263},[61458],{"type":26,"value":2508},{"type":21,"tag":209,"props":61460,"children":61461},{"style":222},[61462],{"type":26,"value":61463},".options.async);\n",{"type":21,"tag":209,"props":61465,"children":61466},{"class":211,"line":2525},[61467,61471,61475,61479,61483,61488,61492,61496],{"type":21,"tag":209,"props":61468,"children":61469},{"style":263},[61470],{"type":26,"value":46760},{"type":21,"tag":209,"props":61472,"children":61473},{"style":222},[61474],{"type":26,"value":61117},{"type":21,"tag":209,"props":61476,"children":61477},{"style":360},[61478],{"type":26,"value":56746},{"type":21,"tag":209,"props":61480,"children":61481},{"style":222},[61482],{"type":26,"value":368},{"type":21,"tag":209,"props":61484,"children":61485},{"style":233},[61486],{"type":26,"value":61487},"'Accept'",{"type":21,"tag":209,"props":61489,"children":61490},{"style":222},[61491],{"type":26,"value":408},{"type":21,"tag":209,"props":61493,"children":61494},{"style":233},[61495],{"type":26,"value":10754},{"type":21,"tag":209,"props":61497,"children":61498},{"style":222},[61499],{"type":26,"value":2608},{"type":21,"tag":209,"props":61501,"children":61502},{"class":211,"line":2533},[61503,61507,61511,61515,61519,61524,61528,61532],{"type":21,"tag":209,"props":61504,"children":61505},{"style":263},[61506],{"type":26,"value":46760},{"type":21,"tag":209,"props":61508,"children":61509},{"style":222},[61510],{"type":26,"value":61117},{"type":21,"tag":209,"props":61512,"children":61513},{"style":360},[61514],{"type":26,"value":56746},{"type":21,"tag":209,"props":61516,"children":61517},{"style":222},[61518],{"type":26,"value":368},{"type":21,"tag":209,"props":61520,"children":61521},{"style":233},[61522],{"type":26,"value":61523},"'X-File-Name'",{"type":21,"tag":209,"props":61525,"children":61526},{"style":222},[61527],{"type":26,"value":408},{"type":21,"tag":209,"props":61529,"children":61530},{"style":263},[61531],{"type":26,"value":2508},{"type":21,"tag":209,"props":61533,"children":61534},{"style":222},[61535],{"type":26,"value":61536},".file.name);\n",{"type":21,"tag":209,"props":61538,"children":61539},{"class":211,"line":2542},[61540,61544,61548,61552,61556,61561,61565,61569],{"type":21,"tag":209,"props":61541,"children":61542},{"style":263},[61543],{"type":26,"value":46760},{"type":21,"tag":209,"props":61545,"children":61546},{"style":222},[61547],{"type":26,"value":61117},{"type":21,"tag":209,"props":61549,"children":61550},{"style":360},[61551],{"type":26,"value":56746},{"type":21,"tag":209,"props":61553,"children":61554},{"style":222},[61555],{"type":26,"value":368},{"type":21,"tag":209,"props":61557,"children":61558},{"style":233},[61559],{"type":26,"value":61560},"'X-File-Type'",{"type":21,"tag":209,"props":61562,"children":61563},{"style":222},[61564],{"type":26,"value":408},{"type":21,"tag":209,"props":61566,"children":61567},{"style":263},[61568],{"type":26,"value":2508},{"type":21,"tag":209,"props":61570,"children":61571},{"style":222},[61572],{"type":26,"value":61573},".file.type);\n",{"type":21,"tag":209,"props":61575,"children":61576},{"class":211,"line":2550},[61577],{"type":21,"tag":209,"props":61578,"children":61579},{"emptyLinePlaceholder":248},[61580],{"type":26,"value":251},{"type":21,"tag":209,"props":61582,"children":61583},{"class":211,"line":2564},[61584,61588,61592,61596],{"type":21,"tag":209,"props":61585,"children":61586},{"style":216},[61587],{"type":26,"value":9249},{"type":21,"tag":209,"props":61589,"children":61590},{"style":222},[61591],{"type":26,"value":5569},{"type":21,"tag":209,"props":61593,"children":61594},{"style":263},[61595],{"type":26,"value":2508},{"type":21,"tag":209,"props":61597,"children":61598},{"style":222},[61599],{"type":26,"value":55370},{"type":21,"tag":209,"props":61601,"children":61602},{"class":211,"line":2611},[61603],{"type":21,"tag":209,"props":61604,"children":61605},{"style":222},[61606],{"type":26,"value":32675},{"type":21,"tag":209,"props":61608,"children":61609},{"class":211,"line":2619},[61610,61614,61618,61623,61627,61631],{"type":21,"tag":209,"props":61611,"children":61612},{"style":263},[61613],{"type":26,"value":47121},{"type":21,"tag":209,"props":61615,"children":61616},{"style":222},[61617],{"type":26,"value":61117},{"type":21,"tag":209,"props":61619,"children":61620},{"style":360},[61621],{"type":26,"value":61622},"overrideMimeType",{"type":21,"tag":209,"props":61624,"children":61625},{"style":222},[61626],{"type":26,"value":368},{"type":21,"tag":209,"props":61628,"children":61629},{"style":233},[61630],{"type":26,"value":16177},{"type":21,"tag":209,"props":61632,"children":61633},{"style":222},[61634],{"type":26,"value":2608},{"type":21,"tag":209,"props":61636,"children":61637},{"class":211,"line":2627},[61638,61642,61646,61650,61654,61659,61663,61668,61672,61676,61680,61684,61689,61693,61697,61701,61705,61709,61713,61717],{"type":21,"tag":209,"props":61639,"children":61640},{"style":263},[61641],{"type":26,"value":47121},{"type":21,"tag":209,"props":61643,"children":61644},{"style":222},[61645],{"type":26,"value":61117},{"type":21,"tag":209,"props":61647,"children":61648},{"style":360},[61649],{"type":26,"value":56746},{"type":21,"tag":209,"props":61651,"children":61652},{"style":222},[61653],{"type":26,"value":368},{"type":21,"tag":209,"props":61655,"children":61656},{"style":233},[61657],{"type":26,"value":61658},"'Content-Range'",{"type":21,"tag":209,"props":61660,"children":61661},{"style":222},[61662],{"type":26,"value":408},{"type":21,"tag":209,"props":61664,"children":61665},{"style":233},[61666],{"type":26,"value":61667},"'bytes '",{"type":21,"tag":209,"props":61669,"children":61670},{"style":216},[61671],{"type":26,"value":17170},{"type":21,"tag":209,"props":61673,"children":61674},{"style":263},[61675],{"type":26,"value":2508},{"type":21,"tag":209,"props":61677,"children":61678},{"style":222},[61679],{"type":26,"value":61070},{"type":21,"tag":209,"props":61681,"children":61682},{"style":216},[61683],{"type":26,"value":17170},{"type":21,"tag":209,"props":61685,"children":61686},{"style":233},[61687],{"type":26,"value":61688},"\"-\"",{"type":21,"tag":209,"props":61690,"children":61691},{"style":216},[61692],{"type":26,"value":17170},{"type":21,"tag":209,"props":61694,"children":61695},{"style":263},[61696],{"type":26,"value":2508},{"type":21,"tag":209,"props":61698,"children":61699},{"style":222},[61700],{"type":26,"value":55407},{"type":21,"tag":209,"props":61702,"children":61703},{"style":216},[61704],{"type":26,"value":17170},{"type":21,"tag":209,"props":61706,"children":61707},{"style":233},[61708],{"type":26,"value":7645},{"type":21,"tag":209,"props":61710,"children":61711},{"style":216},[61712],{"type":26,"value":17170},{"type":21,"tag":209,"props":61714,"children":61715},{"style":263},[61716],{"type":26,"value":2508},{"type":21,"tag":209,"props":61718,"children":61719},{"style":222},[61720],{"type":26,"value":55420},{"type":21,"tag":209,"props":61722,"children":61723},{"class":211,"line":2636},[61724,61728,61732,61736,61740,61744,61749,61753,61757,61761,61766,61770],{"type":21,"tag":209,"props":61725,"children":61726},{"style":263},[61727],{"type":26,"value":47121},{"type":21,"tag":209,"props":61729,"children":61730},{"style":222},[61731],{"type":26,"value":61117},{"type":21,"tag":209,"props":61733,"children":61734},{"style":360},[61735],{"type":26,"value":6696},{"type":21,"tag":209,"props":61737,"children":61738},{"style":222},[61739],{"type":26,"value":368},{"type":21,"tag":209,"props":61741,"children":61742},{"style":263},[61743],{"type":26,"value":2508},{"type":21,"tag":209,"props":61745,"children":61746},{"style":222},[61747],{"type":26,"value":61748},".file.",{"type":21,"tag":209,"props":61750,"children":61751},{"style":360},[61752],{"type":26,"value":42188},{"type":21,"tag":209,"props":61754,"children":61755},{"style":222},[61756],{"type":26,"value":368},{"type":21,"tag":209,"props":61758,"children":61759},{"style":263},[61760],{"type":26,"value":2508},{"type":21,"tag":209,"props":61762,"children":61763},{"style":222},[61764],{"type":26,"value":61765},".start, ",{"type":21,"tag":209,"props":61767,"children":61768},{"style":263},[61769],{"type":26,"value":2508},{"type":21,"tag":209,"props":61771,"children":61772},{"style":222},[61773],{"type":26,"value":61774},".end));\n",{"type":21,"tag":209,"props":61776,"children":61777},{"class":211,"line":2644},[61778],{"type":21,"tag":209,"props":61779,"children":61780},{"style":222},[61781],{"type":26,"value":331},{"type":21,"tag":209,"props":61783,"children":61784},{"class":211,"line":2657},[61785],{"type":21,"tag":209,"props":61786,"children":61787},{"style":216},[61788],{"type":26,"value":61789},"    else\n",{"type":21,"tag":209,"props":61791,"children":61792},{"class":211,"line":2728},[61793],{"type":21,"tag":209,"props":61794,"children":61795},{"style":222},[61796],{"type":26,"value":32675},{"type":21,"tag":209,"props":61798,"children":61799},{"class":211,"line":2758},[61800,61804,61808,61812,61816,61820,61825,61829,61834],{"type":21,"tag":209,"props":61801,"children":61802},{"style":263},[61803],{"type":26,"value":47121},{"type":21,"tag":209,"props":61805,"children":61806},{"style":222},[61807],{"type":26,"value":61117},{"type":21,"tag":209,"props":61809,"children":61810},{"style":360},[61811],{"type":26,"value":61622},{"type":21,"tag":209,"props":61813,"children":61814},{"style":222},[61815],{"type":26,"value":2709},{"type":21,"tag":209,"props":61817,"children":61818},{"style":263},[61819],{"type":26,"value":2508},{"type":21,"tag":209,"props":61821,"children":61822},{"style":222},[61823],{"type":26,"value":61824},".file.type ",{"type":21,"tag":209,"props":61826,"children":61827},{"style":216},[61828],{"type":26,"value":13270},{"type":21,"tag":209,"props":61830,"children":61831},{"style":233},[61832],{"type":26,"value":61833}," 'application/octet-stream'",{"type":21,"tag":209,"props":61835,"children":61836},{"style":222},[61837],{"type":26,"value":4212},{"type":21,"tag":209,"props":61839,"children":61840},{"class":211,"line":2776},[61841,61845,61849,61853,61857,61861],{"type":21,"tag":209,"props":61842,"children":61843},{"style":263},[61844],{"type":26,"value":47121},{"type":21,"tag":209,"props":61846,"children":61847},{"style":222},[61848],{"type":26,"value":61117},{"type":21,"tag":209,"props":61850,"children":61851},{"style":360},[61852],{"type":26,"value":6696},{"type":21,"tag":209,"props":61854,"children":61855},{"style":222},[61856],{"type":26,"value":368},{"type":21,"tag":209,"props":61858,"children":61859},{"style":263},[61860],{"type":26,"value":2508},{"type":21,"tag":209,"props":61862,"children":61863},{"style":222},[61864],{"type":26,"value":61865},".file);\n",{"type":21,"tag":209,"props":61867,"children":61868},{"class":211,"line":2785},[61869],{"type":21,"tag":209,"props":61870,"children":61871},{"style":222},[61872],{"type":26,"value":331},{"type":21,"tag":209,"props":61874,"children":61875},{"class":211,"line":2793},[61876],{"type":21,"tag":209,"props":61877,"children":61878},{"style":222},[61879],{"type":26,"value":4415},{"type":21,"tag":22,"props":61881,"children":61882},{},[61883,61885,61890],{"type":26,"value":61884},"The main things to notice are that if we're sending a file 'chunked' (that is, in pieces of a pre-determined size - this is a good way to get around, say, php upload file size limits or allow for pausing and resuming a file upload, by the way) we're using the ",{"type":21,"tag":11881,"props":61886,"children":61887},{},[61888],{"type":26,"value":61889},"slice()",{"type":26,"value":61891}," method on our file to get an ArrayBuffer of the appropriate size out of the buffer representing the whole file. This also saves us from needing to read in the whole file before sending it.",{"type":21,"tag":22,"props":61893,"children":61894},{},[61895],{"type":26,"value":61896},"In order to know what's happening with our file upload, we just need to listen (as noted above) on the load, progress and errors events of xhr and xhr.upload.",{"type":21,"tag":3596,"props":61898,"children":61900},{"id":61899},"reading",[61901],{"type":26,"value":61902},"Reading",{"type":21,"tag":22,"props":61904,"children":61905},{},[61906,61908,61915,61917,61924],{"type":26,"value":61907},"This is probably one of my favourite new things to play with in javascript - the ",{"type":21,"tag":29,"props":61909,"children":61912},{"href":61910,"rel":61911},"http://www.w3.org/TR/FileAPI/#FileReader-interface",[93],[61913],{"type":26,"value":61914},"FileReader api",{"type":26,"value":61916}," (which is a subset of the ",{"type":21,"tag":29,"props":61918,"children":61921},{"href":61919,"rel":61920},"http://www.w3.org/TR/FileAPI/",[93],[61922],{"type":26,"value":61923},"File api",{"type":26,"value":61925},"). Get a file from the local user filesystem and work with it in the browser. Yay!",{"type":21,"tag":22,"props":61927,"children":61928},{},[61929],{"type":26,"value":61930},"Its exciting, because coming from a C and Java background, getting a file from the local system wasn't ever a problem, and there's been numerous times in my web dev endeavours when it has been. Ever needed to use that ugly hack where you upload a file to a server and bounce it immediately back to the client, just so you can have access to some image or text file from the user? Yeah, good riddance to that.",{"type":21,"tag":22,"props":61932,"children":61933},{},[61934],{"type":26,"value":61935},"Anyways, our plugin is going to do that to, because the two concepts are fairly closely related - we might want the user to drag and drop those drunken party photos into the browser for manipulation in a photo booth type app (airbrush me out of there... or maybe just add some clothes) before uploading, for instance.",{"type":21,"tag":22,"props":61937,"children":61938},{},[61939],{"type":26,"value":61940},"Here's what that looks like:",{"type":21,"tag":200,"props":61942,"children":61944},{"className":16138,"code":61943,"language":16140,"meta":8,"style":8},"    /**\n     * Deferred wrapper for file reader.\n     * @param read_method\n     * @param file\n     * @returns {Object} promise The Deferred promise object\n     * @constructor\n     */\n    function DeferReader(read_method, file){\n        this.defer = $.Deferred();\n        this.reader = new FileReader();\n        this.file = file;\n        this.read_method = read_method;\n\n    this.listen();\n    this.reader[read_method](file);\n\n    return this.defer.promise();\n}\n\n/**\n * Listen for the various events of interest on the file reader, and return notification or resolution\n * to deferred as appropriate.\n */\nDeferReader.prototype.listen = function(){\n    var that = this;\n\n    this.reader.addEventListener('error', function(event){\n        var err = event.target.error,\n            errCode = event.target.error.code,\n            errMsg = 'Error attempting to read file \"'+this.file.name+'\": ';\n        switch(errCode)\n        {\n            case err.NOT_FOUND_ERR:\n                errMsg += \"File could not be found.\";\n                break;\n            case err.NOT_READABLE_ERR:\n                errMsg += \"File is not readable.\";\n                break;\n            case err.ABORT_ERR:\n                errMsg += \"File read was aborted.\";\n                break;\n            default:\n                errMsg += \"An unexpected error occurred.\";\n                break;\n        }\n        that.defer.reject({state:Hup.state.FILE_READ_ERROR, error:errMsg});\n    }, false);\n\n    this.reader.addEventListener('progress', function(event){\n        if (event.lengthComputable)\n        {\n            that.defer.notify({state:Hup.state.FILE_READ_PROGRESS, file_name:that.file.name,\n                progress:(event.loaded/event.total)});\n        }\n    });\n\n    this.reader.addEventListener('loadend', function(event){\n        if (event.target.readyState == FileReader.DONE)\n        {\n            that.defer.resolve({state:Hup.state.FILE_READ_FINISHED,\n                file_name:that.file.name, file_size:that.file.size, file_type:that.file.type,\n                read_method:that.read_method, read_result:event.target.result});\n        }\n    }, false);\n};\n",[61945],{"type":21,"tag":63,"props":61946,"children":61947},{"__ignoreMap":8},[61948,61955,61963,61979,61994,62014,62025,62032,62063,62090,62119,62138,62159,62166,62185,62197,62204,62227,62234,62241,62248,62256,62264,62271,62307,62330,62337,62381,62402,62419,62462,62475,62482,62504,62525,62537,62557,62577,62588,62608,62628,62639,62651,62671,62682,62689,62715,62731,62738,62781,62792,62799,62825,62842,62849,62856,62863,62907,62937,62944,62968,62976,62984,62991,63006],{"type":21,"tag":209,"props":61949,"children":61950},{"class":211,"line":212},[61951],{"type":21,"tag":209,"props":61952,"children":61953},{"style":448},[61954],{"type":26,"value":13290},{"type":21,"tag":209,"props":61956,"children":61957},{"class":211,"line":244},[61958],{"type":21,"tag":209,"props":61959,"children":61960},{"style":448},[61961],{"type":26,"value":61962},"     * Deferred wrapper for file reader.\n",{"type":21,"tag":209,"props":61964,"children":61965},{"class":211,"line":254},[61966,61970,61974],{"type":21,"tag":209,"props":61967,"children":61968},{"style":448},[61969],{"type":26,"value":13306},{"type":21,"tag":209,"props":61971,"children":61972},{"style":216},[61973],{"type":26,"value":13311},{"type":21,"tag":209,"props":61975,"children":61976},{"style":222},[61977],{"type":26,"value":61978}," read_method\n",{"type":21,"tag":209,"props":61980,"children":61981},{"class":211,"line":279},[61982,61986,61990],{"type":21,"tag":209,"props":61983,"children":61984},{"style":448},[61985],{"type":26,"value":13306},{"type":21,"tag":209,"props":61987,"children":61988},{"style":216},[61989],{"type":26,"value":13311},{"type":21,"tag":209,"props":61991,"children":61992},{"style":222},[61993],{"type":26,"value":60728},{"type":21,"tag":209,"props":61995,"children":61996},{"class":211,"line":288},[61997,62001,62005,62009],{"type":21,"tag":209,"props":61998,"children":61999},{"style":448},[62000],{"type":26,"value":13306},{"type":21,"tag":209,"props":62002,"children":62003},{"style":216},[62004],{"type":26,"value":13333},{"type":21,"tag":209,"props":62006,"children":62007},{"style":360},[62008],{"type":26,"value":60744},{"type":21,"tag":209,"props":62010,"children":62011},{"style":448},[62012],{"type":26,"value":62013}," promise The Deferred promise object\n",{"type":21,"tag":209,"props":62015,"children":62016},{"class":211,"line":307},[62017,62021],{"type":21,"tag":209,"props":62018,"children":62019},{"style":448},[62020],{"type":26,"value":13306},{"type":21,"tag":209,"props":62022,"children":62023},{"style":216},[62024],{"type":26,"value":41933},{"type":21,"tag":209,"props":62026,"children":62027},{"class":211,"line":325},[62028],{"type":21,"tag":209,"props":62029,"children":62030},{"style":448},[62031],{"type":26,"value":13346},{"type":21,"tag":209,"props":62033,"children":62034},{"class":211,"line":334},[62035,62039,62043,62047,62051,62055,62059],{"type":21,"tag":209,"props":62036,"children":62037},{"style":216},[62038],{"type":26,"value":2981},{"type":21,"tag":209,"props":62040,"children":62041},{"style":360},[62042],{"type":26,"value":53675},{"type":21,"tag":209,"props":62044,"children":62045},{"style":222},[62046],{"type":26,"value":368},{"type":21,"tag":209,"props":62048,"children":62049},{"style":400},[62050],{"type":26,"value":31198},{"type":21,"tag":209,"props":62052,"children":62053},{"style":222},[62054],{"type":26,"value":408},{"type":21,"tag":209,"props":62056,"children":62057},{"style":400},[62058],{"type":26,"value":60795},{"type":21,"tag":209,"props":62060,"children":62061},{"style":222},[62062],{"type":26,"value":2369},{"type":21,"tag":209,"props":62064,"children":62065},{"class":211,"line":343},[62066,62070,62074,62078,62082,62086],{"type":21,"tag":209,"props":62067,"children":62068},{"style":263},[62069],{"type":26,"value":47121},{"type":21,"tag":209,"props":62071,"children":62072},{"style":222},[62073],{"type":26,"value":60841},{"type":21,"tag":209,"props":62075,"children":62076},{"style":216},[62077],{"type":26,"value":1432},{"type":21,"tag":209,"props":62079,"children":62080},{"style":222},[62081],{"type":26,"value":25427},{"type":21,"tag":209,"props":62083,"children":62084},{"style":360},[62085],{"type":26,"value":25432},{"type":21,"tag":209,"props":62087,"children":62088},{"style":222},[62089],{"type":26,"value":4123},{"type":21,"tag":209,"props":62091,"children":62092},{"class":211,"line":351},[62093,62097,62102,62106,62110,62115],{"type":21,"tag":209,"props":62094,"children":62095},{"style":263},[62096],{"type":26,"value":47121},{"type":21,"tag":209,"props":62098,"children":62099},{"style":222},[62100],{"type":26,"value":62101},".reader ",{"type":21,"tag":209,"props":62103,"children":62104},{"style":216},[62105],{"type":26,"value":1432},{"type":21,"tag":209,"props":62107,"children":62108},{"style":216},[62109],{"type":26,"value":6371},{"type":21,"tag":209,"props":62111,"children":62112},{"style":360},[62113],{"type":26,"value":62114}," FileReader",{"type":21,"tag":209,"props":62116,"children":62117},{"style":222},[62118],{"type":26,"value":4123},{"type":21,"tag":209,"props":62120,"children":62121},{"class":211,"line":444},[62122,62126,62130,62134],{"type":21,"tag":209,"props":62123,"children":62124},{"style":263},[62125],{"type":26,"value":47121},{"type":21,"tag":209,"props":62127,"children":62128},{"style":222},[62129],{"type":26,"value":60869},{"type":21,"tag":209,"props":62131,"children":62132},{"style":216},[62133],{"type":26,"value":1432},{"type":21,"tag":209,"props":62135,"children":62136},{"style":222},[62137],{"type":26,"value":60878},{"type":21,"tag":209,"props":62139,"children":62140},{"class":211,"line":454},[62141,62145,62150,62154],{"type":21,"tag":209,"props":62142,"children":62143},{"style":263},[62144],{"type":26,"value":47121},{"type":21,"tag":209,"props":62146,"children":62147},{"style":222},[62148],{"type":26,"value":62149},".read_method ",{"type":21,"tag":209,"props":62151,"children":62152},{"style":216},[62153],{"type":26,"value":1432},{"type":21,"tag":209,"props":62155,"children":62156},{"style":222},[62157],{"type":26,"value":62158}," read_method;\n",{"type":21,"tag":209,"props":62160,"children":62161},{"class":211,"line":463},[62162],{"type":21,"tag":209,"props":62163,"children":62164},{"emptyLinePlaceholder":248},[62165],{"type":26,"value":251},{"type":21,"tag":209,"props":62167,"children":62168},{"class":211,"line":472},[62169,62173,62177,62181],{"type":21,"tag":209,"props":62170,"children":62171},{"style":263},[62172],{"type":26,"value":46760},{"type":21,"tag":209,"props":62174,"children":62175},{"style":222},[62176],{"type":26,"value":378},{"type":21,"tag":209,"props":62178,"children":62179},{"style":360},[62180],{"type":26,"value":4593},{"type":21,"tag":209,"props":62182,"children":62183},{"style":222},[62184],{"type":26,"value":4123},{"type":21,"tag":209,"props":62186,"children":62187},{"class":211,"line":480},[62188,62192],{"type":21,"tag":209,"props":62189,"children":62190},{"style":263},[62191],{"type":26,"value":46760},{"type":21,"tag":209,"props":62193,"children":62194},{"style":222},[62195],{"type":26,"value":62196},".reader[read_method](file);\n",{"type":21,"tag":209,"props":62198,"children":62199},{"class":211,"line":489},[62200],{"type":21,"tag":209,"props":62201,"children":62202},{"emptyLinePlaceholder":248},[62203],{"type":26,"value":251},{"type":21,"tag":209,"props":62205,"children":62206},{"class":211,"line":847},[62207,62211,62215,62219,62223],{"type":21,"tag":209,"props":62208,"children":62209},{"style":216},[62210],{"type":26,"value":1298},{"type":21,"tag":209,"props":62212,"children":62213},{"style":263},[62214],{"type":26,"value":20502},{"type":21,"tag":209,"props":62216,"children":62217},{"style":222},[62218],{"type":26,"value":55615},{"type":21,"tag":209,"props":62220,"children":62221},{"style":360},[62222],{"type":26,"value":26332},{"type":21,"tag":209,"props":62224,"children":62225},{"style":222},[62226],{"type":26,"value":4123},{"type":21,"tag":209,"props":62228,"children":62229},{"class":211,"line":860},[62230],{"type":21,"tag":209,"props":62231,"children":62232},{"style":222},[62233],{"type":26,"value":4415},{"type":21,"tag":209,"props":62235,"children":62236},{"class":211,"line":877},[62237],{"type":21,"tag":209,"props":62238,"children":62239},{"emptyLinePlaceholder":248},[62240],{"type":26,"value":251},{"type":21,"tag":209,"props":62242,"children":62243},{"class":211,"line":889},[62244],{"type":21,"tag":209,"props":62245,"children":62246},{"style":448},[62247],{"type":26,"value":731},{"type":21,"tag":209,"props":62249,"children":62250},{"class":211,"line":902},[62251],{"type":21,"tag":209,"props":62252,"children":62253},{"style":448},[62254],{"type":26,"value":62255}," * Listen for the various events of interest on the file reader, and return notification or resolution\n",{"type":21,"tag":209,"props":62257,"children":62258},{"class":211,"line":914},[62259],{"type":21,"tag":209,"props":62260,"children":62261},{"style":448},[62262],{"type":26,"value":62263}," * to deferred as appropriate.\n",{"type":21,"tag":209,"props":62265,"children":62266},{"class":211,"line":922},[62267],{"type":21,"tag":209,"props":62268,"children":62269},{"style":448},[62270],{"type":26,"value":755},{"type":21,"tag":209,"props":62272,"children":62273},{"class":211,"line":2312},[62274,62279,62283,62287,62291,62295,62299,62303],{"type":21,"tag":209,"props":62275,"children":62276},{"style":263},[62277],{"type":26,"value":62278},"DeferReader",{"type":21,"tag":209,"props":62280,"children":62281},{"style":222},[62282],{"type":26,"value":378},{"type":21,"tag":209,"props":62284,"children":62285},{"style":263},[62286],{"type":26,"value":32662},{"type":21,"tag":209,"props":62288,"children":62289},{"style":222},[62290],{"type":26,"value":378},{"type":21,"tag":209,"props":62292,"children":62293},{"style":360},[62294],{"type":26,"value":4593},{"type":21,"tag":209,"props":62296,"children":62297},{"style":216},[62298],{"type":26,"value":271},{"type":21,"tag":209,"props":62300,"children":62301},{"style":216},[62302],{"type":26,"value":4789},{"type":21,"tag":209,"props":62304,"children":62305},{"style":222},[62306],{"type":26,"value":2561},{"type":21,"tag":209,"props":62308,"children":62309},{"class":211,"line":2321},[62310,62314,62318,62322,62326],{"type":21,"tag":209,"props":62311,"children":62312},{"style":216},[62313],{"type":26,"value":16994},{"type":21,"tag":209,"props":62315,"children":62316},{"style":222},[62317],{"type":26,"value":52897},{"type":21,"tag":209,"props":62319,"children":62320},{"style":216},[62321],{"type":26,"value":1432},{"type":21,"tag":209,"props":62323,"children":62324},{"style":263},[62325],{"type":26,"value":20502},{"type":21,"tag":209,"props":62327,"children":62328},{"style":222},[62329],{"type":26,"value":241},{"type":21,"tag":209,"props":62331,"children":62332},{"class":211,"line":2372},[62333],{"type":21,"tag":209,"props":62334,"children":62335},{"emptyLinePlaceholder":248},[62336],{"type":26,"value":251},{"type":21,"tag":209,"props":62338,"children":62339},{"class":211,"line":2381},[62340,62344,62349,62353,62357,62361,62365,62369,62373,62377],{"type":21,"tag":209,"props":62341,"children":62342},{"style":263},[62343],{"type":26,"value":46760},{"type":21,"tag":209,"props":62345,"children":62346},{"style":222},[62347],{"type":26,"value":62348},".reader.",{"type":21,"tag":209,"props":62350,"children":62351},{"style":360},[62352],{"type":26,"value":14995},{"type":21,"tag":209,"props":62354,"children":62355},{"style":222},[62356],{"type":26,"value":368},{"type":21,"tag":209,"props":62358,"children":62359},{"style":233},[62360],{"type":26,"value":20588},{"type":21,"tag":209,"props":62362,"children":62363},{"style":222},[62364],{"type":26,"value":408},{"type":21,"tag":209,"props":62366,"children":62367},{"style":216},[62368],{"type":26,"value":4622},{"type":21,"tag":209,"props":62370,"children":62371},{"style":222},[62372],{"type":26,"value":368},{"type":21,"tag":209,"props":62374,"children":62375},{"style":400},[62376],{"type":26,"value":25805},{"type":21,"tag":209,"props":62378,"children":62379},{"style":222},[62380],{"type":26,"value":2369},{"type":21,"tag":209,"props":62382,"children":62383},{"class":211,"line":2389},[62384,62388,62393,62397],{"type":21,"tag":209,"props":62385,"children":62386},{"style":216},[62387],{"type":26,"value":14505},{"type":21,"tag":209,"props":62389,"children":62390},{"style":222},[62391],{"type":26,"value":62392}," err ",{"type":21,"tag":209,"props":62394,"children":62395},{"style":216},[62396],{"type":26,"value":1432},{"type":21,"tag":209,"props":62398,"children":62399},{"style":222},[62400],{"type":26,"value":62401}," event.target.error,\n",{"type":21,"tag":209,"props":62403,"children":62404},{"class":211,"line":2397},[62405,62410,62414],{"type":21,"tag":209,"props":62406,"children":62407},{"style":222},[62408],{"type":26,"value":62409},"            errCode ",{"type":21,"tag":209,"props":62411,"children":62412},{"style":216},[62413],{"type":26,"value":1432},{"type":21,"tag":209,"props":62415,"children":62416},{"style":222},[62417],{"type":26,"value":62418}," event.target.error.code,\n",{"type":21,"tag":209,"props":62420,"children":62421},{"class":211,"line":2406},[62422,62427,62431,62436,62440,62444,62449,62453,62458],{"type":21,"tag":209,"props":62423,"children":62424},{"style":222},[62425],{"type":26,"value":62426},"            errMsg ",{"type":21,"tag":209,"props":62428,"children":62429},{"style":216},[62430],{"type":26,"value":1432},{"type":21,"tag":209,"props":62432,"children":62433},{"style":233},[62434],{"type":26,"value":62435}," 'Error attempting to read file \"'",{"type":21,"tag":209,"props":62437,"children":62438},{"style":216},[62439],{"type":26,"value":17170},{"type":21,"tag":209,"props":62441,"children":62442},{"style":263},[62443],{"type":26,"value":2508},{"type":21,"tag":209,"props":62445,"children":62446},{"style":222},[62447],{"type":26,"value":62448},".file.name",{"type":21,"tag":209,"props":62450,"children":62451},{"style":216},[62452],{"type":26,"value":17170},{"type":21,"tag":209,"props":62454,"children":62455},{"style":233},[62456],{"type":26,"value":62457},"'\": '",{"type":21,"tag":209,"props":62459,"children":62460},{"style":222},[62461],{"type":26,"value":241},{"type":21,"tag":209,"props":62463,"children":62464},{"class":211,"line":2415},[62465,62470],{"type":21,"tag":209,"props":62466,"children":62467},{"style":216},[62468],{"type":26,"value":62469},"        switch",{"type":21,"tag":209,"props":62471,"children":62472},{"style":222},[62473],{"type":26,"value":62474},"(errCode)\n",{"type":21,"tag":209,"props":62476,"children":62477},{"class":211,"line":2424},[62478],{"type":21,"tag":209,"props":62479,"children":62480},{"style":222},[62481],{"type":26,"value":17555},{"type":21,"tag":209,"props":62483,"children":62484},{"class":211,"line":2433},[62485,62490,62495,62500],{"type":21,"tag":209,"props":62486,"children":62487},{"style":216},[62488],{"type":26,"value":62489},"            case",{"type":21,"tag":209,"props":62491,"children":62492},{"style":222},[62493],{"type":26,"value":62494}," err.",{"type":21,"tag":209,"props":62496,"children":62497},{"style":263},[62498],{"type":26,"value":62499},"NOT_FOUND_ERR",{"type":21,"tag":209,"props":62501,"children":62502},{"style":222},[62503],{"type":26,"value":844},{"type":21,"tag":209,"props":62505,"children":62506},{"class":211,"line":2442},[62507,62512,62516,62521],{"type":21,"tag":209,"props":62508,"children":62509},{"style":222},[62510],{"type":26,"value":62511},"                errMsg ",{"type":21,"tag":209,"props":62513,"children":62514},{"style":216},[62515],{"type":26,"value":51693},{"type":21,"tag":209,"props":62517,"children":62518},{"style":233},[62519],{"type":26,"value":62520}," \"File could not be found.\"",{"type":21,"tag":209,"props":62522,"children":62523},{"style":222},[62524],{"type":26,"value":241},{"type":21,"tag":209,"props":62526,"children":62527},{"class":211,"line":2471},[62528,62533],{"type":21,"tag":209,"props":62529,"children":62530},{"style":216},[62531],{"type":26,"value":62532},"                break",{"type":21,"tag":209,"props":62534,"children":62535},{"style":222},[62536],{"type":26,"value":241},{"type":21,"tag":209,"props":62538,"children":62539},{"class":211,"line":2480},[62540,62544,62548,62553],{"type":21,"tag":209,"props":62541,"children":62542},{"style":216},[62543],{"type":26,"value":62489},{"type":21,"tag":209,"props":62545,"children":62546},{"style":222},[62547],{"type":26,"value":62494},{"type":21,"tag":209,"props":62549,"children":62550},{"style":263},[62551],{"type":26,"value":62552},"NOT_READABLE_ERR",{"type":21,"tag":209,"props":62554,"children":62555},{"style":222},[62556],{"type":26,"value":844},{"type":21,"tag":209,"props":62558,"children":62559},{"class":211,"line":2489},[62560,62564,62568,62573],{"type":21,"tag":209,"props":62561,"children":62562},{"style":222},[62563],{"type":26,"value":62511},{"type":21,"tag":209,"props":62565,"children":62566},{"style":216},[62567],{"type":26,"value":51693},{"type":21,"tag":209,"props":62569,"children":62570},{"style":233},[62571],{"type":26,"value":62572}," \"File is not readable.\"",{"type":21,"tag":209,"props":62574,"children":62575},{"style":222},[62576],{"type":26,"value":241},{"type":21,"tag":209,"props":62578,"children":62579},{"class":211,"line":2516},[62580,62584],{"type":21,"tag":209,"props":62581,"children":62582},{"style":216},[62583],{"type":26,"value":62532},{"type":21,"tag":209,"props":62585,"children":62586},{"style":222},[62587],{"type":26,"value":241},{"type":21,"tag":209,"props":62589,"children":62590},{"class":211,"line":2525},[62591,62595,62599,62604],{"type":21,"tag":209,"props":62592,"children":62593},{"style":216},[62594],{"type":26,"value":62489},{"type":21,"tag":209,"props":62596,"children":62597},{"style":222},[62598],{"type":26,"value":62494},{"type":21,"tag":209,"props":62600,"children":62601},{"style":263},[62602],{"type":26,"value":62603},"ABORT_ERR",{"type":21,"tag":209,"props":62605,"children":62606},{"style":222},[62607],{"type":26,"value":844},{"type":21,"tag":209,"props":62609,"children":62610},{"class":211,"line":2533},[62611,62615,62619,62624],{"type":21,"tag":209,"props":62612,"children":62613},{"style":222},[62614],{"type":26,"value":62511},{"type":21,"tag":209,"props":62616,"children":62617},{"style":216},[62618],{"type":26,"value":51693},{"type":21,"tag":209,"props":62620,"children":62621},{"style":233},[62622],{"type":26,"value":62623}," \"File read was aborted.\"",{"type":21,"tag":209,"props":62625,"children":62626},{"style":222},[62627],{"type":26,"value":241},{"type":21,"tag":209,"props":62629,"children":62630},{"class":211,"line":2542},[62631,62635],{"type":21,"tag":209,"props":62632,"children":62633},{"style":216},[62634],{"type":26,"value":62532},{"type":21,"tag":209,"props":62636,"children":62637},{"style":222},[62638],{"type":26,"value":241},{"type":21,"tag":209,"props":62640,"children":62641},{"class":211,"line":2550},[62642,62647],{"type":21,"tag":209,"props":62643,"children":62644},{"style":216},[62645],{"type":26,"value":62646},"            default",{"type":21,"tag":209,"props":62648,"children":62649},{"style":222},[62650],{"type":26,"value":844},{"type":21,"tag":209,"props":62652,"children":62653},{"class":211,"line":2564},[62654,62658,62662,62667],{"type":21,"tag":209,"props":62655,"children":62656},{"style":222},[62657],{"type":26,"value":62511},{"type":21,"tag":209,"props":62659,"children":62660},{"style":216},[62661],{"type":26,"value":51693},{"type":21,"tag":209,"props":62663,"children":62664},{"style":233},[62665],{"type":26,"value":62666}," \"An unexpected error occurred.\"",{"type":21,"tag":209,"props":62668,"children":62669},{"style":222},[62670],{"type":26,"value":241},{"type":21,"tag":209,"props":62672,"children":62673},{"class":211,"line":2611},[62674,62678],{"type":21,"tag":209,"props":62675,"children":62676},{"style":216},[62677],{"type":26,"value":62532},{"type":21,"tag":209,"props":62679,"children":62680},{"style":222},[62681],{"type":26,"value":241},{"type":21,"tag":209,"props":62683,"children":62684},{"class":211,"line":2619},[62685],{"type":21,"tag":209,"props":62686,"children":62687},{"style":222},[62688],{"type":26,"value":2235},{"type":21,"tag":209,"props":62690,"children":62691},{"class":211,"line":2627},[62692,62697,62701,62705,62710],{"type":21,"tag":209,"props":62693,"children":62694},{"style":222},[62695],{"type":26,"value":62696},"        that.defer.",{"type":21,"tag":209,"props":62698,"children":62699},{"style":360},[62700],{"type":26,"value":14182},{"type":21,"tag":209,"props":62702,"children":62703},{"style":222},[62704],{"type":26,"value":55625},{"type":21,"tag":209,"props":62706,"children":62707},{"style":263},[62708],{"type":26,"value":62709},"FILE_READ_ERROR",{"type":21,"tag":209,"props":62711,"children":62712},{"style":222},[62713],{"type":26,"value":62714},", error:errMsg});\n",{"type":21,"tag":209,"props":62716,"children":62717},{"class":211,"line":2636},[62718,62723,62727],{"type":21,"tag":209,"props":62719,"children":62720},{"style":222},[62721],{"type":26,"value":62722},"    }, ",{"type":21,"tag":209,"props":62724,"children":62725},{"style":263},[62726],{"type":26,"value":4243},{"type":21,"tag":209,"props":62728,"children":62729},{"style":222},[62730],{"type":26,"value":2608},{"type":21,"tag":209,"props":62732,"children":62733},{"class":211,"line":2644},[62734],{"type":21,"tag":209,"props":62735,"children":62736},{"emptyLinePlaceholder":248},[62737],{"type":26,"value":251},{"type":21,"tag":209,"props":62739,"children":62740},{"class":211,"line":2657},[62741,62745,62749,62753,62757,62761,62765,62769,62773,62777],{"type":21,"tag":209,"props":62742,"children":62743},{"style":263},[62744],{"type":26,"value":46760},{"type":21,"tag":209,"props":62746,"children":62747},{"style":222},[62748],{"type":26,"value":62348},{"type":21,"tag":209,"props":62750,"children":62751},{"style":360},[62752],{"type":26,"value":14995},{"type":21,"tag":209,"props":62754,"children":62755},{"style":222},[62756],{"type":26,"value":368},{"type":21,"tag":209,"props":62758,"children":62759},{"style":233},[62760],{"type":26,"value":61185},{"type":21,"tag":209,"props":62762,"children":62763},{"style":222},[62764],{"type":26,"value":408},{"type":21,"tag":209,"props":62766,"children":62767},{"style":216},[62768],{"type":26,"value":4622},{"type":21,"tag":209,"props":62770,"children":62771},{"style":222},[62772],{"type":26,"value":368},{"type":21,"tag":209,"props":62774,"children":62775},{"style":400},[62776],{"type":26,"value":25805},{"type":21,"tag":209,"props":62778,"children":62779},{"style":222},[62780],{"type":26,"value":2369},{"type":21,"tag":209,"props":62782,"children":62783},{"class":211,"line":2728},[62784,62788],{"type":21,"tag":209,"props":62785,"children":62786},{"style":216},[62787],{"type":26,"value":6334},{"type":21,"tag":209,"props":62789,"children":62790},{"style":222},[62791],{"type":26,"value":55313},{"type":21,"tag":209,"props":62793,"children":62794},{"class":211,"line":2758},[62795],{"type":21,"tag":209,"props":62796,"children":62797},{"style":222},[62798],{"type":26,"value":17555},{"type":21,"tag":209,"props":62800,"children":62801},{"class":211,"line":2776},[62802,62807,62811,62815,62820],{"type":21,"tag":209,"props":62803,"children":62804},{"style":222},[62805],{"type":26,"value":62806},"            that.defer.",{"type":21,"tag":209,"props":62808,"children":62809},{"style":360},[62810],{"type":26,"value":55620},{"type":21,"tag":209,"props":62812,"children":62813},{"style":222},[62814],{"type":26,"value":55625},{"type":21,"tag":209,"props":62816,"children":62817},{"style":263},[62818],{"type":26,"value":62819},"FILE_READ_PROGRESS",{"type":21,"tag":209,"props":62821,"children":62822},{"style":222},[62823],{"type":26,"value":62824},", file_name:that.file.name,\n",{"type":21,"tag":209,"props":62826,"children":62827},{"class":211,"line":2785},[62828,62833,62837],{"type":21,"tag":209,"props":62829,"children":62830},{"style":222},[62831],{"type":26,"value":62832},"                progress:(event.loaded",{"type":21,"tag":209,"props":62834,"children":62835},{"style":216},[62836],{"type":26,"value":6460},{"type":21,"tag":209,"props":62838,"children":62839},{"style":222},[62840],{"type":26,"value":62841},"event.total)});\n",{"type":21,"tag":209,"props":62843,"children":62844},{"class":211,"line":2793},[62845],{"type":21,"tag":209,"props":62846,"children":62847},{"style":222},[62848],{"type":26,"value":2235},{"type":21,"tag":209,"props":62850,"children":62851},{"class":211,"line":2801},[62852],{"type":21,"tag":209,"props":62853,"children":62854},{"style":222},[62855],{"type":26,"value":3391},{"type":21,"tag":209,"props":62857,"children":62858},{"class":211,"line":2809},[62859],{"type":21,"tag":209,"props":62860,"children":62861},{"emptyLinePlaceholder":248},[62862],{"type":26,"value":251},{"type":21,"tag":209,"props":62864,"children":62865},{"class":211,"line":10937},[62866,62870,62874,62878,62882,62887,62891,62895,62899,62903],{"type":21,"tag":209,"props":62867,"children":62868},{"style":263},[62869],{"type":26,"value":46760},{"type":21,"tag":209,"props":62871,"children":62872},{"style":222},[62873],{"type":26,"value":62348},{"type":21,"tag":209,"props":62875,"children":62876},{"style":360},[62877],{"type":26,"value":14995},{"type":21,"tag":209,"props":62879,"children":62880},{"style":222},[62881],{"type":26,"value":368},{"type":21,"tag":209,"props":62883,"children":62884},{"style":233},[62885],{"type":26,"value":62886},"'loadend'",{"type":21,"tag":209,"props":62888,"children":62889},{"style":222},[62890],{"type":26,"value":408},{"type":21,"tag":209,"props":62892,"children":62893},{"style":216},[62894],{"type":26,"value":4622},{"type":21,"tag":209,"props":62896,"children":62897},{"style":222},[62898],{"type":26,"value":368},{"type":21,"tag":209,"props":62900,"children":62901},{"style":400},[62902],{"type":26,"value":25805},{"type":21,"tag":209,"props":62904,"children":62905},{"style":222},[62906],{"type":26,"value":2369},{"type":21,"tag":209,"props":62908,"children":62909},{"class":211,"line":10967},[62910,62914,62919,62923,62928,62933],{"type":21,"tag":209,"props":62911,"children":62912},{"style":216},[62913],{"type":26,"value":6334},{"type":21,"tag":209,"props":62915,"children":62916},{"style":222},[62917],{"type":26,"value":62918}," (event.target.readyState ",{"type":21,"tag":209,"props":62920,"children":62921},{"style":216},[62922],{"type":26,"value":23855},{"type":21,"tag":209,"props":62924,"children":62925},{"style":222},[62926],{"type":26,"value":62927}," FileReader.",{"type":21,"tag":209,"props":62929,"children":62930},{"style":263},[62931],{"type":26,"value":62932},"DONE",{"type":21,"tag":209,"props":62934,"children":62935},{"style":222},[62936],{"type":26,"value":8924},{"type":21,"tag":209,"props":62938,"children":62939},{"class":211,"line":11003},[62940],{"type":21,"tag":209,"props":62941,"children":62942},{"style":222},[62943],{"type":26,"value":17555},{"type":21,"tag":209,"props":62945,"children":62946},{"class":211,"line":11038},[62947,62951,62955,62959,62964],{"type":21,"tag":209,"props":62948,"children":62949},{"style":222},[62950],{"type":26,"value":62806},{"type":21,"tag":209,"props":62952,"children":62953},{"style":360},[62954],{"type":26,"value":14173},{"type":21,"tag":209,"props":62956,"children":62957},{"style":222},[62958],{"type":26,"value":55625},{"type":21,"tag":209,"props":62960,"children":62961},{"style":263},[62962],{"type":26,"value":62963},"FILE_READ_FINISHED",{"type":21,"tag":209,"props":62965,"children":62966},{"style":222},[62967],{"type":26,"value":304},{"type":21,"tag":209,"props":62969,"children":62970},{"class":211,"line":11072},[62971],{"type":21,"tag":209,"props":62972,"children":62973},{"style":222},[62974],{"type":26,"value":62975},"                file_name:that.file.name, file_size:that.file.size, file_type:that.file.type,\n",{"type":21,"tag":209,"props":62977,"children":62978},{"class":211,"line":11106},[62979],{"type":21,"tag":209,"props":62980,"children":62981},{"style":222},[62982],{"type":26,"value":62983},"                read_method:that.read_method, read_result:event.target.result});\n",{"type":21,"tag":209,"props":62985,"children":62986},{"class":211,"line":11114},[62987],{"type":21,"tag":209,"props":62988,"children":62989},{"style":222},[62990],{"type":26,"value":2235},{"type":21,"tag":209,"props":62992,"children":62993},{"class":211,"line":14940},[62994,62998,63002],{"type":21,"tag":209,"props":62995,"children":62996},{"style":222},[62997],{"type":26,"value":62722},{"type":21,"tag":209,"props":62999,"children":63000},{"style":263},[63001],{"type":26,"value":4243},{"type":21,"tag":209,"props":63003,"children":63004},{"style":222},[63005],{"type":26,"value":2608},{"type":21,"tag":209,"props":63007,"children":63008},{"class":211,"line":14949},[63009],{"type":21,"tag":209,"props":63010,"children":63011},{"style":222},[63012],{"type":26,"value":340},{"type":21,"tag":22,"props":63014,"children":63015},{},[63016],{"type":26,"value":63017},"Pretty simple (you'll notice I'm using the promises here to wrap around the callbacks that FileReader offer us - we're doing the same with the xhr upload). We set up our reader with a file read method (which will determine what kind of result we're given.",{"type":21,"tag":22,"props":63019,"children":63020},{},[63021,63023,63030],{"type":26,"value":63022},"We can readAsText (text files, obviously), readAsDataURL (images are a good candidate for being read this way - we'll be returned a data url with the contents encoded as base64), readAsBinaryString (which will return us a string with the binary contents encoded - we can get the bytes values by getting the char codes of each character in the string) or readAsArrayBuffer (see ",{"type":21,"tag":29,"props":63024,"children":63027},{"href":63025,"rel":63026},"http://www.khronos.org/registry/typedarray/specs/latest/",[93],[63028],{"type":26,"value":63029},"Array Buffer spec",{"type":26,"value":2699},{"type":21,"tag":22,"props":63032,"children":63033},{},[63034],{"type":26,"value":63035},"The reader will call back to use on progress (useful for a progress bar, for instance) on the file read, and when finished loading, with the result of our read (which will be encoded as we've specified with our read method).",{"type":21,"tag":3596,"props":63037,"children":63038},{"id":17724},[63039],{"type":26,"value":17727},{"type":21,"tag":22,"props":63041,"children":63042},{},[63043],{"type":26,"value":63044},"So, been teasing about that plugin, and pulling it apart should be a good way to get started on learning how this all works; and if you want to forego that, just use the plugin! Keep in mind, the plugin doesn't offer any UI interaction - it just covers reading a file or uploading it, and returns the results of these operations to the element(s) the plugin is called on - you'll need/want to build your UI on top of that.",{"type":21,"tag":22,"props":63046,"children":63047},{},[63048,63050,63056],{"type":26,"value":63049},"Usage, the plugin, a test page and an example php script to receive and assemble chunked uploads can be found at ",{"type":21,"tag":29,"props":63051,"children":63053},{"href":31113,"rel":63052},[93],[63054],{"type":26,"value":63055},"the github repo",{"type":26,"value":378},{"type":21,"tag":63058,"props":63059,"children":63061},"h1",{"id":63060},"note-the-code-below-is-out-of-date-see-the-github-repo-for-the-up-to-date-code",[63062,63064,63070],{"type":26,"value":63063},"NOTE: The code below is OUT OF DATE - see the ",{"type":21,"tag":29,"props":63065,"children":63067},{"href":31113,"rel":63066},[93],[63068],{"type":26,"value":63069},"GITHUB REPO",{"type":26,"value":63071}," for the up-to-date code.",{"type":21,"tag":22,"props":63073,"children":63074},{},[63075],{"type":26,"value":63076},"Meanwhile, here's just the plugin:",{"type":21,"tag":200,"props":63078,"children":63080},{"className":16138,"code":63079,"language":16140,"meta":8,"style":8},"/**\n * Copyright (c) 2013 Christopher Keefer. All Rights Reserved.\n *\n * jQuery plugin for reading in files or uploading them with the HTML5 file api and xhr2.\n */\n(function($){\n    /**\n     * Construct html5 reader/uploader.\n     * @param {Object} options\n     * @constructor\n     */\n    function Hup(options){\n        this.init(options);\n    }\n\n/**\n * Set options, listen for events on input element that indicate we should read/upload selected file(s).\n * @param options\n */\nHup.prototype.init = function(options)\n{\n    this.options = $.extend({\n        async:true, // Whether to send this file asynchronously\n        chunked:true, // Whether to send the file in chunks\n        chunk_size:1048576, // Size of each chunk (default 1024*1024)\n        input:'', // Input element\n        make_dnd:false, // Whether to make the input element handle drag and drop - auto-true if not file input\n        read_method:'readAsDataURL', // the read method to use for reading in the file - one of\n        // readAsText, readAsBinaryString, readAsDataURL or readAsArrayBuffer\n        type:'PUT', // Type of request to use for uploading\n        url:false // Url endpoint to send file to - if not specified or false, we read the file and return it\n    }, options);\n\n    this.input = $(this.options.input);\n\n    var that = this;\n    if (this.options.make_dnd || !this.isFileInput(this.input))\n    {\n        this.options.make_dnd = true;\n        this.input.off('dragover').on('dragover', function(event){\n            event = event.originalEvent;\n            that.handleDragover(event);\n        });\n    }\n    this.input.off('drop change').on('drop change', function(event){\n        event = event.originalEvent;\n        that.handleSelect(event);\n    });\n}\n\n/**\n * Return whether the passed element is an input of type file.\n * @param input Element to check.\n * @returns {boolean}\n */\nHup.prototype.isFileInput = function(input){\n    return (input[0].tagName === 'INPUT' &amp;amp;&amp;amp; input[0].getAttribute('type').indexOf('file') !== -1);\n};\n\n/**\n * Handle the dragging of file(s) to a target, preventing the rejection of the dragover.\n * @param event\n */\nHup.prototype.handleDragover = function(event){\n    event.preventDefault();\n    event.stopPropagation();\n    event.dataTransfer.dropEffect = 'copy';\n};\n\n/**\n * Handle the selection of files to upload via an input or drag and drop to a target.\n * @param event\n */\nHup.prototype.handleSelect = function(event){\n    var files;\n\n    if (this.options.make_dnd)\n    {\n        event.preventDefault();\n        event.stopPropagation();\n        files = event.dataTransfer.files;\n    }\n    else\n    {\n        files = event.target.files;\n    }\n    if (!files.length)\n    {\n        this.input.trigger(Hup.state.FILE_LIST_ERROR, {state:Hup.state.FILE_LIST_ERROR,\n            error:'No files found in file list; no files were selected.'});\n        return;\n    }\n    this.input.trigger(Hup.state.FILE_LIST_LOADED, {state:Hup.state.FILE_LIST_LOADED, files:files});\n\n    this.processFiles(files, this.options.url);\n};\n\n/**\n * Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n * memory and passing them on to be used in the browser.\n * @param files\n * @param upload\n */\nHup.prototype.processFiles = function(files, upload){\n    var that = this,\n        processed = 0;\n\n    for (var i=0, len = files.length; i &amp;lt; len; i++)\n    {\n        var fprocess = (upload) ? new DeferXhr(this.options, files[i]) :\n            new DeferReader(this.options.read_method, files[i]);\n\n        fprocess.progress(function(progress){\n            that.input.trigger(progress.state, progress);\n        }).done(function(res){\n            that.input.trigger(res.state, res);\n            processed++;\n            if (processed == len)\n                that.input.trigger((upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL ,\n                    {state:(upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL, files:len});\n        }).fail(function(res)\n        {\n            that.input.trigger(res.state, res);\n        });\n    }\n};\n\n/**\n * Custom events we'll trigger on our input element at the appropriate times.\n * @type {{FILE_LIST_ERROR: string, FILE_LIST_LOADED: string, FILE_READ_ERROR: string,\n * FILE_READ_PROGRESS: string, FILE_READ_FINISHED: string, FILE_READ_ALL: string,\n * FILE_UPLOAD_ERROR: string, FILE_UPLOAD_PROGRESS: string, FILE_UPLOAD_PAUSE: string,\n * FILE_UPLOAD_RESUME: string, FILE_UPLOAD_FINISHED: string, FILE_UPLOAD_ALL: string}}\n */\nHup.state = {\n    FILE_LIST_ERROR:'fileListError',\n    FILE_LIST_LOADED:'fileListLoaded',\n    FILE_READ_ERROR:'fileReadError',\n    FILE_READ_PROGRESS:'fileReadProgress',\n    FILE_READ_FINISHED:'fileReadFinished',\n    FILE_READ_ALL:'fileReadAll',\n    FILE_UPLOAD_ERROR:'fileUploadError',\n    FILE_UPLOAD_PROGRESS:'fileUploadProgress',\n    FILE_UPLOAD_PAUSE:'fileUploadPause',\n    FILE_UPLOAD_RESUME:'fileUploadResume',\n    FILE_UPLOAD_FINISHED:'fileUploadFinished',\n    FILE_UPLOAD_ALL:'fileUploadAll'\n};\n\n/**\n * Deferred wrapper for xhr upload.\n * @param options\n * @param file\n * @returns {Object} promise The deferred promise object.\n * @constructor\n */\nfunction DeferXhr(options, file){\n    var that = this;\n\n    this.defer = $.Deferred();\n    this.file = file;\n    this.options = options;\n    this.paused = false;\n    this.progress = 0;\n    this.time = {start:0, end:0, speed:0}; // Speed is measured in bytes per second\n    this.xhr = new XMLHttpRequest();\n\n    if (this.options.chunked)\n    {\n        this.start = 0;\n        this.end = Math.min(this.start+this.options.chunk_size, this.file.size);\n    }\n\n    this.xhr.addEventListener('load', function(){that.complete();}, false);\n    this.xhr.upload.addEventListener('progress', function(event){that.uploadProgress(event);}, false);\n    this.xhr.upload.addEventListener('error', function(event){that.uploadError(event);}, false);\n\n    this.upload();\n\n    return this.defer.promise();\n}\n\n/**\n * Carry out the xhr upload, optionally chunked.\n */\nDeferXhr.prototype.upload = function(){\n    this.time.start = +new Date();\n\n    this.xhr.open(this.options.type, this.options.url, this.options.async);\n    this.xhr.setRequestHeader('Accept', 'application/json');\n    this.xhr.setRequestHeader('X-File-Name', this.file.name);\n    this.xhr.setRequestHeader('X-File-Type', this.file.type);\n\n    if (this.options.chunked)\n    {\n        this.xhr.overrideMimeType('application/octet-stream');\n        this.xhr.setRequestHeader('Content-Range', 'bytes '+this.start+\"-\"+this.end+\"/\"+this.file.size);\n        this.xhr.send(this.file.slice(this.start, this.end));\n    }\n    else\n    {\n        this.xhr.overrideMimeType((this.file.type || 'application/octet-stream'));\n        this.xhr.send(this.file);\n    }\n}\n\n/**\n * Report on the upload progress, as a number between 0 and 1, modifying the progress if we're uploading a\n * file in chunks to report on the progress as a percentage of file upload and total chunks uploaded.\n * @param event\n */\nDeferXhr.prototype.uploadProgress = function(event){\n    if (event.lengthComputable)\n    {\n        this.progress = (event.loaded/event.total);\n        if (this.options.chunked)\n        {\n            this.progress *= (this.end/this.file.size);\n        }\n        this.time.end = +new Date();\n        this.time.speed = (this.file.size*this.progress)/(this.time.end-this.time.start)*1000;\n        console.log('time:', this.time.end-this.time.start, 'speed:', this.time.speed);\n        this.defer.notify({state:Hup.state.FILE_UPLOAD_PROGRESS, file_name:this.file.name, speed:this.time.speed,\n            progress:this.progress});\n    }\n};\n\nDeferXhr.prototype.uploadError = function(event){\n    this.defer.reject({state:Hup.state.FILE_UPLOAD_ERROR, error:event});\n}\n\n/**\n * Called when we've completed an upload (full file or chunk). If full file, or we've reached the last chunk,\n * the upload is complete. Otherwise, we calculate the next chunk offsets and, if the upload isn't paused,\n * upload it.\n */\nDeferXhr.prototype.complete = function(){\n    this.time.end = +new Date();\n    if (!this.options.chunked || this.end == this.file.size)\n    {\n        this.uploadComplete();\n        return;\n    }\n\n    this.defer.notify({state:Hup.state.FILE_UPLOAD_PROGRESS, file_name:this.file.name,\n        response:this.parseResponse(this.xhr.responseText), progress:this.progress});\n\n    this.start = this.end;\n    this.end = Math.min(this.start+this.options.chunk_size, this.file.size);\n\n    if (!this.paused)\n    {\n        this.upload();\n    }\n};\n\n/**\n * Called when the full file has been uploaded.\n */\nDeferXhr.prototype.uploadComplete = function(){\n    this.defer.resolve({state:Hup.state.FILE_UPLOAD_FINISHED, file_name:this.file.name,\n        file_size:this.file.size, file_type:this.file.type,\n        response:this.parseResponse(this.xhr.responseText)});\n};\n\n/**\n * Try to parse the response as a JSON, and on failure return the error and the plaintext.\n * @param response\n * @returns {Object}\n */\nDeferXhr.prototype.parseResponse = function(response)\n{\n    var response;\n    try{\n        response = JSON.parse(this.xhr.responseText);\n    }catch(e){\n        response = {error:e, text:this.xhr.responseText};\n    }\n    return response;\n}\n\n/**\n * Pause the upload (works for chunked uploads only).\n */\nDeferXhr.prototype.pause = function(){\n    this.paused = true;\n    this.defer.notify({state:Hup.state.FILE_UPLOAD_PAUSE, current_range:{start:this.start, end:this.end,\n        total:this.file.size}});\n}\n\n/**\n * Resume the upload (works for chunked uploads only).\n */\nDeferXhr.prototype.resume = function(){\n    if (this.paused)\n    {\n        this.paused = false;\n        this.defer.notify({state:Hup.state.FILE_UPLOAD_RESUME, current_range:{start:this.start, end:this.end,\n            total:this.file.size}});\n        this.upload();\n    }\n}\n\n/**\n * Deferred wrapper for file reader.\n * @param read_method\n * @param file\n * @returns {Object} promise The Deferred promise object\n * @constructor\n */\nfunction DeferReader(read_method, file){\n    this.defer = $.Deferred();\n    this.reader = new FileReader();\n    this.file = file;\n    this.read_method = read_method;\n\n    this.listen();\n    this.reader[read_method](file);\n\n    return this.defer.promise();\n}\n\n/**\n * Listen for the various events of interest on the file reader, and return notification or resolution\n * to deferred as appropriate.\n */\nDeferReader.prototype.listen = function(){\n    var that = this;\n\n    this.reader.addEventListener('error', function(event){\n        var err = event.target.error,\n            errCode = event.target.error.code,\n            errMsg = 'Error attempting to read file \"'+this.file.name+'\": ';\n        switch(errCode)\n        {\n            case err.NOT_FOUND_ERR:\n                errMsg += \"File could not be found.\";\n                break;\n            case err.NOT_READABLE_ERR:\n                errMsg += \"File is not readable.\";\n                break;\n            case err.ABORT_ERR:\n                errMsg += \"File read was aborted.\";\n                break;\n            default:\n                errMsg += \"An unexpected error occurred.\";\n                break;\n        }\n        that.defer.reject({state:Hup.state.FILE_READ_ERROR, error:errMsg});\n    }, false);\n\n    this.reader.addEventListener('progress', function(event){\n        if (event.lengthComputable)\n        {\n            that.defer.notify({state:Hup.state.FILE_READ_PROGRESS, file_name:that.file.name,\n                progress:(event.loaded/event.total)});\n        }\n    });\n\n    this.reader.addEventListener('loadend', function(event){\n        if (event.target.readyState == FileReader.DONE)\n        {\n            that.defer.resolve({state:Hup.state.FILE_READ_FINISHED,\n                file_name:that.file.name, file_size:that.file.size, file_type:that.file.type,\n                read_method:that.read_method, read_result:event.target.result});\n        }\n    }, false);\n};\n\n/**\n * Entry point for calling the reader/uploader, with the element to be used as input specified.\n * Usage:\n * $('#input').hup({options}).on('events') --OR--\n * $('.inputs').hup({options}).on('events')\n * @param options\n * @returns {Hup} Promise deferred from Hup.\n */\n$.fn.hup = function(options){\n    var options = (options || {});\n    return this.each(function(){\n        options.input = this;\n        var $this = $(this),\n            hup = $this.data('hup');\n        if (!hup)\n        {\n            $this.data('hup', new Hup(options));\n        }\n        else if (hup instanceof Hup)\n        {\n            hup.init(options);\n        }\n    });\n};\n})(jQuery);\n",[63081],{"type":21,"tag":63,"props":63082,"children":63083},{"__ignoreMap":8},[63084,63091,63099,63106,63114,63121,63144,63151,63159,63178,63189,63196,63220,63240,63247,63254,63261,63269,63284,63291,63334,63341,63368,63389,63410,63432,63453,63474,63496,63504,63526,63543,63551,63558,63591,63598,63621,63675,63682,63705,63764,63780,63797,63804,63811,63870,63886,63903,63910,63917,63924,63931,63939,63960,63976,63983,64026,64133,64140,64147,64154,64162,64177,64184,64227,64242,64257,64278,64285,64292,64299,64307,64322,64329,64372,64383,64390,64410,64417,64433,64448,64464,64471,64478,64485,64500,64507,64535,64542,64579,64596,64607,64614,64651,64658,64687,64694,64701,64708,64716,64724,64739,64754,64761,64812,64835,64854,64861,64925,64932,64980,65004,65011,65043,65058,65089,65104,65120,65140,65184,65220,65251,65258,65273,65280,65287,65294,65301,65308,65316,65332,65340,65348,65356,65363,65379,65396,65413,65430,65447,65464,65481,65498,65515,65532,65549,65566,65579,65586,65593,65600,65608,65623,65638,65657,65668,65675,65706,65729,65736,65763,65782,65801,65824,65847,65900,65927,65934,65953,65960,65983,66038,66045,66052,66103,66162,66221,66228,66247,66254,66277,66284,66291,66298,66305,66312,66347,66375,66382,66425,66460,66496,66532,66540,66560,66568,66596,66681,66733,66741,66749,66757,66797,66825,66833,66841,66849,66857,66866,66875,66891,66899,66943,66955,66963,66991,67011,67019,67059,67067,67095,67175,67235,67279,67296,67304,67312,67320,67364,67394,67402,67410,67418,67427,67436,67445,67453,67489,67517,67567,67575,67596,67608,67616,67624,67661,67704,67712,67737,67793,67801,67826,67834,67854,67862,67870,67878,67886,67895,67903,67939,67976,68003,68036,68044,68052,68060,68069,68085,68102,68110,68154,68162,68174,68186,68224,68241,68267,68275,68287,68295,68303,68311,68320,68328,68365,68389,68437,68455,68463,68471,68479,68488,68496,68532,68552,68560,68584,68629,68646,68666,68674,68682,68690,68698,68707,68723,68739,68759,68771,68779,68811,68839,68867,68887,68907,68915,68935,68947,68955,68979,68987,68995,69003,69011,69019,69027,69063,69087,69095,69139,69159,69175,69215,69227,69235,69255,69275,69287,69307,69327,69339,69359,69379,69391,69403,69423,69435,69443,69467,69483,69491,69535,69547,69555,69579,69595,69603,69611,69619,69663,69691,69699,69723,69731,69739,69747,69763,69771,69779,69787,69796,69805,69814,69823,69839,69861,69869,69903,69934,69966,69987,70019,70053,70074,70082,70120,70128,70158,70166,70183,70191,70199,70207],{"type":21,"tag":209,"props":63085,"children":63086},{"class":211,"line":212},[63087],{"type":21,"tag":209,"props":63088,"children":63089},{"style":448},[63090],{"type":26,"value":731},{"type":21,"tag":209,"props":63092,"children":63093},{"class":211,"line":244},[63094],{"type":21,"tag":209,"props":63095,"children":63096},{"style":448},[63097],{"type":26,"value":63098}," * Copyright (c) 2013 Christopher Keefer. All Rights Reserved.\n",{"type":21,"tag":209,"props":63100,"children":63101},{"class":211,"line":254},[63102],{"type":21,"tag":209,"props":63103,"children":63104},{"style":448},[63105],{"type":26,"value":17778},{"type":21,"tag":209,"props":63107,"children":63108},{"class":211,"line":279},[63109],{"type":21,"tag":209,"props":63110,"children":63111},{"style":448},[63112],{"type":26,"value":63113}," * jQuery plugin for reading in files or uploading them with the HTML5 file api and xhr2.\n",{"type":21,"tag":209,"props":63115,"children":63116},{"class":211,"line":288},[63117],{"type":21,"tag":209,"props":63118,"children":63119},{"style":448},[63120],{"type":26,"value":755},{"type":21,"tag":209,"props":63122,"children":63123},{"class":211,"line":307},[63124,63128,63132,63136,63140],{"type":21,"tag":209,"props":63125,"children":63126},{"style":222},[63127],{"type":26,"value":368},{"type":21,"tag":209,"props":63129,"children":63130},{"style":216},[63131],{"type":26,"value":4622},{"type":21,"tag":209,"props":63133,"children":63134},{"style":222},[63135],{"type":26,"value":368},{"type":21,"tag":209,"props":63137,"children":63138},{"style":400},[63139],{"type":26,"value":6476},{"type":21,"tag":209,"props":63141,"children":63142},{"style":222},[63143],{"type":26,"value":2369},{"type":21,"tag":209,"props":63145,"children":63146},{"class":211,"line":325},[63147],{"type":21,"tag":209,"props":63148,"children":63149},{"style":448},[63150],{"type":26,"value":13290},{"type":21,"tag":209,"props":63152,"children":63153},{"class":211,"line":334},[63154],{"type":21,"tag":209,"props":63155,"children":63156},{"style":448},[63157],{"type":26,"value":63158},"     * Construct html5 reader/uploader.\n",{"type":21,"tag":209,"props":63160,"children":63161},{"class":211,"line":343},[63162,63166,63170,63174],{"type":21,"tag":209,"props":63163,"children":63164},{"style":448},[63165],{"type":26,"value":13306},{"type":21,"tag":209,"props":63167,"children":63168},{"style":216},[63169],{"type":26,"value":13311},{"type":21,"tag":209,"props":63171,"children":63172},{"style":360},[63173],{"type":26,"value":60744},{"type":21,"tag":209,"props":63175,"children":63176},{"style":222},[63177],{"type":26,"value":60712},{"type":21,"tag":209,"props":63179,"children":63180},{"class":211,"line":351},[63181,63185],{"type":21,"tag":209,"props":63182,"children":63183},{"style":448},[63184],{"type":26,"value":13306},{"type":21,"tag":209,"props":63186,"children":63187},{"style":216},[63188],{"type":26,"value":41933},{"type":21,"tag":209,"props":63190,"children":63191},{"class":211,"line":444},[63192],{"type":21,"tag":209,"props":63193,"children":63194},{"style":448},[63195],{"type":26,"value":13346},{"type":21,"tag":209,"props":63197,"children":63198},{"class":211,"line":454},[63199,63203,63208,63212,63216],{"type":21,"tag":209,"props":63200,"children":63201},{"style":216},[63202],{"type":26,"value":2981},{"type":21,"tag":209,"props":63204,"children":63205},{"style":360},[63206],{"type":26,"value":63207}," Hup",{"type":21,"tag":209,"props":63209,"children":63210},{"style":222},[63211],{"type":26,"value":368},{"type":21,"tag":209,"props":63213,"children":63214},{"style":400},[63215],{"type":26,"value":28349},{"type":21,"tag":209,"props":63217,"children":63218},{"style":222},[63219],{"type":26,"value":2369},{"type":21,"tag":209,"props":63221,"children":63222},{"class":211,"line":463},[63223,63227,63231,63235],{"type":21,"tag":209,"props":63224,"children":63225},{"style":263},[63226],{"type":26,"value":47121},{"type":21,"tag":209,"props":63228,"children":63229},{"style":222},[63230],{"type":26,"value":378},{"type":21,"tag":209,"props":63232,"children":63233},{"style":360},[63234],{"type":26,"value":46847},{"type":21,"tag":209,"props":63236,"children":63237},{"style":222},[63238],{"type":26,"value":63239},"(options);\n",{"type":21,"tag":209,"props":63241,"children":63242},{"class":211,"line":472},[63243],{"type":21,"tag":209,"props":63244,"children":63245},{"style":222},[63246],{"type":26,"value":331},{"type":21,"tag":209,"props":63248,"children":63249},{"class":211,"line":480},[63250],{"type":21,"tag":209,"props":63251,"children":63252},{"emptyLinePlaceholder":248},[63253],{"type":26,"value":251},{"type":21,"tag":209,"props":63255,"children":63256},{"class":211,"line":489},[63257],{"type":21,"tag":209,"props":63258,"children":63259},{"style":448},[63260],{"type":26,"value":731},{"type":21,"tag":209,"props":63262,"children":63263},{"class":211,"line":847},[63264],{"type":21,"tag":209,"props":63265,"children":63266},{"style":448},[63267],{"type":26,"value":63268}," * Set options, listen for events on input element that indicate we should read/upload selected file(s).\n",{"type":21,"tag":209,"props":63270,"children":63271},{"class":211,"line":860},[63272,63276,63280],{"type":21,"tag":209,"props":63273,"children":63274},{"style":448},[63275],{"type":26,"value":39750},{"type":21,"tag":209,"props":63277,"children":63278},{"style":216},[63279],{"type":26,"value":13311},{"type":21,"tag":209,"props":63281,"children":63282},{"style":222},[63283],{"type":26,"value":60712},{"type":21,"tag":209,"props":63285,"children":63286},{"class":211,"line":877},[63287],{"type":21,"tag":209,"props":63288,"children":63289},{"style":448},[63290],{"type":26,"value":755},{"type":21,"tag":209,"props":63292,"children":63293},{"class":211,"line":889},[63294,63298,63302,63306,63310,63314,63318,63322,63326,63330],{"type":21,"tag":209,"props":63295,"children":63296},{"style":263},[63297],{"type":26,"value":52111},{"type":21,"tag":209,"props":63299,"children":63300},{"style":222},[63301],{"type":26,"value":378},{"type":21,"tag":209,"props":63303,"children":63304},{"style":263},[63305],{"type":26,"value":32662},{"type":21,"tag":209,"props":63307,"children":63308},{"style":222},[63309],{"type":26,"value":378},{"type":21,"tag":209,"props":63311,"children":63312},{"style":360},[63313],{"type":26,"value":46847},{"type":21,"tag":209,"props":63315,"children":63316},{"style":216},[63317],{"type":26,"value":271},{"type":21,"tag":209,"props":63319,"children":63320},{"style":216},[63321],{"type":26,"value":4789},{"type":21,"tag":209,"props":63323,"children":63324},{"style":222},[63325],{"type":26,"value":368},{"type":21,"tag":209,"props":63327,"children":63328},{"style":400},[63329],{"type":26,"value":28349},{"type":21,"tag":209,"props":63331,"children":63332},{"style":222},[63333],{"type":26,"value":8924},{"type":21,"tag":209,"props":63335,"children":63336},{"class":211,"line":902},[63337],{"type":21,"tag":209,"props":63338,"children":63339},{"style":222},[63340],{"type":26,"value":29353},{"type":21,"tag":209,"props":63342,"children":63343},{"class":211,"line":914},[63344,63348,63352,63356,63360,63364],{"type":21,"tag":209,"props":63345,"children":63346},{"style":263},[63347],{"type":26,"value":46760},{"type":21,"tag":209,"props":63349,"children":63350},{"style":222},[63351],{"type":26,"value":60890},{"type":21,"tag":209,"props":63353,"children":63354},{"style":216},[63355],{"type":26,"value":1432},{"type":21,"tag":209,"props":63357,"children":63358},{"style":222},[63359],{"type":26,"value":25427},{"type":21,"tag":209,"props":63361,"children":63362},{"style":360},[63363],{"type":26,"value":34329},{"type":21,"tag":209,"props":63365,"children":63366},{"style":222},[63367],{"type":26,"value":7767},{"type":21,"tag":209,"props":63369,"children":63370},{"class":211,"line":922},[63371,63376,63380,63384],{"type":21,"tag":209,"props":63372,"children":63373},{"style":222},[63374],{"type":26,"value":63375},"        async:",{"type":21,"tag":209,"props":63377,"children":63378},{"style":263},[63379],{"type":26,"value":2223},{"type":21,"tag":209,"props":63381,"children":63382},{"style":222},[63383],{"type":26,"value":408},{"type":21,"tag":209,"props":63385,"children":63386},{"style":448},[63387],{"type":26,"value":63388},"// Whether to send this file asynchronously\n",{"type":21,"tag":209,"props":63390,"children":63391},{"class":211,"line":2312},[63392,63397,63401,63405],{"type":21,"tag":209,"props":63393,"children":63394},{"style":222},[63395],{"type":26,"value":63396},"        chunked:",{"type":21,"tag":209,"props":63398,"children":63399},{"style":263},[63400],{"type":26,"value":2223},{"type":21,"tag":209,"props":63402,"children":63403},{"style":222},[63404],{"type":26,"value":408},{"type":21,"tag":209,"props":63406,"children":63407},{"style":448},[63408],{"type":26,"value":63409},"// Whether to send the file in chunks\n",{"type":21,"tag":209,"props":63411,"children":63412},{"class":211,"line":2321},[63413,63418,63423,63427],{"type":21,"tag":209,"props":63414,"children":63415},{"style":222},[63416],{"type":26,"value":63417},"        chunk_size:",{"type":21,"tag":209,"props":63419,"children":63420},{"style":263},[63421],{"type":26,"value":63422},"1048576",{"type":21,"tag":209,"props":63424,"children":63425},{"style":222},[63426],{"type":26,"value":408},{"type":21,"tag":209,"props":63428,"children":63429},{"style":448},[63430],{"type":26,"value":63431},"// Size of each chunk (default 1024*1024)\n",{"type":21,"tag":209,"props":63433,"children":63434},{"class":211,"line":2372},[63435,63440,63444,63448],{"type":21,"tag":209,"props":63436,"children":63437},{"style":222},[63438],{"type":26,"value":63439},"        input:",{"type":21,"tag":209,"props":63441,"children":63442},{"style":233},[63443],{"type":26,"value":10775},{"type":21,"tag":209,"props":63445,"children":63446},{"style":222},[63447],{"type":26,"value":408},{"type":21,"tag":209,"props":63449,"children":63450},{"style":448},[63451],{"type":26,"value":63452},"// Input element\n",{"type":21,"tag":209,"props":63454,"children":63455},{"class":211,"line":2381},[63456,63461,63465,63469],{"type":21,"tag":209,"props":63457,"children":63458},{"style":222},[63459],{"type":26,"value":63460},"        make_dnd:",{"type":21,"tag":209,"props":63462,"children":63463},{"style":263},[63464],{"type":26,"value":4243},{"type":21,"tag":209,"props":63466,"children":63467},{"style":222},[63468],{"type":26,"value":408},{"type":21,"tag":209,"props":63470,"children":63471},{"style":448},[63472],{"type":26,"value":63473},"// Whether to make the input element handle drag and drop - auto-true if not file input\n",{"type":21,"tag":209,"props":63475,"children":63476},{"class":211,"line":2389},[63477,63482,63487,63491],{"type":21,"tag":209,"props":63478,"children":63479},{"style":222},[63480],{"type":26,"value":63481},"        read_method:",{"type":21,"tag":209,"props":63483,"children":63484},{"style":233},[63485],{"type":26,"value":63486},"'readAsDataURL'",{"type":21,"tag":209,"props":63488,"children":63489},{"style":222},[63490],{"type":26,"value":408},{"type":21,"tag":209,"props":63492,"children":63493},{"style":448},[63494],{"type":26,"value":63495},"// the read method to use for reading in the file - one of\n",{"type":21,"tag":209,"props":63497,"children":63498},{"class":211,"line":2397},[63499],{"type":21,"tag":209,"props":63500,"children":63501},{"style":448},[63502],{"type":26,"value":63503},"        // readAsText, readAsBinaryString, readAsDataURL or readAsArrayBuffer\n",{"type":21,"tag":209,"props":63505,"children":63506},{"class":211,"line":2406},[63507,63512,63517,63521],{"type":21,"tag":209,"props":63508,"children":63509},{"style":222},[63510],{"type":26,"value":63511},"        type:",{"type":21,"tag":209,"props":63513,"children":63514},{"style":233},[63515],{"type":26,"value":63516},"'PUT'",{"type":21,"tag":209,"props":63518,"children":63519},{"style":222},[63520],{"type":26,"value":408},{"type":21,"tag":209,"props":63522,"children":63523},{"style":448},[63524],{"type":26,"value":63525},"// Type of request to use for uploading\n",{"type":21,"tag":209,"props":63527,"children":63528},{"class":211,"line":2415},[63529,63534,63538],{"type":21,"tag":209,"props":63530,"children":63531},{"style":222},[63532],{"type":26,"value":63533},"        url:",{"type":21,"tag":209,"props":63535,"children":63536},{"style":263},[63537],{"type":26,"value":4243},{"type":21,"tag":209,"props":63539,"children":63540},{"style":448},[63541],{"type":26,"value":63542}," // Url endpoint to send file to - if not specified or false, we read the file and return it\n",{"type":21,"tag":209,"props":63544,"children":63545},{"class":211,"line":2424},[63546],{"type":21,"tag":209,"props":63547,"children":63548},{"style":222},[63549],{"type":26,"value":63550},"    }, options);\n",{"type":21,"tag":209,"props":63552,"children":63553},{"class":211,"line":2433},[63554],{"type":21,"tag":209,"props":63555,"children":63556},{"emptyLinePlaceholder":248},[63557],{"type":26,"value":251},{"type":21,"tag":209,"props":63559,"children":63560},{"class":211,"line":2442},[63561,63565,63570,63574,63578,63582,63586],{"type":21,"tag":209,"props":63562,"children":63563},{"style":263},[63564],{"type":26,"value":46760},{"type":21,"tag":209,"props":63566,"children":63567},{"style":222},[63568],{"type":26,"value":63569},".input ",{"type":21,"tag":209,"props":63571,"children":63572},{"style":216},[63573],{"type":26,"value":1432},{"type":21,"tag":209,"props":63575,"children":63576},{"style":360},[63577],{"type":26,"value":45616},{"type":21,"tag":209,"props":63579,"children":63580},{"style":222},[63581],{"type":26,"value":368},{"type":21,"tag":209,"props":63583,"children":63584},{"style":263},[63585],{"type":26,"value":2508},{"type":21,"tag":209,"props":63587,"children":63588},{"style":222},[63589],{"type":26,"value":63590},".options.input);\n",{"type":21,"tag":209,"props":63592,"children":63593},{"class":211,"line":2471},[63594],{"type":21,"tag":209,"props":63595,"children":63596},{"emptyLinePlaceholder":248},[63597],{"type":26,"value":251},{"type":21,"tag":209,"props":63599,"children":63600},{"class":211,"line":2480},[63601,63605,63609,63613,63617],{"type":21,"tag":209,"props":63602,"children":63603},{"style":216},[63604],{"type":26,"value":16994},{"type":21,"tag":209,"props":63606,"children":63607},{"style":222},[63608],{"type":26,"value":52897},{"type":21,"tag":209,"props":63610,"children":63611},{"style":216},[63612],{"type":26,"value":1432},{"type":21,"tag":209,"props":63614,"children":63615},{"style":263},[63616],{"type":26,"value":20502},{"type":21,"tag":209,"props":63618,"children":63619},{"style":222},[63620],{"type":26,"value":241},{"type":21,"tag":209,"props":63622,"children":63623},{"class":211,"line":2489},[63624,63628,63632,63636,63641,63645,63649,63653,63657,63662,63666,63670],{"type":21,"tag":209,"props":63625,"children":63626},{"style":216},[63627],{"type":26,"value":9249},{"type":21,"tag":209,"props":63629,"children":63630},{"style":222},[63631],{"type":26,"value":5569},{"type":21,"tag":209,"props":63633,"children":63634},{"style":263},[63635],{"type":26,"value":2508},{"type":21,"tag":209,"props":63637,"children":63638},{"style":222},[63639],{"type":26,"value":63640},".options.make_dnd ",{"type":21,"tag":209,"props":63642,"children":63643},{"style":216},[63644],{"type":26,"value":13270},{"type":21,"tag":209,"props":63646,"children":63647},{"style":216},[63648],{"type":26,"value":19960},{"type":21,"tag":209,"props":63650,"children":63651},{"style":263},[63652],{"type":26,"value":2508},{"type":21,"tag":209,"props":63654,"children":63655},{"style":222},[63656],{"type":26,"value":378},{"type":21,"tag":209,"props":63658,"children":63659},{"style":360},[63660],{"type":26,"value":63661},"isFileInput",{"type":21,"tag":209,"props":63663,"children":63664},{"style":222},[63665],{"type":26,"value":368},{"type":21,"tag":209,"props":63667,"children":63668},{"style":263},[63669],{"type":26,"value":2508},{"type":21,"tag":209,"props":63671,"children":63672},{"style":222},[63673],{"type":26,"value":63674},".input))\n",{"type":21,"tag":209,"props":63676,"children":63677},{"class":211,"line":2516},[63678],{"type":21,"tag":209,"props":63679,"children":63680},{"style":222},[63681],{"type":26,"value":32675},{"type":21,"tag":209,"props":63683,"children":63684},{"class":211,"line":2525},[63685,63689,63693,63697,63701],{"type":21,"tag":209,"props":63686,"children":63687},{"style":263},[63688],{"type":26,"value":47121},{"type":21,"tag":209,"props":63690,"children":63691},{"style":222},[63692],{"type":26,"value":63640},{"type":21,"tag":209,"props":63694,"children":63695},{"style":216},[63696],{"type":26,"value":1432},{"type":21,"tag":209,"props":63698,"children":63699},{"style":263},[63700],{"type":26,"value":14819},{"type":21,"tag":209,"props":63702,"children":63703},{"style":222},[63704],{"type":26,"value":241},{"type":21,"tag":209,"props":63706,"children":63707},{"class":211,"line":2533},[63708,63712,63716,63720,63724,63728,63732,63736,63740,63744,63748,63752,63756,63760],{"type":21,"tag":209,"props":63709,"children":63710},{"style":263},[63711],{"type":26,"value":47121},{"type":21,"tag":209,"props":63713,"children":63714},{"style":222},[63715],{"type":26,"value":53296},{"type":21,"tag":209,"props":63717,"children":63718},{"style":360},[63719],{"type":26,"value":60360},{"type":21,"tag":209,"props":63721,"children":63722},{"style":222},[63723],{"type":26,"value":368},{"type":21,"tag":209,"props":63725,"children":63726},{"style":233},[63727],{"type":26,"value":60369},{"type":21,"tag":209,"props":63729,"children":63730},{"style":222},[63731],{"type":26,"value":2699},{"type":21,"tag":209,"props":63733,"children":63734},{"style":360},[63735],{"type":26,"value":363},{"type":21,"tag":209,"props":63737,"children":63738},{"style":222},[63739],{"type":26,"value":368},{"type":21,"tag":209,"props":63741,"children":63742},{"style":233},[63743],{"type":26,"value":60369},{"type":21,"tag":209,"props":63745,"children":63746},{"style":222},[63747],{"type":26,"value":408},{"type":21,"tag":209,"props":63749,"children":63750},{"style":216},[63751],{"type":26,"value":4622},{"type":21,"tag":209,"props":63753,"children":63754},{"style":222},[63755],{"type":26,"value":368},{"type":21,"tag":209,"props":63757,"children":63758},{"style":400},[63759],{"type":26,"value":25805},{"type":21,"tag":209,"props":63761,"children":63762},{"style":222},[63763],{"type":26,"value":2369},{"type":21,"tag":209,"props":63765,"children":63766},{"class":211,"line":2542},[63767,63772,63776],{"type":21,"tag":209,"props":63768,"children":63769},{"style":222},[63770],{"type":26,"value":63771},"            event ",{"type":21,"tag":209,"props":63773,"children":63774},{"style":216},[63775],{"type":26,"value":1432},{"type":21,"tag":209,"props":63777,"children":63778},{"style":222},[63779],{"type":26,"value":60422},{"type":21,"tag":209,"props":63781,"children":63782},{"class":211,"line":2550},[63783,63788,63793],{"type":21,"tag":209,"props":63784,"children":63785},{"style":222},[63786],{"type":26,"value":63787},"            that.",{"type":21,"tag":209,"props":63789,"children":63790},{"style":360},[63791],{"type":26,"value":63792},"handleDragover",{"type":21,"tag":209,"props":63794,"children":63795},{"style":222},[63796],{"type":26,"value":25825},{"type":21,"tag":209,"props":63798,"children":63799},{"class":211,"line":2564},[63800],{"type":21,"tag":209,"props":63801,"children":63802},{"style":222},[63803],{"type":26,"value":13702},{"type":21,"tag":209,"props":63805,"children":63806},{"class":211,"line":2611},[63807],{"type":21,"tag":209,"props":63808,"children":63809},{"style":222},[63810],{"type":26,"value":331},{"type":21,"tag":209,"props":63812,"children":63813},{"class":211,"line":2619},[63814,63818,63822,63826,63830,63834,63838,63842,63846,63850,63854,63858,63862,63866],{"type":21,"tag":209,"props":63815,"children":63816},{"style":263},[63817],{"type":26,"value":46760},{"type":21,"tag":209,"props":63819,"children":63820},{"style":222},[63821],{"type":26,"value":53296},{"type":21,"tag":209,"props":63823,"children":63824},{"style":360},[63825],{"type":26,"value":60360},{"type":21,"tag":209,"props":63827,"children":63828},{"style":222},[63829],{"type":26,"value":368},{"type":21,"tag":209,"props":63831,"children":63832},{"style":233},[63833],{"type":26,"value":60513},{"type":21,"tag":209,"props":63835,"children":63836},{"style":222},[63837],{"type":26,"value":2699},{"type":21,"tag":209,"props":63839,"children":63840},{"style":360},[63841],{"type":26,"value":363},{"type":21,"tag":209,"props":63843,"children":63844},{"style":222},[63845],{"type":26,"value":368},{"type":21,"tag":209,"props":63847,"children":63848},{"style":233},[63849],{"type":26,"value":60513},{"type":21,"tag":209,"props":63851,"children":63852},{"style":222},[63853],{"type":26,"value":408},{"type":21,"tag":209,"props":63855,"children":63856},{"style":216},[63857],{"type":26,"value":4622},{"type":21,"tag":209,"props":63859,"children":63860},{"style":222},[63861],{"type":26,"value":368},{"type":21,"tag":209,"props":63863,"children":63864},{"style":400},[63865],{"type":26,"value":25805},{"type":21,"tag":209,"props":63867,"children":63868},{"style":222},[63869],{"type":26,"value":2369},{"type":21,"tag":209,"props":63871,"children":63872},{"class":211,"line":2627},[63873,63878,63882],{"type":21,"tag":209,"props":63874,"children":63875},{"style":222},[63876],{"type":26,"value":63877},"        event ",{"type":21,"tag":209,"props":63879,"children":63880},{"style":216},[63881],{"type":26,"value":1432},{"type":21,"tag":209,"props":63883,"children":63884},{"style":222},[63885],{"type":26,"value":60422},{"type":21,"tag":209,"props":63887,"children":63888},{"class":211,"line":2636},[63889,63894,63899],{"type":21,"tag":209,"props":63890,"children":63891},{"style":222},[63892],{"type":26,"value":63893},"        that.",{"type":21,"tag":209,"props":63895,"children":63896},{"style":360},[63897],{"type":26,"value":63898},"handleSelect",{"type":21,"tag":209,"props":63900,"children":63901},{"style":222},[63902],{"type":26,"value":25825},{"type":21,"tag":209,"props":63904,"children":63905},{"class":211,"line":2644},[63906],{"type":21,"tag":209,"props":63907,"children":63908},{"style":222},[63909],{"type":26,"value":3391},{"type":21,"tag":209,"props":63911,"children":63912},{"class":211,"line":2657},[63913],{"type":21,"tag":209,"props":63914,"children":63915},{"style":222},[63916],{"type":26,"value":4415},{"type":21,"tag":209,"props":63918,"children":63919},{"class":211,"line":2728},[63920],{"type":21,"tag":209,"props":63921,"children":63922},{"emptyLinePlaceholder":248},[63923],{"type":26,"value":251},{"type":21,"tag":209,"props":63925,"children":63926},{"class":211,"line":2758},[63927],{"type":21,"tag":209,"props":63928,"children":63929},{"style":448},[63930],{"type":26,"value":731},{"type":21,"tag":209,"props":63932,"children":63933},{"class":211,"line":2776},[63934],{"type":21,"tag":209,"props":63935,"children":63936},{"style":448},[63937],{"type":26,"value":63938}," * Return whether the passed element is an input of type file.\n",{"type":21,"tag":209,"props":63940,"children":63941},{"class":211,"line":2785},[63942,63946,63950,63955],{"type":21,"tag":209,"props":63943,"children":63944},{"style":448},[63945],{"type":26,"value":39750},{"type":21,"tag":209,"props":63947,"children":63948},{"style":216},[63949],{"type":26,"value":13311},{"type":21,"tag":209,"props":63951,"children":63952},{"style":222},[63953],{"type":26,"value":63954}," input",{"type":21,"tag":209,"props":63956,"children":63957},{"style":448},[63958],{"type":26,"value":63959}," Element to check.\n",{"type":21,"tag":209,"props":63961,"children":63962},{"class":211,"line":2793},[63963,63967,63971],{"type":21,"tag":209,"props":63964,"children":63965},{"style":448},[63966],{"type":26,"value":39750},{"type":21,"tag":209,"props":63968,"children":63969},{"style":216},[63970],{"type":26,"value":13333},{"type":21,"tag":209,"props":63972,"children":63973},{"style":360},[63974],{"type":26,"value":63975}," {boolean}\n",{"type":21,"tag":209,"props":63977,"children":63978},{"class":211,"line":2801},[63979],{"type":21,"tag":209,"props":63980,"children":63981},{"style":448},[63982],{"type":26,"value":755},{"type":21,"tag":209,"props":63984,"children":63985},{"class":211,"line":2809},[63986,63990,63994,63998,64002,64006,64010,64014,64018,64022],{"type":21,"tag":209,"props":63987,"children":63988},{"style":263},[63989],{"type":26,"value":52111},{"type":21,"tag":209,"props":63991,"children":63992},{"style":222},[63993],{"type":26,"value":378},{"type":21,"tag":209,"props":63995,"children":63996},{"style":263},[63997],{"type":26,"value":32662},{"type":21,"tag":209,"props":63999,"children":64000},{"style":222},[64001],{"type":26,"value":378},{"type":21,"tag":209,"props":64003,"children":64004},{"style":360},[64005],{"type":26,"value":63661},{"type":21,"tag":209,"props":64007,"children":64008},{"style":216},[64009],{"type":26,"value":271},{"type":21,"tag":209,"props":64011,"children":64012},{"style":216},[64013],{"type":26,"value":4789},{"type":21,"tag":209,"props":64015,"children":64016},{"style":222},[64017],{"type":26,"value":368},{"type":21,"tag":209,"props":64019,"children":64020},{"style":400},[64021],{"type":26,"value":60217},{"type":21,"tag":209,"props":64023,"children":64024},{"style":222},[64025],{"type":26,"value":2369},{"type":21,"tag":209,"props":64027,"children":64028},{"class":211,"line":10937},[64029,64033,64038,64042,64047,64051,64056,64061,64066,64070,64075,64079,64083,64088,64092,64096,64100,64104,64108,64113,64117,64121,64125,64129],{"type":21,"tag":209,"props":64030,"children":64031},{"style":216},[64032],{"type":26,"value":1298},{"type":21,"tag":209,"props":64034,"children":64035},{"style":222},[64036],{"type":26,"value":64037}," (input[",{"type":21,"tag":209,"props":64039,"children":64040},{"style":263},[64041],{"type":26,"value":8554},{"type":21,"tag":209,"props":64043,"children":64044},{"style":222},[64045],{"type":26,"value":64046},"].tagName ",{"type":21,"tag":209,"props":64048,"children":64049},{"style":216},[64050],{"type":26,"value":14680},{"type":21,"tag":209,"props":64052,"children":64053},{"style":233},[64054],{"type":26,"value":64055}," 'INPUT'",{"type":21,"tag":209,"props":64057,"children":64058},{"style":216},[64059],{"type":26,"value":64060}," &",{"type":21,"tag":209,"props":64062,"children":64063},{"style":222},[64064],{"type":26,"value":64065},"amp;amp;",{"type":21,"tag":209,"props":64067,"children":64068},{"style":216},[64069],{"type":26,"value":32229},{"type":21,"tag":209,"props":64071,"children":64072},{"style":222},[64073],{"type":26,"value":64074},"amp;amp; input[",{"type":21,"tag":209,"props":64076,"children":64077},{"style":263},[64078],{"type":26,"value":8554},{"type":21,"tag":209,"props":64080,"children":64081},{"style":222},[64082],{"type":26,"value":50468},{"type":21,"tag":209,"props":64084,"children":64085},{"style":360},[64086],{"type":26,"value":64087},"getAttribute",{"type":21,"tag":209,"props":64089,"children":64090},{"style":222},[64091],{"type":26,"value":368},{"type":21,"tag":209,"props":64093,"children":64094},{"style":233},[64095],{"type":26,"value":32587},{"type":21,"tag":209,"props":64097,"children":64098},{"style":222},[64099],{"type":26,"value":2699},{"type":21,"tag":209,"props":64101,"children":64102},{"style":360},[64103],{"type":26,"value":45239},{"type":21,"tag":209,"props":64105,"children":64106},{"style":222},[64107],{"type":26,"value":368},{"type":21,"tag":209,"props":64109,"children":64110},{"style":233},[64111],{"type":26,"value":64112},"'file'",{"type":21,"tag":209,"props":64114,"children":64115},{"style":222},[64116],{"type":26,"value":432},{"type":21,"tag":209,"props":64118,"children":64119},{"style":216},[64120],{"type":26,"value":8046},{"type":21,"tag":209,"props":64122,"children":64123},{"style":216},[64124],{"type":26,"value":45261},{"type":21,"tag":209,"props":64126,"children":64127},{"style":263},[64128],{"type":26,"value":3224},{"type":21,"tag":209,"props":64130,"children":64131},{"style":222},[64132],{"type":26,"value":2608},{"type":21,"tag":209,"props":64134,"children":64135},{"class":211,"line":10967},[64136],{"type":21,"tag":209,"props":64137,"children":64138},{"style":222},[64139],{"type":26,"value":340},{"type":21,"tag":209,"props":64141,"children":64142},{"class":211,"line":11003},[64143],{"type":21,"tag":209,"props":64144,"children":64145},{"emptyLinePlaceholder":248},[64146],{"type":26,"value":251},{"type":21,"tag":209,"props":64148,"children":64149},{"class":211,"line":11038},[64150],{"type":21,"tag":209,"props":64151,"children":64152},{"style":448},[64153],{"type":26,"value":731},{"type":21,"tag":209,"props":64155,"children":64156},{"class":211,"line":11072},[64157],{"type":21,"tag":209,"props":64158,"children":64159},{"style":448},[64160],{"type":26,"value":64161}," * Handle the dragging of file(s) to a target, preventing the rejection of the dragover.\n",{"type":21,"tag":209,"props":64163,"children":64164},{"class":211,"line":11106},[64165,64169,64173],{"type":21,"tag":209,"props":64166,"children":64167},{"style":448},[64168],{"type":26,"value":39750},{"type":21,"tag":209,"props":64170,"children":64171},{"style":216},[64172],{"type":26,"value":13311},{"type":21,"tag":209,"props":64174,"children":64175},{"style":222},[64176],{"type":26,"value":25768},{"type":21,"tag":209,"props":64178,"children":64179},{"class":211,"line":11114},[64180],{"type":21,"tag":209,"props":64181,"children":64182},{"style":448},[64183],{"type":26,"value":755},{"type":21,"tag":209,"props":64185,"children":64186},{"class":211,"line":14940},[64187,64191,64195,64199,64203,64207,64211,64215,64219,64223],{"type":21,"tag":209,"props":64188,"children":64189},{"style":263},[64190],{"type":26,"value":52111},{"type":21,"tag":209,"props":64192,"children":64193},{"style":222},[64194],{"type":26,"value":378},{"type":21,"tag":209,"props":64196,"children":64197},{"style":263},[64198],{"type":26,"value":32662},{"type":21,"tag":209,"props":64200,"children":64201},{"style":222},[64202],{"type":26,"value":378},{"type":21,"tag":209,"props":64204,"children":64205},{"style":360},[64206],{"type":26,"value":63792},{"type":21,"tag":209,"props":64208,"children":64209},{"style":216},[64210],{"type":26,"value":271},{"type":21,"tag":209,"props":64212,"children":64213},{"style":216},[64214],{"type":26,"value":4789},{"type":21,"tag":209,"props":64216,"children":64217},{"style":222},[64218],{"type":26,"value":368},{"type":21,"tag":209,"props":64220,"children":64221},{"style":400},[64222],{"type":26,"value":25805},{"type":21,"tag":209,"props":64224,"children":64225},{"style":222},[64226],{"type":26,"value":2369},{"type":21,"tag":209,"props":64228,"children":64229},{"class":211,"line":14949},[64230,64234,64238],{"type":21,"tag":209,"props":64231,"children":64232},{"style":222},[64233],{"type":26,"value":60430},{"type":21,"tag":209,"props":64235,"children":64236},{"style":360},[64237],{"type":26,"value":60435},{"type":21,"tag":209,"props":64239,"children":64240},{"style":222},[64241],{"type":26,"value":4123},{"type":21,"tag":209,"props":64243,"children":64244},{"class":211,"line":14958},[64245,64249,64253],{"type":21,"tag":209,"props":64246,"children":64247},{"style":222},[64248],{"type":26,"value":60430},{"type":21,"tag":209,"props":64250,"children":64251},{"style":360},[64252],{"type":26,"value":60451},{"type":21,"tag":209,"props":64254,"children":64255},{"style":222},[64256],{"type":26,"value":4123},{"type":21,"tag":209,"props":64258,"children":64259},{"class":211,"line":14966},[64260,64265,64269,64274],{"type":21,"tag":209,"props":64261,"children":64262},{"style":222},[64263],{"type":26,"value":64264},"    event.dataTransfer.dropEffect ",{"type":21,"tag":209,"props":64266,"children":64267},{"style":216},[64268],{"type":26,"value":1432},{"type":21,"tag":209,"props":64270,"children":64271},{"style":233},[64272],{"type":26,"value":64273}," 'copy'",{"type":21,"tag":209,"props":64275,"children":64276},{"style":222},[64277],{"type":26,"value":241},{"type":21,"tag":209,"props":64279,"children":64280},{"class":211,"line":14975},[64281],{"type":21,"tag":209,"props":64282,"children":64283},{"style":222},[64284],{"type":26,"value":340},{"type":21,"tag":209,"props":64286,"children":64287},{"class":211,"line":14984},[64288],{"type":21,"tag":209,"props":64289,"children":64290},{"emptyLinePlaceholder":248},[64291],{"type":26,"value":251},{"type":21,"tag":209,"props":64293,"children":64294},{"class":211,"line":15018},[64295],{"type":21,"tag":209,"props":64296,"children":64297},{"style":448},[64298],{"type":26,"value":731},{"type":21,"tag":209,"props":64300,"children":64301},{"class":211,"line":15050},[64302],{"type":21,"tag":209,"props":64303,"children":64304},{"style":448},[64305],{"type":26,"value":64306}," * Handle the selection of files to upload via an input or drag and drop to a target.\n",{"type":21,"tag":209,"props":64308,"children":64309},{"class":211,"line":15082},[64310,64314,64318],{"type":21,"tag":209,"props":64311,"children":64312},{"style":448},[64313],{"type":26,"value":39750},{"type":21,"tag":209,"props":64315,"children":64316},{"style":216},[64317],{"type":26,"value":13311},{"type":21,"tag":209,"props":64319,"children":64320},{"style":222},[64321],{"type":26,"value":25768},{"type":21,"tag":209,"props":64323,"children":64324},{"class":211,"line":15090},[64325],{"type":21,"tag":209,"props":64326,"children":64327},{"style":448},[64328],{"type":26,"value":755},{"type":21,"tag":209,"props":64330,"children":64331},{"class":211,"line":15098},[64332,64336,64340,64344,64348,64352,64356,64360,64364,64368],{"type":21,"tag":209,"props":64333,"children":64334},{"style":263},[64335],{"type":26,"value":52111},{"type":21,"tag":209,"props":64337,"children":64338},{"style":222},[64339],{"type":26,"value":378},{"type":21,"tag":209,"props":64341,"children":64342},{"style":263},[64343],{"type":26,"value":32662},{"type":21,"tag":209,"props":64345,"children":64346},{"style":222},[64347],{"type":26,"value":378},{"type":21,"tag":209,"props":64349,"children":64350},{"style":360},[64351],{"type":26,"value":63898},{"type":21,"tag":209,"props":64353,"children":64354},{"style":216},[64355],{"type":26,"value":271},{"type":21,"tag":209,"props":64357,"children":64358},{"style":216},[64359],{"type":26,"value":4789},{"type":21,"tag":209,"props":64361,"children":64362},{"style":222},[64363],{"type":26,"value":368},{"type":21,"tag":209,"props":64365,"children":64366},{"style":400},[64367],{"type":26,"value":25805},{"type":21,"tag":209,"props":64369,"children":64370},{"style":222},[64371],{"type":26,"value":2369},{"type":21,"tag":209,"props":64373,"children":64374},{"class":211,"line":15106},[64375,64379],{"type":21,"tag":209,"props":64376,"children":64377},{"style":216},[64378],{"type":26,"value":16994},{"type":21,"tag":209,"props":64380,"children":64381},{"style":222},[64382],{"type":26,"value":60481},{"type":21,"tag":209,"props":64384,"children":64385},{"class":211,"line":15114},[64386],{"type":21,"tag":209,"props":64387,"children":64388},{"emptyLinePlaceholder":248},[64389],{"type":26,"value":251},{"type":21,"tag":209,"props":64391,"children":64392},{"class":211,"line":15123},[64393,64397,64401,64405],{"type":21,"tag":209,"props":64394,"children":64395},{"style":216},[64396],{"type":26,"value":9249},{"type":21,"tag":209,"props":64398,"children":64399},{"style":222},[64400],{"type":26,"value":5569},{"type":21,"tag":209,"props":64402,"children":64403},{"style":263},[64404],{"type":26,"value":2508},{"type":21,"tag":209,"props":64406,"children":64407},{"style":222},[64408],{"type":26,"value":64409},".options.make_dnd)\n",{"type":21,"tag":209,"props":64411,"children":64412},{"class":211,"line":15143},[64413],{"type":21,"tag":209,"props":64414,"children":64415},{"style":222},[64416],{"type":26,"value":32675},{"type":21,"tag":209,"props":64418,"children":64419},{"class":211,"line":15160},[64420,64425,64429],{"type":21,"tag":209,"props":64421,"children":64422},{"style":222},[64423],{"type":26,"value":64424},"        event.",{"type":21,"tag":209,"props":64426,"children":64427},{"style":360},[64428],{"type":26,"value":60435},{"type":21,"tag":209,"props":64430,"children":64431},{"style":222},[64432],{"type":26,"value":4123},{"type":21,"tag":209,"props":64434,"children":64435},{"class":211,"line":15168},[64436,64440,64444],{"type":21,"tag":209,"props":64437,"children":64438},{"style":222},[64439],{"type":26,"value":64424},{"type":21,"tag":209,"props":64441,"children":64442},{"style":360},[64443],{"type":26,"value":60451},{"type":21,"tag":209,"props":64445,"children":64446},{"style":222},[64447],{"type":26,"value":4123},{"type":21,"tag":209,"props":64449,"children":64450},{"class":211,"line":15196},[64451,64456,64460],{"type":21,"tag":209,"props":64452,"children":64453},{"style":222},[64454],{"type":26,"value":64455},"        files ",{"type":21,"tag":209,"props":64457,"children":64458},{"style":216},[64459],{"type":26,"value":1432},{"type":21,"tag":209,"props":64461,"children":64462},{"style":222},[64463],{"type":26,"value":60619},{"type":21,"tag":209,"props":64465,"children":64466},{"class":211,"line":15219},[64467],{"type":21,"tag":209,"props":64468,"children":64469},{"style":222},[64470],{"type":26,"value":331},{"type":21,"tag":209,"props":64472,"children":64473},{"class":211,"line":15240},[64474],{"type":21,"tag":209,"props":64475,"children":64476},{"style":216},[64477],{"type":26,"value":61789},{"type":21,"tag":209,"props":64479,"children":64480},{"class":211,"line":15248},[64481],{"type":21,"tag":209,"props":64482,"children":64483},{"style":222},[64484],{"type":26,"value":32675},{"type":21,"tag":209,"props":64486,"children":64487},{"class":211,"line":15256},[64488,64492,64496],{"type":21,"tag":209,"props":64489,"children":64490},{"style":222},[64491],{"type":26,"value":64455},{"type":21,"tag":209,"props":64493,"children":64494},{"style":216},[64495],{"type":26,"value":1432},{"type":21,"tag":209,"props":64497,"children":64498},{"style":222},[64499],{"type":26,"value":60643},{"type":21,"tag":209,"props":64501,"children":64502},{"class":211,"line":15284},[64503],{"type":21,"tag":209,"props":64504,"children":64505},{"style":222},[64506],{"type":26,"value":331},{"type":21,"tag":209,"props":64508,"children":64509},{"class":211,"line":15317},[64510,64514,64518,64522,64527,64531],{"type":21,"tag":209,"props":64511,"children":64512},{"style":216},[64513],{"type":26,"value":9249},{"type":21,"tag":209,"props":64515,"children":64516},{"style":222},[64517],{"type":26,"value":5569},{"type":21,"tag":209,"props":64519,"children":64520},{"style":216},[64521],{"type":26,"value":6455},{"type":21,"tag":209,"props":64523,"children":64524},{"style":222},[64525],{"type":26,"value":64526},"files.",{"type":21,"tag":209,"props":64528,"children":64529},{"style":263},[64530],{"type":26,"value":6344},{"type":21,"tag":209,"props":64532,"children":64533},{"style":222},[64534],{"type":26,"value":8924},{"type":21,"tag":209,"props":64536,"children":64537},{"class":211,"line":15331},[64538],{"type":21,"tag":209,"props":64539,"children":64540},{"style":222},[64541],{"type":26,"value":32675},{"type":21,"tag":209,"props":64543,"children":64544},{"class":211,"line":15339},[64545,64549,64553,64557,64561,64566,64571,64575],{"type":21,"tag":209,"props":64546,"children":64547},{"style":263},[64548],{"type":26,"value":47121},{"type":21,"tag":209,"props":64550,"children":64551},{"style":222},[64552],{"type":26,"value":53296},{"type":21,"tag":209,"props":64554,"children":64555},{"style":360},[64556],{"type":26,"value":499},{"type":21,"tag":209,"props":64558,"children":64559},{"style":222},[64560],{"type":26,"value":53305},{"type":21,"tag":209,"props":64562,"children":64563},{"style":263},[64564],{"type":26,"value":64565},"FILE_LIST_ERROR",{"type":21,"tag":209,"props":64567,"children":64568},{"style":222},[64569],{"type":26,"value":64570},", {state:Hup.state.",{"type":21,"tag":209,"props":64572,"children":64573},{"style":263},[64574],{"type":26,"value":64565},{"type":21,"tag":209,"props":64576,"children":64577},{"style":222},[64578],{"type":26,"value":304},{"type":21,"tag":209,"props":64580,"children":64581},{"class":211,"line":15352},[64582,64587,64592],{"type":21,"tag":209,"props":64583,"children":64584},{"style":222},[64585],{"type":26,"value":64586},"            error:",{"type":21,"tag":209,"props":64588,"children":64589},{"style":233},[64590],{"type":26,"value":64591},"'No files found in file list; no files were selected.'",{"type":21,"tag":209,"props":64593,"children":64594},{"style":222},[64595],{"type":26,"value":469},{"type":21,"tag":209,"props":64597,"children":64598},{"class":211,"line":15382},[64599,64603],{"type":21,"tag":209,"props":64600,"children":64601},{"style":216},[64602],{"type":26,"value":3069},{"type":21,"tag":209,"props":64604,"children":64605},{"style":222},[64606],{"type":26,"value":241},{"type":21,"tag":209,"props":64608,"children":64609},{"class":211,"line":15400},[64610],{"type":21,"tag":209,"props":64611,"children":64612},{"style":222},[64613],{"type":26,"value":331},{"type":21,"tag":209,"props":64615,"children":64616},{"class":211,"line":15409},[64617,64621,64625,64629,64633,64638,64642,64646],{"type":21,"tag":209,"props":64618,"children":64619},{"style":263},[64620],{"type":26,"value":46760},{"type":21,"tag":209,"props":64622,"children":64623},{"style":222},[64624],{"type":26,"value":53296},{"type":21,"tag":209,"props":64626,"children":64627},{"style":360},[64628],{"type":26,"value":499},{"type":21,"tag":209,"props":64630,"children":64631},{"style":222},[64632],{"type":26,"value":53305},{"type":21,"tag":209,"props":64634,"children":64635},{"style":263},[64636],{"type":26,"value":64637},"FILE_LIST_LOADED",{"type":21,"tag":209,"props":64639,"children":64640},{"style":222},[64641],{"type":26,"value":64570},{"type":21,"tag":209,"props":64643,"children":64644},{"style":263},[64645],{"type":26,"value":64637},{"type":21,"tag":209,"props":64647,"children":64648},{"style":222},[64649],{"type":26,"value":64650},", files:files});\n",{"type":21,"tag":209,"props":64652,"children":64653},{"class":211,"line":15433},[64654],{"type":21,"tag":209,"props":64655,"children":64656},{"emptyLinePlaceholder":248},[64657],{"type":26,"value":251},{"type":21,"tag":209,"props":64659,"children":64660},{"class":211,"line":15441},[64661,64665,64669,64673,64678,64682],{"type":21,"tag":209,"props":64662,"children":64663},{"style":263},[64664],{"type":26,"value":46760},{"type":21,"tag":209,"props":64666,"children":64667},{"style":222},[64668],{"type":26,"value":378},{"type":21,"tag":209,"props":64670,"children":64671},{"style":360},[64672],{"type":26,"value":52856},{"type":21,"tag":209,"props":64674,"children":64675},{"style":222},[64676],{"type":26,"value":64677},"(files, ",{"type":21,"tag":209,"props":64679,"children":64680},{"style":263},[64681],{"type":26,"value":2508},{"type":21,"tag":209,"props":64683,"children":64684},{"style":222},[64685],{"type":26,"value":64686},".options.url);\n",{"type":21,"tag":209,"props":64688,"children":64689},{"class":211,"line":15449},[64690],{"type":21,"tag":209,"props":64691,"children":64692},{"style":222},[64693],{"type":26,"value":340},{"type":21,"tag":209,"props":64695,"children":64696},{"class":211,"line":15467},[64697],{"type":21,"tag":209,"props":64698,"children":64699},{"emptyLinePlaceholder":248},[64700],{"type":26,"value":251},{"type":21,"tag":209,"props":64702,"children":64703},{"class":211,"line":15475},[64704],{"type":21,"tag":209,"props":64705,"children":64706},{"style":448},[64707],{"type":26,"value":731},{"type":21,"tag":209,"props":64709,"children":64710},{"class":211,"line":15487},[64711],{"type":21,"tag":209,"props":64712,"children":64713},{"style":448},[64714],{"type":26,"value":64715}," * Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n",{"type":21,"tag":209,"props":64717,"children":64718},{"class":211,"line":15495},[64719],{"type":21,"tag":209,"props":64720,"children":64721},{"style":448},[64722],{"type":26,"value":64723}," * memory and passing them on to be used in the browser.\n",{"type":21,"tag":209,"props":64725,"children":64726},{"class":211,"line":15503},[64727,64731,64735],{"type":21,"tag":209,"props":64728,"children":64729},{"style":448},[64730],{"type":26,"value":39750},{"type":21,"tag":209,"props":64732,"children":64733},{"style":216},[64734],{"type":26,"value":13311},{"type":21,"tag":209,"props":64736,"children":64737},{"style":222},[64738],{"type":26,"value":52809},{"type":21,"tag":209,"props":64740,"children":64741},{"class":211,"line":15511},[64742,64746,64750],{"type":21,"tag":209,"props":64743,"children":64744},{"style":448},[64745],{"type":26,"value":39750},{"type":21,"tag":209,"props":64747,"children":64748},{"style":216},[64749],{"type":26,"value":13311},{"type":21,"tag":209,"props":64751,"children":64752},{"style":222},[64753],{"type":26,"value":52825},{"type":21,"tag":209,"props":64755,"children":64756},{"class":211,"line":15520},[64757],{"type":21,"tag":209,"props":64758,"children":64759},{"style":448},[64760],{"type":26,"value":755},{"type":21,"tag":209,"props":64762,"children":64763},{"class":211,"line":15529},[64764,64768,64772,64776,64780,64784,64788,64792,64796,64800,64804,64808],{"type":21,"tag":209,"props":64765,"children":64766},{"style":263},[64767],{"type":26,"value":52111},{"type":21,"tag":209,"props":64769,"children":64770},{"style":222},[64771],{"type":26,"value":378},{"type":21,"tag":209,"props":64773,"children":64774},{"style":263},[64775],{"type":26,"value":32662},{"type":21,"tag":209,"props":64777,"children":64778},{"style":222},[64779],{"type":26,"value":378},{"type":21,"tag":209,"props":64781,"children":64782},{"style":360},[64783],{"type":26,"value":52856},{"type":21,"tag":209,"props":64785,"children":64786},{"style":216},[64787],{"type":26,"value":271},{"type":21,"tag":209,"props":64789,"children":64790},{"style":216},[64791],{"type":26,"value":4789},{"type":21,"tag":209,"props":64793,"children":64794},{"style":222},[64795],{"type":26,"value":368},{"type":21,"tag":209,"props":64797,"children":64798},{"style":400},[64799],{"type":26,"value":52873},{"type":21,"tag":209,"props":64801,"children":64802},{"style":222},[64803],{"type":26,"value":408},{"type":21,"tag":209,"props":64805,"children":64806},{"style":400},[64807],{"type":26,"value":31175},{"type":21,"tag":209,"props":64809,"children":64810},{"style":222},[64811],{"type":26,"value":2369},{"type":21,"tag":209,"props":64813,"children":64814},{"class":211,"line":15545},[64815,64819,64823,64827,64831],{"type":21,"tag":209,"props":64816,"children":64817},{"style":216},[64818],{"type":26,"value":16994},{"type":21,"tag":209,"props":64820,"children":64821},{"style":222},[64822],{"type":26,"value":52897},{"type":21,"tag":209,"props":64824,"children":64825},{"style":216},[64826],{"type":26,"value":1432},{"type":21,"tag":209,"props":64828,"children":64829},{"style":263},[64830],{"type":26,"value":20502},{"type":21,"tag":209,"props":64832,"children":64833},{"style":222},[64834],{"type":26,"value":304},{"type":21,"tag":209,"props":64836,"children":64837},{"class":211,"line":15561},[64838,64842,64846,64850],{"type":21,"tag":209,"props":64839,"children":64840},{"style":222},[64841],{"type":26,"value":52917},{"type":21,"tag":209,"props":64843,"children":64844},{"style":216},[64845],{"type":26,"value":1432},{"type":21,"tag":209,"props":64847,"children":64848},{"style":263},[64849],{"type":26,"value":8009},{"type":21,"tag":209,"props":64851,"children":64852},{"style":222},[64853],{"type":26,"value":241},{"type":21,"tag":209,"props":64855,"children":64856},{"class":211,"line":15569},[64857],{"type":21,"tag":209,"props":64858,"children":64859},{"emptyLinePlaceholder":248},[64860],{"type":26,"value":251},{"type":21,"tag":209,"props":64862,"children":64863},{"class":211,"line":15593},[64864,64868,64872,64876,64880,64884,64888,64892,64896,64900,64904,64908,64912,64917,64921],{"type":21,"tag":209,"props":64865,"children":64866},{"style":216},[64867],{"type":26,"value":51637},{"type":21,"tag":209,"props":64869,"children":64870},{"style":222},[64871],{"type":26,"value":5569},{"type":21,"tag":209,"props":64873,"children":64874},{"style":216},[64875],{"type":26,"value":3909},{"type":21,"tag":209,"props":64877,"children":64878},{"style":222},[64879],{"type":26,"value":32266},{"type":21,"tag":209,"props":64881,"children":64882},{"style":216},[64883],{"type":26,"value":1432},{"type":21,"tag":209,"props":64885,"children":64886},{"style":263},[64887],{"type":26,"value":8554},{"type":21,"tag":209,"props":64889,"children":64890},{"style":222},[64891],{"type":26,"value":52313},{"type":21,"tag":209,"props":64893,"children":64894},{"style":216},[64895],{"type":26,"value":1432},{"type":21,"tag":209,"props":64897,"children":64898},{"style":222},[64899],{"type":26,"value":53046},{"type":21,"tag":209,"props":64901,"children":64902},{"style":263},[64903],{"type":26,"value":6344},{"type":21,"tag":209,"props":64905,"children":64906},{"style":222},[64907],{"type":26,"value":32292},{"type":21,"tag":209,"props":64909,"children":64910},{"style":216},[64911],{"type":26,"value":32229},{"type":21,"tag":209,"props":64913,"children":64914},{"style":222},[64915],{"type":26,"value":64916},"amp;lt; len; i",{"type":21,"tag":209,"props":64918,"children":64919},{"style":216},[64920],{"type":26,"value":32306},{"type":21,"tag":209,"props":64922,"children":64923},{"style":222},[64924],{"type":26,"value":8924},{"type":21,"tag":209,"props":64926,"children":64927},{"class":211,"line":15634},[64928],{"type":21,"tag":209,"props":64929,"children":64930},{"style":222},[64931],{"type":26,"value":32675},{"type":21,"tag":209,"props":64933,"children":64934},{"class":211,"line":15662},[64935,64939,64944,64948,64952,64956,64960,64964,64968,64972,64976],{"type":21,"tag":209,"props":64936,"children":64937},{"style":216},[64938],{"type":26,"value":14505},{"type":21,"tag":209,"props":64940,"children":64941},{"style":222},[64942],{"type":26,"value":64943}," fprocess ",{"type":21,"tag":209,"props":64945,"children":64946},{"style":216},[64947],{"type":26,"value":1432},{"type":21,"tag":209,"props":64949,"children":64950},{"style":222},[64951],{"type":26,"value":53632},{"type":21,"tag":209,"props":64953,"children":64954},{"style":216},[64955],{"type":26,"value":8258},{"type":21,"tag":209,"props":64957,"children":64958},{"style":216},[64959],{"type":26,"value":6371},{"type":21,"tag":209,"props":64961,"children":64962},{"style":360},[64963],{"type":26,"value":53645},{"type":21,"tag":209,"props":64965,"children":64966},{"style":222},[64967],{"type":26,"value":368},{"type":21,"tag":209,"props":64969,"children":64970},{"style":263},[64971],{"type":26,"value":2508},{"type":21,"tag":209,"props":64973,"children":64974},{"style":222},[64975],{"type":26,"value":53658},{"type":21,"tag":209,"props":64977,"children":64978},{"style":216},[64979],{"type":26,"value":844},{"type":21,"tag":209,"props":64981,"children":64982},{"class":211,"line":15678},[64983,64988,64992,64996,65000],{"type":21,"tag":209,"props":64984,"children":64985},{"style":216},[64986],{"type":26,"value":64987},"            new",{"type":21,"tag":209,"props":64989,"children":64990},{"style":360},[64991],{"type":26,"value":53675},{"type":21,"tag":209,"props":64993,"children":64994},{"style":222},[64995],{"type":26,"value":368},{"type":21,"tag":209,"props":64997,"children":64998},{"style":263},[64999],{"type":26,"value":2508},{"type":21,"tag":209,"props":65001,"children":65002},{"style":222},[65003],{"type":26,"value":53688},{"type":21,"tag":209,"props":65005,"children":65006},{"class":211,"line":15694},[65007],{"type":21,"tag":209,"props":65008,"children":65009},{"emptyLinePlaceholder":248},[65010],{"type":26,"value":251},{"type":21,"tag":209,"props":65012,"children":65013},{"class":211,"line":15710},[65014,65019,65023,65027,65031,65035,65039],{"type":21,"tag":209,"props":65015,"children":65016},{"style":222},[65017],{"type":26,"value":65018},"        fprocess.",{"type":21,"tag":209,"props":65020,"children":65021},{"style":360},[65022],{"type":26,"value":53708},{"type":21,"tag":209,"props":65024,"children":65025},{"style":222},[65026],{"type":26,"value":368},{"type":21,"tag":209,"props":65028,"children":65029},{"style":216},[65030],{"type":26,"value":4622},{"type":21,"tag":209,"props":65032,"children":65033},{"style":222},[65034],{"type":26,"value":368},{"type":21,"tag":209,"props":65036,"children":65037},{"style":400},[65038],{"type":26,"value":53708},{"type":21,"tag":209,"props":65040,"children":65041},{"style":222},[65042],{"type":26,"value":2369},{"type":21,"tag":209,"props":65044,"children":65045},{"class":211,"line":15718},[65046,65050,65054],{"type":21,"tag":209,"props":65047,"children":65048},{"style":222},[65049],{"type":26,"value":53846},{"type":21,"tag":209,"props":65051,"children":65052},{"style":360},[65053],{"type":26,"value":499},{"type":21,"tag":209,"props":65055,"children":65056},{"style":222},[65057],{"type":26,"value":53745},{"type":21,"tag":209,"props":65059,"children":65060},{"class":211,"line":15730},[65061,65065,65069,65073,65077,65081,65085],{"type":21,"tag":209,"props":65062,"children":65063},{"style":222},[65064],{"type":26,"value":22728},{"type":21,"tag":209,"props":65066,"children":65067},{"style":360},[65068],{"type":26,"value":20845},{"type":21,"tag":209,"props":65070,"children":65071},{"style":222},[65072],{"type":26,"value":368},{"type":21,"tag":209,"props":65074,"children":65075},{"style":216},[65076],{"type":26,"value":4622},{"type":21,"tag":209,"props":65078,"children":65079},{"style":222},[65080],{"type":26,"value":368},{"type":21,"tag":209,"props":65082,"children":65083},{"style":400},[65084],{"type":26,"value":1385},{"type":21,"tag":209,"props":65086,"children":65087},{"style":222},[65088],{"type":26,"value":2369},{"type":21,"tag":209,"props":65090,"children":65091},{"class":211,"line":15738},[65092,65096,65100],{"type":21,"tag":209,"props":65093,"children":65094},{"style":222},[65095],{"type":26,"value":53846},{"type":21,"tag":209,"props":65097,"children":65098},{"style":360},[65099],{"type":26,"value":499},{"type":21,"tag":209,"props":65101,"children":65102},{"style":222},[65103],{"type":26,"value":53792},{"type":21,"tag":209,"props":65105,"children":65106},{"class":211,"line":15746},[65107,65112,65116],{"type":21,"tag":209,"props":65108,"children":65109},{"style":222},[65110],{"type":26,"value":65111},"            processed",{"type":21,"tag":209,"props":65113,"children":65114},{"style":216},[65115],{"type":26,"value":32306},{"type":21,"tag":209,"props":65117,"children":65118},{"style":222},[65119],{"type":26,"value":241},{"type":21,"tag":209,"props":65121,"children":65122},{"class":211,"line":15754},[65123,65127,65131,65135],{"type":21,"tag":209,"props":65124,"children":65125},{"style":216},[65126],{"type":26,"value":14662},{"type":21,"tag":209,"props":65128,"children":65129},{"style":222},[65130],{"type":26,"value":53820},{"type":21,"tag":209,"props":65132,"children":65133},{"style":216},[65134],{"type":26,"value":23855},{"type":21,"tag":209,"props":65136,"children":65137},{"style":222},[65138],{"type":26,"value":65139}," len)\n",{"type":21,"tag":209,"props":65141,"children":65142},{"class":211,"line":15767},[65143,65148,65152,65156,65160,65164,65168,65172,65176,65180],{"type":21,"tag":209,"props":65144,"children":65145},{"style":222},[65146],{"type":26,"value":65147},"                that.input.",{"type":21,"tag":209,"props":65149,"children":65150},{"style":360},[65151],{"type":26,"value":499},{"type":21,"tag":209,"props":65153,"children":65154},{"style":222},[65155],{"type":26,"value":53855},{"type":21,"tag":209,"props":65157,"children":65158},{"style":216},[65159],{"type":26,"value":8258},{"type":21,"tag":209,"props":65161,"children":65162},{"style":222},[65163],{"type":26,"value":53864},{"type":21,"tag":209,"props":65165,"children":65166},{"style":263},[65167],{"type":26,"value":53869},{"type":21,"tag":209,"props":65169,"children":65170},{"style":216},[65171],{"type":26,"value":53874},{"type":21,"tag":209,"props":65173,"children":65174},{"style":222},[65175],{"type":26,"value":53864},{"type":21,"tag":209,"props":65177,"children":65178},{"style":263},[65179],{"type":26,"value":53883},{"type":21,"tag":209,"props":65181,"children":65182},{"style":222},[65183],{"type":26,"value":53888},{"type":21,"tag":209,"props":65185,"children":65186},{"class":211,"line":19592},[65187,65192,65196,65200,65204,65208,65212,65216],{"type":21,"tag":209,"props":65188,"children":65189},{"style":222},[65190],{"type":26,"value":65191},"                    {state:(upload) ",{"type":21,"tag":209,"props":65193,"children":65194},{"style":216},[65195],{"type":26,"value":8258},{"type":21,"tag":209,"props":65197,"children":65198},{"style":222},[65199],{"type":26,"value":53864},{"type":21,"tag":209,"props":65201,"children":65202},{"style":263},[65203],{"type":26,"value":53869},{"type":21,"tag":209,"props":65205,"children":65206},{"style":216},[65207],{"type":26,"value":53874},{"type":21,"tag":209,"props":65209,"children":65210},{"style":222},[65211],{"type":26,"value":53864},{"type":21,"tag":209,"props":65213,"children":65214},{"style":263},[65215],{"type":26,"value":53883},{"type":21,"tag":209,"props":65217,"children":65218},{"style":222},[65219],{"type":26,"value":53925},{"type":21,"tag":209,"props":65221,"children":65222},{"class":211,"line":19601},[65223,65227,65231,65235,65239,65243,65247],{"type":21,"tag":209,"props":65224,"children":65225},{"style":222},[65226],{"type":26,"value":22728},{"type":21,"tag":209,"props":65228,"children":65229},{"style":360},[65230],{"type":26,"value":20894},{"type":21,"tag":209,"props":65232,"children":65233},{"style":222},[65234],{"type":26,"value":368},{"type":21,"tag":209,"props":65236,"children":65237},{"style":216},[65238],{"type":26,"value":4622},{"type":21,"tag":209,"props":65240,"children":65241},{"style":222},[65242],{"type":26,"value":368},{"type":21,"tag":209,"props":65244,"children":65245},{"style":400},[65246],{"type":26,"value":1385},{"type":21,"tag":209,"props":65248,"children":65249},{"style":222},[65250],{"type":26,"value":8924},{"type":21,"tag":209,"props":65252,"children":65253},{"class":211,"line":19615},[65254],{"type":21,"tag":209,"props":65255,"children":65256},{"style":222},[65257],{"type":26,"value":17555},{"type":21,"tag":209,"props":65259,"children":65260},{"class":211,"line":19624},[65261,65265,65269],{"type":21,"tag":209,"props":65262,"children":65263},{"style":222},[65264],{"type":26,"value":53846},{"type":21,"tag":209,"props":65266,"children":65267},{"style":360},[65268],{"type":26,"value":499},{"type":21,"tag":209,"props":65270,"children":65271},{"style":222},[65272],{"type":26,"value":53792},{"type":21,"tag":209,"props":65274,"children":65275},{"class":211,"line":19638},[65276],{"type":21,"tag":209,"props":65277,"children":65278},{"style":222},[65279],{"type":26,"value":13702},{"type":21,"tag":209,"props":65281,"children":65282},{"class":211,"line":19652},[65283],{"type":21,"tag":209,"props":65284,"children":65285},{"style":222},[65286],{"type":26,"value":331},{"type":21,"tag":209,"props":65288,"children":65289},{"class":211,"line":19660},[65290],{"type":21,"tag":209,"props":65291,"children":65292},{"style":222},[65293],{"type":26,"value":340},{"type":21,"tag":209,"props":65295,"children":65296},{"class":211,"line":19701},[65297],{"type":21,"tag":209,"props":65298,"children":65299},{"emptyLinePlaceholder":248},[65300],{"type":26,"value":251},{"type":21,"tag":209,"props":65302,"children":65303},{"class":211,"line":19726},[65304],{"type":21,"tag":209,"props":65305,"children":65306},{"style":448},[65307],{"type":26,"value":731},{"type":21,"tag":209,"props":65309,"children":65310},{"class":211,"line":19757},[65311],{"type":21,"tag":209,"props":65312,"children":65313},{"style":448},[65314],{"type":26,"value":65315}," * Custom events we'll trigger on our input element at the appropriate times.\n",{"type":21,"tag":209,"props":65317,"children":65318},{"class":211,"line":19779},[65319,65323,65327],{"type":21,"tag":209,"props":65320,"children":65321},{"style":448},[65322],{"type":26,"value":39750},{"type":21,"tag":209,"props":65324,"children":65325},{"style":216},[65326],{"type":26,"value":47062},{"type":21,"tag":209,"props":65328,"children":65329},{"style":360},[65330],{"type":26,"value":65331}," {{FILE_LIST_ERROR: string, FILE_LIST_LOADED: string, FILE_READ_ERROR: string,\n",{"type":21,"tag":209,"props":65333,"children":65334},{"class":211,"line":19797},[65335],{"type":21,"tag":209,"props":65336,"children":65337},{"style":360},[65338],{"type":26,"value":65339}," * FILE_READ_PROGRESS: string, FILE_READ_FINISHED: string, FILE_READ_ALL: string,\n",{"type":21,"tag":209,"props":65341,"children":65342},{"class":211,"line":19806},[65343],{"type":21,"tag":209,"props":65344,"children":65345},{"style":360},[65346],{"type":26,"value":65347}," * FILE_UPLOAD_ERROR: string, FILE_UPLOAD_PROGRESS: string, FILE_UPLOAD_PAUSE: string,\n",{"type":21,"tag":209,"props":65349,"children":65350},{"class":211,"line":19814},[65351],{"type":21,"tag":209,"props":65352,"children":65353},{"style":360},[65354],{"type":26,"value":65355}," * FILE_UPLOAD_RESUME: string, FILE_UPLOAD_FINISHED: string, FILE_UPLOAD_ALL: string}}\n",{"type":21,"tag":209,"props":65357,"children":65358},{"class":211,"line":19823},[65359],{"type":21,"tag":209,"props":65360,"children":65361},{"style":448},[65362],{"type":26,"value":755},{"type":21,"tag":209,"props":65364,"children":65365},{"class":211,"line":19831},[65366,65371,65375],{"type":21,"tag":209,"props":65367,"children":65368},{"style":222},[65369],{"type":26,"value":65370},"Hup.state ",{"type":21,"tag":209,"props":65372,"children":65373},{"style":216},[65374],{"type":26,"value":1432},{"type":21,"tag":209,"props":65376,"children":65377},{"style":222},[65378],{"type":26,"value":276},{"type":21,"tag":209,"props":65380,"children":65381},{"class":211,"line":19864},[65382,65387,65392],{"type":21,"tag":209,"props":65383,"children":65384},{"style":222},[65385],{"type":26,"value":65386},"    FILE_LIST_ERROR:",{"type":21,"tag":209,"props":65388,"children":65389},{"style":233},[65390],{"type":26,"value":65391},"'fileListError'",{"type":21,"tag":209,"props":65393,"children":65394},{"style":222},[65395],{"type":26,"value":304},{"type":21,"tag":209,"props":65397,"children":65398},{"class":211,"line":19872},[65399,65404,65409],{"type":21,"tag":209,"props":65400,"children":65401},{"style":222},[65402],{"type":26,"value":65403},"    FILE_LIST_LOADED:",{"type":21,"tag":209,"props":65405,"children":65406},{"style":233},[65407],{"type":26,"value":65408},"'fileListLoaded'",{"type":21,"tag":209,"props":65410,"children":65411},{"style":222},[65412],{"type":26,"value":304},{"type":21,"tag":209,"props":65414,"children":65415},{"class":211,"line":19911},[65416,65421,65426],{"type":21,"tag":209,"props":65417,"children":65418},{"style":222},[65419],{"type":26,"value":65420},"    FILE_READ_ERROR:",{"type":21,"tag":209,"props":65422,"children":65423},{"style":233},[65424],{"type":26,"value":65425},"'fileReadError'",{"type":21,"tag":209,"props":65427,"children":65428},{"style":222},[65429],{"type":26,"value":304},{"type":21,"tag":209,"props":65431,"children":65432},{"class":211,"line":19919},[65433,65438,65443],{"type":21,"tag":209,"props":65434,"children":65435},{"style":222},[65436],{"type":26,"value":65437},"    FILE_READ_PROGRESS:",{"type":21,"tag":209,"props":65439,"children":65440},{"style":233},[65441],{"type":26,"value":65442},"'fileReadProgress'",{"type":21,"tag":209,"props":65444,"children":65445},{"style":222},[65446],{"type":26,"value":304},{"type":21,"tag":209,"props":65448,"children":65449},{"class":211,"line":19973},[65450,65455,65460],{"type":21,"tag":209,"props":65451,"children":65452},{"style":222},[65453],{"type":26,"value":65454},"    FILE_READ_FINISHED:",{"type":21,"tag":209,"props":65456,"children":65457},{"style":233},[65458],{"type":26,"value":65459},"'fileReadFinished'",{"type":21,"tag":209,"props":65461,"children":65462},{"style":222},[65463],{"type":26,"value":304},{"type":21,"tag":209,"props":65465,"children":65466},{"class":211,"line":19985},[65467,65472,65477],{"type":21,"tag":209,"props":65468,"children":65469},{"style":222},[65470],{"type":26,"value":65471},"    FILE_READ_ALL:",{"type":21,"tag":209,"props":65473,"children":65474},{"style":233},[65475],{"type":26,"value":65476},"'fileReadAll'",{"type":21,"tag":209,"props":65478,"children":65479},{"style":222},[65480],{"type":26,"value":304},{"type":21,"tag":209,"props":65482,"children":65483},{"class":211,"line":20006},[65484,65489,65494],{"type":21,"tag":209,"props":65485,"children":65486},{"style":222},[65487],{"type":26,"value":65488},"    FILE_UPLOAD_ERROR:",{"type":21,"tag":209,"props":65490,"children":65491},{"style":233},[65492],{"type":26,"value":65493},"'fileUploadError'",{"type":21,"tag":209,"props":65495,"children":65496},{"style":222},[65497],{"type":26,"value":304},{"type":21,"tag":209,"props":65499,"children":65500},{"class":211,"line":20014},[65501,65506,65511],{"type":21,"tag":209,"props":65502,"children":65503},{"style":222},[65504],{"type":26,"value":65505},"    FILE_UPLOAD_PROGRESS:",{"type":21,"tag":209,"props":65507,"children":65508},{"style":233},[65509],{"type":26,"value":65510},"'fileUploadProgress'",{"type":21,"tag":209,"props":65512,"children":65513},{"style":222},[65514],{"type":26,"value":304},{"type":21,"tag":209,"props":65516,"children":65517},{"class":211,"line":20022},[65518,65523,65528],{"type":21,"tag":209,"props":65519,"children":65520},{"style":222},[65521],{"type":26,"value":65522},"    FILE_UPLOAD_PAUSE:",{"type":21,"tag":209,"props":65524,"children":65525},{"style":233},[65526],{"type":26,"value":65527},"'fileUploadPause'",{"type":21,"tag":209,"props":65529,"children":65530},{"style":222},[65531],{"type":26,"value":304},{"type":21,"tag":209,"props":65533,"children":65534},{"class":211,"line":20061},[65535,65540,65545],{"type":21,"tag":209,"props":65536,"children":65537},{"style":222},[65538],{"type":26,"value":65539},"    FILE_UPLOAD_RESUME:",{"type":21,"tag":209,"props":65541,"children":65542},{"style":233},[65543],{"type":26,"value":65544},"'fileUploadResume'",{"type":21,"tag":209,"props":65546,"children":65547},{"style":222},[65548],{"type":26,"value":304},{"type":21,"tag":209,"props":65550,"children":65551},{"class":211,"line":20073},[65552,65557,65562],{"type":21,"tag":209,"props":65553,"children":65554},{"style":222},[65555],{"type":26,"value":65556},"    FILE_UPLOAD_FINISHED:",{"type":21,"tag":209,"props":65558,"children":65559},{"style":233},[65560],{"type":26,"value":65561},"'fileUploadFinished'",{"type":21,"tag":209,"props":65563,"children":65564},{"style":222},[65565],{"type":26,"value":304},{"type":21,"tag":209,"props":65567,"children":65568},{"class":211,"line":20081},[65569,65574],{"type":21,"tag":209,"props":65570,"children":65571},{"style":222},[65572],{"type":26,"value":65573},"    FILE_UPLOAD_ALL:",{"type":21,"tag":209,"props":65575,"children":65576},{"style":233},[65577],{"type":26,"value":65578},"'fileUploadAll'\n",{"type":21,"tag":209,"props":65580,"children":65581},{"class":211,"line":20089},[65582],{"type":21,"tag":209,"props":65583,"children":65584},{"style":222},[65585],{"type":26,"value":340},{"type":21,"tag":209,"props":65587,"children":65588},{"class":211,"line":20114},[65589],{"type":21,"tag":209,"props":65590,"children":65591},{"emptyLinePlaceholder":248},[65592],{"type":26,"value":251},{"type":21,"tag":209,"props":65594,"children":65595},{"class":211,"line":20122},[65596],{"type":21,"tag":209,"props":65597,"children":65598},{"style":448},[65599],{"type":26,"value":731},{"type":21,"tag":209,"props":65601,"children":65602},{"class":211,"line":20143},[65603],{"type":21,"tag":209,"props":65604,"children":65605},{"style":448},[65606],{"type":26,"value":65607}," * Deferred wrapper for xhr upload.\n",{"type":21,"tag":209,"props":65609,"children":65610},{"class":211,"line":20152},[65611,65615,65619],{"type":21,"tag":209,"props":65612,"children":65613},{"style":448},[65614],{"type":26,"value":39750},{"type":21,"tag":209,"props":65616,"children":65617},{"style":216},[65618],{"type":26,"value":13311},{"type":21,"tag":209,"props":65620,"children":65621},{"style":222},[65622],{"type":26,"value":60712},{"type":21,"tag":209,"props":65624,"children":65625},{"class":211,"line":20161},[65626,65630,65634],{"type":21,"tag":209,"props":65627,"children":65628},{"style":448},[65629],{"type":26,"value":39750},{"type":21,"tag":209,"props":65631,"children":65632},{"style":216},[65633],{"type":26,"value":13311},{"type":21,"tag":209,"props":65635,"children":65636},{"style":222},[65637],{"type":26,"value":60728},{"type":21,"tag":209,"props":65639,"children":65640},{"class":211,"line":20206},[65641,65645,65649,65653],{"type":21,"tag":209,"props":65642,"children":65643},{"style":448},[65644],{"type":26,"value":39750},{"type":21,"tag":209,"props":65646,"children":65647},{"style":216},[65648],{"type":26,"value":13333},{"type":21,"tag":209,"props":65650,"children":65651},{"style":360},[65652],{"type":26,"value":60744},{"type":21,"tag":209,"props":65654,"children":65655},{"style":448},[65656],{"type":26,"value":60749},{"type":21,"tag":209,"props":65658,"children":65659},{"class":211,"line":20214},[65660,65664],{"type":21,"tag":209,"props":65661,"children":65662},{"style":448},[65663],{"type":26,"value":39750},{"type":21,"tag":209,"props":65665,"children":65666},{"style":216},[65667],{"type":26,"value":41933},{"type":21,"tag":209,"props":65669,"children":65670},{"class":211,"line":20222},[65671],{"type":21,"tag":209,"props":65672,"children":65673},{"style":448},[65674],{"type":26,"value":755},{"type":21,"tag":209,"props":65676,"children":65677},{"class":211,"line":20231},[65678,65682,65686,65690,65694,65698,65702],{"type":21,"tag":209,"props":65679,"children":65680},{"style":216},[65681],{"type":26,"value":4622},{"type":21,"tag":209,"props":65683,"children":65684},{"style":360},[65685],{"type":26,"value":53645},{"type":21,"tag":209,"props":65687,"children":65688},{"style":222},[65689],{"type":26,"value":368},{"type":21,"tag":209,"props":65691,"children":65692},{"style":400},[65693],{"type":26,"value":28349},{"type":21,"tag":209,"props":65695,"children":65696},{"style":222},[65697],{"type":26,"value":408},{"type":21,"tag":209,"props":65699,"children":65700},{"style":400},[65701],{"type":26,"value":60795},{"type":21,"tag":209,"props":65703,"children":65704},{"style":222},[65705],{"type":26,"value":2369},{"type":21,"tag":209,"props":65707,"children":65708},{"class":211,"line":20240},[65709,65713,65717,65721,65725],{"type":21,"tag":209,"props":65710,"children":65711},{"style":216},[65712],{"type":26,"value":16994},{"type":21,"tag":209,"props":65714,"children":65715},{"style":222},[65716],{"type":26,"value":52897},{"type":21,"tag":209,"props":65718,"children":65719},{"style":216},[65720],{"type":26,"value":1432},{"type":21,"tag":209,"props":65722,"children":65723},{"style":263},[65724],{"type":26,"value":20502},{"type":21,"tag":209,"props":65726,"children":65727},{"style":222},[65728],{"type":26,"value":241},{"type":21,"tag":209,"props":65730,"children":65731},{"class":211,"line":20288},[65732],{"type":21,"tag":209,"props":65733,"children":65734},{"emptyLinePlaceholder":248},[65735],{"type":26,"value":251},{"type":21,"tag":209,"props":65737,"children":65738},{"class":211,"line":20305},[65739,65743,65747,65751,65755,65759],{"type":21,"tag":209,"props":65740,"children":65741},{"style":263},[65742],{"type":26,"value":46760},{"type":21,"tag":209,"props":65744,"children":65745},{"style":222},[65746],{"type":26,"value":60841},{"type":21,"tag":209,"props":65748,"children":65749},{"style":216},[65750],{"type":26,"value":1432},{"type":21,"tag":209,"props":65752,"children":65753},{"style":222},[65754],{"type":26,"value":25427},{"type":21,"tag":209,"props":65756,"children":65757},{"style":360},[65758],{"type":26,"value":25432},{"type":21,"tag":209,"props":65760,"children":65761},{"style":222},[65762],{"type":26,"value":4123},{"type":21,"tag":209,"props":65764,"children":65765},{"class":211,"line":20313},[65766,65770,65774,65778],{"type":21,"tag":209,"props":65767,"children":65768},{"style":263},[65769],{"type":26,"value":46760},{"type":21,"tag":209,"props":65771,"children":65772},{"style":222},[65773],{"type":26,"value":60869},{"type":21,"tag":209,"props":65775,"children":65776},{"style":216},[65777],{"type":26,"value":1432},{"type":21,"tag":209,"props":65779,"children":65780},{"style":222},[65781],{"type":26,"value":60878},{"type":21,"tag":209,"props":65783,"children":65784},{"class":211,"line":27786},[65785,65789,65793,65797],{"type":21,"tag":209,"props":65786,"children":65787},{"style":263},[65788],{"type":26,"value":46760},{"type":21,"tag":209,"props":65790,"children":65791},{"style":222},[65792],{"type":26,"value":60890},{"type":21,"tag":209,"props":65794,"children":65795},{"style":216},[65796],{"type":26,"value":1432},{"type":21,"tag":209,"props":65798,"children":65799},{"style":222},[65800],{"type":26,"value":60899},{"type":21,"tag":209,"props":65802,"children":65803},{"class":211,"line":27794},[65804,65808,65812,65816,65820],{"type":21,"tag":209,"props":65805,"children":65806},{"style":263},[65807],{"type":26,"value":46760},{"type":21,"tag":209,"props":65809,"children":65810},{"style":222},[65811],{"type":26,"value":60911},{"type":21,"tag":209,"props":65813,"children":65814},{"style":216},[65815],{"type":26,"value":1432},{"type":21,"tag":209,"props":65817,"children":65818},{"style":263},[65819],{"type":26,"value":14038},{"type":21,"tag":209,"props":65821,"children":65822},{"style":222},[65823],{"type":26,"value":241},{"type":21,"tag":209,"props":65825,"children":65826},{"class":211,"line":27802},[65827,65831,65835,65839,65843],{"type":21,"tag":209,"props":65828,"children":65829},{"style":263},[65830],{"type":26,"value":46760},{"type":21,"tag":209,"props":65832,"children":65833},{"style":222},[65834],{"type":26,"value":55332},{"type":21,"tag":209,"props":65836,"children":65837},{"style":216},[65838],{"type":26,"value":1432},{"type":21,"tag":209,"props":65840,"children":65841},{"style":263},[65842],{"type":26,"value":8009},{"type":21,"tag":209,"props":65844,"children":65845},{"style":222},[65846],{"type":26,"value":241},{"type":21,"tag":209,"props":65848,"children":65849},{"class":211,"line":27811},[65850,65854,65859,65863,65868,65872,65877,65881,65886,65890,65895],{"type":21,"tag":209,"props":65851,"children":65852},{"style":263},[65853],{"type":26,"value":46760},{"type":21,"tag":209,"props":65855,"children":65856},{"style":222},[65857],{"type":26,"value":65858},".time ",{"type":21,"tag":209,"props":65860,"children":65861},{"style":216},[65862],{"type":26,"value":1432},{"type":21,"tag":209,"props":65864,"children":65865},{"style":222},[65866],{"type":26,"value":65867}," {start:",{"type":21,"tag":209,"props":65869,"children":65870},{"style":263},[65871],{"type":26,"value":8554},{"type":21,"tag":209,"props":65873,"children":65874},{"style":222},[65875],{"type":26,"value":65876},", end:",{"type":21,"tag":209,"props":65878,"children":65879},{"style":263},[65880],{"type":26,"value":8554},{"type":21,"tag":209,"props":65882,"children":65883},{"style":222},[65884],{"type":26,"value":65885},", speed:",{"type":21,"tag":209,"props":65887,"children":65888},{"style":263},[65889],{"type":26,"value":8554},{"type":21,"tag":209,"props":65891,"children":65892},{"style":222},[65893],{"type":26,"value":65894},"}; ",{"type":21,"tag":209,"props":65896,"children":65897},{"style":448},[65898],{"type":26,"value":65899},"// Speed is measured in bytes per second\n",{"type":21,"tag":209,"props":65901,"children":65902},{"class":211,"line":27831},[65903,65907,65911,65915,65919,65923],{"type":21,"tag":209,"props":65904,"children":65905},{"style":263},[65906],{"type":26,"value":46760},{"type":21,"tag":209,"props":65908,"children":65909},{"style":222},[65910],{"type":26,"value":60958},{"type":21,"tag":209,"props":65912,"children":65913},{"style":216},[65914],{"type":26,"value":1432},{"type":21,"tag":209,"props":65916,"children":65917},{"style":216},[65918],{"type":26,"value":6371},{"type":21,"tag":209,"props":65920,"children":65921},{"style":360},[65922],{"type":26,"value":20437},{"type":21,"tag":209,"props":65924,"children":65925},{"style":222},[65926],{"type":26,"value":4123},{"type":21,"tag":209,"props":65928,"children":65929},{"class":211,"line":27839},[65930],{"type":21,"tag":209,"props":65931,"children":65932},{"emptyLinePlaceholder":248},[65933],{"type":26,"value":251},{"type":21,"tag":209,"props":65935,"children":65936},{"class":211,"line":27847},[65937,65941,65945,65949],{"type":21,"tag":209,"props":65938,"children":65939},{"style":216},[65940],{"type":26,"value":9249},{"type":21,"tag":209,"props":65942,"children":65943},{"style":222},[65944],{"type":26,"value":5569},{"type":21,"tag":209,"props":65946,"children":65947},{"style":263},[65948],{"type":26,"value":2508},{"type":21,"tag":209,"props":65950,"children":65951},{"style":222},[65952],{"type":26,"value":55370},{"type":21,"tag":209,"props":65954,"children":65955},{"class":211,"line":27868},[65956],{"type":21,"tag":209,"props":65957,"children":65958},{"style":222},[65959],{"type":26,"value":32675},{"type":21,"tag":209,"props":65961,"children":65962},{"class":211,"line":27896},[65963,65967,65971,65975,65979],{"type":21,"tag":209,"props":65964,"children":65965},{"style":263},[65966],{"type":26,"value":47121},{"type":21,"tag":209,"props":65968,"children":65969},{"style":222},[65970],{"type":26,"value":61019},{"type":21,"tag":209,"props":65972,"children":65973},{"style":216},[65974],{"type":26,"value":1432},{"type":21,"tag":209,"props":65976,"children":65977},{"style":263},[65978],{"type":26,"value":8009},{"type":21,"tag":209,"props":65980,"children":65981},{"style":222},[65982],{"type":26,"value":241},{"type":21,"tag":209,"props":65984,"children":65985},{"class":211,"line":27929},[65986,65990,65994,65998,66002,66006,66010,66014,66018,66022,66026,66030,66034],{"type":21,"tag":209,"props":65987,"children":65988},{"style":263},[65989],{"type":26,"value":47121},{"type":21,"tag":209,"props":65991,"children":65992},{"style":222},[65993],{"type":26,"value":61043},{"type":21,"tag":209,"props":65995,"children":65996},{"style":216},[65997],{"type":26,"value":1432},{"type":21,"tag":209,"props":65999,"children":66000},{"style":222},[66001],{"type":26,"value":61052},{"type":21,"tag":209,"props":66003,"children":66004},{"style":360},[66005],{"type":26,"value":61057},{"type":21,"tag":209,"props":66007,"children":66008},{"style":222},[66009],{"type":26,"value":368},{"type":21,"tag":209,"props":66011,"children":66012},{"style":263},[66013],{"type":26,"value":2508},{"type":21,"tag":209,"props":66015,"children":66016},{"style":222},[66017],{"type":26,"value":61070},{"type":21,"tag":209,"props":66019,"children":66020},{"style":216},[66021],{"type":26,"value":17170},{"type":21,"tag":209,"props":66023,"children":66024},{"style":263},[66025],{"type":26,"value":2508},{"type":21,"tag":209,"props":66027,"children":66028},{"style":222},[66029],{"type":26,"value":61083},{"type":21,"tag":209,"props":66031,"children":66032},{"style":263},[66033],{"type":26,"value":2508},{"type":21,"tag":209,"props":66035,"children":66036},{"style":222},[66037],{"type":26,"value":55420},{"type":21,"tag":209,"props":66039,"children":66040},{"class":211,"line":27937},[66041],{"type":21,"tag":209,"props":66042,"children":66043},{"style":222},[66044],{"type":26,"value":331},{"type":21,"tag":209,"props":66046,"children":66047},{"class":211,"line":27962},[66048],{"type":21,"tag":209,"props":66049,"children":66050},{"emptyLinePlaceholder":248},[66051],{"type":26,"value":251},{"type":21,"tag":209,"props":66053,"children":66054},{"class":211,"line":27970},[66055,66059,66063,66067,66071,66075,66079,66083,66087,66091,66095,66099],{"type":21,"tag":209,"props":66056,"children":66057},{"style":263},[66058],{"type":26,"value":46760},{"type":21,"tag":209,"props":66060,"children":66061},{"style":222},[66062],{"type":26,"value":61117},{"type":21,"tag":209,"props":66064,"children":66065},{"style":360},[66066],{"type":26,"value":14995},{"type":21,"tag":209,"props":66068,"children":66069},{"style":222},[66070],{"type":26,"value":368},{"type":21,"tag":209,"props":66072,"children":66073},{"style":233},[66074],{"type":26,"value":20469},{"type":21,"tag":209,"props":66076,"children":66077},{"style":222},[66078],{"type":26,"value":408},{"type":21,"tag":209,"props":66080,"children":66081},{"style":216},[66082],{"type":26,"value":4622},{"type":21,"tag":209,"props":66084,"children":66085},{"style":222},[66086],{"type":26,"value":61142},{"type":21,"tag":209,"props":66088,"children":66089},{"style":360},[66090],{"type":26,"value":61147},{"type":21,"tag":209,"props":66092,"children":66093},{"style":222},[66094],{"type":26,"value":61152},{"type":21,"tag":209,"props":66096,"children":66097},{"style":263},[66098],{"type":26,"value":4243},{"type":21,"tag":209,"props":66100,"children":66101},{"style":222},[66102],{"type":26,"value":2608},{"type":21,"tag":209,"props":66104,"children":66105},{"class":211,"line":28002},[66106,66110,66114,66118,66122,66126,66130,66134,66138,66142,66146,66150,66154,66158],{"type":21,"tag":209,"props":66107,"children":66108},{"style":263},[66109],{"type":26,"value":46760},{"type":21,"tag":209,"props":66111,"children":66112},{"style":222},[66113],{"type":26,"value":61172},{"type":21,"tag":209,"props":66115,"children":66116},{"style":360},[66117],{"type":26,"value":14995},{"type":21,"tag":209,"props":66119,"children":66120},{"style":222},[66121],{"type":26,"value":368},{"type":21,"tag":209,"props":66123,"children":66124},{"style":233},[66125],{"type":26,"value":61185},{"type":21,"tag":209,"props":66127,"children":66128},{"style":222},[66129],{"type":26,"value":408},{"type":21,"tag":209,"props":66131,"children":66132},{"style":216},[66133],{"type":26,"value":4622},{"type":21,"tag":209,"props":66135,"children":66136},{"style":222},[66137],{"type":26,"value":368},{"type":21,"tag":209,"props":66139,"children":66140},{"style":400},[66141],{"type":26,"value":25805},{"type":21,"tag":209,"props":66143,"children":66144},{"style":222},[66145],{"type":26,"value":61206},{"type":21,"tag":209,"props":66147,"children":66148},{"style":360},[66149],{"type":26,"value":55281},{"type":21,"tag":209,"props":66151,"children":66152},{"style":222},[66153],{"type":26,"value":61215},{"type":21,"tag":209,"props":66155,"children":66156},{"style":263},[66157],{"type":26,"value":4243},{"type":21,"tag":209,"props":66159,"children":66160},{"style":222},[66161],{"type":26,"value":2608},{"type":21,"tag":209,"props":66163,"children":66164},{"class":211,"line":28018},[66165,66169,66173,66177,66181,66185,66189,66193,66197,66201,66205,66209,66213,66217],{"type":21,"tag":209,"props":66166,"children":66167},{"style":263},[66168],{"type":26,"value":46760},{"type":21,"tag":209,"props":66170,"children":66171},{"style":222},[66172],{"type":26,"value":61172},{"type":21,"tag":209,"props":66174,"children":66175},{"style":360},[66176],{"type":26,"value":14995},{"type":21,"tag":209,"props":66178,"children":66179},{"style":222},[66180],{"type":26,"value":368},{"type":21,"tag":209,"props":66182,"children":66183},{"style":233},[66184],{"type":26,"value":20588},{"type":21,"tag":209,"props":66186,"children":66187},{"style":222},[66188],{"type":26,"value":408},{"type":21,"tag":209,"props":66190,"children":66191},{"style":216},[66192],{"type":26,"value":4622},{"type":21,"tag":209,"props":66194,"children":66195},{"style":222},[66196],{"type":26,"value":368},{"type":21,"tag":209,"props":66198,"children":66199},{"style":400},[66200],{"type":26,"value":25805},{"type":21,"tag":209,"props":66202,"children":66203},{"style":222},[66204],{"type":26,"value":61206},{"type":21,"tag":209,"props":66206,"children":66207},{"style":360},[66208],{"type":26,"value":61271},{"type":21,"tag":209,"props":66210,"children":66211},{"style":222},[66212],{"type":26,"value":61215},{"type":21,"tag":209,"props":66214,"children":66215},{"style":263},[66216],{"type":26,"value":4243},{"type":21,"tag":209,"props":66218,"children":66219},{"style":222},[66220],{"type":26,"value":2608},{"type":21,"tag":209,"props":66222,"children":66223},{"class":211,"line":28034},[66224],{"type":21,"tag":209,"props":66225,"children":66226},{"emptyLinePlaceholder":248},[66227],{"type":26,"value":251},{"type":21,"tag":209,"props":66229,"children":66230},{"class":211,"line":28042},[66231,66235,66239,66243],{"type":21,"tag":209,"props":66232,"children":66233},{"style":263},[66234],{"type":26,"value":46760},{"type":21,"tag":209,"props":66236,"children":66237},{"style":222},[66238],{"type":26,"value":378},{"type":21,"tag":209,"props":66240,"children":66241},{"style":360},[66242],{"type":26,"value":31175},{"type":21,"tag":209,"props":66244,"children":66245},{"style":222},[66246],{"type":26,"value":4123},{"type":21,"tag":209,"props":66248,"children":66249},{"class":211,"line":28050},[66250],{"type":21,"tag":209,"props":66251,"children":66252},{"emptyLinePlaceholder":248},[66253],{"type":26,"value":251},{"type":21,"tag":209,"props":66255,"children":66256},{"class":211,"line":28074},[66257,66261,66265,66269,66273],{"type":21,"tag":209,"props":66258,"children":66259},{"style":216},[66260],{"type":26,"value":1298},{"type":21,"tag":209,"props":66262,"children":66263},{"style":263},[66264],{"type":26,"value":20502},{"type":21,"tag":209,"props":66266,"children":66267},{"style":222},[66268],{"type":26,"value":55615},{"type":21,"tag":209,"props":66270,"children":66271},{"style":360},[66272],{"type":26,"value":26332},{"type":21,"tag":209,"props":66274,"children":66275},{"style":222},[66276],{"type":26,"value":4123},{"type":21,"tag":209,"props":66278,"children":66279},{"class":211,"line":28098},[66280],{"type":21,"tag":209,"props":66281,"children":66282},{"style":222},[66283],{"type":26,"value":4415},{"type":21,"tag":209,"props":66285,"children":66286},{"class":211,"line":28115},[66287],{"type":21,"tag":209,"props":66288,"children":66289},{"emptyLinePlaceholder":248},[66290],{"type":26,"value":251},{"type":21,"tag":209,"props":66292,"children":66293},{"class":211,"line":28124},[66294],{"type":21,"tag":209,"props":66295,"children":66296},{"style":448},[66297],{"type":26,"value":731},{"type":21,"tag":209,"props":66299,"children":66300},{"class":211,"line":28132},[66301],{"type":21,"tag":209,"props":66302,"children":66303},{"style":448},[66304],{"type":26,"value":61368},{"type":21,"tag":209,"props":66306,"children":66307},{"class":211,"line":28145},[66308],{"type":21,"tag":209,"props":66309,"children":66310},{"style":448},[66311],{"type":26,"value":755},{"type":21,"tag":209,"props":66313,"children":66314},{"class":211,"line":28153},[66315,66319,66323,66327,66331,66335,66339,66343],{"type":21,"tag":209,"props":66316,"children":66317},{"style":263},[66318],{"type":26,"value":55264},{"type":21,"tag":209,"props":66320,"children":66321},{"style":222},[66322],{"type":26,"value":378},{"type":21,"tag":209,"props":66324,"children":66325},{"style":263},[66326],{"type":26,"value":32662},{"type":21,"tag":209,"props":66328,"children":66329},{"style":222},[66330],{"type":26,"value":378},{"type":21,"tag":209,"props":66332,"children":66333},{"style":360},[66334],{"type":26,"value":31175},{"type":21,"tag":209,"props":66336,"children":66337},{"style":216},[66338],{"type":26,"value":271},{"type":21,"tag":209,"props":66340,"children":66341},{"style":216},[66342],{"type":26,"value":4789},{"type":21,"tag":209,"props":66344,"children":66345},{"style":222},[66346],{"type":26,"value":2561},{"type":21,"tag":209,"props":66348,"children":66349},{"class":211,"line":28161},[66350,66354,66359,66363,66367,66371],{"type":21,"tag":209,"props":66351,"children":66352},{"style":263},[66353],{"type":26,"value":46760},{"type":21,"tag":209,"props":66355,"children":66356},{"style":222},[66357],{"type":26,"value":66358},".time.start ",{"type":21,"tag":209,"props":66360,"children":66361},{"style":216},[66362],{"type":26,"value":1432},{"type":21,"tag":209,"props":66364,"children":66365},{"style":216},[66366],{"type":26,"value":20050},{"type":21,"tag":209,"props":66368,"children":66369},{"style":360},[66370],{"type":26,"value":17189},{"type":21,"tag":209,"props":66372,"children":66373},{"style":222},[66374],{"type":26,"value":4123},{"type":21,"tag":209,"props":66376,"children":66377},{"class":211,"line":28181},[66378],{"type":21,"tag":209,"props":66379,"children":66380},{"emptyLinePlaceholder":248},[66381],{"type":26,"value":251},{"type":21,"tag":209,"props":66383,"children":66384},{"class":211,"line":28189},[66385,66389,66393,66397,66401,66405,66409,66413,66417,66421],{"type":21,"tag":209,"props":66386,"children":66387},{"style":263},[66388],{"type":26,"value":46760},{"type":21,"tag":209,"props":66390,"children":66391},{"style":222},[66392],{"type":26,"value":61117},{"type":21,"tag":209,"props":66394,"children":66395},{"style":360},[66396],{"type":26,"value":20680},{"type":21,"tag":209,"props":66398,"children":66399},{"style":222},[66400],{"type":26,"value":368},{"type":21,"tag":209,"props":66402,"children":66403},{"style":263},[66404],{"type":26,"value":2508},{"type":21,"tag":209,"props":66406,"children":66407},{"style":222},[66408],{"type":26,"value":61445},{"type":21,"tag":209,"props":66410,"children":66411},{"style":263},[66412],{"type":26,"value":2508},{"type":21,"tag":209,"props":66414,"children":66415},{"style":222},[66416],{"type":26,"value":61454},{"type":21,"tag":209,"props":66418,"children":66419},{"style":263},[66420],{"type":26,"value":2508},{"type":21,"tag":209,"props":66422,"children":66423},{"style":222},[66424],{"type":26,"value":61463},{"type":21,"tag":209,"props":66426,"children":66427},{"class":211,"line":28197},[66428,66432,66436,66440,66444,66448,66452,66456],{"type":21,"tag":209,"props":66429,"children":66430},{"style":263},[66431],{"type":26,"value":46760},{"type":21,"tag":209,"props":66433,"children":66434},{"style":222},[66435],{"type":26,"value":61117},{"type":21,"tag":209,"props":66437,"children":66438},{"style":360},[66439],{"type":26,"value":56746},{"type":21,"tag":209,"props":66441,"children":66442},{"style":222},[66443],{"type":26,"value":368},{"type":21,"tag":209,"props":66445,"children":66446},{"style":233},[66447],{"type":26,"value":61487},{"type":21,"tag":209,"props":66449,"children":66450},{"style":222},[66451],{"type":26,"value":408},{"type":21,"tag":209,"props":66453,"children":66454},{"style":233},[66455],{"type":26,"value":10754},{"type":21,"tag":209,"props":66457,"children":66458},{"style":222},[66459],{"type":26,"value":2608},{"type":21,"tag":209,"props":66461,"children":66463},{"class":211,"line":66462},191,[66464,66468,66472,66476,66480,66484,66488,66492],{"type":21,"tag":209,"props":66465,"children":66466},{"style":263},[66467],{"type":26,"value":46760},{"type":21,"tag":209,"props":66469,"children":66470},{"style":222},[66471],{"type":26,"value":61117},{"type":21,"tag":209,"props":66473,"children":66474},{"style":360},[66475],{"type":26,"value":56746},{"type":21,"tag":209,"props":66477,"children":66478},{"style":222},[66479],{"type":26,"value":368},{"type":21,"tag":209,"props":66481,"children":66482},{"style":233},[66483],{"type":26,"value":61523},{"type":21,"tag":209,"props":66485,"children":66486},{"style":222},[66487],{"type":26,"value":408},{"type":21,"tag":209,"props":66489,"children":66490},{"style":263},[66491],{"type":26,"value":2508},{"type":21,"tag":209,"props":66493,"children":66494},{"style":222},[66495],{"type":26,"value":61536},{"type":21,"tag":209,"props":66497,"children":66499},{"class":211,"line":66498},192,[66500,66504,66508,66512,66516,66520,66524,66528],{"type":21,"tag":209,"props":66501,"children":66502},{"style":263},[66503],{"type":26,"value":46760},{"type":21,"tag":209,"props":66505,"children":66506},{"style":222},[66507],{"type":26,"value":61117},{"type":21,"tag":209,"props":66509,"children":66510},{"style":360},[66511],{"type":26,"value":56746},{"type":21,"tag":209,"props":66513,"children":66514},{"style":222},[66515],{"type":26,"value":368},{"type":21,"tag":209,"props":66517,"children":66518},{"style":233},[66519],{"type":26,"value":61560},{"type":21,"tag":209,"props":66521,"children":66522},{"style":222},[66523],{"type":26,"value":408},{"type":21,"tag":209,"props":66525,"children":66526},{"style":263},[66527],{"type":26,"value":2508},{"type":21,"tag":209,"props":66529,"children":66530},{"style":222},[66531],{"type":26,"value":61573},{"type":21,"tag":209,"props":66533,"children":66535},{"class":211,"line":66534},193,[66536],{"type":21,"tag":209,"props":66537,"children":66538},{"emptyLinePlaceholder":248},[66539],{"type":26,"value":251},{"type":21,"tag":209,"props":66541,"children":66543},{"class":211,"line":66542},194,[66544,66548,66552,66556],{"type":21,"tag":209,"props":66545,"children":66546},{"style":216},[66547],{"type":26,"value":9249},{"type":21,"tag":209,"props":66549,"children":66550},{"style":222},[66551],{"type":26,"value":5569},{"type":21,"tag":209,"props":66553,"children":66554},{"style":263},[66555],{"type":26,"value":2508},{"type":21,"tag":209,"props":66557,"children":66558},{"style":222},[66559],{"type":26,"value":55370},{"type":21,"tag":209,"props":66561,"children":66563},{"class":211,"line":66562},195,[66564],{"type":21,"tag":209,"props":66565,"children":66566},{"style":222},[66567],{"type":26,"value":32675},{"type":21,"tag":209,"props":66569,"children":66571},{"class":211,"line":66570},196,[66572,66576,66580,66584,66588,66592],{"type":21,"tag":209,"props":66573,"children":66574},{"style":263},[66575],{"type":26,"value":47121},{"type":21,"tag":209,"props":66577,"children":66578},{"style":222},[66579],{"type":26,"value":61117},{"type":21,"tag":209,"props":66581,"children":66582},{"style":360},[66583],{"type":26,"value":61622},{"type":21,"tag":209,"props":66585,"children":66586},{"style":222},[66587],{"type":26,"value":368},{"type":21,"tag":209,"props":66589,"children":66590},{"style":233},[66591],{"type":26,"value":16177},{"type":21,"tag":209,"props":66593,"children":66594},{"style":222},[66595],{"type":26,"value":2608},{"type":21,"tag":209,"props":66597,"children":66599},{"class":211,"line":66598},197,[66600,66604,66608,66612,66616,66620,66624,66628,66632,66636,66640,66644,66648,66652,66656,66660,66664,66669,66673,66677],{"type":21,"tag":209,"props":66601,"children":66602},{"style":263},[66603],{"type":26,"value":47121},{"type":21,"tag":209,"props":66605,"children":66606},{"style":222},[66607],{"type":26,"value":61117},{"type":21,"tag":209,"props":66609,"children":66610},{"style":360},[66611],{"type":26,"value":56746},{"type":21,"tag":209,"props":66613,"children":66614},{"style":222},[66615],{"type":26,"value":368},{"type":21,"tag":209,"props":66617,"children":66618},{"style":233},[66619],{"type":26,"value":61658},{"type":21,"tag":209,"props":66621,"children":66622},{"style":222},[66623],{"type":26,"value":408},{"type":21,"tag":209,"props":66625,"children":66626},{"style":233},[66627],{"type":26,"value":61667},{"type":21,"tag":209,"props":66629,"children":66630},{"style":216},[66631],{"type":26,"value":17170},{"type":21,"tag":209,"props":66633,"children":66634},{"style":263},[66635],{"type":26,"value":2508},{"type":21,"tag":209,"props":66637,"children":66638},{"style":222},[66639],{"type":26,"value":61070},{"type":21,"tag":209,"props":66641,"children":66642},{"style":216},[66643],{"type":26,"value":17170},{"type":21,"tag":209,"props":66645,"children":66646},{"style":233},[66647],{"type":26,"value":61688},{"type":21,"tag":209,"props":66649,"children":66650},{"style":216},[66651],{"type":26,"value":17170},{"type":21,"tag":209,"props":66653,"children":66654},{"style":263},[66655],{"type":26,"value":2508},{"type":21,"tag":209,"props":66657,"children":66658},{"style":222},[66659],{"type":26,"value":55407},{"type":21,"tag":209,"props":66661,"children":66662},{"style":216},[66663],{"type":26,"value":17170},{"type":21,"tag":209,"props":66665,"children":66666},{"style":233},[66667],{"type":26,"value":66668},"\"/\"",{"type":21,"tag":209,"props":66670,"children":66671},{"style":216},[66672],{"type":26,"value":17170},{"type":21,"tag":209,"props":66674,"children":66675},{"style":263},[66676],{"type":26,"value":2508},{"type":21,"tag":209,"props":66678,"children":66679},{"style":222},[66680],{"type":26,"value":55420},{"type":21,"tag":209,"props":66682,"children":66684},{"class":211,"line":66683},198,[66685,66689,66693,66697,66701,66705,66709,66713,66717,66721,66725,66729],{"type":21,"tag":209,"props":66686,"children":66687},{"style":263},[66688],{"type":26,"value":47121},{"type":21,"tag":209,"props":66690,"children":66691},{"style":222},[66692],{"type":26,"value":61117},{"type":21,"tag":209,"props":66694,"children":66695},{"style":360},[66696],{"type":26,"value":6696},{"type":21,"tag":209,"props":66698,"children":66699},{"style":222},[66700],{"type":26,"value":368},{"type":21,"tag":209,"props":66702,"children":66703},{"style":263},[66704],{"type":26,"value":2508},{"type":21,"tag":209,"props":66706,"children":66707},{"style":222},[66708],{"type":26,"value":61748},{"type":21,"tag":209,"props":66710,"children":66711},{"style":360},[66712],{"type":26,"value":42188},{"type":21,"tag":209,"props":66714,"children":66715},{"style":222},[66716],{"type":26,"value":368},{"type":21,"tag":209,"props":66718,"children":66719},{"style":263},[66720],{"type":26,"value":2508},{"type":21,"tag":209,"props":66722,"children":66723},{"style":222},[66724],{"type":26,"value":61765},{"type":21,"tag":209,"props":66726,"children":66727},{"style":263},[66728],{"type":26,"value":2508},{"type":21,"tag":209,"props":66730,"children":66731},{"style":222},[66732],{"type":26,"value":61774},{"type":21,"tag":209,"props":66734,"children":66736},{"class":211,"line":66735},199,[66737],{"type":21,"tag":209,"props":66738,"children":66739},{"style":222},[66740],{"type":26,"value":331},{"type":21,"tag":209,"props":66742,"children":66744},{"class":211,"line":66743},200,[66745],{"type":21,"tag":209,"props":66746,"children":66747},{"style":216},[66748],{"type":26,"value":61789},{"type":21,"tag":209,"props":66750,"children":66752},{"class":211,"line":66751},201,[66753],{"type":21,"tag":209,"props":66754,"children":66755},{"style":222},[66756],{"type":26,"value":32675},{"type":21,"tag":209,"props":66758,"children":66760},{"class":211,"line":66759},202,[66761,66765,66769,66773,66777,66781,66785,66789,66793],{"type":21,"tag":209,"props":66762,"children":66763},{"style":263},[66764],{"type":26,"value":47121},{"type":21,"tag":209,"props":66766,"children":66767},{"style":222},[66768],{"type":26,"value":61117},{"type":21,"tag":209,"props":66770,"children":66771},{"style":360},[66772],{"type":26,"value":61622},{"type":21,"tag":209,"props":66774,"children":66775},{"style":222},[66776],{"type":26,"value":2709},{"type":21,"tag":209,"props":66778,"children":66779},{"style":263},[66780],{"type":26,"value":2508},{"type":21,"tag":209,"props":66782,"children":66783},{"style":222},[66784],{"type":26,"value":61824},{"type":21,"tag":209,"props":66786,"children":66787},{"style":216},[66788],{"type":26,"value":13270},{"type":21,"tag":209,"props":66790,"children":66791},{"style":233},[66792],{"type":26,"value":61833},{"type":21,"tag":209,"props":66794,"children":66795},{"style":222},[66796],{"type":26,"value":4212},{"type":21,"tag":209,"props":66798,"children":66800},{"class":211,"line":66799},203,[66801,66805,66809,66813,66817,66821],{"type":21,"tag":209,"props":66802,"children":66803},{"style":263},[66804],{"type":26,"value":47121},{"type":21,"tag":209,"props":66806,"children":66807},{"style":222},[66808],{"type":26,"value":61117},{"type":21,"tag":209,"props":66810,"children":66811},{"style":360},[66812],{"type":26,"value":6696},{"type":21,"tag":209,"props":66814,"children":66815},{"style":222},[66816],{"type":26,"value":368},{"type":21,"tag":209,"props":66818,"children":66819},{"style":263},[66820],{"type":26,"value":2508},{"type":21,"tag":209,"props":66822,"children":66823},{"style":222},[66824],{"type":26,"value":61865},{"type":21,"tag":209,"props":66826,"children":66828},{"class":211,"line":66827},204,[66829],{"type":21,"tag":209,"props":66830,"children":66831},{"style":222},[66832],{"type":26,"value":331},{"type":21,"tag":209,"props":66834,"children":66836},{"class":211,"line":66835},205,[66837],{"type":21,"tag":209,"props":66838,"children":66839},{"style":222},[66840],{"type":26,"value":4415},{"type":21,"tag":209,"props":66842,"children":66844},{"class":211,"line":66843},206,[66845],{"type":21,"tag":209,"props":66846,"children":66847},{"emptyLinePlaceholder":248},[66848],{"type":26,"value":251},{"type":21,"tag":209,"props":66850,"children":66852},{"class":211,"line":66851},207,[66853],{"type":21,"tag":209,"props":66854,"children":66855},{"style":448},[66856],{"type":26,"value":731},{"type":21,"tag":209,"props":66858,"children":66860},{"class":211,"line":66859},208,[66861],{"type":21,"tag":209,"props":66862,"children":66863},{"style":448},[66864],{"type":26,"value":66865}," * Report on the upload progress, as a number between 0 and 1, modifying the progress if we're uploading a\n",{"type":21,"tag":209,"props":66867,"children":66869},{"class":211,"line":66868},209,[66870],{"type":21,"tag":209,"props":66871,"children":66872},{"style":448},[66873],{"type":26,"value":66874}," * file in chunks to report on the progress as a percentage of file upload and total chunks uploaded.\n",{"type":21,"tag":209,"props":66876,"children":66878},{"class":211,"line":66877},210,[66879,66883,66887],{"type":21,"tag":209,"props":66880,"children":66881},{"style":448},[66882],{"type":26,"value":39750},{"type":21,"tag":209,"props":66884,"children":66885},{"style":216},[66886],{"type":26,"value":13311},{"type":21,"tag":209,"props":66888,"children":66889},{"style":222},[66890],{"type":26,"value":25768},{"type":21,"tag":209,"props":66892,"children":66894},{"class":211,"line":66893},211,[66895],{"type":21,"tag":209,"props":66896,"children":66897},{"style":448},[66898],{"type":26,"value":755},{"type":21,"tag":209,"props":66900,"children":66902},{"class":211,"line":66901},212,[66903,66907,66911,66915,66919,66923,66927,66931,66935,66939],{"type":21,"tag":209,"props":66904,"children":66905},{"style":263},[66906],{"type":26,"value":55264},{"type":21,"tag":209,"props":66908,"children":66909},{"style":222},[66910],{"type":26,"value":378},{"type":21,"tag":209,"props":66912,"children":66913},{"style":263},[66914],{"type":26,"value":32662},{"type":21,"tag":209,"props":66916,"children":66917},{"style":222},[66918],{"type":26,"value":378},{"type":21,"tag":209,"props":66920,"children":66921},{"style":360},[66922],{"type":26,"value":55281},{"type":21,"tag":209,"props":66924,"children":66925},{"style":216},[66926],{"type":26,"value":271},{"type":21,"tag":209,"props":66928,"children":66929},{"style":216},[66930],{"type":26,"value":4789},{"type":21,"tag":209,"props":66932,"children":66933},{"style":222},[66934],{"type":26,"value":368},{"type":21,"tag":209,"props":66936,"children":66937},{"style":400},[66938],{"type":26,"value":25805},{"type":21,"tag":209,"props":66940,"children":66941},{"style":222},[66942],{"type":26,"value":2369},{"type":21,"tag":209,"props":66944,"children":66946},{"class":211,"line":66945},213,[66947,66951],{"type":21,"tag":209,"props":66948,"children":66949},{"style":216},[66950],{"type":26,"value":9249},{"type":21,"tag":209,"props":66952,"children":66953},{"style":222},[66954],{"type":26,"value":55313},{"type":21,"tag":209,"props":66956,"children":66958},{"class":211,"line":66957},214,[66959],{"type":21,"tag":209,"props":66960,"children":66961},{"style":222},[66962],{"type":26,"value":32675},{"type":21,"tag":209,"props":66964,"children":66966},{"class":211,"line":66965},215,[66967,66971,66975,66979,66983,66987],{"type":21,"tag":209,"props":66968,"children":66969},{"style":263},[66970],{"type":26,"value":47121},{"type":21,"tag":209,"props":66972,"children":66973},{"style":222},[66974],{"type":26,"value":55332},{"type":21,"tag":209,"props":66976,"children":66977},{"style":216},[66978],{"type":26,"value":1432},{"type":21,"tag":209,"props":66980,"children":66981},{"style":222},[66982],{"type":26,"value":55341},{"type":21,"tag":209,"props":66984,"children":66985},{"style":216},[66986],{"type":26,"value":6460},{"type":21,"tag":209,"props":66988,"children":66989},{"style":222},[66990],{"type":26,"value":55350},{"type":21,"tag":209,"props":66992,"children":66994},{"class":211,"line":66993},216,[66995,66999,67003,67007],{"type":21,"tag":209,"props":66996,"children":66997},{"style":216},[66998],{"type":26,"value":6334},{"type":21,"tag":209,"props":67000,"children":67001},{"style":222},[67002],{"type":26,"value":5569},{"type":21,"tag":209,"props":67004,"children":67005},{"style":263},[67006],{"type":26,"value":2508},{"type":21,"tag":209,"props":67008,"children":67009},{"style":222},[67010],{"type":26,"value":55370},{"type":21,"tag":209,"props":67012,"children":67014},{"class":211,"line":67013},217,[67015],{"type":21,"tag":209,"props":67016,"children":67017},{"style":222},[67018],{"type":26,"value":17555},{"type":21,"tag":209,"props":67020,"children":67022},{"class":211,"line":67021},218,[67023,67027,67031,67035,67039,67043,67047,67051,67055],{"type":21,"tag":209,"props":67024,"children":67025},{"style":263},[67026],{"type":26,"value":2570},{"type":21,"tag":209,"props":67028,"children":67029},{"style":222},[67030],{"type":26,"value":55332},{"type":21,"tag":209,"props":67032,"children":67033},{"style":216},[67034],{"type":26,"value":55394},{"type":21,"tag":209,"props":67036,"children":67037},{"style":222},[67038],{"type":26,"value":5569},{"type":21,"tag":209,"props":67040,"children":67041},{"style":263},[67042],{"type":26,"value":2508},{"type":21,"tag":209,"props":67044,"children":67045},{"style":222},[67046],{"type":26,"value":55407},{"type":21,"tag":209,"props":67048,"children":67049},{"style":216},[67050],{"type":26,"value":6460},{"type":21,"tag":209,"props":67052,"children":67053},{"style":263},[67054],{"type":26,"value":2508},{"type":21,"tag":209,"props":67056,"children":67057},{"style":222},[67058],{"type":26,"value":55420},{"type":21,"tag":209,"props":67060,"children":67062},{"class":211,"line":67061},219,[67063],{"type":21,"tag":209,"props":67064,"children":67065},{"style":222},[67066],{"type":26,"value":2235},{"type":21,"tag":209,"props":67068,"children":67070},{"class":211,"line":67069},220,[67071,67075,67079,67083,67087,67091],{"type":21,"tag":209,"props":67072,"children":67073},{"style":263},[67074],{"type":26,"value":47121},{"type":21,"tag":209,"props":67076,"children":67077},{"style":222},[67078],{"type":26,"value":55439},{"type":21,"tag":209,"props":67080,"children":67081},{"style":216},[67082],{"type":26,"value":1432},{"type":21,"tag":209,"props":67084,"children":67085},{"style":216},[67086],{"type":26,"value":20050},{"type":21,"tag":209,"props":67088,"children":67089},{"style":360},[67090],{"type":26,"value":17189},{"type":21,"tag":209,"props":67092,"children":67093},{"style":222},[67094],{"type":26,"value":4123},{"type":21,"tag":209,"props":67096,"children":67098},{"class":211,"line":67097},221,[67099,67103,67107,67111,67115,67119,67123,67127,67131,67135,67139,67143,67147,67151,67155,67159,67163,67167,67171],{"type":21,"tag":209,"props":67100,"children":67101},{"style":263},[67102],{"type":26,"value":47121},{"type":21,"tag":209,"props":67104,"children":67105},{"style":222},[67106],{"type":26,"value":55467},{"type":21,"tag":209,"props":67108,"children":67109},{"style":216},[67110],{"type":26,"value":1432},{"type":21,"tag":209,"props":67112,"children":67113},{"style":222},[67114],{"type":26,"value":5569},{"type":21,"tag":209,"props":67116,"children":67117},{"style":263},[67118],{"type":26,"value":2508},{"type":21,"tag":209,"props":67120,"children":67121},{"style":222},[67122],{"type":26,"value":55484},{"type":21,"tag":209,"props":67124,"children":67125},{"style":216},[67126],{"type":26,"value":944},{"type":21,"tag":209,"props":67128,"children":67129},{"style":263},[67130],{"type":26,"value":2508},{"type":21,"tag":209,"props":67132,"children":67133},{"style":222},[67134],{"type":26,"value":55497},{"type":21,"tag":209,"props":67136,"children":67137},{"style":216},[67138],{"type":26,"value":6460},{"type":21,"tag":209,"props":67140,"children":67141},{"style":222},[67142],{"type":26,"value":368},{"type":21,"tag":209,"props":67144,"children":67145},{"style":263},[67146],{"type":26,"value":2508},{"type":21,"tag":209,"props":67148,"children":67149},{"style":222},[67150],{"type":26,"value":55514},{"type":21,"tag":209,"props":67152,"children":67153},{"style":216},[67154],{"type":26,"value":42628},{"type":21,"tag":209,"props":67156,"children":67157},{"style":263},[67158],{"type":26,"value":2508},{"type":21,"tag":209,"props":67160,"children":67161},{"style":222},[67162],{"type":26,"value":55527},{"type":21,"tag":209,"props":67164,"children":67165},{"style":216},[67166],{"type":26,"value":944},{"type":21,"tag":209,"props":67168,"children":67169},{"style":263},[67170],{"type":26,"value":55536},{"type":21,"tag":209,"props":67172,"children":67173},{"style":222},[67174],{"type":26,"value":241},{"type":21,"tag":209,"props":67176,"children":67178},{"class":211,"line":67177},222,[67179,67183,67187,67191,67195,67199,67203,67207,67211,67215,67219,67223,67227,67231],{"type":21,"tag":209,"props":67180,"children":67181},{"style":222},[67182],{"type":26,"value":3374},{"type":21,"tag":209,"props":67184,"children":67185},{"style":360},[67186],{"type":26,"value":1059},{"type":21,"tag":209,"props":67188,"children":67189},{"style":222},[67190],{"type":26,"value":368},{"type":21,"tag":209,"props":67192,"children":67193},{"style":233},[67194],{"type":26,"value":55560},{"type":21,"tag":209,"props":67196,"children":67197},{"style":222},[67198],{"type":26,"value":408},{"type":21,"tag":209,"props":67200,"children":67201},{"style":263},[67202],{"type":26,"value":2508},{"type":21,"tag":209,"props":67204,"children":67205},{"style":222},[67206],{"type":26,"value":55514},{"type":21,"tag":209,"props":67208,"children":67209},{"style":216},[67210],{"type":26,"value":42628},{"type":21,"tag":209,"props":67212,"children":67213},{"style":263},[67214],{"type":26,"value":2508},{"type":21,"tag":209,"props":67216,"children":67217},{"style":222},[67218],{"type":26,"value":55585},{"type":21,"tag":209,"props":67220,"children":67221},{"style":233},[67222],{"type":26,"value":55590},{"type":21,"tag":209,"props":67224,"children":67225},{"style":222},[67226],{"type":26,"value":408},{"type":21,"tag":209,"props":67228,"children":67229},{"style":263},[67230],{"type":26,"value":2508},{"type":21,"tag":209,"props":67232,"children":67233},{"style":222},[67234],{"type":26,"value":55603},{"type":21,"tag":209,"props":67236,"children":67238},{"class":211,"line":67237},223,[67239,67243,67247,67251,67255,67259,67263,67267,67271,67275],{"type":21,"tag":209,"props":67240,"children":67241},{"style":263},[67242],{"type":26,"value":47121},{"type":21,"tag":209,"props":67244,"children":67245},{"style":222},[67246],{"type":26,"value":55615},{"type":21,"tag":209,"props":67248,"children":67249},{"style":360},[67250],{"type":26,"value":55620},{"type":21,"tag":209,"props":67252,"children":67253},{"style":222},[67254],{"type":26,"value":55625},{"type":21,"tag":209,"props":67256,"children":67257},{"style":263},[67258],{"type":26,"value":55630},{"type":21,"tag":209,"props":67260,"children":67261},{"style":222},[67262],{"type":26,"value":55635},{"type":21,"tag":209,"props":67264,"children":67265},{"style":263},[67266],{"type":26,"value":2508},{"type":21,"tag":209,"props":67268,"children":67269},{"style":222},[67270],{"type":26,"value":55644},{"type":21,"tag":209,"props":67272,"children":67273},{"style":263},[67274],{"type":26,"value":2508},{"type":21,"tag":209,"props":67276,"children":67277},{"style":222},[67278],{"type":26,"value":55653},{"type":21,"tag":209,"props":67280,"children":67282},{"class":211,"line":67281},224,[67283,67288,67292],{"type":21,"tag":209,"props":67284,"children":67285},{"style":222},[67286],{"type":26,"value":67287},"            progress:",{"type":21,"tag":209,"props":67289,"children":67290},{"style":263},[67291],{"type":26,"value":2508},{"type":21,"tag":209,"props":67293,"children":67294},{"style":222},[67295],{"type":26,"value":55670},{"type":21,"tag":209,"props":67297,"children":67299},{"class":211,"line":67298},225,[67300],{"type":21,"tag":209,"props":67301,"children":67302},{"style":222},[67303],{"type":26,"value":331},{"type":21,"tag":209,"props":67305,"children":67307},{"class":211,"line":67306},226,[67308],{"type":21,"tag":209,"props":67309,"children":67310},{"style":222},[67311],{"type":26,"value":340},{"type":21,"tag":209,"props":67313,"children":67315},{"class":211,"line":67314},227,[67316],{"type":21,"tag":209,"props":67317,"children":67318},{"emptyLinePlaceholder":248},[67319],{"type":26,"value":251},{"type":21,"tag":209,"props":67321,"children":67323},{"class":211,"line":67322},228,[67324,67328,67332,67336,67340,67344,67348,67352,67356,67360],{"type":21,"tag":209,"props":67325,"children":67326},{"style":263},[67327],{"type":26,"value":55264},{"type":21,"tag":209,"props":67329,"children":67330},{"style":222},[67331],{"type":26,"value":378},{"type":21,"tag":209,"props":67333,"children":67334},{"style":263},[67335],{"type":26,"value":32662},{"type":21,"tag":209,"props":67337,"children":67338},{"style":222},[67339],{"type":26,"value":378},{"type":21,"tag":209,"props":67341,"children":67342},{"style":360},[67343],{"type":26,"value":61271},{"type":21,"tag":209,"props":67345,"children":67346},{"style":216},[67347],{"type":26,"value":271},{"type":21,"tag":209,"props":67349,"children":67350},{"style":216},[67351],{"type":26,"value":4789},{"type":21,"tag":209,"props":67353,"children":67354},{"style":222},[67355],{"type":26,"value":368},{"type":21,"tag":209,"props":67357,"children":67358},{"style":400},[67359],{"type":26,"value":25805},{"type":21,"tag":209,"props":67361,"children":67362},{"style":222},[67363],{"type":26,"value":2369},{"type":21,"tag":209,"props":67365,"children":67367},{"class":211,"line":67366},229,[67368,67372,67376,67380,67384,67389],{"type":21,"tag":209,"props":67369,"children":67370},{"style":263},[67371],{"type":26,"value":46760},{"type":21,"tag":209,"props":67373,"children":67374},{"style":222},[67375],{"type":26,"value":55615},{"type":21,"tag":209,"props":67377,"children":67378},{"style":360},[67379],{"type":26,"value":14182},{"type":21,"tag":209,"props":67381,"children":67382},{"style":222},[67383],{"type":26,"value":55625},{"type":21,"tag":209,"props":67385,"children":67386},{"style":263},[67387],{"type":26,"value":67388},"FILE_UPLOAD_ERROR",{"type":21,"tag":209,"props":67390,"children":67391},{"style":222},[67392],{"type":26,"value":67393},", error:event});\n",{"type":21,"tag":209,"props":67395,"children":67397},{"class":211,"line":67396},230,[67398],{"type":21,"tag":209,"props":67399,"children":67400},{"style":222},[67401],{"type":26,"value":4415},{"type":21,"tag":209,"props":67403,"children":67405},{"class":211,"line":67404},231,[67406],{"type":21,"tag":209,"props":67407,"children":67408},{"emptyLinePlaceholder":248},[67409],{"type":26,"value":251},{"type":21,"tag":209,"props":67411,"children":67413},{"class":211,"line":67412},232,[67414],{"type":21,"tag":209,"props":67415,"children":67416},{"style":448},[67417],{"type":26,"value":731},{"type":21,"tag":209,"props":67419,"children":67421},{"class":211,"line":67420},233,[67422],{"type":21,"tag":209,"props":67423,"children":67424},{"style":448},[67425],{"type":26,"value":67426}," * Called when we've completed an upload (full file or chunk). If full file, or we've reached the last chunk,\n",{"type":21,"tag":209,"props":67428,"children":67430},{"class":211,"line":67429},234,[67431],{"type":21,"tag":209,"props":67432,"children":67433},{"style":448},[67434],{"type":26,"value":67435}," * the upload is complete. Otherwise, we calculate the next chunk offsets and, if the upload isn't paused,\n",{"type":21,"tag":209,"props":67437,"children":67439},{"class":211,"line":67438},235,[67440],{"type":21,"tag":209,"props":67441,"children":67442},{"style":448},[67443],{"type":26,"value":67444}," * upload it.\n",{"type":21,"tag":209,"props":67446,"children":67448},{"class":211,"line":67447},236,[67449],{"type":21,"tag":209,"props":67450,"children":67451},{"style":448},[67452],{"type":26,"value":755},{"type":21,"tag":209,"props":67454,"children":67456},{"class":211,"line":67455},237,[67457,67461,67465,67469,67473,67477,67481,67485],{"type":21,"tag":209,"props":67458,"children":67459},{"style":263},[67460],{"type":26,"value":55264},{"type":21,"tag":209,"props":67462,"children":67463},{"style":222},[67464],{"type":26,"value":378},{"type":21,"tag":209,"props":67466,"children":67467},{"style":263},[67468],{"type":26,"value":32662},{"type":21,"tag":209,"props":67470,"children":67471},{"style":222},[67472],{"type":26,"value":378},{"type":21,"tag":209,"props":67474,"children":67475},{"style":360},[67476],{"type":26,"value":61147},{"type":21,"tag":209,"props":67478,"children":67479},{"style":216},[67480],{"type":26,"value":271},{"type":21,"tag":209,"props":67482,"children":67483},{"style":216},[67484],{"type":26,"value":4789},{"type":21,"tag":209,"props":67486,"children":67487},{"style":222},[67488],{"type":26,"value":2561},{"type":21,"tag":209,"props":67490,"children":67492},{"class":211,"line":67491},238,[67493,67497,67501,67505,67509,67513],{"type":21,"tag":209,"props":67494,"children":67495},{"style":263},[67496],{"type":26,"value":46760},{"type":21,"tag":209,"props":67498,"children":67499},{"style":222},[67500],{"type":26,"value":55439},{"type":21,"tag":209,"props":67502,"children":67503},{"style":216},[67504],{"type":26,"value":1432},{"type":21,"tag":209,"props":67506,"children":67507},{"style":216},[67508],{"type":26,"value":20050},{"type":21,"tag":209,"props":67510,"children":67511},{"style":360},[67512],{"type":26,"value":17189},{"type":21,"tag":209,"props":67514,"children":67515},{"style":222},[67516],{"type":26,"value":4123},{"type":21,"tag":209,"props":67518,"children":67520},{"class":211,"line":67519},239,[67521,67525,67529,67533,67537,67542,67546,67550,67554,67558,67562],{"type":21,"tag":209,"props":67522,"children":67523},{"style":216},[67524],{"type":26,"value":9249},{"type":21,"tag":209,"props":67526,"children":67527},{"style":222},[67528],{"type":26,"value":5569},{"type":21,"tag":209,"props":67530,"children":67531},{"style":216},[67532],{"type":26,"value":6455},{"type":21,"tag":209,"props":67534,"children":67535},{"style":263},[67536],{"type":26,"value":2508},{"type":21,"tag":209,"props":67538,"children":67539},{"style":222},[67540],{"type":26,"value":67541},".options.chunked ",{"type":21,"tag":209,"props":67543,"children":67544},{"style":216},[67545],{"type":26,"value":13270},{"type":21,"tag":209,"props":67547,"children":67548},{"style":263},[67549],{"type":26,"value":20502},{"type":21,"tag":209,"props":67551,"children":67552},{"style":222},[67553],{"type":26,"value":61043},{"type":21,"tag":209,"props":67555,"children":67556},{"style":216},[67557],{"type":26,"value":23855},{"type":21,"tag":209,"props":67559,"children":67560},{"style":263},[67561],{"type":26,"value":20502},{"type":21,"tag":209,"props":67563,"children":67564},{"style":222},[67565],{"type":26,"value":67566},".file.size)\n",{"type":21,"tag":209,"props":67568,"children":67570},{"class":211,"line":67569},240,[67571],{"type":21,"tag":209,"props":67572,"children":67573},{"style":222},[67574],{"type":26,"value":32675},{"type":21,"tag":209,"props":67576,"children":67578},{"class":211,"line":67577},241,[67579,67583,67587,67592],{"type":21,"tag":209,"props":67580,"children":67581},{"style":263},[67582],{"type":26,"value":47121},{"type":21,"tag":209,"props":67584,"children":67585},{"style":222},[67586],{"type":26,"value":378},{"type":21,"tag":209,"props":67588,"children":67589},{"style":360},[67590],{"type":26,"value":67591},"uploadComplete",{"type":21,"tag":209,"props":67593,"children":67594},{"style":222},[67595],{"type":26,"value":4123},{"type":21,"tag":209,"props":67597,"children":67599},{"class":211,"line":67598},242,[67600,67604],{"type":21,"tag":209,"props":67601,"children":67602},{"style":216},[67603],{"type":26,"value":3069},{"type":21,"tag":209,"props":67605,"children":67606},{"style":222},[67607],{"type":26,"value":241},{"type":21,"tag":209,"props":67609,"children":67611},{"class":211,"line":67610},243,[67612],{"type":21,"tag":209,"props":67613,"children":67614},{"style":222},[67615],{"type":26,"value":331},{"type":21,"tag":209,"props":67617,"children":67619},{"class":211,"line":67618},244,[67620],{"type":21,"tag":209,"props":67621,"children":67622},{"emptyLinePlaceholder":248},[67623],{"type":26,"value":251},{"type":21,"tag":209,"props":67625,"children":67627},{"class":211,"line":67626},245,[67628,67632,67636,67640,67644,67648,67652,67656],{"type":21,"tag":209,"props":67629,"children":67630},{"style":263},[67631],{"type":26,"value":46760},{"type":21,"tag":209,"props":67633,"children":67634},{"style":222},[67635],{"type":26,"value":55615},{"type":21,"tag":209,"props":67637,"children":67638},{"style":360},[67639],{"type":26,"value":55620},{"type":21,"tag":209,"props":67641,"children":67642},{"style":222},[67643],{"type":26,"value":55625},{"type":21,"tag":209,"props":67645,"children":67646},{"style":263},[67647],{"type":26,"value":55630},{"type":21,"tag":209,"props":67649,"children":67650},{"style":222},[67651],{"type":26,"value":55635},{"type":21,"tag":209,"props":67653,"children":67654},{"style":263},[67655],{"type":26,"value":2508},{"type":21,"tag":209,"props":67657,"children":67658},{"style":222},[67659],{"type":26,"value":67660},".file.name,\n",{"type":21,"tag":209,"props":67662,"children":67664},{"class":211,"line":67663},246,[67665,67670,67674,67678,67683,67687,67691,67696,67700],{"type":21,"tag":209,"props":67666,"children":67667},{"style":222},[67668],{"type":26,"value":67669},"        response:",{"type":21,"tag":209,"props":67671,"children":67672},{"style":263},[67673],{"type":26,"value":2508},{"type":21,"tag":209,"props":67675,"children":67676},{"style":222},[67677],{"type":26,"value":378},{"type":21,"tag":209,"props":67679,"children":67680},{"style":360},[67681],{"type":26,"value":67682},"parseResponse",{"type":21,"tag":209,"props":67684,"children":67685},{"style":222},[67686],{"type":26,"value":368},{"type":21,"tag":209,"props":67688,"children":67689},{"style":263},[67690],{"type":26,"value":2508},{"type":21,"tag":209,"props":67692,"children":67693},{"style":222},[67694],{"type":26,"value":67695},".xhr.responseText), progress:",{"type":21,"tag":209,"props":67697,"children":67698},{"style":263},[67699],{"type":26,"value":2508},{"type":21,"tag":209,"props":67701,"children":67702},{"style":222},[67703],{"type":26,"value":55670},{"type":21,"tag":209,"props":67705,"children":67707},{"class":211,"line":67706},247,[67708],{"type":21,"tag":209,"props":67709,"children":67710},{"emptyLinePlaceholder":248},[67711],{"type":26,"value":251},{"type":21,"tag":209,"props":67713,"children":67715},{"class":211,"line":67714},248,[67716,67720,67724,67728,67732],{"type":21,"tag":209,"props":67717,"children":67718},{"style":263},[67719],{"type":26,"value":46760},{"type":21,"tag":209,"props":67721,"children":67722},{"style":222},[67723],{"type":26,"value":61019},{"type":21,"tag":209,"props":67725,"children":67726},{"style":216},[67727],{"type":26,"value":1432},{"type":21,"tag":209,"props":67729,"children":67730},{"style":263},[67731],{"type":26,"value":20502},{"type":21,"tag":209,"props":67733,"children":67734},{"style":222},[67735],{"type":26,"value":67736},".end;\n",{"type":21,"tag":209,"props":67738,"children":67740},{"class":211,"line":67739},249,[67741,67745,67749,67753,67757,67761,67765,67769,67773,67777,67781,67785,67789],{"type":21,"tag":209,"props":67742,"children":67743},{"style":263},[67744],{"type":26,"value":46760},{"type":21,"tag":209,"props":67746,"children":67747},{"style":222},[67748],{"type":26,"value":61043},{"type":21,"tag":209,"props":67750,"children":67751},{"style":216},[67752],{"type":26,"value":1432},{"type":21,"tag":209,"props":67754,"children":67755},{"style":222},[67756],{"type":26,"value":61052},{"type":21,"tag":209,"props":67758,"children":67759},{"style":360},[67760],{"type":26,"value":61057},{"type":21,"tag":209,"props":67762,"children":67763},{"style":222},[67764],{"type":26,"value":368},{"type":21,"tag":209,"props":67766,"children":67767},{"style":263},[67768],{"type":26,"value":2508},{"type":21,"tag":209,"props":67770,"children":67771},{"style":222},[67772],{"type":26,"value":61070},{"type":21,"tag":209,"props":67774,"children":67775},{"style":216},[67776],{"type":26,"value":17170},{"type":21,"tag":209,"props":67778,"children":67779},{"style":263},[67780],{"type":26,"value":2508},{"type":21,"tag":209,"props":67782,"children":67783},{"style":222},[67784],{"type":26,"value":61083},{"type":21,"tag":209,"props":67786,"children":67787},{"style":263},[67788],{"type":26,"value":2508},{"type":21,"tag":209,"props":67790,"children":67791},{"style":222},[67792],{"type":26,"value":55420},{"type":21,"tag":209,"props":67794,"children":67796},{"class":211,"line":67795},250,[67797],{"type":21,"tag":209,"props":67798,"children":67799},{"emptyLinePlaceholder":248},[67800],{"type":26,"value":251},{"type":21,"tag":209,"props":67802,"children":67804},{"class":211,"line":67803},251,[67805,67809,67813,67817,67821],{"type":21,"tag":209,"props":67806,"children":67807},{"style":216},[67808],{"type":26,"value":9249},{"type":21,"tag":209,"props":67810,"children":67811},{"style":222},[67812],{"type":26,"value":5569},{"type":21,"tag":209,"props":67814,"children":67815},{"style":216},[67816],{"type":26,"value":6455},{"type":21,"tag":209,"props":67818,"children":67819},{"style":263},[67820],{"type":26,"value":2508},{"type":21,"tag":209,"props":67822,"children":67823},{"style":222},[67824],{"type":26,"value":67825},".paused)\n",{"type":21,"tag":209,"props":67827,"children":67829},{"class":211,"line":67828},252,[67830],{"type":21,"tag":209,"props":67831,"children":67832},{"style":222},[67833],{"type":26,"value":32675},{"type":21,"tag":209,"props":67835,"children":67837},{"class":211,"line":67836},253,[67838,67842,67846,67850],{"type":21,"tag":209,"props":67839,"children":67840},{"style":263},[67841],{"type":26,"value":47121},{"type":21,"tag":209,"props":67843,"children":67844},{"style":222},[67845],{"type":26,"value":378},{"type":21,"tag":209,"props":67847,"children":67848},{"style":360},[67849],{"type":26,"value":31175},{"type":21,"tag":209,"props":67851,"children":67852},{"style":222},[67853],{"type":26,"value":4123},{"type":21,"tag":209,"props":67855,"children":67857},{"class":211,"line":67856},254,[67858],{"type":21,"tag":209,"props":67859,"children":67860},{"style":222},[67861],{"type":26,"value":331},{"type":21,"tag":209,"props":67863,"children":67865},{"class":211,"line":67864},255,[67866],{"type":21,"tag":209,"props":67867,"children":67868},{"style":222},[67869],{"type":26,"value":340},{"type":21,"tag":209,"props":67871,"children":67873},{"class":211,"line":67872},256,[67874],{"type":21,"tag":209,"props":67875,"children":67876},{"emptyLinePlaceholder":248},[67877],{"type":26,"value":251},{"type":21,"tag":209,"props":67879,"children":67881},{"class":211,"line":67880},257,[67882],{"type":21,"tag":209,"props":67883,"children":67884},{"style":448},[67885],{"type":26,"value":731},{"type":21,"tag":209,"props":67887,"children":67889},{"class":211,"line":67888},258,[67890],{"type":21,"tag":209,"props":67891,"children":67892},{"style":448},[67893],{"type":26,"value":67894}," * Called when the full file has been uploaded.\n",{"type":21,"tag":209,"props":67896,"children":67898},{"class":211,"line":67897},259,[67899],{"type":21,"tag":209,"props":67900,"children":67901},{"style":448},[67902],{"type":26,"value":755},{"type":21,"tag":209,"props":67904,"children":67906},{"class":211,"line":67905},260,[67907,67911,67915,67919,67923,67927,67931,67935],{"type":21,"tag":209,"props":67908,"children":67909},{"style":263},[67910],{"type":26,"value":55264},{"type":21,"tag":209,"props":67912,"children":67913},{"style":222},[67914],{"type":26,"value":378},{"type":21,"tag":209,"props":67916,"children":67917},{"style":263},[67918],{"type":26,"value":32662},{"type":21,"tag":209,"props":67920,"children":67921},{"style":222},[67922],{"type":26,"value":378},{"type":21,"tag":209,"props":67924,"children":67925},{"style":360},[67926],{"type":26,"value":67591},{"type":21,"tag":209,"props":67928,"children":67929},{"style":216},[67930],{"type":26,"value":271},{"type":21,"tag":209,"props":67932,"children":67933},{"style":216},[67934],{"type":26,"value":4789},{"type":21,"tag":209,"props":67936,"children":67937},{"style":222},[67938],{"type":26,"value":2561},{"type":21,"tag":209,"props":67940,"children":67942},{"class":211,"line":67941},261,[67943,67947,67951,67955,67959,67964,67968,67972],{"type":21,"tag":209,"props":67944,"children":67945},{"style":263},[67946],{"type":26,"value":46760},{"type":21,"tag":209,"props":67948,"children":67949},{"style":222},[67950],{"type":26,"value":55615},{"type":21,"tag":209,"props":67952,"children":67953},{"style":360},[67954],{"type":26,"value":14173},{"type":21,"tag":209,"props":67956,"children":67957},{"style":222},[67958],{"type":26,"value":55625},{"type":21,"tag":209,"props":67960,"children":67961},{"style":263},[67962],{"type":26,"value":67963},"FILE_UPLOAD_FINISHED",{"type":21,"tag":209,"props":67965,"children":67966},{"style":222},[67967],{"type":26,"value":55635},{"type":21,"tag":209,"props":67969,"children":67970},{"style":263},[67971],{"type":26,"value":2508},{"type":21,"tag":209,"props":67973,"children":67974},{"style":222},[67975],{"type":26,"value":67660},{"type":21,"tag":209,"props":67977,"children":67979},{"class":211,"line":67978},262,[67980,67985,67989,67994,67998],{"type":21,"tag":209,"props":67981,"children":67982},{"style":222},[67983],{"type":26,"value":67984},"        file_size:",{"type":21,"tag":209,"props":67986,"children":67987},{"style":263},[67988],{"type":26,"value":2508},{"type":21,"tag":209,"props":67990,"children":67991},{"style":222},[67992],{"type":26,"value":67993},".file.size, file_type:",{"type":21,"tag":209,"props":67995,"children":67996},{"style":263},[67997],{"type":26,"value":2508},{"type":21,"tag":209,"props":67999,"children":68000},{"style":222},[68001],{"type":26,"value":68002},".file.type,\n",{"type":21,"tag":209,"props":68004,"children":68006},{"class":211,"line":68005},263,[68007,68011,68015,68019,68023,68027,68031],{"type":21,"tag":209,"props":68008,"children":68009},{"style":222},[68010],{"type":26,"value":67669},{"type":21,"tag":209,"props":68012,"children":68013},{"style":263},[68014],{"type":26,"value":2508},{"type":21,"tag":209,"props":68016,"children":68017},{"style":222},[68018],{"type":26,"value":378},{"type":21,"tag":209,"props":68020,"children":68021},{"style":360},[68022],{"type":26,"value":67682},{"type":21,"tag":209,"props":68024,"children":68025},{"style":222},[68026],{"type":26,"value":368},{"type":21,"tag":209,"props":68028,"children":68029},{"style":263},[68030],{"type":26,"value":2508},{"type":21,"tag":209,"props":68032,"children":68033},{"style":222},[68034],{"type":26,"value":68035},".xhr.responseText)});\n",{"type":21,"tag":209,"props":68037,"children":68039},{"class":211,"line":68038},264,[68040],{"type":21,"tag":209,"props":68041,"children":68042},{"style":222},[68043],{"type":26,"value":340},{"type":21,"tag":209,"props":68045,"children":68047},{"class":211,"line":68046},265,[68048],{"type":21,"tag":209,"props":68049,"children":68050},{"emptyLinePlaceholder":248},[68051],{"type":26,"value":251},{"type":21,"tag":209,"props":68053,"children":68055},{"class":211,"line":68054},266,[68056],{"type":21,"tag":209,"props":68057,"children":68058},{"style":448},[68059],{"type":26,"value":731},{"type":21,"tag":209,"props":68061,"children":68063},{"class":211,"line":68062},267,[68064],{"type":21,"tag":209,"props":68065,"children":68066},{"style":448},[68067],{"type":26,"value":68068}," * Try to parse the response as a JSON, and on failure return the error and the plaintext.\n",{"type":21,"tag":209,"props":68070,"children":68072},{"class":211,"line":68071},268,[68073,68077,68081],{"type":21,"tag":209,"props":68074,"children":68075},{"style":448},[68076],{"type":26,"value":39750},{"type":21,"tag":209,"props":68078,"children":68079},{"style":216},[68080],{"type":26,"value":13311},{"type":21,"tag":209,"props":68082,"children":68083},{"style":222},[68084],{"type":26,"value":16926},{"type":21,"tag":209,"props":68086,"children":68088},{"class":211,"line":68087},269,[68089,68093,68097],{"type":21,"tag":209,"props":68090,"children":68091},{"style":448},[68092],{"type":26,"value":39750},{"type":21,"tag":209,"props":68094,"children":68095},{"style":216},[68096],{"type":26,"value":13333},{"type":21,"tag":209,"props":68098,"children":68099},{"style":360},[68100],{"type":26,"value":68101}," {Object}\n",{"type":21,"tag":209,"props":68103,"children":68105},{"class":211,"line":68104},270,[68106],{"type":21,"tag":209,"props":68107,"children":68108},{"style":448},[68109],{"type":26,"value":755},{"type":21,"tag":209,"props":68111,"children":68113},{"class":211,"line":68112},271,[68114,68118,68122,68126,68130,68134,68138,68142,68146,68150],{"type":21,"tag":209,"props":68115,"children":68116},{"style":263},[68117],{"type":26,"value":55264},{"type":21,"tag":209,"props":68119,"children":68120},{"style":222},[68121],{"type":26,"value":378},{"type":21,"tag":209,"props":68123,"children":68124},{"style":263},[68125],{"type":26,"value":32662},{"type":21,"tag":209,"props":68127,"children":68128},{"style":222},[68129],{"type":26,"value":378},{"type":21,"tag":209,"props":68131,"children":68132},{"style":360},[68133],{"type":26,"value":67682},{"type":21,"tag":209,"props":68135,"children":68136},{"style":216},[68137],{"type":26,"value":271},{"type":21,"tag":209,"props":68139,"children":68140},{"style":216},[68141],{"type":26,"value":4789},{"type":21,"tag":209,"props":68143,"children":68144},{"style":222},[68145],{"type":26,"value":368},{"type":21,"tag":209,"props":68147,"children":68148},{"style":400},[68149],{"type":26,"value":16982},{"type":21,"tag":209,"props":68151,"children":68152},{"style":222},[68153],{"type":26,"value":8924},{"type":21,"tag":209,"props":68155,"children":68157},{"class":211,"line":68156},272,[68158],{"type":21,"tag":209,"props":68159,"children":68160},{"style":222},[68161],{"type":26,"value":29353},{"type":21,"tag":209,"props":68163,"children":68165},{"class":211,"line":68164},273,[68166,68170],{"type":21,"tag":209,"props":68167,"children":68168},{"style":216},[68169],{"type":26,"value":16994},{"type":21,"tag":209,"props":68171,"children":68172},{"style":222},[68173],{"type":26,"value":17357},{"type":21,"tag":209,"props":68175,"children":68177},{"class":211,"line":68176},274,[68178,68182],{"type":21,"tag":209,"props":68179,"children":68180},{"style":216},[68181],{"type":26,"value":6640},{"type":21,"tag":209,"props":68183,"children":68184},{"style":222},[68185],{"type":26,"value":29353},{"type":21,"tag":209,"props":68187,"children":68189},{"class":211,"line":68188},275,[68190,68195,68199,68203,68207,68211,68215,68219],{"type":21,"tag":209,"props":68191,"children":68192},{"style":222},[68193],{"type":26,"value":68194},"        response ",{"type":21,"tag":209,"props":68196,"children":68197},{"style":216},[68198],{"type":26,"value":1432},{"type":21,"tag":209,"props":68200,"children":68201},{"style":263},[68202],{"type":26,"value":20516},{"type":21,"tag":209,"props":68204,"children":68205},{"style":222},[68206],{"type":26,"value":378},{"type":21,"tag":209,"props":68208,"children":68209},{"style":360},[68210],{"type":26,"value":20525},{"type":21,"tag":209,"props":68212,"children":68213},{"style":222},[68214],{"type":26,"value":368},{"type":21,"tag":209,"props":68216,"children":68217},{"style":263},[68218],{"type":26,"value":2508},{"type":21,"tag":209,"props":68220,"children":68221},{"style":222},[68222],{"type":26,"value":68223},".xhr.responseText);\n",{"type":21,"tag":209,"props":68225,"children":68227},{"class":211,"line":68226},276,[68228,68233,68237],{"type":21,"tag":209,"props":68229,"children":68230},{"style":222},[68231],{"type":26,"value":68232},"    }",{"type":21,"tag":209,"props":68234,"children":68235},{"style":216},[68236],{"type":26,"value":5347},{"type":21,"tag":209,"props":68238,"children":68239},{"style":222},[68240],{"type":26,"value":29422},{"type":21,"tag":209,"props":68242,"children":68244},{"class":211,"line":68243},277,[68245,68249,68253,68258,68262],{"type":21,"tag":209,"props":68246,"children":68247},{"style":222},[68248],{"type":26,"value":68194},{"type":21,"tag":209,"props":68250,"children":68251},{"style":216},[68252],{"type":26,"value":1432},{"type":21,"tag":209,"props":68254,"children":68255},{"style":222},[68256],{"type":26,"value":68257}," {error:e, text:",{"type":21,"tag":209,"props":68259,"children":68260},{"style":263},[68261],{"type":26,"value":2508},{"type":21,"tag":209,"props":68263,"children":68264},{"style":222},[68265],{"type":26,"value":68266},".xhr.responseText};\n",{"type":21,"tag":209,"props":68268,"children":68270},{"class":211,"line":68269},278,[68271],{"type":21,"tag":209,"props":68272,"children":68273},{"style":222},[68274],{"type":26,"value":331},{"type":21,"tag":209,"props":68276,"children":68278},{"class":211,"line":68277},279,[68279,68283],{"type":21,"tag":209,"props":68280,"children":68281},{"style":216},[68282],{"type":26,"value":1298},{"type":21,"tag":209,"props":68284,"children":68285},{"style":222},[68286],{"type":26,"value":17357},{"type":21,"tag":209,"props":68288,"children":68290},{"class":211,"line":68289},280,[68291],{"type":21,"tag":209,"props":68292,"children":68293},{"style":222},[68294],{"type":26,"value":4415},{"type":21,"tag":209,"props":68296,"children":68298},{"class":211,"line":68297},281,[68299],{"type":21,"tag":209,"props":68300,"children":68301},{"emptyLinePlaceholder":248},[68302],{"type":26,"value":251},{"type":21,"tag":209,"props":68304,"children":68306},{"class":211,"line":68305},282,[68307],{"type":21,"tag":209,"props":68308,"children":68309},{"style":448},[68310],{"type":26,"value":731},{"type":21,"tag":209,"props":68312,"children":68314},{"class":211,"line":68313},283,[68315],{"type":21,"tag":209,"props":68316,"children":68317},{"style":448},[68318],{"type":26,"value":68319}," * Pause the upload (works for chunked uploads only).\n",{"type":21,"tag":209,"props":68321,"children":68323},{"class":211,"line":68322},284,[68324],{"type":21,"tag":209,"props":68325,"children":68326},{"style":448},[68327],{"type":26,"value":755},{"type":21,"tag":209,"props":68329,"children":68331},{"class":211,"line":68330},285,[68332,68336,68340,68344,68348,68353,68357,68361],{"type":21,"tag":209,"props":68333,"children":68334},{"style":263},[68335],{"type":26,"value":55264},{"type":21,"tag":209,"props":68337,"children":68338},{"style":222},[68339],{"type":26,"value":378},{"type":21,"tag":209,"props":68341,"children":68342},{"style":263},[68343],{"type":26,"value":32662},{"type":21,"tag":209,"props":68345,"children":68346},{"style":222},[68347],{"type":26,"value":378},{"type":21,"tag":209,"props":68349,"children":68350},{"style":360},[68351],{"type":26,"value":68352},"pause",{"type":21,"tag":209,"props":68354,"children":68355},{"style":216},[68356],{"type":26,"value":271},{"type":21,"tag":209,"props":68358,"children":68359},{"style":216},[68360],{"type":26,"value":4789},{"type":21,"tag":209,"props":68362,"children":68363},{"style":222},[68364],{"type":26,"value":2561},{"type":21,"tag":209,"props":68366,"children":68368},{"class":211,"line":68367},286,[68369,68373,68377,68381,68385],{"type":21,"tag":209,"props":68370,"children":68371},{"style":263},[68372],{"type":26,"value":46760},{"type":21,"tag":209,"props":68374,"children":68375},{"style":222},[68376],{"type":26,"value":60911},{"type":21,"tag":209,"props":68378,"children":68379},{"style":216},[68380],{"type":26,"value":1432},{"type":21,"tag":209,"props":68382,"children":68383},{"style":263},[68384],{"type":26,"value":14819},{"type":21,"tag":209,"props":68386,"children":68387},{"style":222},[68388],{"type":26,"value":241},{"type":21,"tag":209,"props":68390,"children":68392},{"class":211,"line":68391},287,[68393,68397,68401,68405,68409,68414,68419,68423,68428,68432],{"type":21,"tag":209,"props":68394,"children":68395},{"style":263},[68396],{"type":26,"value":46760},{"type":21,"tag":209,"props":68398,"children":68399},{"style":222},[68400],{"type":26,"value":55615},{"type":21,"tag":209,"props":68402,"children":68403},{"style":360},[68404],{"type":26,"value":55620},{"type":21,"tag":209,"props":68406,"children":68407},{"style":222},[68408],{"type":26,"value":55625},{"type":21,"tag":209,"props":68410,"children":68411},{"style":263},[68412],{"type":26,"value":68413},"FILE_UPLOAD_PAUSE",{"type":21,"tag":209,"props":68415,"children":68416},{"style":222},[68417],{"type":26,"value":68418},", current_range:{start:",{"type":21,"tag":209,"props":68420,"children":68421},{"style":263},[68422],{"type":26,"value":2508},{"type":21,"tag":209,"props":68424,"children":68425},{"style":222},[68426],{"type":26,"value":68427},".start, end:",{"type":21,"tag":209,"props":68429,"children":68430},{"style":263},[68431],{"type":26,"value":2508},{"type":21,"tag":209,"props":68433,"children":68434},{"style":222},[68435],{"type":26,"value":68436},".end,\n",{"type":21,"tag":209,"props":68438,"children":68440},{"class":211,"line":68439},288,[68441,68446,68450],{"type":21,"tag":209,"props":68442,"children":68443},{"style":222},[68444],{"type":26,"value":68445},"        total:",{"type":21,"tag":209,"props":68447,"children":68448},{"style":263},[68449],{"type":26,"value":2508},{"type":21,"tag":209,"props":68451,"children":68452},{"style":222},[68453],{"type":26,"value":68454},".file.size}});\n",{"type":21,"tag":209,"props":68456,"children":68458},{"class":211,"line":68457},289,[68459],{"type":21,"tag":209,"props":68460,"children":68461},{"style":222},[68462],{"type":26,"value":4415},{"type":21,"tag":209,"props":68464,"children":68466},{"class":211,"line":68465},290,[68467],{"type":21,"tag":209,"props":68468,"children":68469},{"emptyLinePlaceholder":248},[68470],{"type":26,"value":251},{"type":21,"tag":209,"props":68472,"children":68474},{"class":211,"line":68473},291,[68475],{"type":21,"tag":209,"props":68476,"children":68477},{"style":448},[68478],{"type":26,"value":731},{"type":21,"tag":209,"props":68480,"children":68482},{"class":211,"line":68481},292,[68483],{"type":21,"tag":209,"props":68484,"children":68485},{"style":448},[68486],{"type":26,"value":68487}," * Resume the upload (works for chunked uploads only).\n",{"type":21,"tag":209,"props":68489,"children":68491},{"class":211,"line":68490},293,[68492],{"type":21,"tag":209,"props":68493,"children":68494},{"style":448},[68495],{"type":26,"value":755},{"type":21,"tag":209,"props":68497,"children":68499},{"class":211,"line":68498},294,[68500,68504,68508,68512,68516,68520,68524,68528],{"type":21,"tag":209,"props":68501,"children":68502},{"style":263},[68503],{"type":26,"value":55264},{"type":21,"tag":209,"props":68505,"children":68506},{"style":222},[68507],{"type":26,"value":378},{"type":21,"tag":209,"props":68509,"children":68510},{"style":263},[68511],{"type":26,"value":32662},{"type":21,"tag":209,"props":68513,"children":68514},{"style":222},[68515],{"type":26,"value":378},{"type":21,"tag":209,"props":68517,"children":68518},{"style":360},[68519],{"type":26,"value":14702},{"type":21,"tag":209,"props":68521,"children":68522},{"style":216},[68523],{"type":26,"value":271},{"type":21,"tag":209,"props":68525,"children":68526},{"style":216},[68527],{"type":26,"value":4789},{"type":21,"tag":209,"props":68529,"children":68530},{"style":222},[68531],{"type":26,"value":2561},{"type":21,"tag":209,"props":68533,"children":68535},{"class":211,"line":68534},295,[68536,68540,68544,68548],{"type":21,"tag":209,"props":68537,"children":68538},{"style":216},[68539],{"type":26,"value":9249},{"type":21,"tag":209,"props":68541,"children":68542},{"style":222},[68543],{"type":26,"value":5569},{"type":21,"tag":209,"props":68545,"children":68546},{"style":263},[68547],{"type":26,"value":2508},{"type":21,"tag":209,"props":68549,"children":68550},{"style":222},[68551],{"type":26,"value":67825},{"type":21,"tag":209,"props":68553,"children":68555},{"class":211,"line":68554},296,[68556],{"type":21,"tag":209,"props":68557,"children":68558},{"style":222},[68559],{"type":26,"value":32675},{"type":21,"tag":209,"props":68561,"children":68563},{"class":211,"line":68562},297,[68564,68568,68572,68576,68580],{"type":21,"tag":209,"props":68565,"children":68566},{"style":263},[68567],{"type":26,"value":47121},{"type":21,"tag":209,"props":68569,"children":68570},{"style":222},[68571],{"type":26,"value":60911},{"type":21,"tag":209,"props":68573,"children":68574},{"style":216},[68575],{"type":26,"value":1432},{"type":21,"tag":209,"props":68577,"children":68578},{"style":263},[68579],{"type":26,"value":14038},{"type":21,"tag":209,"props":68581,"children":68582},{"style":222},[68583],{"type":26,"value":241},{"type":21,"tag":209,"props":68585,"children":68587},{"class":211,"line":68586},298,[68588,68592,68596,68600,68604,68609,68613,68617,68621,68625],{"type":21,"tag":209,"props":68589,"children":68590},{"style":263},[68591],{"type":26,"value":47121},{"type":21,"tag":209,"props":68593,"children":68594},{"style":222},[68595],{"type":26,"value":55615},{"type":21,"tag":209,"props":68597,"children":68598},{"style":360},[68599],{"type":26,"value":55620},{"type":21,"tag":209,"props":68601,"children":68602},{"style":222},[68603],{"type":26,"value":55625},{"type":21,"tag":209,"props":68605,"children":68606},{"style":263},[68607],{"type":26,"value":68608},"FILE_UPLOAD_RESUME",{"type":21,"tag":209,"props":68610,"children":68611},{"style":222},[68612],{"type":26,"value":68418},{"type":21,"tag":209,"props":68614,"children":68615},{"style":263},[68616],{"type":26,"value":2508},{"type":21,"tag":209,"props":68618,"children":68619},{"style":222},[68620],{"type":26,"value":68427},{"type":21,"tag":209,"props":68622,"children":68623},{"style":263},[68624],{"type":26,"value":2508},{"type":21,"tag":209,"props":68626,"children":68627},{"style":222},[68628],{"type":26,"value":68436},{"type":21,"tag":209,"props":68630,"children":68632},{"class":211,"line":68631},299,[68633,68638,68642],{"type":21,"tag":209,"props":68634,"children":68635},{"style":222},[68636],{"type":26,"value":68637},"            total:",{"type":21,"tag":209,"props":68639,"children":68640},{"style":263},[68641],{"type":26,"value":2508},{"type":21,"tag":209,"props":68643,"children":68644},{"style":222},[68645],{"type":26,"value":68454},{"type":21,"tag":209,"props":68647,"children":68649},{"class":211,"line":68648},300,[68650,68654,68658,68662],{"type":21,"tag":209,"props":68651,"children":68652},{"style":263},[68653],{"type":26,"value":47121},{"type":21,"tag":209,"props":68655,"children":68656},{"style":222},[68657],{"type":26,"value":378},{"type":21,"tag":209,"props":68659,"children":68660},{"style":360},[68661],{"type":26,"value":31175},{"type":21,"tag":209,"props":68663,"children":68664},{"style":222},[68665],{"type":26,"value":4123},{"type":21,"tag":209,"props":68667,"children":68669},{"class":211,"line":68668},301,[68670],{"type":21,"tag":209,"props":68671,"children":68672},{"style":222},[68673],{"type":26,"value":331},{"type":21,"tag":209,"props":68675,"children":68677},{"class":211,"line":68676},302,[68678],{"type":21,"tag":209,"props":68679,"children":68680},{"style":222},[68681],{"type":26,"value":4415},{"type":21,"tag":209,"props":68683,"children":68685},{"class":211,"line":68684},303,[68686],{"type":21,"tag":209,"props":68687,"children":68688},{"emptyLinePlaceholder":248},[68689],{"type":26,"value":251},{"type":21,"tag":209,"props":68691,"children":68693},{"class":211,"line":68692},304,[68694],{"type":21,"tag":209,"props":68695,"children":68696},{"style":448},[68697],{"type":26,"value":731},{"type":21,"tag":209,"props":68699,"children":68701},{"class":211,"line":68700},305,[68702],{"type":21,"tag":209,"props":68703,"children":68704},{"style":448},[68705],{"type":26,"value":68706}," * Deferred wrapper for file reader.\n",{"type":21,"tag":209,"props":68708,"children":68710},{"class":211,"line":68709},306,[68711,68715,68719],{"type":21,"tag":209,"props":68712,"children":68713},{"style":448},[68714],{"type":26,"value":39750},{"type":21,"tag":209,"props":68716,"children":68717},{"style":216},[68718],{"type":26,"value":13311},{"type":21,"tag":209,"props":68720,"children":68721},{"style":222},[68722],{"type":26,"value":61978},{"type":21,"tag":209,"props":68724,"children":68726},{"class":211,"line":68725},307,[68727,68731,68735],{"type":21,"tag":209,"props":68728,"children":68729},{"style":448},[68730],{"type":26,"value":39750},{"type":21,"tag":209,"props":68732,"children":68733},{"style":216},[68734],{"type":26,"value":13311},{"type":21,"tag":209,"props":68736,"children":68737},{"style":222},[68738],{"type":26,"value":60728},{"type":21,"tag":209,"props":68740,"children":68742},{"class":211,"line":68741},308,[68743,68747,68751,68755],{"type":21,"tag":209,"props":68744,"children":68745},{"style":448},[68746],{"type":26,"value":39750},{"type":21,"tag":209,"props":68748,"children":68749},{"style":216},[68750],{"type":26,"value":13333},{"type":21,"tag":209,"props":68752,"children":68753},{"style":360},[68754],{"type":26,"value":60744},{"type":21,"tag":209,"props":68756,"children":68757},{"style":448},[68758],{"type":26,"value":62013},{"type":21,"tag":209,"props":68760,"children":68762},{"class":211,"line":68761},309,[68763,68767],{"type":21,"tag":209,"props":68764,"children":68765},{"style":448},[68766],{"type":26,"value":39750},{"type":21,"tag":209,"props":68768,"children":68769},{"style":216},[68770],{"type":26,"value":41933},{"type":21,"tag":209,"props":68772,"children":68774},{"class":211,"line":68773},310,[68775],{"type":21,"tag":209,"props":68776,"children":68777},{"style":448},[68778],{"type":26,"value":755},{"type":21,"tag":209,"props":68780,"children":68782},{"class":211,"line":68781},311,[68783,68787,68791,68795,68799,68803,68807],{"type":21,"tag":209,"props":68784,"children":68785},{"style":216},[68786],{"type":26,"value":4622},{"type":21,"tag":209,"props":68788,"children":68789},{"style":360},[68790],{"type":26,"value":53675},{"type":21,"tag":209,"props":68792,"children":68793},{"style":222},[68794],{"type":26,"value":368},{"type":21,"tag":209,"props":68796,"children":68797},{"style":400},[68798],{"type":26,"value":31198},{"type":21,"tag":209,"props":68800,"children":68801},{"style":222},[68802],{"type":26,"value":408},{"type":21,"tag":209,"props":68804,"children":68805},{"style":400},[68806],{"type":26,"value":60795},{"type":21,"tag":209,"props":68808,"children":68809},{"style":222},[68810],{"type":26,"value":2369},{"type":21,"tag":209,"props":68812,"children":68814},{"class":211,"line":68813},312,[68815,68819,68823,68827,68831,68835],{"type":21,"tag":209,"props":68816,"children":68817},{"style":263},[68818],{"type":26,"value":46760},{"type":21,"tag":209,"props":68820,"children":68821},{"style":222},[68822],{"type":26,"value":60841},{"type":21,"tag":209,"props":68824,"children":68825},{"style":216},[68826],{"type":26,"value":1432},{"type":21,"tag":209,"props":68828,"children":68829},{"style":222},[68830],{"type":26,"value":25427},{"type":21,"tag":209,"props":68832,"children":68833},{"style":360},[68834],{"type":26,"value":25432},{"type":21,"tag":209,"props":68836,"children":68837},{"style":222},[68838],{"type":26,"value":4123},{"type":21,"tag":209,"props":68840,"children":68842},{"class":211,"line":68841},313,[68843,68847,68851,68855,68859,68863],{"type":21,"tag":209,"props":68844,"children":68845},{"style":263},[68846],{"type":26,"value":46760},{"type":21,"tag":209,"props":68848,"children":68849},{"style":222},[68850],{"type":26,"value":62101},{"type":21,"tag":209,"props":68852,"children":68853},{"style":216},[68854],{"type":26,"value":1432},{"type":21,"tag":209,"props":68856,"children":68857},{"style":216},[68858],{"type":26,"value":6371},{"type":21,"tag":209,"props":68860,"children":68861},{"style":360},[68862],{"type":26,"value":62114},{"type":21,"tag":209,"props":68864,"children":68865},{"style":222},[68866],{"type":26,"value":4123},{"type":21,"tag":209,"props":68868,"children":68870},{"class":211,"line":68869},314,[68871,68875,68879,68883],{"type":21,"tag":209,"props":68872,"children":68873},{"style":263},[68874],{"type":26,"value":46760},{"type":21,"tag":209,"props":68876,"children":68877},{"style":222},[68878],{"type":26,"value":60869},{"type":21,"tag":209,"props":68880,"children":68881},{"style":216},[68882],{"type":26,"value":1432},{"type":21,"tag":209,"props":68884,"children":68885},{"style":222},[68886],{"type":26,"value":60878},{"type":21,"tag":209,"props":68888,"children":68890},{"class":211,"line":68889},315,[68891,68895,68899,68903],{"type":21,"tag":209,"props":68892,"children":68893},{"style":263},[68894],{"type":26,"value":46760},{"type":21,"tag":209,"props":68896,"children":68897},{"style":222},[68898],{"type":26,"value":62149},{"type":21,"tag":209,"props":68900,"children":68901},{"style":216},[68902],{"type":26,"value":1432},{"type":21,"tag":209,"props":68904,"children":68905},{"style":222},[68906],{"type":26,"value":62158},{"type":21,"tag":209,"props":68908,"children":68910},{"class":211,"line":68909},316,[68911],{"type":21,"tag":209,"props":68912,"children":68913},{"emptyLinePlaceholder":248},[68914],{"type":26,"value":251},{"type":21,"tag":209,"props":68916,"children":68918},{"class":211,"line":68917},317,[68919,68923,68927,68931],{"type":21,"tag":209,"props":68920,"children":68921},{"style":263},[68922],{"type":26,"value":46760},{"type":21,"tag":209,"props":68924,"children":68925},{"style":222},[68926],{"type":26,"value":378},{"type":21,"tag":209,"props":68928,"children":68929},{"style":360},[68930],{"type":26,"value":4593},{"type":21,"tag":209,"props":68932,"children":68933},{"style":222},[68934],{"type":26,"value":4123},{"type":21,"tag":209,"props":68936,"children":68938},{"class":211,"line":68937},318,[68939,68943],{"type":21,"tag":209,"props":68940,"children":68941},{"style":263},[68942],{"type":26,"value":46760},{"type":21,"tag":209,"props":68944,"children":68945},{"style":222},[68946],{"type":26,"value":62196},{"type":21,"tag":209,"props":68948,"children":68950},{"class":211,"line":68949},319,[68951],{"type":21,"tag":209,"props":68952,"children":68953},{"emptyLinePlaceholder":248},[68954],{"type":26,"value":251},{"type":21,"tag":209,"props":68956,"children":68958},{"class":211,"line":68957},320,[68959,68963,68967,68971,68975],{"type":21,"tag":209,"props":68960,"children":68961},{"style":216},[68962],{"type":26,"value":1298},{"type":21,"tag":209,"props":68964,"children":68965},{"style":263},[68966],{"type":26,"value":20502},{"type":21,"tag":209,"props":68968,"children":68969},{"style":222},[68970],{"type":26,"value":55615},{"type":21,"tag":209,"props":68972,"children":68973},{"style":360},[68974],{"type":26,"value":26332},{"type":21,"tag":209,"props":68976,"children":68977},{"style":222},[68978],{"type":26,"value":4123},{"type":21,"tag":209,"props":68980,"children":68982},{"class":211,"line":68981},321,[68983],{"type":21,"tag":209,"props":68984,"children":68985},{"style":222},[68986],{"type":26,"value":4415},{"type":21,"tag":209,"props":68988,"children":68990},{"class":211,"line":68989},322,[68991],{"type":21,"tag":209,"props":68992,"children":68993},{"emptyLinePlaceholder":248},[68994],{"type":26,"value":251},{"type":21,"tag":209,"props":68996,"children":68998},{"class":211,"line":68997},323,[68999],{"type":21,"tag":209,"props":69000,"children":69001},{"style":448},[69002],{"type":26,"value":731},{"type":21,"tag":209,"props":69004,"children":69006},{"class":211,"line":69005},324,[69007],{"type":21,"tag":209,"props":69008,"children":69009},{"style":448},[69010],{"type":26,"value":62255},{"type":21,"tag":209,"props":69012,"children":69014},{"class":211,"line":69013},325,[69015],{"type":21,"tag":209,"props":69016,"children":69017},{"style":448},[69018],{"type":26,"value":62263},{"type":21,"tag":209,"props":69020,"children":69022},{"class":211,"line":69021},326,[69023],{"type":21,"tag":209,"props":69024,"children":69025},{"style":448},[69026],{"type":26,"value":755},{"type":21,"tag":209,"props":69028,"children":69030},{"class":211,"line":69029},327,[69031,69035,69039,69043,69047,69051,69055,69059],{"type":21,"tag":209,"props":69032,"children":69033},{"style":263},[69034],{"type":26,"value":62278},{"type":21,"tag":209,"props":69036,"children":69037},{"style":222},[69038],{"type":26,"value":378},{"type":21,"tag":209,"props":69040,"children":69041},{"style":263},[69042],{"type":26,"value":32662},{"type":21,"tag":209,"props":69044,"children":69045},{"style":222},[69046],{"type":26,"value":378},{"type":21,"tag":209,"props":69048,"children":69049},{"style":360},[69050],{"type":26,"value":4593},{"type":21,"tag":209,"props":69052,"children":69053},{"style":216},[69054],{"type":26,"value":271},{"type":21,"tag":209,"props":69056,"children":69057},{"style":216},[69058],{"type":26,"value":4789},{"type":21,"tag":209,"props":69060,"children":69061},{"style":222},[69062],{"type":26,"value":2561},{"type":21,"tag":209,"props":69064,"children":69066},{"class":211,"line":69065},328,[69067,69071,69075,69079,69083],{"type":21,"tag":209,"props":69068,"children":69069},{"style":216},[69070],{"type":26,"value":16994},{"type":21,"tag":209,"props":69072,"children":69073},{"style":222},[69074],{"type":26,"value":52897},{"type":21,"tag":209,"props":69076,"children":69077},{"style":216},[69078],{"type":26,"value":1432},{"type":21,"tag":209,"props":69080,"children":69081},{"style":263},[69082],{"type":26,"value":20502},{"type":21,"tag":209,"props":69084,"children":69085},{"style":222},[69086],{"type":26,"value":241},{"type":21,"tag":209,"props":69088,"children":69090},{"class":211,"line":69089},329,[69091],{"type":21,"tag":209,"props":69092,"children":69093},{"emptyLinePlaceholder":248},[69094],{"type":26,"value":251},{"type":21,"tag":209,"props":69096,"children":69098},{"class":211,"line":69097},330,[69099,69103,69107,69111,69115,69119,69123,69127,69131,69135],{"type":21,"tag":209,"props":69100,"children":69101},{"style":263},[69102],{"type":26,"value":46760},{"type":21,"tag":209,"props":69104,"children":69105},{"style":222},[69106],{"type":26,"value":62348},{"type":21,"tag":209,"props":69108,"children":69109},{"style":360},[69110],{"type":26,"value":14995},{"type":21,"tag":209,"props":69112,"children":69113},{"style":222},[69114],{"type":26,"value":368},{"type":21,"tag":209,"props":69116,"children":69117},{"style":233},[69118],{"type":26,"value":20588},{"type":21,"tag":209,"props":69120,"children":69121},{"style":222},[69122],{"type":26,"value":408},{"type":21,"tag":209,"props":69124,"children":69125},{"style":216},[69126],{"type":26,"value":4622},{"type":21,"tag":209,"props":69128,"children":69129},{"style":222},[69130],{"type":26,"value":368},{"type":21,"tag":209,"props":69132,"children":69133},{"style":400},[69134],{"type":26,"value":25805},{"type":21,"tag":209,"props":69136,"children":69137},{"style":222},[69138],{"type":26,"value":2369},{"type":21,"tag":209,"props":69140,"children":69142},{"class":211,"line":69141},331,[69143,69147,69151,69155],{"type":21,"tag":209,"props":69144,"children":69145},{"style":216},[69146],{"type":26,"value":14505},{"type":21,"tag":209,"props":69148,"children":69149},{"style":222},[69150],{"type":26,"value":62392},{"type":21,"tag":209,"props":69152,"children":69153},{"style":216},[69154],{"type":26,"value":1432},{"type":21,"tag":209,"props":69156,"children":69157},{"style":222},[69158],{"type":26,"value":62401},{"type":21,"tag":209,"props":69160,"children":69162},{"class":211,"line":69161},332,[69163,69167,69171],{"type":21,"tag":209,"props":69164,"children":69165},{"style":222},[69166],{"type":26,"value":62409},{"type":21,"tag":209,"props":69168,"children":69169},{"style":216},[69170],{"type":26,"value":1432},{"type":21,"tag":209,"props":69172,"children":69173},{"style":222},[69174],{"type":26,"value":62418},{"type":21,"tag":209,"props":69176,"children":69178},{"class":211,"line":69177},333,[69179,69183,69187,69191,69195,69199,69203,69207,69211],{"type":21,"tag":209,"props":69180,"children":69181},{"style":222},[69182],{"type":26,"value":62426},{"type":21,"tag":209,"props":69184,"children":69185},{"style":216},[69186],{"type":26,"value":1432},{"type":21,"tag":209,"props":69188,"children":69189},{"style":233},[69190],{"type":26,"value":62435},{"type":21,"tag":209,"props":69192,"children":69193},{"style":216},[69194],{"type":26,"value":17170},{"type":21,"tag":209,"props":69196,"children":69197},{"style":263},[69198],{"type":26,"value":2508},{"type":21,"tag":209,"props":69200,"children":69201},{"style":222},[69202],{"type":26,"value":62448},{"type":21,"tag":209,"props":69204,"children":69205},{"style":216},[69206],{"type":26,"value":17170},{"type":21,"tag":209,"props":69208,"children":69209},{"style":233},[69210],{"type":26,"value":62457},{"type":21,"tag":209,"props":69212,"children":69213},{"style":222},[69214],{"type":26,"value":241},{"type":21,"tag":209,"props":69216,"children":69218},{"class":211,"line":69217},334,[69219,69223],{"type":21,"tag":209,"props":69220,"children":69221},{"style":216},[69222],{"type":26,"value":62469},{"type":21,"tag":209,"props":69224,"children":69225},{"style":222},[69226],{"type":26,"value":62474},{"type":21,"tag":209,"props":69228,"children":69230},{"class":211,"line":69229},335,[69231],{"type":21,"tag":209,"props":69232,"children":69233},{"style":222},[69234],{"type":26,"value":17555},{"type":21,"tag":209,"props":69236,"children":69238},{"class":211,"line":69237},336,[69239,69243,69247,69251],{"type":21,"tag":209,"props":69240,"children":69241},{"style":216},[69242],{"type":26,"value":62489},{"type":21,"tag":209,"props":69244,"children":69245},{"style":222},[69246],{"type":26,"value":62494},{"type":21,"tag":209,"props":69248,"children":69249},{"style":263},[69250],{"type":26,"value":62499},{"type":21,"tag":209,"props":69252,"children":69253},{"style":222},[69254],{"type":26,"value":844},{"type":21,"tag":209,"props":69256,"children":69258},{"class":211,"line":69257},337,[69259,69263,69267,69271],{"type":21,"tag":209,"props":69260,"children":69261},{"style":222},[69262],{"type":26,"value":62511},{"type":21,"tag":209,"props":69264,"children":69265},{"style":216},[69266],{"type":26,"value":51693},{"type":21,"tag":209,"props":69268,"children":69269},{"style":233},[69270],{"type":26,"value":62520},{"type":21,"tag":209,"props":69272,"children":69273},{"style":222},[69274],{"type":26,"value":241},{"type":21,"tag":209,"props":69276,"children":69278},{"class":211,"line":69277},338,[69279,69283],{"type":21,"tag":209,"props":69280,"children":69281},{"style":216},[69282],{"type":26,"value":62532},{"type":21,"tag":209,"props":69284,"children":69285},{"style":222},[69286],{"type":26,"value":241},{"type":21,"tag":209,"props":69288,"children":69290},{"class":211,"line":69289},339,[69291,69295,69299,69303],{"type":21,"tag":209,"props":69292,"children":69293},{"style":216},[69294],{"type":26,"value":62489},{"type":21,"tag":209,"props":69296,"children":69297},{"style":222},[69298],{"type":26,"value":62494},{"type":21,"tag":209,"props":69300,"children":69301},{"style":263},[69302],{"type":26,"value":62552},{"type":21,"tag":209,"props":69304,"children":69305},{"style":222},[69306],{"type":26,"value":844},{"type":21,"tag":209,"props":69308,"children":69310},{"class":211,"line":69309},340,[69311,69315,69319,69323],{"type":21,"tag":209,"props":69312,"children":69313},{"style":222},[69314],{"type":26,"value":62511},{"type":21,"tag":209,"props":69316,"children":69317},{"style":216},[69318],{"type":26,"value":51693},{"type":21,"tag":209,"props":69320,"children":69321},{"style":233},[69322],{"type":26,"value":62572},{"type":21,"tag":209,"props":69324,"children":69325},{"style":222},[69326],{"type":26,"value":241},{"type":21,"tag":209,"props":69328,"children":69330},{"class":211,"line":69329},341,[69331,69335],{"type":21,"tag":209,"props":69332,"children":69333},{"style":216},[69334],{"type":26,"value":62532},{"type":21,"tag":209,"props":69336,"children":69337},{"style":222},[69338],{"type":26,"value":241},{"type":21,"tag":209,"props":69340,"children":69342},{"class":211,"line":69341},342,[69343,69347,69351,69355],{"type":21,"tag":209,"props":69344,"children":69345},{"style":216},[69346],{"type":26,"value":62489},{"type":21,"tag":209,"props":69348,"children":69349},{"style":222},[69350],{"type":26,"value":62494},{"type":21,"tag":209,"props":69352,"children":69353},{"style":263},[69354],{"type":26,"value":62603},{"type":21,"tag":209,"props":69356,"children":69357},{"style":222},[69358],{"type":26,"value":844},{"type":21,"tag":209,"props":69360,"children":69362},{"class":211,"line":69361},343,[69363,69367,69371,69375],{"type":21,"tag":209,"props":69364,"children":69365},{"style":222},[69366],{"type":26,"value":62511},{"type":21,"tag":209,"props":69368,"children":69369},{"style":216},[69370],{"type":26,"value":51693},{"type":21,"tag":209,"props":69372,"children":69373},{"style":233},[69374],{"type":26,"value":62623},{"type":21,"tag":209,"props":69376,"children":69377},{"style":222},[69378],{"type":26,"value":241},{"type":21,"tag":209,"props":69380,"children":69382},{"class":211,"line":69381},344,[69383,69387],{"type":21,"tag":209,"props":69384,"children":69385},{"style":216},[69386],{"type":26,"value":62532},{"type":21,"tag":209,"props":69388,"children":69389},{"style":222},[69390],{"type":26,"value":241},{"type":21,"tag":209,"props":69392,"children":69394},{"class":211,"line":69393},345,[69395,69399],{"type":21,"tag":209,"props":69396,"children":69397},{"style":216},[69398],{"type":26,"value":62646},{"type":21,"tag":209,"props":69400,"children":69401},{"style":222},[69402],{"type":26,"value":844},{"type":21,"tag":209,"props":69404,"children":69406},{"class":211,"line":69405},346,[69407,69411,69415,69419],{"type":21,"tag":209,"props":69408,"children":69409},{"style":222},[69410],{"type":26,"value":62511},{"type":21,"tag":209,"props":69412,"children":69413},{"style":216},[69414],{"type":26,"value":51693},{"type":21,"tag":209,"props":69416,"children":69417},{"style":233},[69418],{"type":26,"value":62666},{"type":21,"tag":209,"props":69420,"children":69421},{"style":222},[69422],{"type":26,"value":241},{"type":21,"tag":209,"props":69424,"children":69426},{"class":211,"line":69425},347,[69427,69431],{"type":21,"tag":209,"props":69428,"children":69429},{"style":216},[69430],{"type":26,"value":62532},{"type":21,"tag":209,"props":69432,"children":69433},{"style":222},[69434],{"type":26,"value":241},{"type":21,"tag":209,"props":69436,"children":69438},{"class":211,"line":69437},348,[69439],{"type":21,"tag":209,"props":69440,"children":69441},{"style":222},[69442],{"type":26,"value":2235},{"type":21,"tag":209,"props":69444,"children":69446},{"class":211,"line":69445},349,[69447,69451,69455,69459,69463],{"type":21,"tag":209,"props":69448,"children":69449},{"style":222},[69450],{"type":26,"value":62696},{"type":21,"tag":209,"props":69452,"children":69453},{"style":360},[69454],{"type":26,"value":14182},{"type":21,"tag":209,"props":69456,"children":69457},{"style":222},[69458],{"type":26,"value":55625},{"type":21,"tag":209,"props":69460,"children":69461},{"style":263},[69462],{"type":26,"value":62709},{"type":21,"tag":209,"props":69464,"children":69465},{"style":222},[69466],{"type":26,"value":62714},{"type":21,"tag":209,"props":69468,"children":69470},{"class":211,"line":69469},350,[69471,69475,69479],{"type":21,"tag":209,"props":69472,"children":69473},{"style":222},[69474],{"type":26,"value":62722},{"type":21,"tag":209,"props":69476,"children":69477},{"style":263},[69478],{"type":26,"value":4243},{"type":21,"tag":209,"props":69480,"children":69481},{"style":222},[69482],{"type":26,"value":2608},{"type":21,"tag":209,"props":69484,"children":69486},{"class":211,"line":69485},351,[69487],{"type":21,"tag":209,"props":69488,"children":69489},{"emptyLinePlaceholder":248},[69490],{"type":26,"value":251},{"type":21,"tag":209,"props":69492,"children":69494},{"class":211,"line":69493},352,[69495,69499,69503,69507,69511,69515,69519,69523,69527,69531],{"type":21,"tag":209,"props":69496,"children":69497},{"style":263},[69498],{"type":26,"value":46760},{"type":21,"tag":209,"props":69500,"children":69501},{"style":222},[69502],{"type":26,"value":62348},{"type":21,"tag":209,"props":69504,"children":69505},{"style":360},[69506],{"type":26,"value":14995},{"type":21,"tag":209,"props":69508,"children":69509},{"style":222},[69510],{"type":26,"value":368},{"type":21,"tag":209,"props":69512,"children":69513},{"style":233},[69514],{"type":26,"value":61185},{"type":21,"tag":209,"props":69516,"children":69517},{"style":222},[69518],{"type":26,"value":408},{"type":21,"tag":209,"props":69520,"children":69521},{"style":216},[69522],{"type":26,"value":4622},{"type":21,"tag":209,"props":69524,"children":69525},{"style":222},[69526],{"type":26,"value":368},{"type":21,"tag":209,"props":69528,"children":69529},{"style":400},[69530],{"type":26,"value":25805},{"type":21,"tag":209,"props":69532,"children":69533},{"style":222},[69534],{"type":26,"value":2369},{"type":21,"tag":209,"props":69536,"children":69538},{"class":211,"line":69537},353,[69539,69543],{"type":21,"tag":209,"props":69540,"children":69541},{"style":216},[69542],{"type":26,"value":6334},{"type":21,"tag":209,"props":69544,"children":69545},{"style":222},[69546],{"type":26,"value":55313},{"type":21,"tag":209,"props":69548,"children":69550},{"class":211,"line":69549},354,[69551],{"type":21,"tag":209,"props":69552,"children":69553},{"style":222},[69554],{"type":26,"value":17555},{"type":21,"tag":209,"props":69556,"children":69558},{"class":211,"line":69557},355,[69559,69563,69567,69571,69575],{"type":21,"tag":209,"props":69560,"children":69561},{"style":222},[69562],{"type":26,"value":62806},{"type":21,"tag":209,"props":69564,"children":69565},{"style":360},[69566],{"type":26,"value":55620},{"type":21,"tag":209,"props":69568,"children":69569},{"style":222},[69570],{"type":26,"value":55625},{"type":21,"tag":209,"props":69572,"children":69573},{"style":263},[69574],{"type":26,"value":62819},{"type":21,"tag":209,"props":69576,"children":69577},{"style":222},[69578],{"type":26,"value":62824},{"type":21,"tag":209,"props":69580,"children":69582},{"class":211,"line":69581},356,[69583,69587,69591],{"type":21,"tag":209,"props":69584,"children":69585},{"style":222},[69586],{"type":26,"value":62832},{"type":21,"tag":209,"props":69588,"children":69589},{"style":216},[69590],{"type":26,"value":6460},{"type":21,"tag":209,"props":69592,"children":69593},{"style":222},[69594],{"type":26,"value":62841},{"type":21,"tag":209,"props":69596,"children":69598},{"class":211,"line":69597},357,[69599],{"type":21,"tag":209,"props":69600,"children":69601},{"style":222},[69602],{"type":26,"value":2235},{"type":21,"tag":209,"props":69604,"children":69606},{"class":211,"line":69605},358,[69607],{"type":21,"tag":209,"props":69608,"children":69609},{"style":222},[69610],{"type":26,"value":3391},{"type":21,"tag":209,"props":69612,"children":69614},{"class":211,"line":69613},359,[69615],{"type":21,"tag":209,"props":69616,"children":69617},{"emptyLinePlaceholder":248},[69618],{"type":26,"value":251},{"type":21,"tag":209,"props":69620,"children":69622},{"class":211,"line":69621},360,[69623,69627,69631,69635,69639,69643,69647,69651,69655,69659],{"type":21,"tag":209,"props":69624,"children":69625},{"style":263},[69626],{"type":26,"value":46760},{"type":21,"tag":209,"props":69628,"children":69629},{"style":222},[69630],{"type":26,"value":62348},{"type":21,"tag":209,"props":69632,"children":69633},{"style":360},[69634],{"type":26,"value":14995},{"type":21,"tag":209,"props":69636,"children":69637},{"style":222},[69638],{"type":26,"value":368},{"type":21,"tag":209,"props":69640,"children":69641},{"style":233},[69642],{"type":26,"value":62886},{"type":21,"tag":209,"props":69644,"children":69645},{"style":222},[69646],{"type":26,"value":408},{"type":21,"tag":209,"props":69648,"children":69649},{"style":216},[69650],{"type":26,"value":4622},{"type":21,"tag":209,"props":69652,"children":69653},{"style":222},[69654],{"type":26,"value":368},{"type":21,"tag":209,"props":69656,"children":69657},{"style":400},[69658],{"type":26,"value":25805},{"type":21,"tag":209,"props":69660,"children":69661},{"style":222},[69662],{"type":26,"value":2369},{"type":21,"tag":209,"props":69664,"children":69666},{"class":211,"line":69665},361,[69667,69671,69675,69679,69683,69687],{"type":21,"tag":209,"props":69668,"children":69669},{"style":216},[69670],{"type":26,"value":6334},{"type":21,"tag":209,"props":69672,"children":69673},{"style":222},[69674],{"type":26,"value":62918},{"type":21,"tag":209,"props":69676,"children":69677},{"style":216},[69678],{"type":26,"value":23855},{"type":21,"tag":209,"props":69680,"children":69681},{"style":222},[69682],{"type":26,"value":62927},{"type":21,"tag":209,"props":69684,"children":69685},{"style":263},[69686],{"type":26,"value":62932},{"type":21,"tag":209,"props":69688,"children":69689},{"style":222},[69690],{"type":26,"value":8924},{"type":21,"tag":209,"props":69692,"children":69694},{"class":211,"line":69693},362,[69695],{"type":21,"tag":209,"props":69696,"children":69697},{"style":222},[69698],{"type":26,"value":17555},{"type":21,"tag":209,"props":69700,"children":69702},{"class":211,"line":69701},363,[69703,69707,69711,69715,69719],{"type":21,"tag":209,"props":69704,"children":69705},{"style":222},[69706],{"type":26,"value":62806},{"type":21,"tag":209,"props":69708,"children":69709},{"style":360},[69710],{"type":26,"value":14173},{"type":21,"tag":209,"props":69712,"children":69713},{"style":222},[69714],{"type":26,"value":55625},{"type":21,"tag":209,"props":69716,"children":69717},{"style":263},[69718],{"type":26,"value":62963},{"type":21,"tag":209,"props":69720,"children":69721},{"style":222},[69722],{"type":26,"value":304},{"type":21,"tag":209,"props":69724,"children":69726},{"class":211,"line":69725},364,[69727],{"type":21,"tag":209,"props":69728,"children":69729},{"style":222},[69730],{"type":26,"value":62975},{"type":21,"tag":209,"props":69732,"children":69734},{"class":211,"line":69733},365,[69735],{"type":21,"tag":209,"props":69736,"children":69737},{"style":222},[69738],{"type":26,"value":62983},{"type":21,"tag":209,"props":69740,"children":69742},{"class":211,"line":69741},366,[69743],{"type":21,"tag":209,"props":69744,"children":69745},{"style":222},[69746],{"type":26,"value":2235},{"type":21,"tag":209,"props":69748,"children":69750},{"class":211,"line":69749},367,[69751,69755,69759],{"type":21,"tag":209,"props":69752,"children":69753},{"style":222},[69754],{"type":26,"value":62722},{"type":21,"tag":209,"props":69756,"children":69757},{"style":263},[69758],{"type":26,"value":4243},{"type":21,"tag":209,"props":69760,"children":69761},{"style":222},[69762],{"type":26,"value":2608},{"type":21,"tag":209,"props":69764,"children":69766},{"class":211,"line":69765},368,[69767],{"type":21,"tag":209,"props":69768,"children":69769},{"style":222},[69770],{"type":26,"value":340},{"type":21,"tag":209,"props":69772,"children":69774},{"class":211,"line":69773},369,[69775],{"type":21,"tag":209,"props":69776,"children":69777},{"emptyLinePlaceholder":248},[69778],{"type":26,"value":251},{"type":21,"tag":209,"props":69780,"children":69782},{"class":211,"line":69781},370,[69783],{"type":21,"tag":209,"props":69784,"children":69785},{"style":448},[69786],{"type":26,"value":731},{"type":21,"tag":209,"props":69788,"children":69790},{"class":211,"line":69789},371,[69791],{"type":21,"tag":209,"props":69792,"children":69793},{"style":448},[69794],{"type":26,"value":69795}," * Entry point for calling the reader/uploader, with the element to be used as input specified.\n",{"type":21,"tag":209,"props":69797,"children":69799},{"class":211,"line":69798},372,[69800],{"type":21,"tag":209,"props":69801,"children":69802},{"style":448},[69803],{"type":26,"value":69804}," * Usage:\n",{"type":21,"tag":209,"props":69806,"children":69808},{"class":211,"line":69807},373,[69809],{"type":21,"tag":209,"props":69810,"children":69811},{"style":448},[69812],{"type":26,"value":69813}," * $('#input').hup({options}).on('events') --OR--\n",{"type":21,"tag":209,"props":69815,"children":69817},{"class":211,"line":69816},374,[69818],{"type":21,"tag":209,"props":69819,"children":69820},{"style":448},[69821],{"type":26,"value":69822}," * $('.inputs').hup({options}).on('events')\n",{"type":21,"tag":209,"props":69824,"children":69826},{"class":211,"line":69825},375,[69827,69831,69835],{"type":21,"tag":209,"props":69828,"children":69829},{"style":448},[69830],{"type":26,"value":39750},{"type":21,"tag":209,"props":69832,"children":69833},{"style":216},[69834],{"type":26,"value":13311},{"type":21,"tag":209,"props":69836,"children":69837},{"style":222},[69838],{"type":26,"value":60712},{"type":21,"tag":209,"props":69840,"children":69842},{"class":211,"line":69841},376,[69843,69847,69851,69856],{"type":21,"tag":209,"props":69844,"children":69845},{"style":448},[69846],{"type":26,"value":39750},{"type":21,"tag":209,"props":69848,"children":69849},{"style":216},[69850],{"type":26,"value":13333},{"type":21,"tag":209,"props":69852,"children":69853},{"style":360},[69854],{"type":26,"value":69855}," {Hup}",{"type":21,"tag":209,"props":69857,"children":69858},{"style":448},[69859],{"type":26,"value":69860}," Promise deferred from Hup.\n",{"type":21,"tag":209,"props":69862,"children":69864},{"class":211,"line":69863},377,[69865],{"type":21,"tag":209,"props":69866,"children":69867},{"style":448},[69868],{"type":26,"value":755},{"type":21,"tag":209,"props":69870,"children":69872},{"class":211,"line":69871},378,[69873,69878,69883,69887,69891,69895,69899],{"type":21,"tag":209,"props":69874,"children":69875},{"style":222},[69876],{"type":26,"value":69877},"$.fn.",{"type":21,"tag":209,"props":69879,"children":69880},{"style":360},[69881],{"type":26,"value":69882},"hup",{"type":21,"tag":209,"props":69884,"children":69885},{"style":216},[69886],{"type":26,"value":271},{"type":21,"tag":209,"props":69888,"children":69889},{"style":216},[69890],{"type":26,"value":4789},{"type":21,"tag":209,"props":69892,"children":69893},{"style":222},[69894],{"type":26,"value":368},{"type":21,"tag":209,"props":69896,"children":69897},{"style":400},[69898],{"type":26,"value":28349},{"type":21,"tag":209,"props":69900,"children":69901},{"style":222},[69902],{"type":26,"value":2369},{"type":21,"tag":209,"props":69904,"children":69906},{"class":211,"line":69905},379,[69907,69911,69916,69920,69925,69929],{"type":21,"tag":209,"props":69908,"children":69909},{"style":216},[69910],{"type":26,"value":16994},{"type":21,"tag":209,"props":69912,"children":69913},{"style":222},[69914],{"type":26,"value":69915}," options ",{"type":21,"tag":209,"props":69917,"children":69918},{"style":216},[69919],{"type":26,"value":1432},{"type":21,"tag":209,"props":69921,"children":69922},{"style":222},[69923],{"type":26,"value":69924}," (options ",{"type":21,"tag":209,"props":69926,"children":69927},{"style":216},[69928],{"type":26,"value":13270},{"type":21,"tag":209,"props":69930,"children":69931},{"style":222},[69932],{"type":26,"value":69933}," {});\n",{"type":21,"tag":209,"props":69935,"children":69937},{"class":211,"line":69936},380,[69938,69942,69946,69950,69954,69958,69962],{"type":21,"tag":209,"props":69939,"children":69940},{"style":216},[69941],{"type":26,"value":1298},{"type":21,"tag":209,"props":69943,"children":69944},{"style":263},[69945],{"type":26,"value":20502},{"type":21,"tag":209,"props":69947,"children":69948},{"style":222},[69949],{"type":26,"value":378},{"type":21,"tag":209,"props":69951,"children":69952},{"style":360},[69953],{"type":26,"value":45662},{"type":21,"tag":209,"props":69955,"children":69956},{"style":222},[69957],{"type":26,"value":368},{"type":21,"tag":209,"props":69959,"children":69960},{"style":216},[69961],{"type":26,"value":4622},{"type":21,"tag":209,"props":69963,"children":69964},{"style":222},[69965],{"type":26,"value":2561},{"type":21,"tag":209,"props":69967,"children":69969},{"class":211,"line":69968},381,[69970,69975,69979,69983],{"type":21,"tag":209,"props":69971,"children":69972},{"style":222},[69973],{"type":26,"value":69974},"        options.input ",{"type":21,"tag":209,"props":69976,"children":69977},{"style":216},[69978],{"type":26,"value":1432},{"type":21,"tag":209,"props":69980,"children":69981},{"style":263},[69982],{"type":26,"value":20502},{"type":21,"tag":209,"props":69984,"children":69985},{"style":222},[69986],{"type":26,"value":241},{"type":21,"tag":209,"props":69988,"children":69990},{"class":211,"line":69989},382,[69991,69995,69999,70003,70007,70011,70015],{"type":21,"tag":209,"props":69992,"children":69993},{"style":216},[69994],{"type":26,"value":14505},{"type":21,"tag":209,"props":69996,"children":69997},{"style":222},[69998],{"type":26,"value":45727},{"type":21,"tag":209,"props":70000,"children":70001},{"style":216},[70002],{"type":26,"value":1432},{"type":21,"tag":209,"props":70004,"children":70005},{"style":360},[70006],{"type":26,"value":45616},{"type":21,"tag":209,"props":70008,"children":70009},{"style":222},[70010],{"type":26,"value":368},{"type":21,"tag":209,"props":70012,"children":70013},{"style":263},[70014],{"type":26,"value":2508},{"type":21,"tag":209,"props":70016,"children":70017},{"style":222},[70018],{"type":26,"value":5404},{"type":21,"tag":209,"props":70020,"children":70022},{"class":211,"line":70021},383,[70023,70028,70032,70036,70040,70044,70049],{"type":21,"tag":209,"props":70024,"children":70025},{"style":222},[70026],{"type":26,"value":70027},"            hup ",{"type":21,"tag":209,"props":70029,"children":70030},{"style":216},[70031],{"type":26,"value":1432},{"type":21,"tag":209,"props":70033,"children":70034},{"style":222},[70035],{"type":26,"value":45764},{"type":21,"tag":209,"props":70037,"children":70038},{"style":360},[70039],{"type":26,"value":2863},{"type":21,"tag":209,"props":70041,"children":70042},{"style":222},[70043],{"type":26,"value":368},{"type":21,"tag":209,"props":70045,"children":70046},{"style":233},[70047],{"type":26,"value":70048},"'hup'",{"type":21,"tag":209,"props":70050,"children":70051},{"style":222},[70052],{"type":26,"value":2608},{"type":21,"tag":209,"props":70054,"children":70056},{"class":211,"line":70055},384,[70057,70061,70065,70069],{"type":21,"tag":209,"props":70058,"children":70059},{"style":216},[70060],{"type":26,"value":6334},{"type":21,"tag":209,"props":70062,"children":70063},{"style":222},[70064],{"type":26,"value":5569},{"type":21,"tag":209,"props":70066,"children":70067},{"style":216},[70068],{"type":26,"value":6455},{"type":21,"tag":209,"props":70070,"children":70071},{"style":222},[70072],{"type":26,"value":70073},"hup)\n",{"type":21,"tag":209,"props":70075,"children":70077},{"class":211,"line":70076},385,[70078],{"type":21,"tag":209,"props":70079,"children":70080},{"style":222},[70081],{"type":26,"value":17555},{"type":21,"tag":209,"props":70083,"children":70085},{"class":211,"line":70084},386,[70086,70091,70095,70099,70103,70107,70111,70115],{"type":21,"tag":209,"props":70087,"children":70088},{"style":222},[70089],{"type":26,"value":70090},"            $this.",{"type":21,"tag":209,"props":70092,"children":70093},{"style":360},[70094],{"type":26,"value":2863},{"type":21,"tag":209,"props":70096,"children":70097},{"style":222},[70098],{"type":26,"value":368},{"type":21,"tag":209,"props":70100,"children":70101},{"style":233},[70102],{"type":26,"value":70048},{"type":21,"tag":209,"props":70104,"children":70105},{"style":222},[70106],{"type":26,"value":408},{"type":21,"tag":209,"props":70108,"children":70109},{"style":216},[70110],{"type":26,"value":32573},{"type":21,"tag":209,"props":70112,"children":70113},{"style":360},[70114],{"type":26,"value":63207},{"type":21,"tag":209,"props":70116,"children":70117},{"style":222},[70118],{"type":26,"value":70119},"(options));\n",{"type":21,"tag":209,"props":70121,"children":70123},{"class":211,"line":70122},387,[70124],{"type":21,"tag":209,"props":70125,"children":70126},{"style":222},[70127],{"type":26,"value":2235},{"type":21,"tag":209,"props":70129,"children":70131},{"class":211,"line":70130},388,[70132,70136,70141,70146,70150,70154],{"type":21,"tag":209,"props":70133,"children":70134},{"style":216},[70135],{"type":26,"value":24665},{"type":21,"tag":209,"props":70137,"children":70138},{"style":216},[70139],{"type":26,"value":70140}," if",{"type":21,"tag":209,"props":70142,"children":70143},{"style":222},[70144],{"type":26,"value":70145}," (hup ",{"type":21,"tag":209,"props":70147,"children":70148},{"style":216},[70149],{"type":26,"value":45611},{"type":21,"tag":209,"props":70151,"children":70152},{"style":360},[70153],{"type":26,"value":63207},{"type":21,"tag":209,"props":70155,"children":70156},{"style":222},[70157],{"type":26,"value":8924},{"type":21,"tag":209,"props":70159,"children":70161},{"class":211,"line":70160},389,[70162],{"type":21,"tag":209,"props":70163,"children":70164},{"style":222},[70165],{"type":26,"value":17555},{"type":21,"tag":209,"props":70167,"children":70169},{"class":211,"line":70168},390,[70170,70175,70179],{"type":21,"tag":209,"props":70171,"children":70172},{"style":222},[70173],{"type":26,"value":70174},"            hup.",{"type":21,"tag":209,"props":70176,"children":70177},{"style":360},[70178],{"type":26,"value":46847},{"type":21,"tag":209,"props":70180,"children":70181},{"style":222},[70182],{"type":26,"value":63239},{"type":21,"tag":209,"props":70184,"children":70186},{"class":211,"line":70185},391,[70187],{"type":21,"tag":209,"props":70188,"children":70189},{"style":222},[70190],{"type":26,"value":2235},{"type":21,"tag":209,"props":70192,"children":70194},{"class":211,"line":70193},392,[70195],{"type":21,"tag":209,"props":70196,"children":70197},{"style":222},[70198],{"type":26,"value":3391},{"type":21,"tag":209,"props":70200,"children":70202},{"class":211,"line":70201},393,[70203],{"type":21,"tag":209,"props":70204,"children":70205},{"style":222},[70206],{"type":26,"value":340},{"type":21,"tag":209,"props":70208,"children":70210},{"class":211,"line":70209},394,[70211],{"type":21,"tag":209,"props":70212,"children":70213},{"style":222},[70214],{"type":26,"value":46369},{"type":21,"tag":3490,"props":70216,"children":70217},{},[70218],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":70220},[70221,70222,70223,70224],{"id":60160,"depth":244,"text":60163},{"id":60658,"depth":244,"text":60661},{"id":61899,"depth":244,"text":61902},{"id":17724,"depth":244,"text":17727},"content:ckeefer:2014-2:ajax-upload-2.md","ckeefer/2014-2/ajax-upload-2.md","ckeefer/2014-2/ajax-upload-2",{"user":3518,"name":3519},{"_path":70230,"_dir":70231,"_draft":7,"_partial":7,"_locale":8,"title":70232,"description":70233,"publishDate":70234,"categories":70235,"tags":70236,"image":70238,"excerpt":70233,"body":70239,"_type":3511,"_id":73622,"_source":3513,"_file":73623,"_stem":73624,"_extension":3516,"author":73625},"/ckeefer/2013-3/ajax-upload","2013-3","Ajax Upload Part I: Framed (and jQuery Deferred)","Inevitably, people want their files on the Internet. If your project is about cute cats, someone will task you with allowing users to upload photos of their cats, videos of their cats, long rambling audio clips in which they attempt to convince their cat to stop attacking the microphone, etcetera. If your project is about the nature and proclivities of mold, someone, somewhere will want to share detailed photographic evidence of their mold problem. The need to upload files is a given.","2013-03-20",[42381],[12,16600,70237],"html5","/ckeefer/2013-3/img/upframe.jpg",{"type":18,"children":70240,"toc":73615},[70241,70255,70277,70282,70287,70293,70298,70303,70491,70496,70842,70847,70853,70858,70872,70991,71003,71009,71014,71276,71288,71446,71451,71825,71830,72148,72153,72159,72164,72170,72175,73611],{"type":21,"tag":22,"props":70242,"children":70243},{},[70244,70246,70253],{"type":26,"value":70245},"Inevitably, people want their files on the Internet. If your project is about cute cats, someone will task you with allowing users to upload photos of their cats, videos of their cats, long rambling audio clips in which they attempt to convince their cat to stop attacking the microphone, etcetera. If your project is about the nature and proclivities of mold, ",{"type":21,"tag":29,"props":70247,"children":70250},{"href":70248,"rel":70249},"http://beta.photobucket.com/img/mold+spores/",[93],[70251],{"type":26,"value":70252},"someone, somewhere",{"type":26,"value":70254}," will want to share detailed photographic evidence of their mold problem. The need to upload files is a given.",{"type":21,"tag":22,"props":70256,"children":70257},{},[70258,70260,70267,70269,70275],{"type":26,"value":70259},"Despite that, uploading files has long been one of the roughest aspects of interaction with the web – requiring form submission, and the requisite UI-lockup and page reload, or else some form of plugin intervention (such as Flash). ",{"type":21,"tag":29,"props":70261,"children":70264},{"href":70262,"rel":70263},"http://www.w3.org/TR/XMLHttpRequest2/",[93],[70265],{"type":26,"value":70266},"This is changing",{"type":26,"value":70268}," – with the new XMLHttpRequest level 2 spec, coupled with the ",{"type":21,"tag":29,"props":70270,"children":70272},{"href":61919,"rel":70271},[93],[70273],{"type":26,"value":70274},"File API",{"type":26,"value":70276},", all supporting browsers will be able to cleanly and neatly retrieve a file from the user's local file system and upload it to the web – no page reloads, beautifully asynchronous. We will be focusing on just how to take advantage of these new developments in part II.",{"type":21,"tag":22,"props":70278,"children":70279},{},[70280],{"type":26,"value":70281},"For now, though, let's say you have to support an older browser (\u003C= IE9, for instance). You don't want to have to employ Flash – its a security risk (a topic for another post), and not supported by all mobile browsers or devices; but you want to avoid the deleterious standard behaviour of a form submission. Or maybe there's some other need for a form submission that works like an ajax request (I'll get into that later).",{"type":21,"tag":22,"props":70283,"children":70284},{},[70285],{"type":26,"value":70286},"Aha, I say – its time for a little iframe trick, then.",{"type":21,"tag":3596,"props":70288,"children":70290},{"id":70289},"the-trick",[70291],{"type":26,"value":70292},"The Trick",{"type":21,"tag":22,"props":70294,"children":70295},{},[70296],{"type":26,"value":70297},"Situation: We need to submit a form transparently (to the user), and get the result (so that we know when our file has finished uploading, for instance). We don't want to lock up the UI or reload the page. So, instead of submitting our form within the page, we will submit it within an iframe.",{"type":21,"tag":22,"props":70299,"children":70300},{},[70301],{"type":26,"value":70302},"Say you have a form like this:",{"type":21,"tag":200,"props":70304,"children":70306},{"className":22953,"code":70305,"language":22955,"meta":8,"style":8},"\u003Cform id=\"uploadForm\" action=\"/upload/url\" enctype=\"multipart/form-data\" method=\"POST\">\n    \u003Cinput type=\"file\" name=\"uploadLocalImage\" accept=\"image/*\" />\n    \u003Cinput type=\"submit\" value=\"Submit\" />\n\u003C/form>\n",[70307],{"type":21,"tag":63,"props":70308,"children":70309},{"__ignoreMap":8},[70310,70380,70435,70476],{"type":21,"tag":209,"props":70311,"children":70312},{"class":211,"line":212},[70313,70317,70321,70325,70329,70334,70339,70343,70348,70353,70357,70362,70367,70371,70376],{"type":21,"tag":209,"props":70314,"children":70315},{"style":222},[70316],{"type":26,"value":1985},{"type":21,"tag":209,"props":70318,"children":70319},{"style":1988},[70320],{"type":26,"value":22995},{"type":21,"tag":209,"props":70322,"children":70323},{"style":360},[70324],{"type":26,"value":23016},{"type":21,"tag":209,"props":70326,"children":70327},{"style":222},[70328],{"type":26,"value":1432},{"type":21,"tag":209,"props":70330,"children":70331},{"style":233},[70332],{"type":26,"value":70333},"\"uploadForm\"",{"type":21,"tag":209,"props":70335,"children":70336},{"style":360},[70337],{"type":26,"value":70338}," action",{"type":21,"tag":209,"props":70340,"children":70341},{"style":222},[70342],{"type":26,"value":1432},{"type":21,"tag":209,"props":70344,"children":70345},{"style":233},[70346],{"type":26,"value":70347},"\"/upload/url\"",{"type":21,"tag":209,"props":70349,"children":70350},{"style":360},[70351],{"type":26,"value":70352}," enctype",{"type":21,"tag":209,"props":70354,"children":70355},{"style":222},[70356],{"type":26,"value":1432},{"type":21,"tag":209,"props":70358,"children":70359},{"style":233},[70360],{"type":26,"value":70361},"\"multipart/form-data\"",{"type":21,"tag":209,"props":70363,"children":70364},{"style":360},[70365],{"type":26,"value":70366}," method",{"type":21,"tag":209,"props":70368,"children":70369},{"style":222},[70370],{"type":26,"value":1432},{"type":21,"tag":209,"props":70372,"children":70373},{"style":233},[70374],{"type":26,"value":70375},"\"POST\"",{"type":21,"tag":209,"props":70377,"children":70378},{"style":222},[70379],{"type":26,"value":1996},{"type":21,"tag":209,"props":70381,"children":70382},{"class":211,"line":244},[70383,70387,70391,70395,70399,70403,70408,70412,70417,70422,70426,70431],{"type":21,"tag":209,"props":70384,"children":70385},{"style":222},[70386],{"type":26,"value":2004},{"type":21,"tag":209,"props":70388,"children":70389},{"style":1988},[70390],{"type":26,"value":60217},{"type":21,"tag":209,"props":70392,"children":70393},{"style":360},[70394],{"type":26,"value":23062},{"type":21,"tag":209,"props":70396,"children":70397},{"style":222},[70398],{"type":26,"value":1432},{"type":21,"tag":209,"props":70400,"children":70401},{"style":233},[70402],{"type":26,"value":60243},{"type":21,"tag":209,"props":70404,"children":70405},{"style":360},[70406],{"type":26,"value":70407}," name",{"type":21,"tag":209,"props":70409,"children":70410},{"style":222},[70411],{"type":26,"value":1432},{"type":21,"tag":209,"props":70413,"children":70414},{"style":233},[70415],{"type":26,"value":70416},"\"uploadLocalImage\"",{"type":21,"tag":209,"props":70418,"children":70419},{"style":360},[70420],{"type":26,"value":70421}," accept",{"type":21,"tag":209,"props":70423,"children":70424},{"style":222},[70425],{"type":26,"value":1432},{"type":21,"tag":209,"props":70427,"children":70428},{"style":233},[70429],{"type":26,"value":70430},"\"image/*\"",{"type":21,"tag":209,"props":70432,"children":70433},{"style":222},[70434],{"type":26,"value":60248},{"type":21,"tag":209,"props":70436,"children":70437},{"class":211,"line":254},[70438,70442,70446,70450,70454,70458,70463,70467,70472],{"type":21,"tag":209,"props":70439,"children":70440},{"style":222},[70441],{"type":26,"value":2004},{"type":21,"tag":209,"props":70443,"children":70444},{"style":1988},[70445],{"type":26,"value":60217},{"type":21,"tag":209,"props":70447,"children":70448},{"style":360},[70449],{"type":26,"value":23062},{"type":21,"tag":209,"props":70451,"children":70452},{"style":222},[70453],{"type":26,"value":1432},{"type":21,"tag":209,"props":70455,"children":70456},{"style":233},[70457],{"type":26,"value":23071},{"type":21,"tag":209,"props":70459,"children":70460},{"style":360},[70461],{"type":26,"value":70462}," value",{"type":21,"tag":209,"props":70464,"children":70465},{"style":222},[70466],{"type":26,"value":1432},{"type":21,"tag":209,"props":70468,"children":70469},{"style":233},[70470],{"type":26,"value":70471},"\"Submit\"",{"type":21,"tag":209,"props":70473,"children":70474},{"style":222},[70475],{"type":26,"value":60248},{"type":21,"tag":209,"props":70477,"children":70478},{"class":211,"line":279},[70479,70483,70487],{"type":21,"tag":209,"props":70480,"children":70481},{"style":222},[70482],{"type":26,"value":2024},{"type":21,"tag":209,"props":70484,"children":70485},{"style":1988},[70486],{"type":26,"value":22995},{"type":21,"tag":209,"props":70488,"children":70489},{"style":222},[70490],{"type":26,"value":1996},{"type":21,"tag":22,"props":70492,"children":70493},{},[70494],{"type":26,"value":70495},"The user selects the file they want to upload, and clicks submit. We want to upload the file, and expect a json response telling us something (new location of the file, number of MB left for uploading files, etc.)",{"type":21,"tag":200,"props":70497,"children":70499},{"className":16138,"code":70498,"language":16140,"meta":8,"style":8},"$('#uploadForm').on('submit', function(event){\n// Check to see if target is defined before we cancel the default event - this allows us to use the html5 checkValidity function on a form if we so desire, or perform any other checks.\nif ($(this).attr('target') === undefined)\n{\n    event.preventDefault();\n    this.checkValidity(); // See \u003Ca href=\"http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-form- checkvalidity\">checkValidity\u003C/a>; for more details. This probably isn't necessary on a file upload, but might be desirable for other form submissions.\n$.transparentSubmit({\n    dataType:'json',\n    form:this\n}).done(function(response){\n// Woo, completed successfully! Do something with the response.\n    console.log(response);\n}).fail(function(e){\n// Aww, our call failed. :( Do something with the failure message.\n    console.log(e);\n});\n}\n});\n",[70500],{"type":21,"tag":63,"props":70501,"children":70502},{"__ignoreMap":8},[70503,70556,70564,70622,70629,70644,70669,70685,70700,70713,70744,70752,70767,70798,70806,70821,70828,70835],{"type":21,"tag":209,"props":70504,"children":70505},{"class":211,"line":212},[70506,70510,70514,70519,70523,70527,70531,70536,70540,70544,70548,70552],{"type":21,"tag":209,"props":70507,"children":70508},{"style":360},[70509],{"type":26,"value":6476},{"type":21,"tag":209,"props":70511,"children":70512},{"style":222},[70513],{"type":26,"value":368},{"type":21,"tag":209,"props":70515,"children":70516},{"style":233},[70517],{"type":26,"value":70518},"'#uploadForm'",{"type":21,"tag":209,"props":70520,"children":70521},{"style":222},[70522],{"type":26,"value":2699},{"type":21,"tag":209,"props":70524,"children":70525},{"style":360},[70526],{"type":26,"value":363},{"type":21,"tag":209,"props":70528,"children":70529},{"style":222},[70530],{"type":26,"value":368},{"type":21,"tag":209,"props":70532,"children":70533},{"style":233},[70534],{"type":26,"value":70535},"'submit'",{"type":21,"tag":209,"props":70537,"children":70538},{"style":222},[70539],{"type":26,"value":408},{"type":21,"tag":209,"props":70541,"children":70542},{"style":216},[70543],{"type":26,"value":4622},{"type":21,"tag":209,"props":70545,"children":70546},{"style":222},[70547],{"type":26,"value":368},{"type":21,"tag":209,"props":70549,"children":70550},{"style":400},[70551],{"type":26,"value":25805},{"type":21,"tag":209,"props":70553,"children":70554},{"style":222},[70555],{"type":26,"value":2369},{"type":21,"tag":209,"props":70557,"children":70558},{"class":211,"line":244},[70559],{"type":21,"tag":209,"props":70560,"children":70561},{"style":448},[70562],{"type":26,"value":70563},"// Check to see if target is defined before we cancel the default event - this allows us to use the html5 checkValidity function on a form if we so desire, or perform any other checks.\n",{"type":21,"tag":209,"props":70565,"children":70566},{"class":211,"line":254},[70567,70571,70575,70579,70583,70587,70591,70596,70600,70605,70609,70613,70618],{"type":21,"tag":209,"props":70568,"children":70569},{"style":216},[70570],{"type":26,"value":4301},{"type":21,"tag":209,"props":70572,"children":70573},{"style":222},[70574],{"type":26,"value":5569},{"type":21,"tag":209,"props":70576,"children":70577},{"style":360},[70578],{"type":26,"value":6476},{"type":21,"tag":209,"props":70580,"children":70581},{"style":222},[70582],{"type":26,"value":368},{"type":21,"tag":209,"props":70584,"children":70585},{"style":263},[70586],{"type":26,"value":2508},{"type":21,"tag":209,"props":70588,"children":70589},{"style":222},[70590],{"type":26,"value":2699},{"type":21,"tag":209,"props":70592,"children":70593},{"style":360},[70594],{"type":26,"value":70595},"attr",{"type":21,"tag":209,"props":70597,"children":70598},{"style":222},[70599],{"type":26,"value":368},{"type":21,"tag":209,"props":70601,"children":70602},{"style":233},[70603],{"type":26,"value":70604},"'target'",{"type":21,"tag":209,"props":70606,"children":70607},{"style":222},[70608],{"type":26,"value":432},{"type":21,"tag":209,"props":70610,"children":70611},{"style":216},[70612],{"type":26,"value":14680},{"type":21,"tag":209,"props":70614,"children":70615},{"style":263},[70616],{"type":26,"value":70617}," undefined",{"type":21,"tag":209,"props":70619,"children":70620},{"style":222},[70621],{"type":26,"value":8924},{"type":21,"tag":209,"props":70623,"children":70624},{"class":211,"line":279},[70625],{"type":21,"tag":209,"props":70626,"children":70627},{"style":222},[70628],{"type":26,"value":29353},{"type":21,"tag":209,"props":70630,"children":70631},{"class":211,"line":288},[70632,70636,70640],{"type":21,"tag":209,"props":70633,"children":70634},{"style":222},[70635],{"type":26,"value":60430},{"type":21,"tag":209,"props":70637,"children":70638},{"style":360},[70639],{"type":26,"value":60435},{"type":21,"tag":209,"props":70641,"children":70642},{"style":222},[70643],{"type":26,"value":4123},{"type":21,"tag":209,"props":70645,"children":70646},{"class":211,"line":307},[70647,70651,70655,70660,70664],{"type":21,"tag":209,"props":70648,"children":70649},{"style":263},[70650],{"type":26,"value":46760},{"type":21,"tag":209,"props":70652,"children":70653},{"style":222},[70654],{"type":26,"value":378},{"type":21,"tag":209,"props":70656,"children":70657},{"style":360},[70658],{"type":26,"value":70659},"checkValidity",{"type":21,"tag":209,"props":70661,"children":70662},{"style":222},[70663],{"type":26,"value":34119},{"type":21,"tag":209,"props":70665,"children":70666},{"style":448},[70667],{"type":26,"value":70668},"// See \u003Ca href=\"http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-form- checkvalidity\">checkValidity\u003C/a>; for more details. This probably isn't necessary on a file upload, but might be desirable for other form submissions.\n",{"type":21,"tag":209,"props":70670,"children":70671},{"class":211,"line":325},[70672,70676,70681],{"type":21,"tag":209,"props":70673,"children":70674},{"style":222},[70675],{"type":26,"value":20778},{"type":21,"tag":209,"props":70677,"children":70678},{"style":360},[70679],{"type":26,"value":70680},"transparentSubmit",{"type":21,"tag":209,"props":70682,"children":70683},{"style":222},[70684],{"type":26,"value":7767},{"type":21,"tag":209,"props":70686,"children":70687},{"class":211,"line":334},[70688,70692,70696],{"type":21,"tag":209,"props":70689,"children":70690},{"style":222},[70691],{"type":26,"value":20827},{"type":21,"tag":209,"props":70693,"children":70694},{"style":233},[70695],{"type":26,"value":22703},{"type":21,"tag":209,"props":70697,"children":70698},{"style":222},[70699],{"type":26,"value":304},{"type":21,"tag":209,"props":70701,"children":70702},{"class":211,"line":343},[70703,70708],{"type":21,"tag":209,"props":70704,"children":70705},{"style":222},[70706],{"type":26,"value":70707},"    form:",{"type":21,"tag":209,"props":70709,"children":70710},{"style":263},[70711],{"type":26,"value":70712},"this\n",{"type":21,"tag":209,"props":70714,"children":70715},{"class":211,"line":351},[70716,70720,70724,70728,70732,70736,70740],{"type":21,"tag":209,"props":70717,"children":70718},{"style":222},[70719],{"type":26,"value":20840},{"type":21,"tag":209,"props":70721,"children":70722},{"style":360},[70723],{"type":26,"value":20845},{"type":21,"tag":209,"props":70725,"children":70726},{"style":222},[70727],{"type":26,"value":368},{"type":21,"tag":209,"props":70729,"children":70730},{"style":216},[70731],{"type":26,"value":4622},{"type":21,"tag":209,"props":70733,"children":70734},{"style":222},[70735],{"type":26,"value":368},{"type":21,"tag":209,"props":70737,"children":70738},{"style":400},[70739],{"type":26,"value":16982},{"type":21,"tag":209,"props":70741,"children":70742},{"style":222},[70743],{"type":26,"value":2369},{"type":21,"tag":209,"props":70745,"children":70746},{"class":211,"line":444},[70747],{"type":21,"tag":209,"props":70748,"children":70749},{"style":448},[70750],{"type":26,"value":70751},"// Woo, completed successfully! Do something with the response.\n",{"type":21,"tag":209,"props":70753,"children":70754},{"class":211,"line":454},[70755,70759,70763],{"type":21,"tag":209,"props":70756,"children":70757},{"style":222},[70758],{"type":26,"value":1054},{"type":21,"tag":209,"props":70760,"children":70761},{"style":360},[70762],{"type":26,"value":1059},{"type":21,"tag":209,"props":70764,"children":70765},{"style":222},[70766],{"type":26,"value":17694},{"type":21,"tag":209,"props":70768,"children":70769},{"class":211,"line":463},[70770,70774,70778,70782,70786,70790,70794],{"type":21,"tag":209,"props":70771,"children":70772},{"style":222},[70773],{"type":26,"value":20840},{"type":21,"tag":209,"props":70775,"children":70776},{"style":360},[70777],{"type":26,"value":20894},{"type":21,"tag":209,"props":70779,"children":70780},{"style":222},[70781],{"type":26,"value":368},{"type":21,"tag":209,"props":70783,"children":70784},{"style":216},[70785],{"type":26,"value":4622},{"type":21,"tag":209,"props":70787,"children":70788},{"style":222},[70789],{"type":26,"value":368},{"type":21,"tag":209,"props":70791,"children":70792},{"style":400},[70793],{"type":26,"value":14527},{"type":21,"tag":209,"props":70795,"children":70796},{"style":222},[70797],{"type":26,"value":2369},{"type":21,"tag":209,"props":70799,"children":70800},{"class":211,"line":472},[70801],{"type":21,"tag":209,"props":70802,"children":70803},{"style":448},[70804],{"type":26,"value":70805},"// Aww, our call failed. :( Do something with the failure message.\n",{"type":21,"tag":209,"props":70807,"children":70808},{"class":211,"line":480},[70809,70813,70817],{"type":21,"tag":209,"props":70810,"children":70811},{"style":222},[70812],{"type":26,"value":1054},{"type":21,"tag":209,"props":70814,"children":70815},{"style":360},[70816],{"type":26,"value":1059},{"type":21,"tag":209,"props":70818,"children":70819},{"style":222},[70820],{"type":26,"value":29450},{"type":21,"tag":209,"props":70822,"children":70823},{"class":211,"line":489},[70824],{"type":21,"tag":209,"props":70825,"children":70826},{"style":222},[70827],{"type":26,"value":469},{"type":21,"tag":209,"props":70829,"children":70830},{"class":211,"line":847},[70831],{"type":21,"tag":209,"props":70832,"children":70833},{"style":222},[70834],{"type":26,"value":4415},{"type":21,"tag":209,"props":70836,"children":70837},{"class":211,"line":860},[70838],{"type":21,"tag":209,"props":70839,"children":70840},{"style":222},[70841],{"type":26,"value":469},{"type":21,"tag":22,"props":70843,"children":70844},{},[70845],{"type":26,"value":70846},"Looks pretty simple, right? It's missing something, though - what's this $.transparentSubmit thing? It might look familiar if you're used to $.ajax - we're using the same nice, neat callback style via $.Deferred.",{"type":21,"tag":3596,"props":70848,"children":70850},{"id":70849},"aside-deferred",[70851],{"type":26,"value":70852},"Aside: $.Deferred",{"type":21,"tag":22,"props":70854,"children":70855},{},[70856],{"type":26,"value":70857},"jQuery offers us a very powerful tool for perfoming asynchronous calls, following the Promise pattern, in the form of $.Deferred. jQuery's ajax implements deferred as a way of offering us chainable callbacks (in the form of .done on success, .fail on failure, .always no matter the result, as well as waiting on multiple sucessful calls with .when, and chaining calls together with .then).",{"type":21,"tag":22,"props":70859,"children":70860},{},[70861,70863,70870],{"type":26,"value":70862},"This is all kinds of good, and could fill a post on its own (see ",{"type":21,"tag":29,"props":70864,"children":70867},{"href":70865,"rel":70866},"http://www.html5rocks.com/en/tutorials/async/deferred/",[93],[70868],{"type":26,"value":70869},"this post",{"type":26,"value":70871}," for example). For now, suffice to say that since we want our transparent form submission to work like an ajax call, it makes perfect sense for it to look and operate like one, too. It opens up neat possibilities - say we need the results of our form submission and a seperate ajax call before we proceed:",{"type":21,"tag":200,"props":70873,"children":70875},{"className":16138,"code":70874,"language":16140,"meta":8,"style":8},"$.when($('#myForm').transparentSubmit({}), $.ajax({url:'/ajax/page'}))\n.done(function(res1, res2){\n// Do something with the responses from both of our asynch calls\n});\n\n",[70876],{"type":21,"tag":63,"props":70877,"children":70878},{"__ignoreMap":8},[70879,70937,70976,70984],{"type":21,"tag":209,"props":70880,"children":70881},{"class":211,"line":212},[70882,70886,70890,70894,70898,70902,70907,70911,70915,70920,70924,70928,70933],{"type":21,"tag":209,"props":70883,"children":70884},{"style":222},[70885],{"type":26,"value":20778},{"type":21,"tag":209,"props":70887,"children":70888},{"style":360},[70889],{"type":26,"value":36261},{"type":21,"tag":209,"props":70891,"children":70892},{"style":222},[70893],{"type":26,"value":368},{"type":21,"tag":209,"props":70895,"children":70896},{"style":360},[70897],{"type":26,"value":6476},{"type":21,"tag":209,"props":70899,"children":70900},{"style":222},[70901],{"type":26,"value":368},{"type":21,"tag":209,"props":70903,"children":70904},{"style":233},[70905],{"type":26,"value":70906},"'#myForm'",{"type":21,"tag":209,"props":70908,"children":70909},{"style":222},[70910],{"type":26,"value":2699},{"type":21,"tag":209,"props":70912,"children":70913},{"style":360},[70914],{"type":26,"value":70680},{"type":21,"tag":209,"props":70916,"children":70917},{"style":222},[70918],{"type":26,"value":70919},"({}), $.",{"type":21,"tag":209,"props":70921,"children":70922},{"style":360},[70923],{"type":26,"value":20783},{"type":21,"tag":209,"props":70925,"children":70926},{"style":222},[70927],{"type":26,"value":38686},{"type":21,"tag":209,"props":70929,"children":70930},{"style":233},[70931],{"type":26,"value":70932},"'/ajax/page'",{"type":21,"tag":209,"props":70934,"children":70935},{"style":222},[70936],{"type":26,"value":5274},{"type":21,"tag":209,"props":70938,"children":70939},{"class":211,"line":244},[70940,70944,70948,70952,70956,70960,70964,70968,70972],{"type":21,"tag":209,"props":70941,"children":70942},{"style":222},[70943],{"type":26,"value":378},{"type":21,"tag":209,"props":70945,"children":70946},{"style":360},[70947],{"type":26,"value":20845},{"type":21,"tag":209,"props":70949,"children":70950},{"style":222},[70951],{"type":26,"value":368},{"type":21,"tag":209,"props":70953,"children":70954},{"style":216},[70955],{"type":26,"value":4622},{"type":21,"tag":209,"props":70957,"children":70958},{"style":222},[70959],{"type":26,"value":368},{"type":21,"tag":209,"props":70961,"children":70962},{"style":400},[70963],{"type":26,"value":3341},{"type":21,"tag":209,"props":70965,"children":70966},{"style":222},[70967],{"type":26,"value":408},{"type":21,"tag":209,"props":70969,"children":70970},{"style":400},[70971],{"type":26,"value":3350},{"type":21,"tag":209,"props":70973,"children":70974},{"style":222},[70975],{"type":26,"value":2369},{"type":21,"tag":209,"props":70977,"children":70978},{"class":211,"line":254},[70979],{"type":21,"tag":209,"props":70980,"children":70981},{"style":448},[70982],{"type":26,"value":70983},"// Do something with the responses from both of our asynch calls\n",{"type":21,"tag":209,"props":70985,"children":70986},{"class":211,"line":279},[70987],{"type":21,"tag":209,"props":70988,"children":70989},{"style":222},[70990],{"type":26,"value":469},{"type":21,"tag":22,"props":70992,"children":70993},{},[70994,70995,71001],{"type":26,"value":35724},{"type":21,"tag":29,"props":70996,"children":70998},{"href":34950,"rel":70997},[93],[70999],{"type":26,"value":71000},"jQuery docs",{"type":26,"value":71002}," for more details.",{"type":21,"tag":3596,"props":71004,"children":71006},{"id":71005},"breakdown",[71007],{"type":26,"value":71008},"Breakdown",{"type":21,"tag":22,"props":71010,"children":71011},{},[71012],{"type":26,"value":71013},"So just how does this transparentSubmit thing work, then? Let's go through it a few pieces at a time.",{"type":21,"tag":200,"props":71015,"children":71017},{"className":16138,"code":71016,"language":16140,"meta":8,"style":8},"var defer = $.Deferred(),\noptions = $.extend({\n    dataType:'json'\n}, (options || {})),\nname = 'target-'+Math.random().toString(36).substring(7),\nhiframe = $(''),\nform = $(options.form),\ncleanup = function(){\n    hiframe.remove();\n    delete frames[name];\n};\n",[71018],{"type":21,"tag":63,"props":71019,"children":71020},{"__ignoreMap":8},[71021,71048,71072,71083,71100,71171,71199,71220,71240,71256,71269],{"type":21,"tag":209,"props":71022,"children":71023},{"class":211,"line":212},[71024,71028,71032,71036,71040,71044],{"type":21,"tag":209,"props":71025,"children":71026},{"style":216},[71027],{"type":26,"value":3909},{"type":21,"tag":209,"props":71029,"children":71030},{"style":222},[71031],{"type":26,"value":26603},{"type":21,"tag":209,"props":71033,"children":71034},{"style":216},[71035],{"type":26,"value":1432},{"type":21,"tag":209,"props":71037,"children":71038},{"style":222},[71039],{"type":26,"value":25427},{"type":21,"tag":209,"props":71041,"children":71042},{"style":360},[71043],{"type":26,"value":25432},{"type":21,"tag":209,"props":71045,"children":71046},{"style":222},[71047],{"type":26,"value":13988},{"type":21,"tag":209,"props":71049,"children":71050},{"class":211,"line":244},[71051,71056,71060,71064,71068],{"type":21,"tag":209,"props":71052,"children":71053},{"style":222},[71054],{"type":26,"value":71055},"options ",{"type":21,"tag":209,"props":71057,"children":71058},{"style":216},[71059],{"type":26,"value":1432},{"type":21,"tag":209,"props":71061,"children":71062},{"style":222},[71063],{"type":26,"value":25427},{"type":21,"tag":209,"props":71065,"children":71066},{"style":360},[71067],{"type":26,"value":34329},{"type":21,"tag":209,"props":71069,"children":71070},{"style":222},[71071],{"type":26,"value":7767},{"type":21,"tag":209,"props":71073,"children":71074},{"class":211,"line":254},[71075,71079],{"type":21,"tag":209,"props":71076,"children":71077},{"style":222},[71078],{"type":26,"value":20827},{"type":21,"tag":209,"props":71080,"children":71081},{"style":233},[71082],{"type":26,"value":20832},{"type":21,"tag":209,"props":71084,"children":71085},{"class":211,"line":279},[71086,71091,71095],{"type":21,"tag":209,"props":71087,"children":71088},{"style":222},[71089],{"type":26,"value":71090},"}, (options ",{"type":21,"tag":209,"props":71092,"children":71093},{"style":216},[71094],{"type":26,"value":13270},{"type":21,"tag":209,"props":71096,"children":71097},{"style":222},[71098],{"type":26,"value":71099}," {})),\n",{"type":21,"tag":209,"props":71101,"children":71102},{"class":211,"line":288},[71103,71108,71112,71117,71121,71126,71131,71135,71140,71144,71149,71153,71158,71162,71167],{"type":21,"tag":209,"props":71104,"children":71105},{"style":222},[71106],{"type":26,"value":71107},"name ",{"type":21,"tag":209,"props":71109,"children":71110},{"style":216},[71111],{"type":26,"value":1432},{"type":21,"tag":209,"props":71113,"children":71114},{"style":233},[71115],{"type":26,"value":71116}," 'target-'",{"type":21,"tag":209,"props":71118,"children":71119},{"style":216},[71120],{"type":26,"value":17170},{"type":21,"tag":209,"props":71122,"children":71123},{"style":222},[71124],{"type":26,"value":71125},"Math.",{"type":21,"tag":209,"props":71127,"children":71128},{"style":360},[71129],{"type":26,"value":71130},"random",{"type":21,"tag":209,"props":71132,"children":71133},{"style":222},[71134],{"type":26,"value":17096},{"type":21,"tag":209,"props":71136,"children":71137},{"style":360},[71138],{"type":26,"value":71139},"toString",{"type":21,"tag":209,"props":71141,"children":71142},{"style":222},[71143],{"type":26,"value":368},{"type":21,"tag":209,"props":71145,"children":71146},{"style":263},[71147],{"type":26,"value":71148},"36",{"type":21,"tag":209,"props":71150,"children":71151},{"style":222},[71152],{"type":26,"value":2699},{"type":21,"tag":209,"props":71154,"children":71155},{"style":360},[71156],{"type":26,"value":71157},"substring",{"type":21,"tag":209,"props":71159,"children":71160},{"style":222},[71161],{"type":26,"value":368},{"type":21,"tag":209,"props":71163,"children":71164},{"style":263},[71165],{"type":26,"value":71166},"7",{"type":21,"tag":209,"props":71168,"children":71169},{"style":222},[71170],{"type":26,"value":5404},{"type":21,"tag":209,"props":71172,"children":71173},{"class":211,"line":307},[71174,71179,71183,71187,71191,71195],{"type":21,"tag":209,"props":71175,"children":71176},{"style":222},[71177],{"type":26,"value":71178},"hiframe ",{"type":21,"tag":209,"props":71180,"children":71181},{"style":216},[71182],{"type":26,"value":1432},{"type":21,"tag":209,"props":71184,"children":71185},{"style":360},[71186],{"type":26,"value":45616},{"type":21,"tag":209,"props":71188,"children":71189},{"style":222},[71190],{"type":26,"value":368},{"type":21,"tag":209,"props":71192,"children":71193},{"style":233},[71194],{"type":26,"value":10775},{"type":21,"tag":209,"props":71196,"children":71197},{"style":222},[71198],{"type":26,"value":5404},{"type":21,"tag":209,"props":71200,"children":71201},{"class":211,"line":325},[71202,71207,71211,71215],{"type":21,"tag":209,"props":71203,"children":71204},{"style":222},[71205],{"type":26,"value":71206},"form ",{"type":21,"tag":209,"props":71208,"children":71209},{"style":216},[71210],{"type":26,"value":1432},{"type":21,"tag":209,"props":71212,"children":71213},{"style":360},[71214],{"type":26,"value":45616},{"type":21,"tag":209,"props":71216,"children":71217},{"style":222},[71218],{"type":26,"value":71219},"(options.form),\n",{"type":21,"tag":209,"props":71221,"children":71222},{"class":211,"line":334},[71223,71228,71232,71236],{"type":21,"tag":209,"props":71224,"children":71225},{"style":360},[71226],{"type":26,"value":71227},"cleanup",{"type":21,"tag":209,"props":71229,"children":71230},{"style":216},[71231],{"type":26,"value":271},{"type":21,"tag":209,"props":71233,"children":71234},{"style":216},[71235],{"type":26,"value":4789},{"type":21,"tag":209,"props":71237,"children":71238},{"style":222},[71239],{"type":26,"value":2561},{"type":21,"tag":209,"props":71241,"children":71242},{"class":211,"line":343},[71243,71248,71252],{"type":21,"tag":209,"props":71244,"children":71245},{"style":222},[71246],{"type":26,"value":71247},"    hiframe.",{"type":21,"tag":209,"props":71249,"children":71250},{"style":360},[71251],{"type":26,"value":48015},{"type":21,"tag":209,"props":71253,"children":71254},{"style":222},[71255],{"type":26,"value":4123},{"type":21,"tag":209,"props":71257,"children":71258},{"class":211,"line":351},[71259,71264],{"type":21,"tag":209,"props":71260,"children":71261},{"style":216},[71262],{"type":26,"value":71263},"    delete",{"type":21,"tag":209,"props":71265,"children":71266},{"style":222},[71267],{"type":26,"value":71268}," frames[name];\n",{"type":21,"tag":209,"props":71270,"children":71271},{"class":211,"line":444},[71272],{"type":21,"tag":209,"props":71273,"children":71274},{"style":222},[71275],{"type":26,"value":340},{"type":21,"tag":22,"props":71277,"children":71278},{},[71279,71281,71286],{"type":26,"value":71280},"At the top we declare our deferred object, get options (which are passed to our plugin function, or else is made an empty object), set a name for the frame, create said iframe, get the form and declare an inline function to do some house-keeping. ",{"type":21,"tag":11881,"props":71282,"children":71283},{},[71284],{"type":26,"value":71285},"Note",{"type":26,"value":71287},": name is assigned a value from Math.random converted to a string using base 36 (0-9a-z) to generate a 5 letter random string we append to 'target-'. This isn't strictly necessary - originally, using the same name for more than one frame would cause us problems, but this is resolved by the call in cleanup to delete the named frame. I've left it in as a neat little trick that someone might be interested in!",{"type":21,"tag":200,"props":71289,"children":71291},{"className":16138,"code":71290,"language":16140,"meta":8,"style":8},"if (!form.length || form[0].tagName !== 'FORM')\n{\ndefer.reject(\"No form element specified to submit.\");\nreturn defer.promise();\n}\n\nform.attr('target', name).append(hiframe);\n",[71292],{"type":21,"tag":63,"props":71293,"children":71294},{"__ignoreMap":8},[71295,71349,71356,71380,71399,71406,71413],{"type":21,"tag":209,"props":71296,"children":71297},{"class":211,"line":212},[71298,71302,71306,71310,71315,71319,71323,71328,71332,71336,71340,71345],{"type":21,"tag":209,"props":71299,"children":71300},{"style":216},[71301],{"type":26,"value":4301},{"type":21,"tag":209,"props":71303,"children":71304},{"style":222},[71305],{"type":26,"value":5569},{"type":21,"tag":209,"props":71307,"children":71308},{"style":216},[71309],{"type":26,"value":6455},{"type":21,"tag":209,"props":71311,"children":71312},{"style":222},[71313],{"type":26,"value":71314},"form.",{"type":21,"tag":209,"props":71316,"children":71317},{"style":263},[71318],{"type":26,"value":6344},{"type":21,"tag":209,"props":71320,"children":71321},{"style":216},[71322],{"type":26,"value":4608},{"type":21,"tag":209,"props":71324,"children":71325},{"style":222},[71326],{"type":26,"value":71327}," form[",{"type":21,"tag":209,"props":71329,"children":71330},{"style":263},[71331],{"type":26,"value":8554},{"type":21,"tag":209,"props":71333,"children":71334},{"style":222},[71335],{"type":26,"value":64046},{"type":21,"tag":209,"props":71337,"children":71338},{"style":216},[71339],{"type":26,"value":8046},{"type":21,"tag":209,"props":71341,"children":71342},{"style":233},[71343],{"type":26,"value":71344}," 'FORM'",{"type":21,"tag":209,"props":71346,"children":71347},{"style":222},[71348],{"type":26,"value":8924},{"type":21,"tag":209,"props":71350,"children":71351},{"class":211,"line":244},[71352],{"type":21,"tag":209,"props":71353,"children":71354},{"style":222},[71355],{"type":26,"value":29353},{"type":21,"tag":209,"props":71357,"children":71358},{"class":211,"line":254},[71359,71363,71367,71371,71376],{"type":21,"tag":209,"props":71360,"children":71361},{"style":222},[71362],{"type":26,"value":35125},{"type":21,"tag":209,"props":71364,"children":71365},{"style":360},[71366],{"type":26,"value":14182},{"type":21,"tag":209,"props":71368,"children":71369},{"style":222},[71370],{"type":26,"value":368},{"type":21,"tag":209,"props":71372,"children":71373},{"style":233},[71374],{"type":26,"value":71375},"\"No form element specified to submit.\"",{"type":21,"tag":209,"props":71377,"children":71378},{"style":222},[71379],{"type":26,"value":2608},{"type":21,"tag":209,"props":71381,"children":71382},{"class":211,"line":279},[71383,71387,71391,71395],{"type":21,"tag":209,"props":71384,"children":71385},{"style":216},[71386],{"type":26,"value":8982},{"type":21,"tag":209,"props":71388,"children":71389},{"style":222},[71390],{"type":26,"value":26782},{"type":21,"tag":209,"props":71392,"children":71393},{"style":360},[71394],{"type":26,"value":26332},{"type":21,"tag":209,"props":71396,"children":71397},{"style":222},[71398],{"type":26,"value":4123},{"type":21,"tag":209,"props":71400,"children":71401},{"class":211,"line":288},[71402],{"type":21,"tag":209,"props":71403,"children":71404},{"style":222},[71405],{"type":26,"value":4415},{"type":21,"tag":209,"props":71407,"children":71408},{"class":211,"line":307},[71409],{"type":21,"tag":209,"props":71410,"children":71411},{"emptyLinePlaceholder":248},[71412],{"type":26,"value":251},{"type":21,"tag":209,"props":71414,"children":71415},{"class":211,"line":325},[71416,71420,71424,71428,71432,71437,71441],{"type":21,"tag":209,"props":71417,"children":71418},{"style":222},[71419],{"type":26,"value":71314},{"type":21,"tag":209,"props":71421,"children":71422},{"style":360},[71423],{"type":26,"value":70595},{"type":21,"tag":209,"props":71425,"children":71426},{"style":222},[71427],{"type":26,"value":368},{"type":21,"tag":209,"props":71429,"children":71430},{"style":233},[71431],{"type":26,"value":70604},{"type":21,"tag":209,"props":71433,"children":71434},{"style":222},[71435],{"type":26,"value":71436},", name).",{"type":21,"tag":209,"props":71438,"children":71439},{"style":360},[71440],{"type":26,"value":47442},{"type":21,"tag":209,"props":71442,"children":71443},{"style":222},[71444],{"type":26,"value":71445},"(hiframe);\n",{"type":21,"tag":22,"props":71447,"children":71448},{},[71449],{"type":26,"value":71450},"We make sure that form is in the DOM and is a form, or else call reject on our deferred object (triggering any .fail attached to our promise). Then, we set the target attribute on the form to point at our iframe, and append the iframe to the form.",{"type":21,"tag":200,"props":71452,"children":71454},{"className":16138,"code":71453,"language":16140,"meta":8,"style":8},"hiframe.on('load', function(){\nvar res;\n\nform.removeAttr('target');\n\ntry{\nif (options.dataType.indexOf('json') != -1)\n{\n    res = frames[name].document.getElementsByTagName(\"pre\")[0].innerHTML;\n}\nelse\n{\n    res = frames[name].document.getElementsByTagName('body')[0].innerHTML;\n}\n}catch(e){\n    // Failed to receive anything in the body of the frame\n    cleanup();\n    defer.reject(\"Failed to receive response in form target \"+name+\": \"+e.message);\n    return;\n}\ncleanup();\n",[71455],{"type":21,"tag":63,"props":71456,"children":71457},{"__ignoreMap":8},[71458,71490,71501,71508,71532,71539,71550,71595,71602,71646,71653,71661,71668,71707,71714,71730,71738,71750,71796,71807,71814],{"type":21,"tag":209,"props":71459,"children":71460},{"class":211,"line":212},[71461,71466,71470,71474,71478,71482,71486],{"type":21,"tag":209,"props":71462,"children":71463},{"style":222},[71464],{"type":26,"value":71465},"hiframe.",{"type":21,"tag":209,"props":71467,"children":71468},{"style":360},[71469],{"type":26,"value":363},{"type":21,"tag":209,"props":71471,"children":71472},{"style":222},[71473],{"type":26,"value":368},{"type":21,"tag":209,"props":71475,"children":71476},{"style":233},[71477],{"type":26,"value":20469},{"type":21,"tag":209,"props":71479,"children":71480},{"style":222},[71481],{"type":26,"value":408},{"type":21,"tag":209,"props":71483,"children":71484},{"style":216},[71485],{"type":26,"value":4622},{"type":21,"tag":209,"props":71487,"children":71488},{"style":222},[71489],{"type":26,"value":2561},{"type":21,"tag":209,"props":71491,"children":71492},{"class":211,"line":244},[71493,71497],{"type":21,"tag":209,"props":71494,"children":71495},{"style":216},[71496],{"type":26,"value":3909},{"type":21,"tag":209,"props":71498,"children":71499},{"style":222},[71500],{"type":26,"value":1442},{"type":21,"tag":209,"props":71502,"children":71503},{"class":211,"line":254},[71504],{"type":21,"tag":209,"props":71505,"children":71506},{"emptyLinePlaceholder":248},[71507],{"type":26,"value":251},{"type":21,"tag":209,"props":71509,"children":71510},{"class":211,"line":279},[71511,71515,71520,71524,71528],{"type":21,"tag":209,"props":71512,"children":71513},{"style":222},[71514],{"type":26,"value":71314},{"type":21,"tag":209,"props":71516,"children":71517},{"style":360},[71518],{"type":26,"value":71519},"removeAttr",{"type":21,"tag":209,"props":71521,"children":71522},{"style":222},[71523],{"type":26,"value":368},{"type":21,"tag":209,"props":71525,"children":71526},{"style":233},[71527],{"type":26,"value":70604},{"type":21,"tag":209,"props":71529,"children":71530},{"style":222},[71531],{"type":26,"value":2608},{"type":21,"tag":209,"props":71533,"children":71534},{"class":211,"line":288},[71535],{"type":21,"tag":209,"props":71536,"children":71537},{"emptyLinePlaceholder":248},[71538],{"type":26,"value":251},{"type":21,"tag":209,"props":71540,"children":71541},{"class":211,"line":307},[71542,71546],{"type":21,"tag":209,"props":71543,"children":71544},{"style":216},[71545],{"type":26,"value":11307},{"type":21,"tag":209,"props":71547,"children":71548},{"style":222},[71549],{"type":26,"value":29353},{"type":21,"tag":209,"props":71551,"children":71552},{"class":211,"line":325},[71553,71557,71562,71566,71570,71574,71578,71583,71587,71591],{"type":21,"tag":209,"props":71554,"children":71555},{"style":216},[71556],{"type":26,"value":4301},{"type":21,"tag":209,"props":71558,"children":71559},{"style":222},[71560],{"type":26,"value":71561}," (options.dataType.",{"type":21,"tag":209,"props":71563,"children":71564},{"style":360},[71565],{"type":26,"value":45239},{"type":21,"tag":209,"props":71567,"children":71568},{"style":222},[71569],{"type":26,"value":368},{"type":21,"tag":209,"props":71571,"children":71572},{"style":233},[71573],{"type":26,"value":22703},{"type":21,"tag":209,"props":71575,"children":71576},{"style":222},[71577],{"type":26,"value":432},{"type":21,"tag":209,"props":71579,"children":71580},{"style":216},[71581],{"type":26,"value":71582},"!=",{"type":21,"tag":209,"props":71584,"children":71585},{"style":216},[71586],{"type":26,"value":45261},{"type":21,"tag":209,"props":71588,"children":71589},{"style":263},[71590],{"type":26,"value":3224},{"type":21,"tag":209,"props":71592,"children":71593},{"style":222},[71594],{"type":26,"value":8924},{"type":21,"tag":209,"props":71596,"children":71597},{"class":211,"line":334},[71598],{"type":21,"tag":209,"props":71599,"children":71600},{"style":222},[71601],{"type":26,"value":29353},{"type":21,"tag":209,"props":71603,"children":71604},{"class":211,"line":343},[71605,71610,71614,71619,71624,71628,71633,71637,71641],{"type":21,"tag":209,"props":71606,"children":71607},{"style":222},[71608],{"type":26,"value":71609},"    res ",{"type":21,"tag":209,"props":71611,"children":71612},{"style":216},[71613],{"type":26,"value":1432},{"type":21,"tag":209,"props":71615,"children":71616},{"style":222},[71617],{"type":26,"value":71618}," frames[name].document.",{"type":21,"tag":209,"props":71620,"children":71621},{"style":360},[71622],{"type":26,"value":71623},"getElementsByTagName",{"type":21,"tag":209,"props":71625,"children":71626},{"style":222},[71627],{"type":26,"value":368},{"type":21,"tag":209,"props":71629,"children":71630},{"style":233},[71631],{"type":26,"value":71632},"\"pre\"",{"type":21,"tag":209,"props":71634,"children":71635},{"style":222},[71636],{"type":26,"value":22804},{"type":21,"tag":209,"props":71638,"children":71639},{"style":263},[71640],{"type":26,"value":8554},{"type":21,"tag":209,"props":71642,"children":71643},{"style":222},[71644],{"type":26,"value":71645},"].innerHTML;\n",{"type":21,"tag":209,"props":71647,"children":71648},{"class":211,"line":351},[71649],{"type":21,"tag":209,"props":71650,"children":71651},{"style":222},[71652],{"type":26,"value":4415},{"type":21,"tag":209,"props":71654,"children":71655},{"class":211,"line":444},[71656],{"type":21,"tag":209,"props":71657,"children":71658},{"style":216},[71659],{"type":26,"value":71660},"else\n",{"type":21,"tag":209,"props":71662,"children":71663},{"class":211,"line":454},[71664],{"type":21,"tag":209,"props":71665,"children":71666},{"style":222},[71667],{"type":26,"value":29353},{"type":21,"tag":209,"props":71669,"children":71670},{"class":211,"line":463},[71671,71675,71679,71683,71687,71691,71695,71699,71703],{"type":21,"tag":209,"props":71672,"children":71673},{"style":222},[71674],{"type":26,"value":71609},{"type":21,"tag":209,"props":71676,"children":71677},{"style":216},[71678],{"type":26,"value":1432},{"type":21,"tag":209,"props":71680,"children":71681},{"style":222},[71682],{"type":26,"value":71618},{"type":21,"tag":209,"props":71684,"children":71685},{"style":360},[71686],{"type":26,"value":71623},{"type":21,"tag":209,"props":71688,"children":71689},{"style":222},[71690],{"type":26,"value":368},{"type":21,"tag":209,"props":71692,"children":71693},{"style":233},[71694],{"type":26,"value":48539},{"type":21,"tag":209,"props":71696,"children":71697},{"style":222},[71698],{"type":26,"value":22804},{"type":21,"tag":209,"props":71700,"children":71701},{"style":263},[71702],{"type":26,"value":8554},{"type":21,"tag":209,"props":71704,"children":71705},{"style":222},[71706],{"type":26,"value":71645},{"type":21,"tag":209,"props":71708,"children":71709},{"class":211,"line":472},[71710],{"type":21,"tag":209,"props":71711,"children":71712},{"style":222},[71713],{"type":26,"value":4415},{"type":21,"tag":209,"props":71715,"children":71716},{"class":211,"line":480},[71717,71722,71726],{"type":21,"tag":209,"props":71718,"children":71719},{"style":222},[71720],{"type":26,"value":71721},"}",{"type":21,"tag":209,"props":71723,"children":71724},{"style":216},[71725],{"type":26,"value":5347},{"type":21,"tag":209,"props":71727,"children":71728},{"style":222},[71729],{"type":26,"value":29422},{"type":21,"tag":209,"props":71731,"children":71732},{"class":211,"line":489},[71733],{"type":21,"tag":209,"props":71734,"children":71735},{"style":448},[71736],{"type":26,"value":71737},"    // Failed to receive anything in the body of the frame\n",{"type":21,"tag":209,"props":71739,"children":71740},{"class":211,"line":847},[71741,71746],{"type":21,"tag":209,"props":71742,"children":71743},{"style":360},[71744],{"type":26,"value":71745},"    cleanup",{"type":21,"tag":209,"props":71747,"children":71748},{"style":222},[71749],{"type":26,"value":4123},{"type":21,"tag":209,"props":71751,"children":71752},{"class":211,"line":860},[71753,71757,71761,71765,71770,71774,71778,71782,71787,71791],{"type":21,"tag":209,"props":71754,"children":71755},{"style":222},[71756],{"type":26,"value":39462},{"type":21,"tag":209,"props":71758,"children":71759},{"style":360},[71760],{"type":26,"value":14182},{"type":21,"tag":209,"props":71762,"children":71763},{"style":222},[71764],{"type":26,"value":368},{"type":21,"tag":209,"props":71766,"children":71767},{"style":233},[71768],{"type":26,"value":71769},"\"Failed to receive response in form target \"",{"type":21,"tag":209,"props":71771,"children":71772},{"style":216},[71773],{"type":26,"value":17170},{"type":21,"tag":209,"props":71775,"children":71776},{"style":222},[71777],{"type":26,"value":38122},{"type":21,"tag":209,"props":71779,"children":71780},{"style":216},[71781],{"type":26,"value":17170},{"type":21,"tag":209,"props":71783,"children":71784},{"style":233},[71785],{"type":26,"value":71786},"\": \"",{"type":21,"tag":209,"props":71788,"children":71789},{"style":216},[71790],{"type":26,"value":17170},{"type":21,"tag":209,"props":71792,"children":71793},{"style":222},[71794],{"type":26,"value":71795},"e.message);\n",{"type":21,"tag":209,"props":71797,"children":71798},{"class":211,"line":877},[71799,71803],{"type":21,"tag":209,"props":71800,"children":71801},{"style":216},[71802],{"type":26,"value":1298},{"type":21,"tag":209,"props":71804,"children":71805},{"style":222},[71806],{"type":26,"value":241},{"type":21,"tag":209,"props":71808,"children":71809},{"class":211,"line":889},[71810],{"type":21,"tag":209,"props":71811,"children":71812},{"style":222},[71813],{"type":26,"value":4415},{"type":21,"tag":209,"props":71815,"children":71816},{"class":211,"line":902},[71817,71821],{"type":21,"tag":209,"props":71818,"children":71819},{"style":360},[71820],{"type":26,"value":71227},{"type":21,"tag":209,"props":71822,"children":71823},{"style":222},[71824],{"type":26,"value":4123},{"type":21,"tag":22,"props":71826,"children":71827},{},[71828],{"type":26,"value":71829},"Now, we add a listener to the 'load' event for the iframe. When that event is triggered, after the upload is finished, or the form has been successfully submitted, we remove the target from the form (so its ready to be checked previous to submission again), and try and get the content returned from the server we submitted to that will have been loaded into the iframe, based on the dataType we set as an option when calling $.transparentSubmit.",{"type":21,"tag":200,"props":71831,"children":71833},{"className":16138,"code":71832,"language":16140,"meta":8,"style":8},"if (options.dataType.indexOf('json') != -1)\n{\ntry{\n    res = $.parseJSON(res);\n}catch(e){\n    defer.reject(\"Failed to parse response into JSON: \"+e.message);\n    return;\n}\n}\nelse if (options.dataType.indexOf('html') != -1)\n{\nres = $.parseHTML(res);\n}\ndefer.resolve(res);\n});\n\nform.submit();\n\nreturn defer.promise();\n",[71834],{"type":21,"tag":63,"props":71835,"children":71836},{"__ignoreMap":8},[71837,71880,71887,71898,71922,71937,71965,71976,71983,71990,72038,72045,72070,72077,72092,72099,72106,72122,72129],{"type":21,"tag":209,"props":71838,"children":71839},{"class":211,"line":212},[71840,71844,71848,71852,71856,71860,71864,71868,71872,71876],{"type":21,"tag":209,"props":71841,"children":71842},{"style":216},[71843],{"type":26,"value":4301},{"type":21,"tag":209,"props":71845,"children":71846},{"style":222},[71847],{"type":26,"value":71561},{"type":21,"tag":209,"props":71849,"children":71850},{"style":360},[71851],{"type":26,"value":45239},{"type":21,"tag":209,"props":71853,"children":71854},{"style":222},[71855],{"type":26,"value":368},{"type":21,"tag":209,"props":71857,"children":71858},{"style":233},[71859],{"type":26,"value":22703},{"type":21,"tag":209,"props":71861,"children":71862},{"style":222},[71863],{"type":26,"value":432},{"type":21,"tag":209,"props":71865,"children":71866},{"style":216},[71867],{"type":26,"value":71582},{"type":21,"tag":209,"props":71869,"children":71870},{"style":216},[71871],{"type":26,"value":45261},{"type":21,"tag":209,"props":71873,"children":71874},{"style":263},[71875],{"type":26,"value":3224},{"type":21,"tag":209,"props":71877,"children":71878},{"style":222},[71879],{"type":26,"value":8924},{"type":21,"tag":209,"props":71881,"children":71882},{"class":211,"line":244},[71883],{"type":21,"tag":209,"props":71884,"children":71885},{"style":222},[71886],{"type":26,"value":29353},{"type":21,"tag":209,"props":71888,"children":71889},{"class":211,"line":254},[71890,71894],{"type":21,"tag":209,"props":71891,"children":71892},{"style":216},[71893],{"type":26,"value":11307},{"type":21,"tag":209,"props":71895,"children":71896},{"style":222},[71897],{"type":26,"value":29353},{"type":21,"tag":209,"props":71899,"children":71900},{"class":211,"line":279},[71901,71905,71909,71913,71918],{"type":21,"tag":209,"props":71902,"children":71903},{"style":222},[71904],{"type":26,"value":71609},{"type":21,"tag":209,"props":71906,"children":71907},{"style":216},[71908],{"type":26,"value":1432},{"type":21,"tag":209,"props":71910,"children":71911},{"style":222},[71912],{"type":26,"value":25427},{"type":21,"tag":209,"props":71914,"children":71915},{"style":360},[71916],{"type":26,"value":71917},"parseJSON",{"type":21,"tag":209,"props":71919,"children":71920},{"style":222},[71921],{"type":26,"value":23711},{"type":21,"tag":209,"props":71923,"children":71924},{"class":211,"line":288},[71925,71929,71933],{"type":21,"tag":209,"props":71926,"children":71927},{"style":222},[71928],{"type":26,"value":71721},{"type":21,"tag":209,"props":71930,"children":71931},{"style":216},[71932],{"type":26,"value":5347},{"type":21,"tag":209,"props":71934,"children":71935},{"style":222},[71936],{"type":26,"value":29422},{"type":21,"tag":209,"props":71938,"children":71939},{"class":211,"line":307},[71940,71944,71948,71952,71957,71961],{"type":21,"tag":209,"props":71941,"children":71942},{"style":222},[71943],{"type":26,"value":39462},{"type":21,"tag":209,"props":71945,"children":71946},{"style":360},[71947],{"type":26,"value":14182},{"type":21,"tag":209,"props":71949,"children":71950},{"style":222},[71951],{"type":26,"value":368},{"type":21,"tag":209,"props":71953,"children":71954},{"style":233},[71955],{"type":26,"value":71956},"\"Failed to parse response into JSON: \"",{"type":21,"tag":209,"props":71958,"children":71959},{"style":216},[71960],{"type":26,"value":17170},{"type":21,"tag":209,"props":71962,"children":71963},{"style":222},[71964],{"type":26,"value":71795},{"type":21,"tag":209,"props":71966,"children":71967},{"class":211,"line":325},[71968,71972],{"type":21,"tag":209,"props":71969,"children":71970},{"style":216},[71971],{"type":26,"value":1298},{"type":21,"tag":209,"props":71973,"children":71974},{"style":222},[71975],{"type":26,"value":241},{"type":21,"tag":209,"props":71977,"children":71978},{"class":211,"line":334},[71979],{"type":21,"tag":209,"props":71980,"children":71981},{"style":222},[71982],{"type":26,"value":4415},{"type":21,"tag":209,"props":71984,"children":71985},{"class":211,"line":343},[71986],{"type":21,"tag":209,"props":71987,"children":71988},{"style":222},[71989],{"type":26,"value":4415},{"type":21,"tag":209,"props":71991,"children":71992},{"class":211,"line":351},[71993,71997,72001,72005,72009,72013,72018,72022,72026,72030,72034],{"type":21,"tag":209,"props":71994,"children":71995},{"style":216},[71996],{"type":26,"value":4346},{"type":21,"tag":209,"props":71998,"children":71999},{"style":216},[72000],{"type":26,"value":70140},{"type":21,"tag":209,"props":72002,"children":72003},{"style":222},[72004],{"type":26,"value":71561},{"type":21,"tag":209,"props":72006,"children":72007},{"style":360},[72008],{"type":26,"value":45239},{"type":21,"tag":209,"props":72010,"children":72011},{"style":222},[72012],{"type":26,"value":368},{"type":21,"tag":209,"props":72014,"children":72015},{"style":233},[72016],{"type":26,"value":72017},"'html'",{"type":21,"tag":209,"props":72019,"children":72020},{"style":222},[72021],{"type":26,"value":432},{"type":21,"tag":209,"props":72023,"children":72024},{"style":216},[72025],{"type":26,"value":71582},{"type":21,"tag":209,"props":72027,"children":72028},{"style":216},[72029],{"type":26,"value":45261},{"type":21,"tag":209,"props":72031,"children":72032},{"style":263},[72033],{"type":26,"value":3224},{"type":21,"tag":209,"props":72035,"children":72036},{"style":222},[72037],{"type":26,"value":8924},{"type":21,"tag":209,"props":72039,"children":72040},{"class":211,"line":444},[72041],{"type":21,"tag":209,"props":72042,"children":72043},{"style":222},[72044],{"type":26,"value":29353},{"type":21,"tag":209,"props":72046,"children":72047},{"class":211,"line":454},[72048,72053,72057,72061,72066],{"type":21,"tag":209,"props":72049,"children":72050},{"style":222},[72051],{"type":26,"value":72052},"res ",{"type":21,"tag":209,"props":72054,"children":72055},{"style":216},[72056],{"type":26,"value":1432},{"type":21,"tag":209,"props":72058,"children":72059},{"style":222},[72060],{"type":26,"value":25427},{"type":21,"tag":209,"props":72062,"children":72063},{"style":360},[72064],{"type":26,"value":72065},"parseHTML",{"type":21,"tag":209,"props":72067,"children":72068},{"style":222},[72069],{"type":26,"value":23711},{"type":21,"tag":209,"props":72071,"children":72072},{"class":211,"line":463},[72073],{"type":21,"tag":209,"props":72074,"children":72075},{"style":222},[72076],{"type":26,"value":4415},{"type":21,"tag":209,"props":72078,"children":72079},{"class":211,"line":472},[72080,72084,72088],{"type":21,"tag":209,"props":72081,"children":72082},{"style":222},[72083],{"type":26,"value":35125},{"type":21,"tag":209,"props":72085,"children":72086},{"style":360},[72087],{"type":26,"value":14173},{"type":21,"tag":209,"props":72089,"children":72090},{"style":222},[72091],{"type":26,"value":23711},{"type":21,"tag":209,"props":72093,"children":72094},{"class":211,"line":480},[72095],{"type":21,"tag":209,"props":72096,"children":72097},{"style":222},[72098],{"type":26,"value":469},{"type":21,"tag":209,"props":72100,"children":72101},{"class":211,"line":489},[72102],{"type":21,"tag":209,"props":72103,"children":72104},{"emptyLinePlaceholder":248},[72105],{"type":26,"value":251},{"type":21,"tag":209,"props":72107,"children":72108},{"class":211,"line":847},[72109,72113,72118],{"type":21,"tag":209,"props":72110,"children":72111},{"style":222},[72112],{"type":26,"value":71314},{"type":21,"tag":209,"props":72114,"children":72115},{"style":360},[72116],{"type":26,"value":72117},"submit",{"type":21,"tag":209,"props":72119,"children":72120},{"style":222},[72121],{"type":26,"value":4123},{"type":21,"tag":209,"props":72123,"children":72124},{"class":211,"line":860},[72125],{"type":21,"tag":209,"props":72126,"children":72127},{"emptyLinePlaceholder":248},[72128],{"type":26,"value":251},{"type":21,"tag":209,"props":72130,"children":72131},{"class":211,"line":877},[72132,72136,72140,72144],{"type":21,"tag":209,"props":72133,"children":72134},{"style":216},[72135],{"type":26,"value":8982},{"type":21,"tag":209,"props":72137,"children":72138},{"style":222},[72139],{"type":26,"value":26782},{"type":21,"tag":209,"props":72141,"children":72142},{"style":360},[72143],{"type":26,"value":26332},{"type":21,"tag":209,"props":72145,"children":72146},{"style":222},[72147],{"type":26,"value":4123},{"type":21,"tag":22,"props":72149,"children":72150},{},[72151],{"type":26,"value":72152},"If we want to return json or html, then we try and parse it as such. Either way, we can now resolve our promise and return the response. Outside of the load event, after its declared, we make our call to submit the form, which will now target the iframe and submit seamlessly. Finally, we return our deferred promise.",{"type":21,"tag":3596,"props":72154,"children":72156},{"id":72155},"aside-other-uses",[72157],{"type":26,"value":72158},"Aside: Other Uses",{"type":21,"tag":22,"props":72160,"children":72161},{},[72162],{"type":26,"value":72163},"As mentioned previously, all of this is going away as far as file uploading is concerned as soon as all major browsers (and all the legacy browsers we have to support as web developers) gain support for XMLHttpRequest level 2 and the File API. This technique is useful for more than just file uploading, however. In a project I worked on recently, we wanted to submit billing details to a payment gateway without needing to pass said details through our server, and with the gateway only accepting form submission. This technique was the perfect way to submit said details directly to them, without the negative user experience that would normally come with a form submission.",{"type":21,"tag":3596,"props":72165,"children":72167},{"id":72166},"the-gist",[72168],{"type":26,"value":72169},"The Gist",{"type":21,"tag":22,"props":72171,"children":72172},{},[72173],{"type":26,"value":72174},"This is a neat technique which I suspect I will still be getting some use out of even after all the major browsers support ajax file uploading. Therefore, I wrote a little jquery plugin (the aforementioned $.transparentSubmit). Feel free to use it, add to it, deride it mercilessly, etc.",{"type":21,"tag":200,"props":72176,"children":72178},{"className":16138,"code":72177,"language":16140,"meta":8,"style":8},"/**\n * jQuery plugin for transparent submission of a form using an $.ajax-like interface.\n * Usage Examples:\n * $.transparentSubmit({dataType:'json', form:$('#myForm')})\n * $('#myForm').transparentSubmit({dataType:'html'})\n * Supports Deferred (.done, .fail, .when, etc.)\n */\n(function($){\n    $.transparentSubmit = function(options){\n        var defer = $.Deferred(), // Deferred object whose promise we will hook into when adding .done, etc to calls\n            options = $.extend({\n                dataType:'json'\n            }, (options || {})), // coerce options into being an object, extend defaults\n            name = 'target-'+Math.random().toString(36).substring(7), // assign a psuedo-random name to the frame\n            hiframe = $('\u003Ciframe id=\"'+name+'\" name=\"'+name+'\" src=\"about:blank\" ' +\n                'style=\"width:0;height:0;border:0px solid #fff;\">\u003C/iframe>'), // create invisible iframe - NOT display:none\n            form = $(options.form), // get form, make sure its a jquery object\n            cleanup = function(){\n                hiframe.remove();\n                delete frames[name];\n            }; // clean iframe away when we're finished with it\n        if (!form.length || form[0].tagName !== 'FORM'){ // if we don't have a form to submit, reject (call .fail)\n            defer.reject(\"No form element specified to submit.\");\n            return defer.promise();\n        }\n\n        form.attr('target', name).append(hiframe); // set target of form to iframe, and append iframe to the form\n\n        // On load event, grab and parse the contents of the iframe\n        hiframe.on('load', function(){\n            var res;\n\n            form.removeAttr('target');\n\n            try{\n                if (options.dataType.indexOf('json') != -1)\n                { // browsers will wrap a json return with \u003Cpre>\u003C/pre>\n                    res = frames[name].document.getElementsByTagName(\"pre\")[0].innerHTML;\n                }\n                else\n                {\n                    res = frames[name].document.getElementsByTagName('body')[0].innerHTML;\n                }\n            }catch(e){\n                // Failed to receive anything in the body of the frame\n                cleanup();\n                defer.reject(\"Failed to receive response in form target \"+name+\": \"+e.message);\n                return;\n            }\n\n            cleanup();\n\n            if (options.dataType.indexOf('json') != -1)\n            {\n                try{\n                    res = $.parseJSON(res);\n                }catch(e){\n                    defer.reject(\"Failed to parse response into JSON: \"+e.message);\n                    return;\n                }\n            }\n            else if (options.dataType.indexOf('html') != -1)\n            {\n                res = $.parseHTML(res);\n            }\n\n            defer.resolve(res); // Finished (call .done)\n        });\n\n        form.submit();\n\n        return defer.promise();\n    }\n\n/*\n* This allows us the option to call $('#myForm').transparentSubmit - as you can see, its just a slightly different form \n* to the plugin, which calls our transparentSubmit function as defined above.\n*/\n    $.fn.transparentSubmit = function(options){\n        options.form = this;\n        return $.transparentSubmit(options);\n    };\n})(jQuery);\n",[72179],{"type":21,"tag":63,"props":72180,"children":72181},{"__ignoreMap":8},[72182,72189,72197,72205,72213,72221,72229,72236,72259,72290,72323,72347,72359,72381,72450,72513,72530,72556,72576,72592,72604,72617,72673,72696,72715,72722,72729,72767,72774,72782,72814,72825,72832,72856,72863,72874,72917,72930,72970,72977,72985,72992,73031,73038,73054,73062,73074,73117,73128,73135,73142,73153,73160,73203,73210,73222,73245,73261,73288,73300,73307,73314,73362,73369,73393,73400,73407,73428,73435,73442,73457,73464,73483,73490,73497,73504,73512,73520,73527,73558,73578,73597,73604],{"type":21,"tag":209,"props":72183,"children":72184},{"class":211,"line":212},[72185],{"type":21,"tag":209,"props":72186,"children":72187},{"style":448},[72188],{"type":26,"value":731},{"type":21,"tag":209,"props":72190,"children":72191},{"class":211,"line":244},[72192],{"type":21,"tag":209,"props":72193,"children":72194},{"style":448},[72195],{"type":26,"value":72196}," * jQuery plugin for transparent submission of a form using an $.ajax-like interface.\n",{"type":21,"tag":209,"props":72198,"children":72199},{"class":211,"line":254},[72200],{"type":21,"tag":209,"props":72201,"children":72202},{"style":448},[72203],{"type":26,"value":72204}," * Usage Examples:\n",{"type":21,"tag":209,"props":72206,"children":72207},{"class":211,"line":279},[72208],{"type":21,"tag":209,"props":72209,"children":72210},{"style":448},[72211],{"type":26,"value":72212}," * $.transparentSubmit({dataType:'json', form:$('#myForm')})\n",{"type":21,"tag":209,"props":72214,"children":72215},{"class":211,"line":288},[72216],{"type":21,"tag":209,"props":72217,"children":72218},{"style":448},[72219],{"type":26,"value":72220}," * $('#myForm').transparentSubmit({dataType:'html'})\n",{"type":21,"tag":209,"props":72222,"children":72223},{"class":211,"line":307},[72224],{"type":21,"tag":209,"props":72225,"children":72226},{"style":448},[72227],{"type":26,"value":72228}," * Supports Deferred (.done, .fail, .when, etc.)\n",{"type":21,"tag":209,"props":72230,"children":72231},{"class":211,"line":325},[72232],{"type":21,"tag":209,"props":72233,"children":72234},{"style":448},[72235],{"type":26,"value":755},{"type":21,"tag":209,"props":72237,"children":72238},{"class":211,"line":334},[72239,72243,72247,72251,72255],{"type":21,"tag":209,"props":72240,"children":72241},{"style":222},[72242],{"type":26,"value":368},{"type":21,"tag":209,"props":72244,"children":72245},{"style":216},[72246],{"type":26,"value":4622},{"type":21,"tag":209,"props":72248,"children":72249},{"style":222},[72250],{"type":26,"value":368},{"type":21,"tag":209,"props":72252,"children":72253},{"style":400},[72254],{"type":26,"value":6476},{"type":21,"tag":209,"props":72256,"children":72257},{"style":222},[72258],{"type":26,"value":2369},{"type":21,"tag":209,"props":72260,"children":72261},{"class":211,"line":343},[72262,72266,72270,72274,72278,72282,72286],{"type":21,"tag":209,"props":72263,"children":72264},{"style":222},[72265],{"type":26,"value":29649},{"type":21,"tag":209,"props":72267,"children":72268},{"style":360},[72269],{"type":26,"value":70680},{"type":21,"tag":209,"props":72271,"children":72272},{"style":216},[72273],{"type":26,"value":271},{"type":21,"tag":209,"props":72275,"children":72276},{"style":216},[72277],{"type":26,"value":4789},{"type":21,"tag":209,"props":72279,"children":72280},{"style":222},[72281],{"type":26,"value":368},{"type":21,"tag":209,"props":72283,"children":72284},{"style":400},[72285],{"type":26,"value":28349},{"type":21,"tag":209,"props":72287,"children":72288},{"style":222},[72289],{"type":26,"value":2369},{"type":21,"tag":209,"props":72291,"children":72292},{"class":211,"line":351},[72293,72297,72301,72305,72309,72313,72318],{"type":21,"tag":209,"props":72294,"children":72295},{"style":216},[72296],{"type":26,"value":14505},{"type":21,"tag":209,"props":72298,"children":72299},{"style":222},[72300],{"type":26,"value":26603},{"type":21,"tag":209,"props":72302,"children":72303},{"style":216},[72304],{"type":26,"value":1432},{"type":21,"tag":209,"props":72306,"children":72307},{"style":222},[72308],{"type":26,"value":25427},{"type":21,"tag":209,"props":72310,"children":72311},{"style":360},[72312],{"type":26,"value":25432},{"type":21,"tag":209,"props":72314,"children":72315},{"style":222},[72316],{"type":26,"value":72317},"(), ",{"type":21,"tag":209,"props":72319,"children":72320},{"style":448},[72321],{"type":26,"value":72322},"// Deferred object whose promise we will hook into when adding .done, etc to calls\n",{"type":21,"tag":209,"props":72324,"children":72325},{"class":211,"line":444},[72326,72331,72335,72339,72343],{"type":21,"tag":209,"props":72327,"children":72328},{"style":222},[72329],{"type":26,"value":72330},"            options ",{"type":21,"tag":209,"props":72332,"children":72333},{"style":216},[72334],{"type":26,"value":1432},{"type":21,"tag":209,"props":72336,"children":72337},{"style":222},[72338],{"type":26,"value":25427},{"type":21,"tag":209,"props":72340,"children":72341},{"style":360},[72342],{"type":26,"value":34329},{"type":21,"tag":209,"props":72344,"children":72345},{"style":222},[72346],{"type":26,"value":7767},{"type":21,"tag":209,"props":72348,"children":72349},{"class":211,"line":454},[72350,72355],{"type":21,"tag":209,"props":72351,"children":72352},{"style":222},[72353],{"type":26,"value":72354},"                dataType:",{"type":21,"tag":209,"props":72356,"children":72357},{"style":233},[72358],{"type":26,"value":20832},{"type":21,"tag":209,"props":72360,"children":72361},{"class":211,"line":463},[72362,72367,72371,72376],{"type":21,"tag":209,"props":72363,"children":72364},{"style":222},[72365],{"type":26,"value":72366},"            }, (options ",{"type":21,"tag":209,"props":72368,"children":72369},{"style":216},[72370],{"type":26,"value":13270},{"type":21,"tag":209,"props":72372,"children":72373},{"style":222},[72374],{"type":26,"value":72375}," {})), ",{"type":21,"tag":209,"props":72377,"children":72378},{"style":448},[72379],{"type":26,"value":72380},"// coerce options into being an object, extend defaults\n",{"type":21,"tag":209,"props":72382,"children":72383},{"class":211,"line":472},[72384,72389,72393,72397,72401,72405,72409,72413,72417,72421,72425,72429,72433,72437,72441,72445],{"type":21,"tag":209,"props":72385,"children":72386},{"style":222},[72387],{"type":26,"value":72388},"            name ",{"type":21,"tag":209,"props":72390,"children":72391},{"style":216},[72392],{"type":26,"value":1432},{"type":21,"tag":209,"props":72394,"children":72395},{"style":233},[72396],{"type":26,"value":71116},{"type":21,"tag":209,"props":72398,"children":72399},{"style":216},[72400],{"type":26,"value":17170},{"type":21,"tag":209,"props":72402,"children":72403},{"style":222},[72404],{"type":26,"value":71125},{"type":21,"tag":209,"props":72406,"children":72407},{"style":360},[72408],{"type":26,"value":71130},{"type":21,"tag":209,"props":72410,"children":72411},{"style":222},[72412],{"type":26,"value":17096},{"type":21,"tag":209,"props":72414,"children":72415},{"style":360},[72416],{"type":26,"value":71139},{"type":21,"tag":209,"props":72418,"children":72419},{"style":222},[72420],{"type":26,"value":368},{"type":21,"tag":209,"props":72422,"children":72423},{"style":263},[72424],{"type":26,"value":71148},{"type":21,"tag":209,"props":72426,"children":72427},{"style":222},[72428],{"type":26,"value":2699},{"type":21,"tag":209,"props":72430,"children":72431},{"style":360},[72432],{"type":26,"value":71157},{"type":21,"tag":209,"props":72434,"children":72435},{"style":222},[72436],{"type":26,"value":368},{"type":21,"tag":209,"props":72438,"children":72439},{"style":263},[72440],{"type":26,"value":71166},{"type":21,"tag":209,"props":72442,"children":72443},{"style":222},[72444],{"type":26,"value":50542},{"type":21,"tag":209,"props":72446,"children":72447},{"style":448},[72448],{"type":26,"value":72449},"// assign a psuedo-random name to the frame\n",{"type":21,"tag":209,"props":72451,"children":72452},{"class":211,"line":480},[72453,72458,72462,72466,72470,72475,72479,72483,72487,72492,72496,72500,72504,72509],{"type":21,"tag":209,"props":72454,"children":72455},{"style":222},[72456],{"type":26,"value":72457},"            hiframe ",{"type":21,"tag":209,"props":72459,"children":72460},{"style":216},[72461],{"type":26,"value":1432},{"type":21,"tag":209,"props":72463,"children":72464},{"style":360},[72465],{"type":26,"value":45616},{"type":21,"tag":209,"props":72467,"children":72468},{"style":222},[72469],{"type":26,"value":368},{"type":21,"tag":209,"props":72471,"children":72472},{"style":233},[72473],{"type":26,"value":72474},"'\u003Ciframe id=\"'",{"type":21,"tag":209,"props":72476,"children":72477},{"style":216},[72478],{"type":26,"value":17170},{"type":21,"tag":209,"props":72480,"children":72481},{"style":222},[72482],{"type":26,"value":38122},{"type":21,"tag":209,"props":72484,"children":72485},{"style":216},[72486],{"type":26,"value":17170},{"type":21,"tag":209,"props":72488,"children":72489},{"style":233},[72490],{"type":26,"value":72491},"'\" name=\"'",{"type":21,"tag":209,"props":72493,"children":72494},{"style":216},[72495],{"type":26,"value":17170},{"type":21,"tag":209,"props":72497,"children":72498},{"style":222},[72499],{"type":26,"value":38122},{"type":21,"tag":209,"props":72501,"children":72502},{"style":216},[72503],{"type":26,"value":17170},{"type":21,"tag":209,"props":72505,"children":72506},{"style":233},[72507],{"type":26,"value":72508},"'\" src=\"about:blank\" '",{"type":21,"tag":209,"props":72510,"children":72511},{"style":216},[72512],{"type":26,"value":18445},{"type":21,"tag":209,"props":72514,"children":72515},{"class":211,"line":489},[72516,72521,72525],{"type":21,"tag":209,"props":72517,"children":72518},{"style":233},[72519],{"type":26,"value":72520},"                'style=\"width:0;height:0;border:0px solid #fff;\">\u003C/iframe>'",{"type":21,"tag":209,"props":72522,"children":72523},{"style":222},[72524],{"type":26,"value":50542},{"type":21,"tag":209,"props":72526,"children":72527},{"style":448},[72528],{"type":26,"value":72529},"// create invisible iframe - NOT display:none\n",{"type":21,"tag":209,"props":72531,"children":72532},{"class":211,"line":847},[72533,72538,72542,72546,72551],{"type":21,"tag":209,"props":72534,"children":72535},{"style":222},[72536],{"type":26,"value":72537},"            form ",{"type":21,"tag":209,"props":72539,"children":72540},{"style":216},[72541],{"type":26,"value":1432},{"type":21,"tag":209,"props":72543,"children":72544},{"style":360},[72545],{"type":26,"value":45616},{"type":21,"tag":209,"props":72547,"children":72548},{"style":222},[72549],{"type":26,"value":72550},"(options.form), ",{"type":21,"tag":209,"props":72552,"children":72553},{"style":448},[72554],{"type":26,"value":72555},"// get form, make sure its a jquery object\n",{"type":21,"tag":209,"props":72557,"children":72558},{"class":211,"line":860},[72559,72564,72568,72572],{"type":21,"tag":209,"props":72560,"children":72561},{"style":360},[72562],{"type":26,"value":72563},"            cleanup",{"type":21,"tag":209,"props":72565,"children":72566},{"style":216},[72567],{"type":26,"value":271},{"type":21,"tag":209,"props":72569,"children":72570},{"style":216},[72571],{"type":26,"value":4789},{"type":21,"tag":209,"props":72573,"children":72574},{"style":222},[72575],{"type":26,"value":2561},{"type":21,"tag":209,"props":72577,"children":72578},{"class":211,"line":877},[72579,72584,72588],{"type":21,"tag":209,"props":72580,"children":72581},{"style":222},[72582],{"type":26,"value":72583},"                hiframe.",{"type":21,"tag":209,"props":72585,"children":72586},{"style":360},[72587],{"type":26,"value":48015},{"type":21,"tag":209,"props":72589,"children":72590},{"style":222},[72591],{"type":26,"value":4123},{"type":21,"tag":209,"props":72593,"children":72594},{"class":211,"line":889},[72595,72600],{"type":21,"tag":209,"props":72596,"children":72597},{"style":216},[72598],{"type":26,"value":72599},"                delete",{"type":21,"tag":209,"props":72601,"children":72602},{"style":222},[72603],{"type":26,"value":71268},{"type":21,"tag":209,"props":72605,"children":72606},{"class":211,"line":902},[72607,72612],{"type":21,"tag":209,"props":72608,"children":72609},{"style":222},[72610],{"type":26,"value":72611},"            }; ",{"type":21,"tag":209,"props":72613,"children":72614},{"style":448},[72615],{"type":26,"value":72616},"// clean iframe away when we're finished with it\n",{"type":21,"tag":209,"props":72618,"children":72619},{"class":211,"line":914},[72620,72624,72628,72632,72636,72640,72644,72648,72652,72656,72660,72664,72668],{"type":21,"tag":209,"props":72621,"children":72622},{"style":216},[72623],{"type":26,"value":6334},{"type":21,"tag":209,"props":72625,"children":72626},{"style":222},[72627],{"type":26,"value":5569},{"type":21,"tag":209,"props":72629,"children":72630},{"style":216},[72631],{"type":26,"value":6455},{"type":21,"tag":209,"props":72633,"children":72634},{"style":222},[72635],{"type":26,"value":71314},{"type":21,"tag":209,"props":72637,"children":72638},{"style":263},[72639],{"type":26,"value":6344},{"type":21,"tag":209,"props":72641,"children":72642},{"style":216},[72643],{"type":26,"value":4608},{"type":21,"tag":209,"props":72645,"children":72646},{"style":222},[72647],{"type":26,"value":71327},{"type":21,"tag":209,"props":72649,"children":72650},{"style":263},[72651],{"type":26,"value":8554},{"type":21,"tag":209,"props":72653,"children":72654},{"style":222},[72655],{"type":26,"value":64046},{"type":21,"tag":209,"props":72657,"children":72658},{"style":216},[72659],{"type":26,"value":8046},{"type":21,"tag":209,"props":72661,"children":72662},{"style":233},[72663],{"type":26,"value":71344},{"type":21,"tag":209,"props":72665,"children":72666},{"style":222},[72667],{"type":26,"value":39576},{"type":21,"tag":209,"props":72669,"children":72670},{"style":448},[72671],{"type":26,"value":72672},"// if we don't have a form to submit, reject (call .fail)\n",{"type":21,"tag":209,"props":72674,"children":72675},{"class":211,"line":922},[72676,72680,72684,72688,72692],{"type":21,"tag":209,"props":72677,"children":72678},{"style":222},[72679],{"type":26,"value":29441},{"type":21,"tag":209,"props":72681,"children":72682},{"style":360},[72683],{"type":26,"value":14182},{"type":21,"tag":209,"props":72685,"children":72686},{"style":222},[72687],{"type":26,"value":368},{"type":21,"tag":209,"props":72689,"children":72690},{"style":233},[72691],{"type":26,"value":71375},{"type":21,"tag":209,"props":72693,"children":72694},{"style":222},[72695],{"type":26,"value":2608},{"type":21,"tag":209,"props":72697,"children":72698},{"class":211,"line":2312},[72699,72703,72707,72711],{"type":21,"tag":209,"props":72700,"children":72701},{"style":216},[72702],{"type":26,"value":13689},{"type":21,"tag":209,"props":72704,"children":72705},{"style":222},[72706],{"type":26,"value":26782},{"type":21,"tag":209,"props":72708,"children":72709},{"style":360},[72710],{"type":26,"value":26332},{"type":21,"tag":209,"props":72712,"children":72713},{"style":222},[72714],{"type":26,"value":4123},{"type":21,"tag":209,"props":72716,"children":72717},{"class":211,"line":2321},[72718],{"type":21,"tag":209,"props":72719,"children":72720},{"style":222},[72721],{"type":26,"value":2235},{"type":21,"tag":209,"props":72723,"children":72724},{"class":211,"line":2372},[72725],{"type":21,"tag":209,"props":72726,"children":72727},{"emptyLinePlaceholder":248},[72728],{"type":26,"value":251},{"type":21,"tag":209,"props":72730,"children":72731},{"class":211,"line":2381},[72732,72737,72741,72745,72749,72753,72757,72762],{"type":21,"tag":209,"props":72733,"children":72734},{"style":222},[72735],{"type":26,"value":72736},"        form.",{"type":21,"tag":209,"props":72738,"children":72739},{"style":360},[72740],{"type":26,"value":70595},{"type":21,"tag":209,"props":72742,"children":72743},{"style":222},[72744],{"type":26,"value":368},{"type":21,"tag":209,"props":72746,"children":72747},{"style":233},[72748],{"type":26,"value":70604},{"type":21,"tag":209,"props":72750,"children":72751},{"style":222},[72752],{"type":26,"value":71436},{"type":21,"tag":209,"props":72754,"children":72755},{"style":360},[72756],{"type":26,"value":47442},{"type":21,"tag":209,"props":72758,"children":72759},{"style":222},[72760],{"type":26,"value":72761},"(hiframe); ",{"type":21,"tag":209,"props":72763,"children":72764},{"style":448},[72765],{"type":26,"value":72766},"// set target of form to iframe, and append iframe to the form\n",{"type":21,"tag":209,"props":72768,"children":72769},{"class":211,"line":2389},[72770],{"type":21,"tag":209,"props":72771,"children":72772},{"emptyLinePlaceholder":248},[72773],{"type":26,"value":251},{"type":21,"tag":209,"props":72775,"children":72776},{"class":211,"line":2397},[72777],{"type":21,"tag":209,"props":72778,"children":72779},{"style":448},[72780],{"type":26,"value":72781},"        // On load event, grab and parse the contents of the iframe\n",{"type":21,"tag":209,"props":72783,"children":72784},{"class":211,"line":2406},[72785,72790,72794,72798,72802,72806,72810],{"type":21,"tag":209,"props":72786,"children":72787},{"style":222},[72788],{"type":26,"value":72789},"        hiframe.",{"type":21,"tag":209,"props":72791,"children":72792},{"style":360},[72793],{"type":26,"value":363},{"type":21,"tag":209,"props":72795,"children":72796},{"style":222},[72797],{"type":26,"value":368},{"type":21,"tag":209,"props":72799,"children":72800},{"style":233},[72801],{"type":26,"value":20469},{"type":21,"tag":209,"props":72803,"children":72804},{"style":222},[72805],{"type":26,"value":408},{"type":21,"tag":209,"props":72807,"children":72808},{"style":216},[72809],{"type":26,"value":4622},{"type":21,"tag":209,"props":72811,"children":72812},{"style":222},[72813],{"type":26,"value":2561},{"type":21,"tag":209,"props":72815,"children":72816},{"class":211,"line":2415},[72817,72821],{"type":21,"tag":209,"props":72818,"children":72819},{"style":216},[72820],{"type":26,"value":14539},{"type":21,"tag":209,"props":72822,"children":72823},{"style":222},[72824],{"type":26,"value":1442},{"type":21,"tag":209,"props":72826,"children":72827},{"class":211,"line":2424},[72828],{"type":21,"tag":209,"props":72829,"children":72830},{"emptyLinePlaceholder":248},[72831],{"type":26,"value":251},{"type":21,"tag":209,"props":72833,"children":72834},{"class":211,"line":2433},[72835,72840,72844,72848,72852],{"type":21,"tag":209,"props":72836,"children":72837},{"style":222},[72838],{"type":26,"value":72839},"            form.",{"type":21,"tag":209,"props":72841,"children":72842},{"style":360},[72843],{"type":26,"value":71519},{"type":21,"tag":209,"props":72845,"children":72846},{"style":222},[72847],{"type":26,"value":368},{"type":21,"tag":209,"props":72849,"children":72850},{"style":233},[72851],{"type":26,"value":70604},{"type":21,"tag":209,"props":72853,"children":72854},{"style":222},[72855],{"type":26,"value":2608},{"type":21,"tag":209,"props":72857,"children":72858},{"class":211,"line":2442},[72859],{"type":21,"tag":209,"props":72860,"children":72861},{"emptyLinePlaceholder":248},[72862],{"type":26,"value":251},{"type":21,"tag":209,"props":72864,"children":72865},{"class":211,"line":2471},[72866,72870],{"type":21,"tag":209,"props":72867,"children":72868},{"style":216},[72869],{"type":26,"value":18996},{"type":21,"tag":209,"props":72871,"children":72872},{"style":222},[72873],{"type":26,"value":29353},{"type":21,"tag":209,"props":72875,"children":72876},{"class":211,"line":2480},[72877,72881,72885,72889,72893,72897,72901,72905,72909,72913],{"type":21,"tag":209,"props":72878,"children":72879},{"style":216},[72880],{"type":26,"value":37601},{"type":21,"tag":209,"props":72882,"children":72883},{"style":222},[72884],{"type":26,"value":71561},{"type":21,"tag":209,"props":72886,"children":72887},{"style":360},[72888],{"type":26,"value":45239},{"type":21,"tag":209,"props":72890,"children":72891},{"style":222},[72892],{"type":26,"value":368},{"type":21,"tag":209,"props":72894,"children":72895},{"style":233},[72896],{"type":26,"value":22703},{"type":21,"tag":209,"props":72898,"children":72899},{"style":222},[72900],{"type":26,"value":432},{"type":21,"tag":209,"props":72902,"children":72903},{"style":216},[72904],{"type":26,"value":71582},{"type":21,"tag":209,"props":72906,"children":72907},{"style":216},[72908],{"type":26,"value":45261},{"type":21,"tag":209,"props":72910,"children":72911},{"style":263},[72912],{"type":26,"value":3224},{"type":21,"tag":209,"props":72914,"children":72915},{"style":222},[72916],{"type":26,"value":8924},{"type":21,"tag":209,"props":72918,"children":72919},{"class":211,"line":2489},[72920,72925],{"type":21,"tag":209,"props":72921,"children":72922},{"style":222},[72923],{"type":26,"value":72924},"                { ",{"type":21,"tag":209,"props":72926,"children":72927},{"style":448},[72928],{"type":26,"value":72929},"// browsers will wrap a json return with \u003Cpre>\u003C/pre>\n",{"type":21,"tag":209,"props":72931,"children":72932},{"class":211,"line":2516},[72933,72938,72942,72946,72950,72954,72958,72962,72966],{"type":21,"tag":209,"props":72934,"children":72935},{"style":222},[72936],{"type":26,"value":72937},"                    res ",{"type":21,"tag":209,"props":72939,"children":72940},{"style":216},[72941],{"type":26,"value":1432},{"type":21,"tag":209,"props":72943,"children":72944},{"style":222},[72945],{"type":26,"value":71618},{"type":21,"tag":209,"props":72947,"children":72948},{"style":360},[72949],{"type":26,"value":71623},{"type":21,"tag":209,"props":72951,"children":72952},{"style":222},[72953],{"type":26,"value":368},{"type":21,"tag":209,"props":72955,"children":72956},{"style":233},[72957],{"type":26,"value":71632},{"type":21,"tag":209,"props":72959,"children":72960},{"style":222},[72961],{"type":26,"value":22804},{"type":21,"tag":209,"props":72963,"children":72964},{"style":263},[72965],{"type":26,"value":8554},{"type":21,"tag":209,"props":72967,"children":72968},{"style":222},[72969],{"type":26,"value":71645},{"type":21,"tag":209,"props":72971,"children":72972},{"class":211,"line":2525},[72973],{"type":21,"tag":209,"props":72974,"children":72975},{"style":222},[72976],{"type":26,"value":19439},{"type":21,"tag":209,"props":72978,"children":72979},{"class":211,"line":2533},[72980],{"type":21,"tag":209,"props":72981,"children":72982},{"style":216},[72983],{"type":26,"value":72984},"                else\n",{"type":21,"tag":209,"props":72986,"children":72987},{"class":211,"line":2542},[72988],{"type":21,"tag":209,"props":72989,"children":72990},{"style":222},[72991],{"type":26,"value":52556},{"type":21,"tag":209,"props":72993,"children":72994},{"class":211,"line":2550},[72995,72999,73003,73007,73011,73015,73019,73023,73027],{"type":21,"tag":209,"props":72996,"children":72997},{"style":222},[72998],{"type":26,"value":72937},{"type":21,"tag":209,"props":73000,"children":73001},{"style":216},[73002],{"type":26,"value":1432},{"type":21,"tag":209,"props":73004,"children":73005},{"style":222},[73006],{"type":26,"value":71618},{"type":21,"tag":209,"props":73008,"children":73009},{"style":360},[73010],{"type":26,"value":71623},{"type":21,"tag":209,"props":73012,"children":73013},{"style":222},[73014],{"type":26,"value":368},{"type":21,"tag":209,"props":73016,"children":73017},{"style":233},[73018],{"type":26,"value":48539},{"type":21,"tag":209,"props":73020,"children":73021},{"style":222},[73022],{"type":26,"value":22804},{"type":21,"tag":209,"props":73024,"children":73025},{"style":263},[73026],{"type":26,"value":8554},{"type":21,"tag":209,"props":73028,"children":73029},{"style":222},[73030],{"type":26,"value":71645},{"type":21,"tag":209,"props":73032,"children":73033},{"class":211,"line":2564},[73034],{"type":21,"tag":209,"props":73035,"children":73036},{"style":222},[73037],{"type":26,"value":19439},{"type":21,"tag":209,"props":73039,"children":73040},{"class":211,"line":2611},[73041,73046,73050],{"type":21,"tag":209,"props":73042,"children":73043},{"style":222},[73044],{"type":26,"value":73045},"            }",{"type":21,"tag":209,"props":73047,"children":73048},{"style":216},[73049],{"type":26,"value":5347},{"type":21,"tag":209,"props":73051,"children":73052},{"style":222},[73053],{"type":26,"value":29422},{"type":21,"tag":209,"props":73055,"children":73056},{"class":211,"line":2619},[73057],{"type":21,"tag":209,"props":73058,"children":73059},{"style":448},[73060],{"type":26,"value":73061},"                // Failed to receive anything in the body of the frame\n",{"type":21,"tag":209,"props":73063,"children":73064},{"class":211,"line":2627},[73065,73070],{"type":21,"tag":209,"props":73066,"children":73067},{"style":360},[73068],{"type":26,"value":73069},"                cleanup",{"type":21,"tag":209,"props":73071,"children":73072},{"style":222},[73073],{"type":26,"value":4123},{"type":21,"tag":209,"props":73075,"children":73076},{"class":211,"line":2636},[73077,73081,73085,73089,73093,73097,73101,73105,73109,73113],{"type":21,"tag":209,"props":73078,"children":73079},{"style":222},[73080],{"type":26,"value":26985},{"type":21,"tag":209,"props":73082,"children":73083},{"style":360},[73084],{"type":26,"value":14182},{"type":21,"tag":209,"props":73086,"children":73087},{"style":222},[73088],{"type":26,"value":368},{"type":21,"tag":209,"props":73090,"children":73091},{"style":233},[73092],{"type":26,"value":71769},{"type":21,"tag":209,"props":73094,"children":73095},{"style":216},[73096],{"type":26,"value":17170},{"type":21,"tag":209,"props":73098,"children":73099},{"style":222},[73100],{"type":26,"value":38122},{"type":21,"tag":209,"props":73102,"children":73103},{"style":216},[73104],{"type":26,"value":17170},{"type":21,"tag":209,"props":73106,"children":73107},{"style":233},[73108],{"type":26,"value":71786},{"type":21,"tag":209,"props":73110,"children":73111},{"style":216},[73112],{"type":26,"value":17170},{"type":21,"tag":209,"props":73114,"children":73115},{"style":222},[73116],{"type":26,"value":71795},{"type":21,"tag":209,"props":73118,"children":73119},{"class":211,"line":2644},[73120,73124],{"type":21,"tag":209,"props":73121,"children":73122},{"style":216},[73123],{"type":26,"value":14236},{"type":21,"tag":209,"props":73125,"children":73126},{"style":222},[73127],{"type":26,"value":241},{"type":21,"tag":209,"props":73129,"children":73130},{"class":211,"line":2657},[73131],{"type":21,"tag":209,"props":73132,"children":73133},{"style":222},[73134],{"type":26,"value":14714},{"type":21,"tag":209,"props":73136,"children":73137},{"class":211,"line":2728},[73138],{"type":21,"tag":209,"props":73139,"children":73140},{"emptyLinePlaceholder":248},[73141],{"type":26,"value":251},{"type":21,"tag":209,"props":73143,"children":73144},{"class":211,"line":2758},[73145,73149],{"type":21,"tag":209,"props":73146,"children":73147},{"style":360},[73148],{"type":26,"value":72563},{"type":21,"tag":209,"props":73150,"children":73151},{"style":222},[73152],{"type":26,"value":4123},{"type":21,"tag":209,"props":73154,"children":73155},{"class":211,"line":2776},[73156],{"type":21,"tag":209,"props":73157,"children":73158},{"emptyLinePlaceholder":248},[73159],{"type":26,"value":251},{"type":21,"tag":209,"props":73161,"children":73162},{"class":211,"line":2785},[73163,73167,73171,73175,73179,73183,73187,73191,73195,73199],{"type":21,"tag":209,"props":73164,"children":73165},{"style":216},[73166],{"type":26,"value":14662},{"type":21,"tag":209,"props":73168,"children":73169},{"style":222},[73170],{"type":26,"value":71561},{"type":21,"tag":209,"props":73172,"children":73173},{"style":360},[73174],{"type":26,"value":45239},{"type":21,"tag":209,"props":73176,"children":73177},{"style":222},[73178],{"type":26,"value":368},{"type":21,"tag":209,"props":73180,"children":73181},{"style":233},[73182],{"type":26,"value":22703},{"type":21,"tag":209,"props":73184,"children":73185},{"style":222},[73186],{"type":26,"value":432},{"type":21,"tag":209,"props":73188,"children":73189},{"style":216},[73190],{"type":26,"value":71582},{"type":21,"tag":209,"props":73192,"children":73193},{"style":216},[73194],{"type":26,"value":45261},{"type":21,"tag":209,"props":73196,"children":73197},{"style":263},[73198],{"type":26,"value":3224},{"type":21,"tag":209,"props":73200,"children":73201},{"style":222},[73202],{"type":26,"value":8924},{"type":21,"tag":209,"props":73204,"children":73205},{"class":211,"line":2793},[73206],{"type":21,"tag":209,"props":73207,"children":73208},{"style":222},[73209],{"type":26,"value":19379},{"type":21,"tag":209,"props":73211,"children":73212},{"class":211,"line":2801},[73213,73218],{"type":21,"tag":209,"props":73214,"children":73215},{"style":216},[73216],{"type":26,"value":73217},"                try",{"type":21,"tag":209,"props":73219,"children":73220},{"style":222},[73221],{"type":26,"value":29353},{"type":21,"tag":209,"props":73223,"children":73224},{"class":211,"line":2809},[73225,73229,73233,73237,73241],{"type":21,"tag":209,"props":73226,"children":73227},{"style":222},[73228],{"type":26,"value":72937},{"type":21,"tag":209,"props":73230,"children":73231},{"style":216},[73232],{"type":26,"value":1432},{"type":21,"tag":209,"props":73234,"children":73235},{"style":222},[73236],{"type":26,"value":25427},{"type":21,"tag":209,"props":73238,"children":73239},{"style":360},[73240],{"type":26,"value":71917},{"type":21,"tag":209,"props":73242,"children":73243},{"style":222},[73244],{"type":26,"value":23711},{"type":21,"tag":209,"props":73246,"children":73247},{"class":211,"line":10937},[73248,73253,73257],{"type":21,"tag":209,"props":73249,"children":73250},{"style":222},[73251],{"type":26,"value":73252},"                }",{"type":21,"tag":209,"props":73254,"children":73255},{"style":216},[73256],{"type":26,"value":5347},{"type":21,"tag":209,"props":73258,"children":73259},{"style":222},[73260],{"type":26,"value":29422},{"type":21,"tag":209,"props":73262,"children":73263},{"class":211,"line":10967},[73264,73268,73272,73276,73280,73284],{"type":21,"tag":209,"props":73265,"children":73266},{"style":222},[73267],{"type":26,"value":28104},{"type":21,"tag":209,"props":73269,"children":73270},{"style":360},[73271],{"type":26,"value":14182},{"type":21,"tag":209,"props":73273,"children":73274},{"style":222},[73275],{"type":26,"value":368},{"type":21,"tag":209,"props":73277,"children":73278},{"style":233},[73279],{"type":26,"value":71956},{"type":21,"tag":209,"props":73281,"children":73282},{"style":216},[73283],{"type":26,"value":17170},{"type":21,"tag":209,"props":73285,"children":73286},{"style":222},[73287],{"type":26,"value":71795},{"type":21,"tag":209,"props":73289,"children":73290},{"class":211,"line":11003},[73291,73296],{"type":21,"tag":209,"props":73292,"children":73293},{"style":216},[73294],{"type":26,"value":73295},"                    return",{"type":21,"tag":209,"props":73297,"children":73298},{"style":222},[73299],{"type":26,"value":241},{"type":21,"tag":209,"props":73301,"children":73302},{"class":211,"line":11038},[73303],{"type":21,"tag":209,"props":73304,"children":73305},{"style":222},[73306],{"type":26,"value":19439},{"type":21,"tag":209,"props":73308,"children":73309},{"class":211,"line":11072},[73310],{"type":21,"tag":209,"props":73311,"children":73312},{"style":222},[73313],{"type":26,"value":14714},{"type":21,"tag":209,"props":73315,"children":73316},{"class":211,"line":11106},[73317,73322,73326,73330,73334,73338,73342,73346,73350,73354,73358],{"type":21,"tag":209,"props":73318,"children":73319},{"style":216},[73320],{"type":26,"value":73321},"            else",{"type":21,"tag":209,"props":73323,"children":73324},{"style":216},[73325],{"type":26,"value":70140},{"type":21,"tag":209,"props":73327,"children":73328},{"style":222},[73329],{"type":26,"value":71561},{"type":21,"tag":209,"props":73331,"children":73332},{"style":360},[73333],{"type":26,"value":45239},{"type":21,"tag":209,"props":73335,"children":73336},{"style":222},[73337],{"type":26,"value":368},{"type":21,"tag":209,"props":73339,"children":73340},{"style":233},[73341],{"type":26,"value":72017},{"type":21,"tag":209,"props":73343,"children":73344},{"style":222},[73345],{"type":26,"value":432},{"type":21,"tag":209,"props":73347,"children":73348},{"style":216},[73349],{"type":26,"value":71582},{"type":21,"tag":209,"props":73351,"children":73352},{"style":216},[73353],{"type":26,"value":45261},{"type":21,"tag":209,"props":73355,"children":73356},{"style":263},[73357],{"type":26,"value":3224},{"type":21,"tag":209,"props":73359,"children":73360},{"style":222},[73361],{"type":26,"value":8924},{"type":21,"tag":209,"props":73363,"children":73364},{"class":211,"line":11114},[73365],{"type":21,"tag":209,"props":73366,"children":73367},{"style":222},[73368],{"type":26,"value":19379},{"type":21,"tag":209,"props":73370,"children":73371},{"class":211,"line":14940},[73372,73377,73381,73385,73389],{"type":21,"tag":209,"props":73373,"children":73374},{"style":222},[73375],{"type":26,"value":73376},"                res ",{"type":21,"tag":209,"props":73378,"children":73379},{"style":216},[73380],{"type":26,"value":1432},{"type":21,"tag":209,"props":73382,"children":73383},{"style":222},[73384],{"type":26,"value":25427},{"type":21,"tag":209,"props":73386,"children":73387},{"style":360},[73388],{"type":26,"value":72065},{"type":21,"tag":209,"props":73390,"children":73391},{"style":222},[73392],{"type":26,"value":23711},{"type":21,"tag":209,"props":73394,"children":73395},{"class":211,"line":14949},[73396],{"type":21,"tag":209,"props":73397,"children":73398},{"style":222},[73399],{"type":26,"value":14714},{"type":21,"tag":209,"props":73401,"children":73402},{"class":211,"line":14958},[73403],{"type":21,"tag":209,"props":73404,"children":73405},{"emptyLinePlaceholder":248},[73406],{"type":26,"value":251},{"type":21,"tag":209,"props":73408,"children":73409},{"class":211,"line":14966},[73410,73414,73418,73423],{"type":21,"tag":209,"props":73411,"children":73412},{"style":222},[73413],{"type":26,"value":29441},{"type":21,"tag":209,"props":73415,"children":73416},{"style":360},[73417],{"type":26,"value":14173},{"type":21,"tag":209,"props":73419,"children":73420},{"style":222},[73421],{"type":26,"value":73422},"(res); ",{"type":21,"tag":209,"props":73424,"children":73425},{"style":448},[73426],{"type":26,"value":73427},"// Finished (call .done)\n",{"type":21,"tag":209,"props":73429,"children":73430},{"class":211,"line":14975},[73431],{"type":21,"tag":209,"props":73432,"children":73433},{"style":222},[73434],{"type":26,"value":13702},{"type":21,"tag":209,"props":73436,"children":73437},{"class":211,"line":14984},[73438],{"type":21,"tag":209,"props":73439,"children":73440},{"emptyLinePlaceholder":248},[73441],{"type":26,"value":251},{"type":21,"tag":209,"props":73443,"children":73444},{"class":211,"line":15018},[73445,73449,73453],{"type":21,"tag":209,"props":73446,"children":73447},{"style":222},[73448],{"type":26,"value":72736},{"type":21,"tag":209,"props":73450,"children":73451},{"style":360},[73452],{"type":26,"value":72117},{"type":21,"tag":209,"props":73454,"children":73455},{"style":222},[73456],{"type":26,"value":4123},{"type":21,"tag":209,"props":73458,"children":73459},{"class":211,"line":15050},[73460],{"type":21,"tag":209,"props":73461,"children":73462},{"emptyLinePlaceholder":248},[73463],{"type":26,"value":251},{"type":21,"tag":209,"props":73465,"children":73466},{"class":211,"line":15082},[73467,73471,73475,73479],{"type":21,"tag":209,"props":73468,"children":73469},{"style":216},[73470],{"type":26,"value":3069},{"type":21,"tag":209,"props":73472,"children":73473},{"style":222},[73474],{"type":26,"value":26782},{"type":21,"tag":209,"props":73476,"children":73477},{"style":360},[73478],{"type":26,"value":26332},{"type":21,"tag":209,"props":73480,"children":73481},{"style":222},[73482],{"type":26,"value":4123},{"type":21,"tag":209,"props":73484,"children":73485},{"class":211,"line":15090},[73486],{"type":21,"tag":209,"props":73487,"children":73488},{"style":222},[73489],{"type":26,"value":331},{"type":21,"tag":209,"props":73491,"children":73492},{"class":211,"line":15098},[73493],{"type":21,"tag":209,"props":73494,"children":73495},{"emptyLinePlaceholder":248},[73496],{"type":26,"value":251},{"type":21,"tag":209,"props":73498,"children":73499},{"class":211,"line":15106},[73500],{"type":21,"tag":209,"props":73501,"children":73502},{"style":448},[73503],{"type":26,"value":46919},{"type":21,"tag":209,"props":73505,"children":73506},{"class":211,"line":15114},[73507],{"type":21,"tag":209,"props":73508,"children":73509},{"style":448},[73510],{"type":26,"value":73511},"* This allows us the option to call $('#myForm').transparentSubmit - as you can see, its just a slightly different form \n",{"type":21,"tag":209,"props":73513,"children":73514},{"class":211,"line":15123},[73515],{"type":21,"tag":209,"props":73516,"children":73517},{"style":448},[73518],{"type":26,"value":73519},"* to the plugin, which calls our transparentSubmit function as defined above.\n",{"type":21,"tag":209,"props":73521,"children":73522},{"class":211,"line":15143},[73523],{"type":21,"tag":209,"props":73524,"children":73525},{"style":448},[73526],{"type":26,"value":46822},{"type":21,"tag":209,"props":73528,"children":73529},{"class":211,"line":15160},[73530,73534,73538,73542,73546,73550,73554],{"type":21,"tag":209,"props":73531,"children":73532},{"style":222},[73533],{"type":26,"value":46294},{"type":21,"tag":209,"props":73535,"children":73536},{"style":360},[73537],{"type":26,"value":70680},{"type":21,"tag":209,"props":73539,"children":73540},{"style":216},[73541],{"type":26,"value":271},{"type":21,"tag":209,"props":73543,"children":73544},{"style":216},[73545],{"type":26,"value":4789},{"type":21,"tag":209,"props":73547,"children":73548},{"style":222},[73549],{"type":26,"value":368},{"type":21,"tag":209,"props":73551,"children":73552},{"style":400},[73553],{"type":26,"value":28349},{"type":21,"tag":209,"props":73555,"children":73556},{"style":222},[73557],{"type":26,"value":2369},{"type":21,"tag":209,"props":73559,"children":73560},{"class":211,"line":15168},[73561,73566,73570,73574],{"type":21,"tag":209,"props":73562,"children":73563},{"style":222},[73564],{"type":26,"value":73565},"        options.form ",{"type":21,"tag":209,"props":73567,"children":73568},{"style":216},[73569],{"type":26,"value":1432},{"type":21,"tag":209,"props":73571,"children":73572},{"style":263},[73573],{"type":26,"value":20502},{"type":21,"tag":209,"props":73575,"children":73576},{"style":222},[73577],{"type":26,"value":241},{"type":21,"tag":209,"props":73579,"children":73580},{"class":211,"line":15196},[73581,73585,73589,73593],{"type":21,"tag":209,"props":73582,"children":73583},{"style":216},[73584],{"type":26,"value":3069},{"type":21,"tag":209,"props":73586,"children":73587},{"style":222},[73588],{"type":26,"value":25427},{"type":21,"tag":209,"props":73590,"children":73591},{"style":360},[73592],{"type":26,"value":70680},{"type":21,"tag":209,"props":73594,"children":73595},{"style":222},[73596],{"type":26,"value":63239},{"type":21,"tag":209,"props":73598,"children":73599},{"class":211,"line":15219},[73600],{"type":21,"tag":209,"props":73601,"children":73602},{"style":222},[73603],{"type":26,"value":13439},{"type":21,"tag":209,"props":73605,"children":73606},{"class":211,"line":15240},[73607],{"type":21,"tag":209,"props":73608,"children":73609},{"style":222},[73610],{"type":26,"value":46369},{"type":21,"tag":3490,"props":73612,"children":73613},{},[73614],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":73616},[73617,73618,73619,73620,73621],{"id":70289,"depth":244,"text":70292},{"id":70849,"depth":244,"text":70852},{"id":71005,"depth":244,"text":71008},{"id":72155,"depth":244,"text":72158},{"id":72166,"depth":244,"text":72169},"content:ckeefer:2013-3:ajax-upload.md","ckeefer/2013-3/ajax-upload.md","ckeefer/2013-3/ajax-upload",{"user":3518,"name":3519},{"_path":73627,"_dir":73628,"_draft":7,"_partial":7,"_locale":8,"title":73629,"description":73630,"publishDate":73631,"tags":73632,"excerpt":73630,"body":73634,"_type":3511,"_id":75520,"_source":3513,"_file":75521,"_stem":75522,"_extension":3516,"author":75523},"/rbrubaker/2012-07/prototypal-js","2012-07","Prototypal vs. Functional Inheritance in JavaScript","If you ever found JavaScript's prototypal inheritance confusing, do yourself a favor and open this article, open a JavaScript console and code each example in the article. You will definitely come away with a better understanding of how prototypal inheritance works in JavaScript.","2012-07-11",[73633,12],"coffeescript",{"type":18,"children":73635,"toc":75514},[73636,73649,73662,73668,73681,73892,73897,73903,73918,74200,74205,74708,74721,74727,74738,75467,75472,75478,75492,75497,75510],{"type":21,"tag":22,"props":73637,"children":73638},{},[73639,73641,73647],{"type":26,"value":73640},"If you ever found JavaScript's prototypal inheritance confusing, do yourself a favor and open this ",{"type":21,"tag":29,"props":73642,"children":73645},{"href":73643,"rel":73644},"http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/",[93],[73646],{"type":26,"value":8952},{"type":26,"value":73648},", open a JavaScript console and code each example in the article. You will definitely come away with a better understanding of how prototypal inheritance works in JavaScript.",{"type":21,"tag":22,"props":73650,"children":73651},{},[73652,73654,73661],{"type":26,"value":73653},"After reading the article, I thought a good exercise would be to compare CoffeeScript class definitions vs. the prototypal inheritance style those definitions generate vs. Douglas Crockford's functional inheritance style outlined in his book ",{"type":21,"tag":29,"props":73655,"children":73658},{"href":73656,"rel":73657},"http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/ref=sr_1_1?ie=UTF8&qid=1341945198&sr=8-1",[93],[73659],{"type":26,"value":73660},"JavaScript: The Good Parts",{"type":26,"value":378},{"type":21,"tag":51,"props":73663,"children":73665},{"id":73664},"coffeescript-class-definitions",[73666],{"type":26,"value":73667},"CoffeeScript Class Definitions",{"type":21,"tag":22,"props":73669,"children":73670},{},[73671,73672,73679],{"type":26,"value":108},{"type":21,"tag":29,"props":73673,"children":73676},{"href":73674,"rel":73675},"http://coffeescript.org/",[93],[73677],{"type":26,"value":73678},"CoffeeScript homepage",{"type":26,"value":73680}," gives the following example to demonstrate CoffeeScript's class syntax:",{"type":21,"tag":200,"props":73682,"children":73686},{"className":73683,"code":73684,"language":73685,"meta":8,"style":8},"language-coffee shiki shiki-themes github-light github-dark","class Animal\n  constructor: (@name) ->\n\n  move: (meters) ->\n    alert @name + \" moved #{meters}m.\"\n\nclass Snake extends Animal\n  move: ->\n    alert \"Slithering...\"\n    super 5\n\nsam = new Snake \"Sammy the Python\"\nsam.move()\n","coffee",[73687],{"type":21,"tag":63,"props":73688,"children":73689},{"__ignoreMap":8},[73690,73703,73725,73732,73753,73774,73781,73802,73818,73830,73843,73850,73875],{"type":21,"tag":209,"props":73691,"children":73692},{"class":211,"line":212},[73693,73698],{"type":21,"tag":209,"props":73694,"children":73695},{"style":216},[73696],{"type":26,"value":73697},"class",{"type":21,"tag":209,"props":73699,"children":73700},{"style":360},[73701],{"type":26,"value":73702}," Animal\n",{"type":21,"tag":209,"props":73704,"children":73705},{"class":211,"line":244},[73706,73711,73715,73720],{"type":21,"tag":209,"props":73707,"children":73708},{"style":360},[73709],{"type":26,"value":73710},"  constructor",{"type":21,"tag":209,"props":73712,"children":73713},{"style":216},[73714],{"type":26,"value":191},{"type":21,"tag":209,"props":73716,"children":73717},{"style":222},[73718],{"type":26,"value":73719}," (@name) ",{"type":21,"tag":209,"props":73721,"children":73722},{"style":216},[73723],{"type":26,"value":73724},"->\n",{"type":21,"tag":209,"props":73726,"children":73727},{"class":211,"line":254},[73728],{"type":21,"tag":209,"props":73729,"children":73730},{"emptyLinePlaceholder":248},[73731],{"type":26,"value":251},{"type":21,"tag":209,"props":73733,"children":73734},{"class":211,"line":279},[73735,73740,73744,73749],{"type":21,"tag":209,"props":73736,"children":73737},{"style":360},[73738],{"type":26,"value":73739},"  move",{"type":21,"tag":209,"props":73741,"children":73742},{"style":216},[73743],{"type":26,"value":191},{"type":21,"tag":209,"props":73745,"children":73746},{"style":222},[73747],{"type":26,"value":73748}," (meters) ",{"type":21,"tag":209,"props":73750,"children":73751},{"style":216},[73752],{"type":26,"value":73724},{"type":21,"tag":209,"props":73754,"children":73755},{"class":211,"line":288},[73756,73760,73765,73769],{"type":21,"tag":209,"props":73757,"children":73758},{"style":360},[73759],{"type":26,"value":59569},{"type":21,"tag":209,"props":73761,"children":73762},{"style":222},[73763],{"type":26,"value":73764}," @name ",{"type":21,"tag":209,"props":73766,"children":73767},{"style":216},[73768],{"type":26,"value":17170},{"type":21,"tag":209,"props":73770,"children":73771},{"style":233},[73772],{"type":26,"value":73773}," \" moved #{meters}m.\"\n",{"type":21,"tag":209,"props":73775,"children":73776},{"class":211,"line":307},[73777],{"type":21,"tag":209,"props":73778,"children":73779},{"emptyLinePlaceholder":248},[73780],{"type":26,"value":251},{"type":21,"tag":209,"props":73782,"children":73783},{"class":211,"line":325},[73784,73788,73793,73798],{"type":21,"tag":209,"props":73785,"children":73786},{"style":216},[73787],{"type":26,"value":73697},{"type":21,"tag":209,"props":73789,"children":73790},{"style":360},[73791],{"type":26,"value":73792}," Snake",{"type":21,"tag":209,"props":73794,"children":73795},{"style":216},[73796],{"type":26,"value":73797}," extends",{"type":21,"tag":209,"props":73799,"children":73800},{"style":360},[73801],{"type":26,"value":73702},{"type":21,"tag":209,"props":73803,"children":73804},{"class":211,"line":334},[73805,73809,73813],{"type":21,"tag":209,"props":73806,"children":73807},{"style":360},[73808],{"type":26,"value":73739},{"type":21,"tag":209,"props":73810,"children":73811},{"style":216},[73812],{"type":26,"value":191},{"type":21,"tag":209,"props":73814,"children":73815},{"style":216},[73816],{"type":26,"value":73817}," ->\n",{"type":21,"tag":209,"props":73819,"children":73820},{"class":211,"line":343},[73821,73825],{"type":21,"tag":209,"props":73822,"children":73823},{"style":360},[73824],{"type":26,"value":59569},{"type":21,"tag":209,"props":73826,"children":73827},{"style":233},[73828],{"type":26,"value":73829}," \"Slithering...\"\n",{"type":21,"tag":209,"props":73831,"children":73832},{"class":211,"line":351},[73833,73838],{"type":21,"tag":209,"props":73834,"children":73835},{"style":263},[73836],{"type":26,"value":73837},"    super",{"type":21,"tag":209,"props":73839,"children":73840},{"style":263},[73841],{"type":26,"value":73842}," 5\n",{"type":21,"tag":209,"props":73844,"children":73845},{"class":211,"line":444},[73846],{"type":21,"tag":209,"props":73847,"children":73848},{"emptyLinePlaceholder":248},[73849],{"type":26,"value":251},{"type":21,"tag":209,"props":73851,"children":73852},{"class":211,"line":454},[73853,73858,73862,73866,73870],{"type":21,"tag":209,"props":73854,"children":73855},{"style":400},[73856],{"type":26,"value":73857},"sam",{"type":21,"tag":209,"props":73859,"children":73860},{"style":216},[73861],{"type":26,"value":271},{"type":21,"tag":209,"props":73863,"children":73864},{"style":216},[73865],{"type":26,"value":6371},{"type":21,"tag":209,"props":73867,"children":73868},{"style":360},[73869],{"type":26,"value":73792},{"type":21,"tag":209,"props":73871,"children":73872},{"style":233},[73873],{"type":26,"value":73874}," \"Sammy the Python\"\n",{"type":21,"tag":209,"props":73876,"children":73877},{"class":211,"line":463},[73878,73883,73888],{"type":21,"tag":209,"props":73879,"children":73880},{"style":222},[73881],{"type":26,"value":73882},"sam.",{"type":21,"tag":209,"props":73884,"children":73885},{"style":263},[73886],{"type":26,"value":73887},"move",{"type":21,"tag":209,"props":73889,"children":73890},{"style":222},[73891],{"type":26,"value":5225},{"type":21,"tag":22,"props":73893,"children":73894},{},[73895],{"type":26,"value":73896},"Anyone experienced with class-based inheritance should have little trouble understanding this code.",{"type":21,"tag":51,"props":73898,"children":73900},{"id":73899},"prototypal-inheritance",[73901],{"type":26,"value":73902},"Prototypal Inheritance",{"type":21,"tag":22,"props":73904,"children":73905},{},[73906,73908,73916],{"type":26,"value":73907},"The JavaScript generated by the CoffeeScript compiler uses prototypal inheritance. The compiler first generates a utility function that sets the properties on the child constructor and then sets up the prototype chain. It also creates a convenient ",{"type":21,"tag":1084,"props":73909,"children":73910},{},[73911],{"type":21,"tag":11881,"props":73912,"children":73913},{},[73914],{"type":26,"value":73915},"super",{"type":26,"value":73917}," property that allows an object to call methods on its prototype.",{"type":21,"tag":200,"props":73919,"children":73921},{"className":73683,"code":73920,"language":73685,"meta":8,"style":8},"__hasProp = {}.hasOwnProperty,\n__extends = function(child, parent) \n{ \n   for (var key in parent) \n   { \n      if (__hasProp.call(parent, key)) \n         child[key] = parent[key]; \n   } \n\n   function ctor() \n   { \n      this.constructor = child; \n   } \n   ctor.prototype = parent.prototype; \n   child.prototype = new ctor(); \n   child.__super__ = parent.prototype; \n   return child; \n };\n",[73922],{"type":21,"tag":63,"props":73923,"children":73924},{"__ignoreMap":8},[73925,73942,73963,73971,74000,74008,74036,74053,74061,74068,74086,74093,74115,74122,74139,74164,74180,74192],{"type":21,"tag":209,"props":73926,"children":73927},{"class":211,"line":212},[73928,73933,73937],{"type":21,"tag":209,"props":73929,"children":73930},{"style":216},[73931],{"type":26,"value":73932},"__hasProp",{"type":21,"tag":209,"props":73934,"children":73935},{"style":216},[73936],{"type":26,"value":271},{"type":21,"tag":209,"props":73938,"children":73939},{"style":222},[73940],{"type":26,"value":73941}," {}.hasOwnProperty,\n",{"type":21,"tag":209,"props":73943,"children":73944},{"class":211,"line":244},[73945,73950,73954,73958],{"type":21,"tag":209,"props":73946,"children":73947},{"style":216},[73948],{"type":26,"value":73949},"__extends",{"type":21,"tag":209,"props":73951,"children":73952},{"style":216},[73953],{"type":26,"value":271},{"type":21,"tag":209,"props":73955,"children":73956},{"style":216},[73957],{"type":26,"value":4789},{"type":21,"tag":209,"props":73959,"children":73960},{"style":222},[73961],{"type":26,"value":73962},"(child, parent) \n",{"type":21,"tag":209,"props":73964,"children":73965},{"class":211,"line":254},[73966],{"type":21,"tag":209,"props":73967,"children":73968},{"style":222},[73969],{"type":26,"value":73970},"{ \n",{"type":21,"tag":209,"props":73972,"children":73973},{"class":211,"line":279},[73974,73979,73983,73987,73991,73995],{"type":21,"tag":209,"props":73975,"children":73976},{"style":216},[73977],{"type":26,"value":73978},"   for",{"type":21,"tag":209,"props":73980,"children":73981},{"style":222},[73982],{"type":26,"value":5569},{"type":21,"tag":209,"props":73984,"children":73985},{"style":216},[73986],{"type":26,"value":3909},{"type":21,"tag":209,"props":73988,"children":73989},{"style":222},[73990],{"type":26,"value":56701},{"type":21,"tag":209,"props":73992,"children":73993},{"style":216},[73994],{"type":26,"value":56706},{"type":21,"tag":209,"props":73996,"children":73997},{"style":222},[73998],{"type":26,"value":73999}," parent) \n",{"type":21,"tag":209,"props":74001,"children":74002},{"class":211,"line":288},[74003],{"type":21,"tag":209,"props":74004,"children":74005},{"style":222},[74006],{"type":26,"value":74007},"   { \n",{"type":21,"tag":209,"props":74009,"children":74010},{"class":211,"line":307},[74011,74015,74019,74023,74027,74031],{"type":21,"tag":209,"props":74012,"children":74013},{"style":216},[74014],{"type":26,"value":8964},{"type":21,"tag":209,"props":74016,"children":74017},{"style":222},[74018],{"type":26,"value":5569},{"type":21,"tag":209,"props":74020,"children":74021},{"style":216},[74022],{"type":26,"value":73932},{"type":21,"tag":209,"props":74024,"children":74025},{"style":222},[74026],{"type":26,"value":378},{"type":21,"tag":209,"props":74028,"children":74029},{"style":263},[74030],{"type":26,"value":36906},{"type":21,"tag":209,"props":74032,"children":74033},{"style":222},[74034],{"type":26,"value":74035},"(parent, key)) \n",{"type":21,"tag":209,"props":74037,"children":74038},{"class":211,"line":325},[74039,74044,74048],{"type":21,"tag":209,"props":74040,"children":74041},{"style":222},[74042],{"type":26,"value":74043},"         child[key] ",{"type":21,"tag":209,"props":74045,"children":74046},{"style":216},[74047],{"type":26,"value":1432},{"type":21,"tag":209,"props":74049,"children":74050},{"style":222},[74051],{"type":26,"value":74052}," parent[key]; \n",{"type":21,"tag":209,"props":74054,"children":74055},{"class":211,"line":334},[74056],{"type":21,"tag":209,"props":74057,"children":74058},{"style":222},[74059],{"type":26,"value":74060},"   } \n",{"type":21,"tag":209,"props":74062,"children":74063},{"class":211,"line":343},[74064],{"type":21,"tag":209,"props":74065,"children":74066},{"emptyLinePlaceholder":248},[74067],{"type":26,"value":251},{"type":21,"tag":209,"props":74069,"children":74070},{"class":211,"line":351},[74071,74076,74081],{"type":21,"tag":209,"props":74072,"children":74073},{"style":216},[74074],{"type":26,"value":74075},"   function",{"type":21,"tag":209,"props":74077,"children":74078},{"style":360},[74079],{"type":26,"value":74080}," ctor",{"type":21,"tag":209,"props":74082,"children":74083},{"style":222},[74084],{"type":26,"value":74085},"() \n",{"type":21,"tag":209,"props":74087,"children":74088},{"class":211,"line":444},[74089],{"type":21,"tag":209,"props":74090,"children":74091},{"style":222},[74092],{"type":26,"value":74007},{"type":21,"tag":209,"props":74094,"children":74095},{"class":211,"line":454},[74096,74101,74106,74110],{"type":21,"tag":209,"props":74097,"children":74098},{"style":263},[74099],{"type":26,"value":74100},"      this",{"type":21,"tag":209,"props":74102,"children":74103},{"style":222},[74104],{"type":26,"value":74105},".constructor ",{"type":21,"tag":209,"props":74107,"children":74108},{"style":216},[74109],{"type":26,"value":1432},{"type":21,"tag":209,"props":74111,"children":74112},{"style":222},[74113],{"type":26,"value":74114}," child; \n",{"type":21,"tag":209,"props":74116,"children":74117},{"class":211,"line":463},[74118],{"type":21,"tag":209,"props":74119,"children":74120},{"style":222},[74121],{"type":26,"value":74060},{"type":21,"tag":209,"props":74123,"children":74124},{"class":211,"line":472},[74125,74130,74134],{"type":21,"tag":209,"props":74126,"children":74127},{"style":222},[74128],{"type":26,"value":74129},"   ctor.prototype ",{"type":21,"tag":209,"props":74131,"children":74132},{"style":216},[74133],{"type":26,"value":1432},{"type":21,"tag":209,"props":74135,"children":74136},{"style":222},[74137],{"type":26,"value":74138}," parent.prototype; \n",{"type":21,"tag":209,"props":74140,"children":74141},{"class":211,"line":480},[74142,74147,74151,74155,74159],{"type":21,"tag":209,"props":74143,"children":74144},{"style":222},[74145],{"type":26,"value":74146},"   child.prototype ",{"type":21,"tag":209,"props":74148,"children":74149},{"style":216},[74150],{"type":26,"value":1432},{"type":21,"tag":209,"props":74152,"children":74153},{"style":216},[74154],{"type":26,"value":6371},{"type":21,"tag":209,"props":74156,"children":74157},{"style":360},[74158],{"type":26,"value":74080},{"type":21,"tag":209,"props":74160,"children":74161},{"style":222},[74162],{"type":26,"value":74163},"(); \n",{"type":21,"tag":209,"props":74165,"children":74166},{"class":211,"line":489},[74167,74172,74176],{"type":21,"tag":209,"props":74168,"children":74169},{"style":222},[74170],{"type":26,"value":74171},"   child.__super__ ",{"type":21,"tag":209,"props":74173,"children":74174},{"style":216},[74175],{"type":26,"value":1432},{"type":21,"tag":209,"props":74177,"children":74178},{"style":222},[74179],{"type":26,"value":74138},{"type":21,"tag":209,"props":74181,"children":74182},{"class":211,"line":847},[74183,74188],{"type":21,"tag":209,"props":74184,"children":74185},{"style":216},[74186],{"type":26,"value":74187},"   return",{"type":21,"tag":209,"props":74189,"children":74190},{"style":222},[74191],{"type":26,"value":74114},{"type":21,"tag":209,"props":74193,"children":74194},{"class":211,"line":860},[74195],{"type":21,"tag":209,"props":74196,"children":74197},{"style":222},[74198],{"type":26,"value":74199}," };\n",{"type":21,"tag":22,"props":74201,"children":74202},{},[74203],{"type":26,"value":74204},"The constructor functions are then generated as follows:",{"type":21,"tag":200,"props":74206,"children":74208},{"className":73683,"code":74207,"language":73685,"meta":8,"style":8},"Animal = (function() \n{\n   function Animal(name) \n   {\n     this.name = name;\n   }\n\n   Animal.prototype.move = function(meters) \n   {\n      return alert(this.name + (\" moved \" + meters + \"m.\"));\n   };\n   return Animal;\n})();\n\nSnake = (function(_super) \n{\n   __extends(Snake, _super);\n   function Snake() \n   {\n      return Snake.__super__.constructor.apply(this, arguments);\n   }\n\n   Snake.prototype.move = function() \n   {\n      alert(\"Slithering...\");\n      return Snake.__super__.move.call(this, 5);\n   };\n   return Snake;\n})(Animal);\n\nsam = new Snake(\"Sammy the Python\");\nsam.move();\n",[74209],{"type":21,"tag":63,"props":74210,"children":74211},{"__ignoreMap":8},[74212,74236,74243,74260,74268,74290,74298,74305,74326,74333,74392,74400,74412,74419,74426,74451,74458,74471,74486,74493,74529,74536,74543,74563,74570,74591,74627,74634,74646,74654,74661,74693],{"type":21,"tag":209,"props":74213,"children":74214},{"class":211,"line":212},[74215,74220,74224,74228,74232],{"type":21,"tag":209,"props":74216,"children":74217},{"style":400},[74218],{"type":26,"value":74219},"Animal",{"type":21,"tag":209,"props":74221,"children":74222},{"style":216},[74223],{"type":26,"value":271},{"type":21,"tag":209,"props":74225,"children":74226},{"style":222},[74227],{"type":26,"value":5569},{"type":21,"tag":209,"props":74229,"children":74230},{"style":216},[74231],{"type":26,"value":4622},{"type":21,"tag":209,"props":74233,"children":74234},{"style":222},[74235],{"type":26,"value":74085},{"type":21,"tag":209,"props":74237,"children":74238},{"class":211,"line":244},[74239],{"type":21,"tag":209,"props":74240,"children":74241},{"style":222},[74242],{"type":26,"value":29353},{"type":21,"tag":209,"props":74244,"children":74245},{"class":211,"line":254},[74246,74250,74255],{"type":21,"tag":209,"props":74247,"children":74248},{"style":216},[74249],{"type":26,"value":74075},{"type":21,"tag":209,"props":74251,"children":74252},{"style":360},[74253],{"type":26,"value":74254}," Animal",{"type":21,"tag":209,"props":74256,"children":74257},{"style":222},[74258],{"type":26,"value":74259},"(name) \n",{"type":21,"tag":209,"props":74261,"children":74262},{"class":211,"line":279},[74263],{"type":21,"tag":209,"props":74264,"children":74265},{"style":222},[74266],{"type":26,"value":74267},"   {\n",{"type":21,"tag":209,"props":74269,"children":74270},{"class":211,"line":288},[74271,74276,74281,74285],{"type":21,"tag":209,"props":74272,"children":74273},{"style":263},[74274],{"type":26,"value":74275},"     this",{"type":21,"tag":209,"props":74277,"children":74278},{"style":222},[74279],{"type":26,"value":74280},".name ",{"type":21,"tag":209,"props":74282,"children":74283},{"style":216},[74284],{"type":26,"value":1432},{"type":21,"tag":209,"props":74286,"children":74287},{"style":222},[74288],{"type":26,"value":74289}," name;\n",{"type":21,"tag":209,"props":74291,"children":74292},{"class":211,"line":307},[74293],{"type":21,"tag":209,"props":74294,"children":74295},{"style":222},[74296],{"type":26,"value":74297},"   }\n",{"type":21,"tag":209,"props":74299,"children":74300},{"class":211,"line":325},[74301],{"type":21,"tag":209,"props":74302,"children":74303},{"emptyLinePlaceholder":248},[74304],{"type":26,"value":251},{"type":21,"tag":209,"props":74306,"children":74307},{"class":211,"line":334},[74308,74313,74317,74321],{"type":21,"tag":209,"props":74309,"children":74310},{"style":222},[74311],{"type":26,"value":74312},"   Animal.prototype.move ",{"type":21,"tag":209,"props":74314,"children":74315},{"style":216},[74316],{"type":26,"value":1432},{"type":21,"tag":209,"props":74318,"children":74319},{"style":216},[74320],{"type":26,"value":4789},{"type":21,"tag":209,"props":74322,"children":74323},{"style":222},[74324],{"type":26,"value":74325},"(meters) \n",{"type":21,"tag":209,"props":74327,"children":74328},{"class":211,"line":343},[74329],{"type":21,"tag":209,"props":74330,"children":74331},{"style":222},[74332],{"type":26,"value":74267},{"type":21,"tag":209,"props":74334,"children":74335},{"class":211,"line":351},[74336,74340,74345,74349,74353,74357,74361,74365,74370,74374,74379,74383,74388],{"type":21,"tag":209,"props":74337,"children":74338},{"style":216},[74339],{"type":26,"value":9045},{"type":21,"tag":209,"props":74341,"children":74342},{"style":360},[74343],{"type":26,"value":74344}," alert",{"type":21,"tag":209,"props":74346,"children":74347},{"style":222},[74348],{"type":26,"value":368},{"type":21,"tag":209,"props":74350,"children":74351},{"style":263},[74352],{"type":26,"value":2508},{"type":21,"tag":209,"props":74354,"children":74355},{"style":222},[74356],{"type":26,"value":74280},{"type":21,"tag":209,"props":74358,"children":74359},{"style":216},[74360],{"type":26,"value":17170},{"type":21,"tag":209,"props":74362,"children":74363},{"style":222},[74364],{"type":26,"value":5569},{"type":21,"tag":209,"props":74366,"children":74367},{"style":233},[74368],{"type":26,"value":74369},"\" moved \"",{"type":21,"tag":209,"props":74371,"children":74372},{"style":216},[74373],{"type":26,"value":4652},{"type":21,"tag":209,"props":74375,"children":74376},{"style":222},[74377],{"type":26,"value":74378}," meters ",{"type":21,"tag":209,"props":74380,"children":74381},{"style":216},[74382],{"type":26,"value":17170},{"type":21,"tag":209,"props":74384,"children":74385},{"style":233},[74386],{"type":26,"value":74387}," \"m.\"",{"type":21,"tag":209,"props":74389,"children":74390},{"style":222},[74391],{"type":26,"value":4212},{"type":21,"tag":209,"props":74393,"children":74394},{"class":211,"line":444},[74395],{"type":21,"tag":209,"props":74396,"children":74397},{"style":222},[74398],{"type":26,"value":74399},"   };\n",{"type":21,"tag":209,"props":74401,"children":74402},{"class":211,"line":454},[74403,74407],{"type":21,"tag":209,"props":74404,"children":74405},{"style":216},[74406],{"type":26,"value":74187},{"type":21,"tag":209,"props":74408,"children":74409},{"style":222},[74410],{"type":26,"value":74411}," Animal;\n",{"type":21,"tag":209,"props":74413,"children":74414},{"class":211,"line":463},[74415],{"type":21,"tag":209,"props":74416,"children":74417},{"style":222},[74418],{"type":26,"value":32754},{"type":21,"tag":209,"props":74420,"children":74421},{"class":211,"line":472},[74422],{"type":21,"tag":209,"props":74423,"children":74424},{"emptyLinePlaceholder":248},[74425],{"type":26,"value":251},{"type":21,"tag":209,"props":74427,"children":74428},{"class":211,"line":480},[74429,74434,74438,74442,74446],{"type":21,"tag":209,"props":74430,"children":74431},{"style":400},[74432],{"type":26,"value":74433},"Snake",{"type":21,"tag":209,"props":74435,"children":74436},{"style":216},[74437],{"type":26,"value":271},{"type":21,"tag":209,"props":74439,"children":74440},{"style":222},[74441],{"type":26,"value":5569},{"type":21,"tag":209,"props":74443,"children":74444},{"style":216},[74445],{"type":26,"value":4622},{"type":21,"tag":209,"props":74447,"children":74448},{"style":222},[74449],{"type":26,"value":74450},"(_super) \n",{"type":21,"tag":209,"props":74452,"children":74453},{"class":211,"line":489},[74454],{"type":21,"tag":209,"props":74455,"children":74456},{"style":222},[74457],{"type":26,"value":29353},{"type":21,"tag":209,"props":74459,"children":74460},{"class":211,"line":847},[74461,74466],{"type":21,"tag":209,"props":74462,"children":74463},{"style":216},[74464],{"type":26,"value":74465},"   __extends",{"type":21,"tag":209,"props":74467,"children":74468},{"style":222},[74469],{"type":26,"value":74470},"(Snake, _super);\n",{"type":21,"tag":209,"props":74472,"children":74473},{"class":211,"line":860},[74474,74478,74482],{"type":21,"tag":209,"props":74475,"children":74476},{"style":216},[74477],{"type":26,"value":74075},{"type":21,"tag":209,"props":74479,"children":74480},{"style":360},[74481],{"type":26,"value":73792},{"type":21,"tag":209,"props":74483,"children":74484},{"style":222},[74485],{"type":26,"value":74085},{"type":21,"tag":209,"props":74487,"children":74488},{"class":211,"line":877},[74489],{"type":21,"tag":209,"props":74490,"children":74491},{"style":222},[74492],{"type":26,"value":74267},{"type":21,"tag":209,"props":74494,"children":74495},{"class":211,"line":889},[74496,74500,74505,74509,74513,74517,74521,74525],{"type":21,"tag":209,"props":74497,"children":74498},{"style":216},[74499],{"type":26,"value":9045},{"type":21,"tag":209,"props":74501,"children":74502},{"style":222},[74503],{"type":26,"value":74504}," Snake.__super__.constructor.",{"type":21,"tag":209,"props":74506,"children":74507},{"style":263},[74508],{"type":26,"value":38205},{"type":21,"tag":209,"props":74510,"children":74511},{"style":222},[74512],{"type":26,"value":368},{"type":21,"tag":209,"props":74514,"children":74515},{"style":263},[74516],{"type":26,"value":2508},{"type":21,"tag":209,"props":74518,"children":74519},{"style":222},[74520],{"type":26,"value":408},{"type":21,"tag":209,"props":74522,"children":74523},{"style":263},[74524],{"type":26,"value":38173},{"type":21,"tag":209,"props":74526,"children":74527},{"style":222},[74528],{"type":26,"value":2608},{"type":21,"tag":209,"props":74530,"children":74531},{"class":211,"line":902},[74532],{"type":21,"tag":209,"props":74533,"children":74534},{"style":222},[74535],{"type":26,"value":74297},{"type":21,"tag":209,"props":74537,"children":74538},{"class":211,"line":914},[74539],{"type":21,"tag":209,"props":74540,"children":74541},{"emptyLinePlaceholder":248},[74542],{"type":26,"value":251},{"type":21,"tag":209,"props":74544,"children":74545},{"class":211,"line":922},[74546,74551,74555,74559],{"type":21,"tag":209,"props":74547,"children":74548},{"style":222},[74549],{"type":26,"value":74550},"   Snake.prototype.move ",{"type":21,"tag":209,"props":74552,"children":74553},{"style":216},[74554],{"type":26,"value":1432},{"type":21,"tag":209,"props":74556,"children":74557},{"style":216},[74558],{"type":26,"value":4789},{"type":21,"tag":209,"props":74560,"children":74561},{"style":222},[74562],{"type":26,"value":74085},{"type":21,"tag":209,"props":74564,"children":74565},{"class":211,"line":2312},[74566],{"type":21,"tag":209,"props":74567,"children":74568},{"style":222},[74569],{"type":26,"value":74267},{"type":21,"tag":209,"props":74571,"children":74572},{"class":211,"line":2321},[74573,74578,74582,74587],{"type":21,"tag":209,"props":74574,"children":74575},{"style":360},[74576],{"type":26,"value":74577},"      alert",{"type":21,"tag":209,"props":74579,"children":74580},{"style":222},[74581],{"type":26,"value":368},{"type":21,"tag":209,"props":74583,"children":74584},{"style":233},[74585],{"type":26,"value":74586},"\"Slithering...\"",{"type":21,"tag":209,"props":74588,"children":74589},{"style":222},[74590],{"type":26,"value":2608},{"type":21,"tag":209,"props":74592,"children":74593},{"class":211,"line":2372},[74594,74598,74603,74607,74611,74615,74619,74623],{"type":21,"tag":209,"props":74595,"children":74596},{"style":216},[74597],{"type":26,"value":9045},{"type":21,"tag":209,"props":74599,"children":74600},{"style":222},[74601],{"type":26,"value":74602}," Snake.__super__.move.",{"type":21,"tag":209,"props":74604,"children":74605},{"style":263},[74606],{"type":26,"value":36906},{"type":21,"tag":209,"props":74608,"children":74609},{"style":222},[74610],{"type":26,"value":368},{"type":21,"tag":209,"props":74612,"children":74613},{"style":263},[74614],{"type":26,"value":2508},{"type":21,"tag":209,"props":74616,"children":74617},{"style":222},[74618],{"type":26,"value":408},{"type":21,"tag":209,"props":74620,"children":74621},{"style":263},[74622],{"type":26,"value":49340},{"type":21,"tag":209,"props":74624,"children":74625},{"style":222},[74626],{"type":26,"value":2608},{"type":21,"tag":209,"props":74628,"children":74629},{"class":211,"line":2381},[74630],{"type":21,"tag":209,"props":74631,"children":74632},{"style":222},[74633],{"type":26,"value":74399},{"type":21,"tag":209,"props":74635,"children":74636},{"class":211,"line":2389},[74637,74641],{"type":21,"tag":209,"props":74638,"children":74639},{"style":216},[74640],{"type":26,"value":74187},{"type":21,"tag":209,"props":74642,"children":74643},{"style":222},[74644],{"type":26,"value":74645}," Snake;\n",{"type":21,"tag":209,"props":74647,"children":74648},{"class":211,"line":2397},[74649],{"type":21,"tag":209,"props":74650,"children":74651},{"style":222},[74652],{"type":26,"value":74653},"})(Animal);\n",{"type":21,"tag":209,"props":74655,"children":74656},{"class":211,"line":2406},[74657],{"type":21,"tag":209,"props":74658,"children":74659},{"emptyLinePlaceholder":248},[74660],{"type":26,"value":251},{"type":21,"tag":209,"props":74662,"children":74663},{"class":211,"line":2415},[74664,74668,74672,74676,74680,74684,74689],{"type":21,"tag":209,"props":74665,"children":74666},{"style":400},[74667],{"type":26,"value":73857},{"type":21,"tag":209,"props":74669,"children":74670},{"style":216},[74671],{"type":26,"value":271},{"type":21,"tag":209,"props":74673,"children":74674},{"style":216},[74675],{"type":26,"value":6371},{"type":21,"tag":209,"props":74677,"children":74678},{"style":360},[74679],{"type":26,"value":73792},{"type":21,"tag":209,"props":74681,"children":74682},{"style":222},[74683],{"type":26,"value":368},{"type":21,"tag":209,"props":74685,"children":74686},{"style":233},[74687],{"type":26,"value":74688},"\"Sammy the Python\"",{"type":21,"tag":209,"props":74690,"children":74691},{"style":222},[74692],{"type":26,"value":2608},{"type":21,"tag":209,"props":74694,"children":74695},{"class":211,"line":2424},[74696,74700,74704],{"type":21,"tag":209,"props":74697,"children":74698},{"style":222},[74699],{"type":26,"value":73882},{"type":21,"tag":209,"props":74701,"children":74702},{"style":263},[74703],{"type":26,"value":73887},{"type":21,"tag":209,"props":74705,"children":74706},{"style":222},[74707],{"type":26,"value":4123},{"type":21,"tag":22,"props":74709,"children":74710},{},[74711,74713,74720],{"type":26,"value":74712},"Notice how easily the Snake constructor can access its Animal prototype using the ",{"type":21,"tag":1084,"props":74714,"children":74715},{},[74716],{"type":21,"tag":11881,"props":74717,"children":74718},{},[74719],{"type":26,"value":73915},{"type":26,"value":21623},{"type":21,"tag":51,"props":74722,"children":74724},{"id":74723},"functional-inheritance",[74725],{"type":26,"value":74726},"Functional Inheritance",{"type":21,"tag":22,"props":74728,"children":74729},{},[74730,74731,74736],{"type":26,"value":7218},{"type":21,"tag":29,"props":74732,"children":74734},{"href":73656,"rel":74733},[93],[74735],{"type":26,"value":73660},{"type":26,"value":74737},", Crockford advocates a functional inheritance style. Converting the original CoffeeScript code to this style results in the following:",{"type":21,"tag":200,"props":74739,"children":74741},{"className":73683,"code":74740,"language":73685,"meta":8,"style":8},"Function.prototype.method = function(name, func)\n{\n   if (!this.prototype[name])\n   {\n      this.prototype[name] = func;\n      return this;\n   }\n};\n\nObject.method('superior', function(name)\n{\n   var that = this;\n   var method = that[name];\n   return function()\n   {\n      return method.apply(that, arguments);\n   };\n});\n\nvar Animal = function(spec)\n{\n   var that = {};\n   that.name = spec.name;\n\n   that.move = function(meters)\n   {\n      alert(this.name + ' moved ' + meters + 'm.');\n   }\n   return that;\n}\n\nvar Snake = function(spec)\n{\n   var that = Animal(spec);\n   var super_move = that.superior('move');\n\n   that.move = function()\n   {\n      alert('Slithering...');\n      super_move(5);\n   }\n   return that;\n}\n\nsam = new Snake({name:'Sammy the Python'});\nsam.move()\n",[74742],{"type":21,"tag":63,"props":74743,"children":74744},{"__ignoreMap":8},[74745,74771,74778,74803,74810,74831,74846,74853,74860,74867,74905,74912,74937,74957,74972,74979,75008,75015,75022,75029,75053,75060,75079,75096,75103,75124,75131,75180,75187,75199,75206,75213,75236,75243,75267,75306,75313,75332,75339,75359,75379,75386,75397,75404,75411,75452],{"type":21,"tag":209,"props":74746,"children":74747},{"class":211,"line":212},[74748,74753,74758,74762,74766],{"type":21,"tag":209,"props":74749,"children":74750},{"style":263},[74751],{"type":26,"value":74752},"Function",{"type":21,"tag":209,"props":74754,"children":74755},{"style":222},[74756],{"type":26,"value":74757},".prototype.method ",{"type":21,"tag":209,"props":74759,"children":74760},{"style":216},[74761],{"type":26,"value":1432},{"type":21,"tag":209,"props":74763,"children":74764},{"style":216},[74765],{"type":26,"value":4789},{"type":21,"tag":209,"props":74767,"children":74768},{"style":222},[74769],{"type":26,"value":74770},"(name, func)\n",{"type":21,"tag":209,"props":74772,"children":74773},{"class":211,"line":244},[74774],{"type":21,"tag":209,"props":74775,"children":74776},{"style":222},[74777],{"type":26,"value":29353},{"type":21,"tag":209,"props":74779,"children":74780},{"class":211,"line":254},[74781,74786,74790,74794,74798],{"type":21,"tag":209,"props":74782,"children":74783},{"style":216},[74784],{"type":26,"value":74785},"   if",{"type":21,"tag":209,"props":74787,"children":74788},{"style":222},[74789],{"type":26,"value":5569},{"type":21,"tag":209,"props":74791,"children":74792},{"style":216},[74793],{"type":26,"value":6455},{"type":21,"tag":209,"props":74795,"children":74796},{"style":263},[74797],{"type":26,"value":2508},{"type":21,"tag":209,"props":74799,"children":74800},{"style":222},[74801],{"type":26,"value":74802},".prototype[name])\n",{"type":21,"tag":209,"props":74804,"children":74805},{"class":211,"line":279},[74806],{"type":21,"tag":209,"props":74807,"children":74808},{"style":222},[74809],{"type":26,"value":74267},{"type":21,"tag":209,"props":74811,"children":74812},{"class":211,"line":288},[74813,74817,74822,74826],{"type":21,"tag":209,"props":74814,"children":74815},{"style":263},[74816],{"type":26,"value":74100},{"type":21,"tag":209,"props":74818,"children":74819},{"style":222},[74820],{"type":26,"value":74821},".prototype[name] ",{"type":21,"tag":209,"props":74823,"children":74824},{"style":216},[74825],{"type":26,"value":1432},{"type":21,"tag":209,"props":74827,"children":74828},{"style":222},[74829],{"type":26,"value":74830}," func;\n",{"type":21,"tag":209,"props":74832,"children":74833},{"class":211,"line":307},[74834,74838,74842],{"type":21,"tag":209,"props":74835,"children":74836},{"style":216},[74837],{"type":26,"value":9045},{"type":21,"tag":209,"props":74839,"children":74840},{"style":263},[74841],{"type":26,"value":20502},{"type":21,"tag":209,"props":74843,"children":74844},{"style":222},[74845],{"type":26,"value":241},{"type":21,"tag":209,"props":74847,"children":74848},{"class":211,"line":325},[74849],{"type":21,"tag":209,"props":74850,"children":74851},{"style":222},[74852],{"type":26,"value":74297},{"type":21,"tag":209,"props":74854,"children":74855},{"class":211,"line":334},[74856],{"type":21,"tag":209,"props":74857,"children":74858},{"style":222},[74859],{"type":26,"value":340},{"type":21,"tag":209,"props":74861,"children":74862},{"class":211,"line":343},[74863],{"type":21,"tag":209,"props":74864,"children":74865},{"emptyLinePlaceholder":248},[74866],{"type":26,"value":251},{"type":21,"tag":209,"props":74868,"children":74869},{"class":211,"line":351},[74870,74875,74879,74883,74887,74892,74896,74900],{"type":21,"tag":209,"props":74871,"children":74872},{"style":263},[74873],{"type":26,"value":74874},"Object",{"type":21,"tag":209,"props":74876,"children":74877},{"style":222},[74878],{"type":26,"value":378},{"type":21,"tag":209,"props":74880,"children":74881},{"style":360},[74882],{"type":26,"value":36868},{"type":21,"tag":209,"props":74884,"children":74885},{"style":222},[74886],{"type":26,"value":368},{"type":21,"tag":209,"props":74888,"children":74889},{"style":233},[74890],{"type":26,"value":74891},"'superior'",{"type":21,"tag":209,"props":74893,"children":74894},{"style":222},[74895],{"type":26,"value":408},{"type":21,"tag":209,"props":74897,"children":74898},{"style":216},[74899],{"type":26,"value":4622},{"type":21,"tag":209,"props":74901,"children":74902},{"style":222},[74903],{"type":26,"value":74904},"(name)\n",{"type":21,"tag":209,"props":74906,"children":74907},{"class":211,"line":444},[74908],{"type":21,"tag":209,"props":74909,"children":74910},{"style":222},[74911],{"type":26,"value":29353},{"type":21,"tag":209,"props":74913,"children":74914},{"class":211,"line":454},[74915,74920,74925,74929,74933],{"type":21,"tag":209,"props":74916,"children":74917},{"style":216},[74918],{"type":26,"value":74919},"   var",{"type":21,"tag":209,"props":74921,"children":74922},{"style":400},[74923],{"type":26,"value":74924}," that",{"type":21,"tag":209,"props":74926,"children":74927},{"style":216},[74928],{"type":26,"value":271},{"type":21,"tag":209,"props":74930,"children":74931},{"style":263},[74932],{"type":26,"value":20502},{"type":21,"tag":209,"props":74934,"children":74935},{"style":222},[74936],{"type":26,"value":241},{"type":21,"tag":209,"props":74938,"children":74939},{"class":211,"line":463},[74940,74944,74948,74952],{"type":21,"tag":209,"props":74941,"children":74942},{"style":216},[74943],{"type":26,"value":74919},{"type":21,"tag":209,"props":74945,"children":74946},{"style":400},[74947],{"type":26,"value":70366},{"type":21,"tag":209,"props":74949,"children":74950},{"style":216},[74951],{"type":26,"value":271},{"type":21,"tag":209,"props":74953,"children":74954},{"style":222},[74955],{"type":26,"value":74956}," that[name];\n",{"type":21,"tag":209,"props":74958,"children":74959},{"class":211,"line":472},[74960,74964,74968],{"type":21,"tag":209,"props":74961,"children":74962},{"style":216},[74963],{"type":26,"value":74187},{"type":21,"tag":209,"props":74965,"children":74966},{"style":216},[74967],{"type":26,"value":4789},{"type":21,"tag":209,"props":74969,"children":74970},{"style":222},[74971],{"type":26,"value":5225},{"type":21,"tag":209,"props":74973,"children":74974},{"class":211,"line":480},[74975],{"type":21,"tag":209,"props":74976,"children":74977},{"style":222},[74978],{"type":26,"value":74267},{"type":21,"tag":209,"props":74980,"children":74981},{"class":211,"line":489},[74982,74986,74991,74995,75000,75004],{"type":21,"tag":209,"props":74983,"children":74984},{"style":216},[74985],{"type":26,"value":9045},{"type":21,"tag":209,"props":74987,"children":74988},{"style":222},[74989],{"type":26,"value":74990}," method.",{"type":21,"tag":209,"props":74992,"children":74993},{"style":263},[74994],{"type":26,"value":38205},{"type":21,"tag":209,"props":74996,"children":74997},{"style":222},[74998],{"type":26,"value":74999},"(that, ",{"type":21,"tag":209,"props":75001,"children":75002},{"style":263},[75003],{"type":26,"value":38173},{"type":21,"tag":209,"props":75005,"children":75006},{"style":222},[75007],{"type":26,"value":2608},{"type":21,"tag":209,"props":75009,"children":75010},{"class":211,"line":847},[75011],{"type":21,"tag":209,"props":75012,"children":75013},{"style":222},[75014],{"type":26,"value":74399},{"type":21,"tag":209,"props":75016,"children":75017},{"class":211,"line":860},[75018],{"type":21,"tag":209,"props":75019,"children":75020},{"style":222},[75021],{"type":26,"value":469},{"type":21,"tag":209,"props":75023,"children":75024},{"class":211,"line":877},[75025],{"type":21,"tag":209,"props":75026,"children":75027},{"emptyLinePlaceholder":248},[75028],{"type":26,"value":251},{"type":21,"tag":209,"props":75030,"children":75031},{"class":211,"line":889},[75032,75036,75040,75044,75048],{"type":21,"tag":209,"props":75033,"children":75034},{"style":216},[75035],{"type":26,"value":3909},{"type":21,"tag":209,"props":75037,"children":75038},{"style":400},[75039],{"type":26,"value":74254},{"type":21,"tag":209,"props":75041,"children":75042},{"style":216},[75043],{"type":26,"value":271},{"type":21,"tag":209,"props":75045,"children":75046},{"style":216},[75047],{"type":26,"value":4789},{"type":21,"tag":209,"props":75049,"children":75050},{"style":222},[75051],{"type":26,"value":75052},"(spec)\n",{"type":21,"tag":209,"props":75054,"children":75055},{"class":211,"line":902},[75056],{"type":21,"tag":209,"props":75057,"children":75058},{"style":222},[75059],{"type":26,"value":29353},{"type":21,"tag":209,"props":75061,"children":75062},{"class":211,"line":914},[75063,75067,75071,75075],{"type":21,"tag":209,"props":75064,"children":75065},{"style":216},[75066],{"type":26,"value":74919},{"type":21,"tag":209,"props":75068,"children":75069},{"style":400},[75070],{"type":26,"value":74924},{"type":21,"tag":209,"props":75072,"children":75073},{"style":216},[75074],{"type":26,"value":271},{"type":21,"tag":209,"props":75076,"children":75077},{"style":222},[75078],{"type":26,"value":7963},{"type":21,"tag":209,"props":75080,"children":75081},{"class":211,"line":922},[75082,75087,75091],{"type":21,"tag":209,"props":75083,"children":75084},{"style":222},[75085],{"type":26,"value":75086},"   that.name ",{"type":21,"tag":209,"props":75088,"children":75089},{"style":216},[75090],{"type":26,"value":1432},{"type":21,"tag":209,"props":75092,"children":75093},{"style":222},[75094],{"type":26,"value":75095}," spec.name;\n",{"type":21,"tag":209,"props":75097,"children":75098},{"class":211,"line":2312},[75099],{"type":21,"tag":209,"props":75100,"children":75101},{"emptyLinePlaceholder":248},[75102],{"type":26,"value":251},{"type":21,"tag":209,"props":75104,"children":75105},{"class":211,"line":2321},[75106,75111,75115,75119],{"type":21,"tag":209,"props":75107,"children":75108},{"style":222},[75109],{"type":26,"value":75110},"   that.move ",{"type":21,"tag":209,"props":75112,"children":75113},{"style":216},[75114],{"type":26,"value":1432},{"type":21,"tag":209,"props":75116,"children":75117},{"style":216},[75118],{"type":26,"value":4789},{"type":21,"tag":209,"props":75120,"children":75121},{"style":222},[75122],{"type":26,"value":75123},"(meters)\n",{"type":21,"tag":209,"props":75125,"children":75126},{"class":211,"line":2372},[75127],{"type":21,"tag":209,"props":75128,"children":75129},{"style":222},[75130],{"type":26,"value":74267},{"type":21,"tag":209,"props":75132,"children":75133},{"class":211,"line":2381},[75134,75138,75142,75146,75150,75154,75159,75163,75167,75171,75176],{"type":21,"tag":209,"props":75135,"children":75136},{"style":360},[75137],{"type":26,"value":74577},{"type":21,"tag":209,"props":75139,"children":75140},{"style":222},[75141],{"type":26,"value":368},{"type":21,"tag":209,"props":75143,"children":75144},{"style":263},[75145],{"type":26,"value":2508},{"type":21,"tag":209,"props":75147,"children":75148},{"style":222},[75149],{"type":26,"value":74280},{"type":21,"tag":209,"props":75151,"children":75152},{"style":216},[75153],{"type":26,"value":17170},{"type":21,"tag":209,"props":75155,"children":75156},{"style":233},[75157],{"type":26,"value":75158}," ' moved '",{"type":21,"tag":209,"props":75160,"children":75161},{"style":216},[75162],{"type":26,"value":4652},{"type":21,"tag":209,"props":75164,"children":75165},{"style":222},[75166],{"type":26,"value":74378},{"type":21,"tag":209,"props":75168,"children":75169},{"style":216},[75170],{"type":26,"value":17170},{"type":21,"tag":209,"props":75172,"children":75173},{"style":233},[75174],{"type":26,"value":75175}," 'm.'",{"type":21,"tag":209,"props":75177,"children":75178},{"style":222},[75179],{"type":26,"value":2608},{"type":21,"tag":209,"props":75181,"children":75182},{"class":211,"line":2389},[75183],{"type":21,"tag":209,"props":75184,"children":75185},{"style":222},[75186],{"type":26,"value":74297},{"type":21,"tag":209,"props":75188,"children":75189},{"class":211,"line":2397},[75190,75194],{"type":21,"tag":209,"props":75191,"children":75192},{"style":216},[75193],{"type":26,"value":74187},{"type":21,"tag":209,"props":75195,"children":75196},{"style":222},[75197],{"type":26,"value":75198}," that;\n",{"type":21,"tag":209,"props":75200,"children":75201},{"class":211,"line":2406},[75202],{"type":21,"tag":209,"props":75203,"children":75204},{"style":222},[75205],{"type":26,"value":4415},{"type":21,"tag":209,"props":75207,"children":75208},{"class":211,"line":2415},[75209],{"type":21,"tag":209,"props":75210,"children":75211},{"emptyLinePlaceholder":248},[75212],{"type":26,"value":251},{"type":21,"tag":209,"props":75214,"children":75215},{"class":211,"line":2424},[75216,75220,75224,75228,75232],{"type":21,"tag":209,"props":75217,"children":75218},{"style":216},[75219],{"type":26,"value":3909},{"type":21,"tag":209,"props":75221,"children":75222},{"style":400},[75223],{"type":26,"value":73792},{"type":21,"tag":209,"props":75225,"children":75226},{"style":216},[75227],{"type":26,"value":271},{"type":21,"tag":209,"props":75229,"children":75230},{"style":216},[75231],{"type":26,"value":4789},{"type":21,"tag":209,"props":75233,"children":75234},{"style":222},[75235],{"type":26,"value":75052},{"type":21,"tag":209,"props":75237,"children":75238},{"class":211,"line":2433},[75239],{"type":21,"tag":209,"props":75240,"children":75241},{"style":222},[75242],{"type":26,"value":29353},{"type":21,"tag":209,"props":75244,"children":75245},{"class":211,"line":2442},[75246,75250,75254,75258,75262],{"type":21,"tag":209,"props":75247,"children":75248},{"style":216},[75249],{"type":26,"value":74919},{"type":21,"tag":209,"props":75251,"children":75252},{"style":400},[75253],{"type":26,"value":74924},{"type":21,"tag":209,"props":75255,"children":75256},{"style":216},[75257],{"type":26,"value":271},{"type":21,"tag":209,"props":75259,"children":75260},{"style":360},[75261],{"type":26,"value":74254},{"type":21,"tag":209,"props":75263,"children":75264},{"style":222},[75265],{"type":26,"value":75266},"(spec);\n",{"type":21,"tag":209,"props":75268,"children":75269},{"class":211,"line":2471},[75270,75274,75279,75283,75288,75293,75297,75302],{"type":21,"tag":209,"props":75271,"children":75272},{"style":216},[75273],{"type":26,"value":74919},{"type":21,"tag":209,"props":75275,"children":75276},{"style":400},[75277],{"type":26,"value":75278}," super_move",{"type":21,"tag":209,"props":75280,"children":75281},{"style":216},[75282],{"type":26,"value":271},{"type":21,"tag":209,"props":75284,"children":75285},{"style":222},[75286],{"type":26,"value":75287}," that.",{"type":21,"tag":209,"props":75289,"children":75290},{"style":360},[75291],{"type":26,"value":75292},"superior",{"type":21,"tag":209,"props":75294,"children":75295},{"style":222},[75296],{"type":26,"value":368},{"type":21,"tag":209,"props":75298,"children":75299},{"style":233},[75300],{"type":26,"value":75301},"'move'",{"type":21,"tag":209,"props":75303,"children":75304},{"style":222},[75305],{"type":26,"value":2608},{"type":21,"tag":209,"props":75307,"children":75308},{"class":211,"line":2480},[75309],{"type":21,"tag":209,"props":75310,"children":75311},{"emptyLinePlaceholder":248},[75312],{"type":26,"value":251},{"type":21,"tag":209,"props":75314,"children":75315},{"class":211,"line":2489},[75316,75320,75324,75328],{"type":21,"tag":209,"props":75317,"children":75318},{"style":222},[75319],{"type":26,"value":75110},{"type":21,"tag":209,"props":75321,"children":75322},{"style":216},[75323],{"type":26,"value":1432},{"type":21,"tag":209,"props":75325,"children":75326},{"style":216},[75327],{"type":26,"value":4789},{"type":21,"tag":209,"props":75329,"children":75330},{"style":222},[75331],{"type":26,"value":5225},{"type":21,"tag":209,"props":75333,"children":75334},{"class":211,"line":2516},[75335],{"type":21,"tag":209,"props":75336,"children":75337},{"style":222},[75338],{"type":26,"value":74267},{"type":21,"tag":209,"props":75340,"children":75341},{"class":211,"line":2525},[75342,75346,75350,75355],{"type":21,"tag":209,"props":75343,"children":75344},{"style":360},[75345],{"type":26,"value":74577},{"type":21,"tag":209,"props":75347,"children":75348},{"style":222},[75349],{"type":26,"value":368},{"type":21,"tag":209,"props":75351,"children":75352},{"style":233},[75353],{"type":26,"value":75354},"'Slithering...'",{"type":21,"tag":209,"props":75356,"children":75357},{"style":222},[75358],{"type":26,"value":2608},{"type":21,"tag":209,"props":75360,"children":75361},{"class":211,"line":2533},[75362,75367,75371,75375],{"type":21,"tag":209,"props":75363,"children":75364},{"style":360},[75365],{"type":26,"value":75366},"      super_move",{"type":21,"tag":209,"props":75368,"children":75369},{"style":222},[75370],{"type":26,"value":368},{"type":21,"tag":209,"props":75372,"children":75373},{"style":263},[75374],{"type":26,"value":49340},{"type":21,"tag":209,"props":75376,"children":75377},{"style":222},[75378],{"type":26,"value":2608},{"type":21,"tag":209,"props":75380,"children":75381},{"class":211,"line":2542},[75382],{"type":21,"tag":209,"props":75383,"children":75384},{"style":222},[75385],{"type":26,"value":74297},{"type":21,"tag":209,"props":75387,"children":75388},{"class":211,"line":2550},[75389,75393],{"type":21,"tag":209,"props":75390,"children":75391},{"style":216},[75392],{"type":26,"value":74187},{"type":21,"tag":209,"props":75394,"children":75395},{"style":222},[75396],{"type":26,"value":75198},{"type":21,"tag":209,"props":75398,"children":75399},{"class":211,"line":2564},[75400],{"type":21,"tag":209,"props":75401,"children":75402},{"style":222},[75403],{"type":26,"value":4415},{"type":21,"tag":209,"props":75405,"children":75406},{"class":211,"line":2611},[75407],{"type":21,"tag":209,"props":75408,"children":75409},{"emptyLinePlaceholder":248},[75410],{"type":26,"value":251},{"type":21,"tag":209,"props":75412,"children":75413},{"class":211,"line":2619},[75414,75418,75422,75426,75430,75435,75439,75443,75448],{"type":21,"tag":209,"props":75415,"children":75416},{"style":400},[75417],{"type":26,"value":73857},{"type":21,"tag":209,"props":75419,"children":75420},{"style":216},[75421],{"type":26,"value":271},{"type":21,"tag":209,"props":75423,"children":75424},{"style":216},[75425],{"type":26,"value":6371},{"type":21,"tag":209,"props":75427,"children":75428},{"style":360},[75429],{"type":26,"value":73792},{"type":21,"tag":209,"props":75431,"children":75432},{"style":222},[75433],{"type":26,"value":75434},"({",{"type":21,"tag":209,"props":75436,"children":75437},{"style":400},[75438],{"type":26,"value":38122},{"type":21,"tag":209,"props":75440,"children":75441},{"style":216},[75442],{"type":26,"value":191},{"type":21,"tag":209,"props":75444,"children":75445},{"style":233},[75446],{"type":26,"value":75447},"'Sammy the Python'",{"type":21,"tag":209,"props":75449,"children":75450},{"style":222},[75451],{"type":26,"value":469},{"type":21,"tag":209,"props":75453,"children":75454},{"class":211,"line":2627},[75455,75459,75463],{"type":21,"tag":209,"props":75456,"children":75457},{"style":222},[75458],{"type":26,"value":73882},{"type":21,"tag":209,"props":75460,"children":75461},{"style":263},[75462],{"type":26,"value":73887},{"type":21,"tag":209,"props":75464,"children":75465},{"style":222},[75466],{"type":26,"value":5225},{"type":21,"tag":22,"props":75468,"children":75469},{},[75470],{"type":26,"value":75471},"The functional style does nothing with prototypes. Inheritance is implemented by creating an object from a base function, similar to a constructor, but without the need for the new operator. Access to super methods is accomplished by extending the built-in Object and Function objects. Notice that any child object wanting access to a super method must create a new function pointing to the super method.",{"type":21,"tag":51,"props":75473,"children":75475},{"id":75474},"which-one",[75476],{"type":26,"value":75477},"Which One?",{"type":21,"tag":22,"props":75479,"children":75480},{},[75481,75483,75490],{"type":26,"value":75482},"So which method is better? Because I'm more familiar with class-based inheritance, I'd rather just use CoffeeScript and ignore the underlying JavaScript implementation altogether. I like the fact that I can look at a CoffeeScript class definition and see on a single line both the name of the \"class\" and the name of the \"class\" it extends. In both JavaScript implementations, I have to search other lines to find the object that my object is extending. I find the use of the ",{"type":21,"tag":1084,"props":75484,"children":75485},{},[75486],{"type":21,"tag":11881,"props":75487,"children":75488},{},[75489],{"type":26,"value":73915},{"type":26,"value":75491}," property a much more elegant solution when it comes to super methods. The functional method for accessing super methods would not scale well if there are a large number of super methods you want to access.",{"type":21,"tag":22,"props":75493,"children":75494},{},[75495],{"type":26,"value":75496},"Even if you decide to work at the CoffeeScript level, it's imperative that you understand the JavaScript it compiles into. Again, read the article referenced above and the generated JavaScript becomes trivial to understand.",{"type":21,"tag":22,"props":75498,"children":75499},{},[75500,75502,75508],{"type":26,"value":75501},"Finally, if you want a much more thorough comparison and richer examples of prototypal vs. functional inheritance styles, this ",{"type":21,"tag":29,"props":75503,"children":75506},{"href":75504,"rel":75505},"http://bolinfest.com/javascript/inheritance.php",[93],[75507],{"type":26,"value":8952},{"type":26,"value":75509}," provides both and makes a very strong case for the use of prototypal inheritance.",{"type":21,"tag":3490,"props":75511,"children":75512},{},[75513],{"type":26,"value":3494},{"title":8,"searchDepth":254,"depth":254,"links":75515},[75516,75517,75518,75519],{"id":73664,"depth":254,"text":73667},{"id":73899,"depth":254,"text":73902},{"id":74723,"depth":254,"text":74726},{"id":75474,"depth":254,"text":75477},"content:rbrubaker:2012-07:prototypal-js.md","rbrubaker/2012-07/prototypal-js.md","rbrubaker/2012-07/prototypal-js",{"user":75524,"name":75525},"rbrubaker","Ryan Brubaker",1780330265128]