Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: third_party/polymer/components-chromium/core-localstorage/core-localstorage-extracted.js

Issue 1215543002: Remove Polymer 0.5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/components-chromium/core-localstorage/core-localstorage-extracted.js
diff --git a/third_party/polymer/components-chromium/core-localstorage/core-localstorage-extracted.js b/third_party/polymer/components-chromium/core-localstorage/core-localstorage-extracted.js
deleted file mode 100644
index af82985f1db5670986d1f0c1c9ca9cf00afd712d..0000000000000000000000000000000000000000
--- a/third_party/polymer/components-chromium/core-localstorage/core-localstorage-extracted.js
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
- Polymer('core-localstorage', {
-
- /**
- * Fired when a value is loaded from localStorage.
- * @event core-localstorage-load
- */
-
- /**
- * The key to the data stored in localStorage.
- *
- * @attribute name
- * @type string
- * @default null
- */
- name: '',
-
- /**
- * The data associated with the specified name.
- *
- * @attribute value
- * @type object
- * @default null
- */
- value: null,
-
- /**
- * If true, the value is stored and retrieved without JSON processing.
- *
- * @attribute useRaw
- * @type boolean
- * @default false
- */
- useRaw: false,
-
- /**
- * If true, auto save is disabled.
- *
- * @attribute autoSaveDisabled
- * @type boolean
- * @default false
- */
- autoSaveDisabled: false,
-
- valueChanged: function() {
- if (this.loaded && !this.autoSaveDisabled) {
- this.save();
- }
- },
-
- nameChanged: function() {
- this.load();
- },
-
- load: function() {
- var v = localStorage.getItem(this.name);
- if (this.useRaw) {
- this.value = v;
- } else {
- // localStorage has a flaw that makes it difficult to determine
- // if a key actually exists or not (getItem returns null if the
- // key doesn't exist, which is not distinguishable from a stored
- // null value)
- // however, if not `useRaw`, an (unparsed) null value unambiguously
- // signals that there is no value in storage (a stored null value would
- // be escaped, i.e. "null")
- // in this case we save any non-null current (default) value
- if (v === null) {
- if (this.value != null) {
- this.save();
- }
- } else {
- try {
- v = JSON.parse(v);
- } catch(x) {
- }
- this.value = v;
- }
- }
- this.loaded = true;
- this.asyncFire('core-localstorage-load');
- },
-
- /**
- * Saves the value to localStorage.
- *
- * @method save
- */
- save: function() {
- var v = this.useRaw ? this.value : JSON.stringify(this.value);
- localStorage.setItem(this.name, v);
- }
-
- });
-

Powered by Google App Engine
This is Rietveld 408576698