commit d4bd0ee81170c02c0adca39e28726330c50b47c5
parent aca15c0d2d61d6109dddcdd5935d70db3fb32b75
Author: Aurimas Vinckevicius <aurimas.dev@gmail.com>
Date: Fri, 14 Nov 2014 02:06:22 -0600
Move defineProperty from ZU.Internal to Zotero
Diffstat:
4 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js
@@ -55,17 +55,17 @@ Zotero.DataObject = function () {
Zotero.DataObject.prototype._objectType = 'dataObject';
Zotero.DataObject.prototype._dataTypes = [];
-Zotero.Utilities.Internal.defineProperty(Zotero.DataObject.prototype, 'objectType', {
+Zotero.defineProperty(Zotero.DataObject.prototype, 'objectType', {
get: function() this._objectType
});
-Zotero.Utilities.Internal.defineProperty(Zotero.DataObject.prototype, 'libraryKey', {
+Zotero.defineProperty(Zotero.DataObject.prototype, 'libraryKey', {
get: function() this._libraryID + "/" + this._key
});
-Zotero.Utilities.Internal.defineProperty(Zotero.DataObject.prototype, 'parentKey', {
+Zotero.defineProperty(Zotero.DataObject.prototype, 'parentKey', {
get: function() this._parentKey,
set: function(v) this._setParentKey(v)
});
-Zotero.Utilities.Internal.defineProperty(Zotero.DataObject.prototype, 'parentID', {
+Zotero.defineProperty(Zotero.DataObject.prototype, 'parentID', {
get: function() this._getParentID(),
set: function(v) this._setParentID(v)
});
diff --git a/chrome/content/zotero/xpcom/data/libraries.js b/chrome/content/zotero/xpcom/data/libraries.js
@@ -28,7 +28,7 @@ Zotero.Libraries = new function () {
_userLibraryID,
_libraryDataLoaded = false;
- Zotero.Utilities.Internal.defineProperty(this, 'userLibraryID', {
+ Zotero.defineProperty(this, 'userLibraryID', {
get: function() {
if (!_libraryDataLoaded) {
throw new Error("Library data not yet loaded");
diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js
@@ -493,24 +493,6 @@ Zotero.Utilities.Internal = {
}, 0, 0, null);
return pipe.inputStream;
- },
-
- /**
- * Defines property on the object
- * More compact way to do Object.defineProperty
- *
- * @param {Object} obj Target object
- * @param {String} prop Property to be defined
- * @param {Object} desc Propery descriptor. If not overriden, "enumerable" is true
- */
- "defineProperty": function(obj, prop, desc) {
- if (typeof prop != 'string') throw new Error("Property must be a string");
- var d = { __proto__: null, enumerable: true }; // Enumerable by default
- for (let p in desc) {
- if (!desc.hasOwnProperty(p)) continue;
- d[p] = desc[p];
- }
- Object.defineProperty(obj, prop, d);
}
}
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1400,6 +1400,24 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
}
+ /**
+ * Defines property on the object
+ * More compact way to do Object.defineProperty
+ *
+ * @param {Object} obj Target object
+ * @param {String} prop Property to be defined
+ * @param {Object} desc Propery descriptor. If not overriden, "enumerable" is true
+ */
+ this.defineProperty = function(obj, prop, desc) {
+ if (typeof prop != 'string') throw new Error("Property must be a string");
+ var d = { __proto__: null, enumerable: true }; // Enumerable by default
+ for (let p in desc) {
+ if (!desc.hasOwnProperty(p)) continue;
+ d[p] = desc[p];
+ }
+ Object.defineProperty(obj, prop, d);
+ }
+
/*
* This function should be removed
*