react-dnd-html5-backend
Version:
HTML5 backend for React DnD
66 lines (50 loc) • 2.35 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.OptionsReader = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var OptionsReader = /*#__PURE__*/function () {
function OptionsReader(globalContext, options) {
_classCallCheck(this, OptionsReader);
_defineProperty(this, "ownerDocument", null);
_defineProperty(this, "globalContext", void 0);
_defineProperty(this, "optionsArgs", void 0);
this.globalContext = globalContext;
this.optionsArgs = options;
}
_createClass(OptionsReader, [{
key: "window",
get: function get() {
if (this.globalContext) {
return this.globalContext;
} else if (typeof window !== 'undefined') {
return window;
}
return undefined;
}
}, {
key: "document",
get: function get() {
var _this$globalContext;
if ((_this$globalContext = this.globalContext) !== null && _this$globalContext !== void 0 && _this$globalContext.document) {
return this.globalContext.document;
} else if (this.window) {
return this.window.document;
} else {
return undefined;
}
}
}, {
key: "rootElement",
get: function get() {
var _this$optionsArgs;
return ((_this$optionsArgs = this.optionsArgs) === null || _this$optionsArgs === void 0 ? void 0 : _this$optionsArgs.rootElement) || this.window;
}
}]);
return OptionsReader;
}();
exports.OptionsReader = OptionsReader;
;