ethstats-server/web-app/.meteor/local/build/programs/web.browser/packages/reload.js.map
2015-08-14 19:22:53 +02:00

2 lines
9.7 KiB
Plaintext

)]}'
{"version":3,"sources":["reload/reload.js","reload/deprecated.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,G;AACA,kE;AACA,gE;AACA,E;AACA,sD;AACA,E;AACA,mE;AACA,uE;AACA,qE;AACA,gE;AACA,sE;AACA,mE;AACA,4C;AACA,uC;AACA,gE;AACA,4D;AACA,E;AACA,qE;AACA,qE;AACA,wE;AACA,sE;AACA,oC;AACA,E;AACA,qE;AACA,uE;AACA,2C;AACA,G;;AAEA,kE;AACA,kE;AACA,qD;AACA,4C;;AAEA,Y;;AAEA,+B;;AAEA,kB;AACA,+B;AACA,a;;AAEA,8E;AACA,8B;AACA,K;AACA,wE;AACA,wB;AACA,I;AACA,6E;AACA,I;AACA,+E;AACA,uE;AACA,sC;AACA,6C;;AAEA,iC;AACA,2B;AACA,iD;AACA,+C;AACA,U;AACA,uC;AACA,8B;AACA,G;AACA,Y;AACA,gF;AACA,4B;AACA,C;;AAEA,qB;AACA,+B;AACA,oE;AACA,E;;AAEA,yB;AACA,+B;AACA,0C;AACA,Q;AACA,mE;AACA,2B;AACA,uD;AACA,C;;AAEA,+B;AACA,oB;AACA,K;AACA,oC;AACA,uC;AACA,uD;AACA,oB;AACA,G;AACA,e;AACA,yD;AACA,C;;AAEA,+D;AACA,6C;AACA,6B;AACA,C;;;AAGA,mB;;AAEA,kC;;AAEA,wE;AACA,oE;AACA,oE;AACA,mE;AACA,oE;AACA,mE;AACA,+D;AACA,oE;AACA,2D;AACA,iE;AACA,mE;AACA,oE;AACA,6E;AACA,mE;AACA,mE;AACA,qE;AACA,mC;AACA,E;AACA,+C;AACA,kB;AACA,mD;AACA,oB;AACA,qB;AACA,G;AACA,mD;AACA,E;;AAEA,yC;AACA,iE;AACA,E;AACA,yC;AACA,wB;AACA,E;;AAEA,iD;AACA,mD;AACA,0C;AACA,0B;;AAEA,yB;AACA,qC;AACA,sB;AACA,4B;AACA,8B;AACA,gD;AACA,mB;AACA,uB;AACA,oC;AACA,wC;AACA,I;AACA,6C;AACA,yB;AACA,M;AACA,gB;AACA,E;;AAEA,e;AACA,uE;AACA,uE;AACA,iD;AACA,6D;AACA,mB;AACA,wD;AACA,6B;AACA,oC;;AAEA,O;AACA,iC;AACA,+B;AACA,uC;AACA,O;AACA,iB;AACA,0E;AACA,c;AACA,G;;AAEA,2B;AACA,S;AACA,iD;AACA,mB;AACA,wE;AACA,+E;AACA,K;AACA,U;AACA,0F;AACA,G;;AAEA,c;AACA,E;;AAEA,iD;AACA,kD;AACA,6C;AACA,iB;AACA,O;AACA,Q;AACA,a;AACA,kC;AACA,G;AACA,E;;AAEA,kE;AACA,iE;AACA,iE;AACA,mE;AACA,wB;AACA,E;AACA,sB;AACA,qC;AACA,0B;;AAEA,gB;AACA,W;AACA,mB;;AAEA,qD;AACA,8C;AACA,iE;AACA,+B;AACA,K;AACA,Q;;AAEA,c;AACA,E;;;;;;;;;;;;;;;;;;;AClOA,8E;AACA,sD;AACA,wB;AACA,kB;AACA,+B;AACA,uC;AACA,wB;AACA,E","file":"/packages/reload.js","sourcesContent":["/**\n * This code does _NOT_ support hot (session-restoring) reloads on\n * IE6,7. It only works on browsers with sessionStorage support.\n *\n * There are a couple approaches to add IE6,7 support:\n *\n * - use IE's \"userData\" mechanism in combination with window.name.\n * This mostly works, however the problem is that it can not get to the\n * data until after DOMReady. This is a problem for us since this API\n * relies on the data being ready before API users run. We could\n * refactor using Meteor.startup in all API users, but that might slow\n * page loads as we couldn't start the stream until after DOMReady.\n * Here are some resources on this approach:\n * https://github.com/hugeinc/USTORE.js\n * http://thudjs.tumblr.com/post/419577524/localstorage-userdata\n * http://www.javascriptkit.com/javatutors/domstorage2.shtml\n *\n * - POST the data to the server, and have the server send it back on\n * page load. This is nice because it sidesteps all the local storage\n * compatibility issues, however it is kinda tricky. We can use a unique\n * token in the URL, then get rid of it with HTML5 pushstate, but that\n * only works on pushstate browsers.\n *\n * This will all need to be reworked entirely when we add server-side\n * HTML rendering. In that case, the server will need to have access to\n * the client's session to render properly.\n */\n\n// XXX when making this API public, also expose a flag for the app\n// developer to know whether a hot code push is happening. This is\n// useful for apps using `window.onbeforeunload`. See\n// https://github.com/meteor/meteor/pull/657\n\nReload = {};\n\nvar KEY_NAME = 'Meteor_Reload';\n\nvar old_data = {};\n// read in old data at startup.\nvar old_json;\n\n// This logic for sessionStorage detection is based on browserstate/history.js\nvar safeSessionStorage = null;\ntry {\n // This throws a SecurityError on Chrome if cookies & localStorage are\n // explicitly disabled\n //\n // On Firefox with dom.storage.enabled set to false, sessionStorage is null\n //\n // We can't even do (typeof sessionStorage) on Chrome, it throws. So we rely\n // on the throw if sessionStorage == null; the alternative is browser\n // detection, but this seems better.\n safeSessionStorage = window.sessionStorage;\n\n // Check we can actually use it\n if (safeSessionStorage) {\n safeSessionStorage.setItem('__dummy__', '1');\n safeSessionStorage.removeItem('__dummy__');\n } else {\n // Be consistently null, for safety\n safeSessionStorage = null;\n }\n} catch(e) {\n // Expected on chrome with strict security, or if sessionStorage not supported\n safeSessionStorage = null;\n}\n\n// Exported for test.\nReload._getData = function () {\n return safeSessionStorage && safeSessionStorage.getItem(KEY_NAME);\n};\n\nif (safeSessionStorage) {\n old_json = Reload._getData();\n safeSessionStorage.removeItem(KEY_NAME);\n} else {\n // Unsupported browser (IE 6,7) or locked down security settings.\n // No session resumption.\n // Meteor._debug(\"XXX UNSUPPORTED BROWSER/SETTINGS\");\n}\n\nif (!old_json) old_json = '{}';\nvar old_parsed = {};\ntry {\n old_parsed = JSON.parse(old_json);\n if (typeof old_parsed !== \"object\") {\n Meteor._debug(\"Got bad data on reload. Ignoring.\");\n old_parsed = {};\n }\n} catch (err) {\n Meteor._debug(\"Got invalid JSON on reload. Ignoring.\");\n}\n\nif (old_parsed.reload && typeof old_parsed.data === \"object\") {\n // Meteor._debug(\"Restoring reload data.\");\n old_data = old_parsed.data;\n}\n\n\nvar providers = [];\n\n////////// External API //////////\n\n// Packages that support migration should register themselves by calling\n// this function. When it's time to migrate, callback will be called\n// with one argument, the \"retry function,\" and an optional 'option'\n// argument (containing a key 'immediateMigration'). If the package\n// is ready to migrate, it should return [true, data], where data is\n// its migration data, an arbitrary JSON value (or [true] if it has\n// no migration data this time). If the package needs more time\n// before it is ready to migrate, it should return false. Then, once\n// it is ready to migrating again, it should call the retry\n// function. The retry function will return immediately, but will\n// schedule the migration to be retried, meaning that every package\n// will be polled once again for its migration data. If they are all\n// ready this time, then the migration will happen. name must be set if there\n// is migration data. If 'immediateMigration' is set in the options\n// argument, then it doesn't matter whether the package is ready to\n// migrate or not; the reload will happen immediately without waiting\n// (used for OAuth redirect login).\n//\nReload._onMigrate = function (name, callback) {\n if (!callback) {\n // name not provided, so first arg is callback.\n callback = name;\n name = undefined;\n }\n providers.push({name: name, callback: callback});\n};\n\n// Called by packages when they start up.\n// Returns the object that was saved, or undefined if none saved.\n//\nReload._migrationData = function (name) {\n return old_data[name];\n};\n\n// Options are the same as for `Reload._migrate`.\nvar pollProviders = function (tryReload, options) {\n tryReload = tryReload || function () {};\n options = options || {};\n\n var migrationData = {};\n var remaining = _.clone(providers);\n var allReady = true;\n while (remaining.length) {\n var p = remaining.shift();\n var status = p.callback(tryReload, options);\n if (!status[0])\n allReady = false;\n if (status.length > 1 && p.name)\n migrationData[p.name] = status[1];\n };\n if (allReady || options.immediateMigration)\n return migrationData;\n else\n return null;\n};\n\n// Options are:\n// - immediateMigration: true if the page will be reloaded immediately\n// regardless of whether packages report that they are ready or not.\nReload._migrate = function (tryReload, options) {\n // Make sure each package is ready to go, and collect their\n // migration data\n var migrationData = pollProviders(tryReload, options);\n if (migrationData === null)\n return false; // not ready yet..\n\n try {\n // Persist the migration data\n var json = JSON.stringify({\n data: migrationData, reload: true\n });\n } catch (err) {\n Meteor._debug(\"Couldn't serialize data for migration\", migrationData);\n throw err;\n }\n\n if (safeSessionStorage) {\n try {\n safeSessionStorage.setItem(KEY_NAME, json);\n } catch (err) {\n // We should have already checked this, but just log - don't throw\n Meteor._debug(\"Couldn't save data for migration to sessionStorage\", err);\n }\n } else {\n Meteor._debug(\"Browser does not support sessionStorage. Not saving migration state.\");\n }\n\n return true;\n};\n\n// Allows tests to isolate the list of providers.\nReload._withFreshProvidersForTest = function (f) {\n var originalProviders = _.clone(providers);\n providers = [];\n try {\n f();\n } finally {\n providers = originalProviders;\n }\n};\n\n// Migrating reload: reload this page (presumably to pick up a new\n// version of the code or assets), but save the program state and\n// migrate it over. This function returns immediately. The reload\n// will happen at some point in the future once all of the packages\n// are ready to migrate.\n//\nvar reloading = false;\nReload._reload = function (options) {\n options = options || {};\n\n if (reloading)\n return;\n reloading = true;\n\n var tryReload = function () { _.defer(function () {\n if (Reload._migrate(tryReload, options)) {\n // Tell the browser to shut down this VM and make a new one\n window.location.reload();\n }\n }); };\n\n tryReload();\n};\n","// Reload functionality used to live on Meteor._reload. Be nice and try not to\n// break code that uses it, even though it's internal.\n// XXX COMPAT WITH 0.6.4\nMeteor._reload = {\n onMigrate: Reload._onMigrate,\n migrationData: Reload._migrationData,\n reload: Reload._reload\n};\n"]}