Browse Source

无JIRA fix: 吸取经验,防止别人乱改塞undefined之类的,加个判断

research/test
dailer 1 year ago
parent
commit
40f90200c9
  1. 19
      packages/fineui/src/core/constant/writable.var.js

19
packages/fineui/src/core/constant/writable.var.js

@ -14,7 +14,7 @@ export const setEventResponseTime = v => {
PropertyDescriptors["EVENT_RESPONSE_TIME"] = { PropertyDescriptors["EVENT_RESPONSE_TIME"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return EVENT_RESPONSE_TIME; return EVENT_RESPONSE_TIME;
}, },
set: setEventResponseTime, set: setEventResponseTime,
@ -27,7 +27,7 @@ export const setPixUnit = v => {
PropertyDescriptors["pixUnit"] = { PropertyDescriptors["pixUnit"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return pixUnit; return pixUnit;
}, },
set: setPixUnit, set: setPixUnit,
@ -40,7 +40,7 @@ export const setPixRatio = v => {
PropertyDescriptors["pixRatio"] = { PropertyDescriptors["pixRatio"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return pixRatio; return pixRatio;
}, },
set: setPixRatio, set: setPixRatio,
@ -48,12 +48,15 @@ PropertyDescriptors["pixRatio"] = {
export let StartOfWeek = 1; export let StartOfWeek = 1;
export const setStartOfWeek = v => { export const setStartOfWeek = v => {
if (![0, 1].includes(v)) {
throw new Error("setStartOfWeek must be 0 or 1");
}
StartOfWeek = v; StartOfWeek = v;
}; };
PropertyDescriptors["StartOfWeek"] = { PropertyDescriptors["StartOfWeek"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return StartOfWeek; return StartOfWeek;
}, },
set: setStartOfWeek, set: setStartOfWeek,
@ -66,7 +69,7 @@ export const setBlankSplitChar = v => {
PropertyDescriptors["BlankSplitChar"] = { PropertyDescriptors["BlankSplitChar"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return BlankSplitChar; return BlankSplitChar;
}, },
set: setBlankSplitChar, set: setBlankSplitChar,
@ -93,7 +96,7 @@ export const setPixFormat = v => {
PropertyDescriptors["pixFormat"] = { PropertyDescriptors["pixFormat"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return pixFormat; return pixFormat;
}, },
set: setPixFormat, set: setPixFormat,
@ -118,7 +121,7 @@ export let setToPix = v => {
PropertyDescriptors["toPix"] = { PropertyDescriptors["toPix"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return toPix; return toPix;
}, },
set: setToPix, set: setToPix,
@ -135,7 +138,7 @@ export const setEventBlur = v => {
PropertyDescriptors["EVENT_BLUR"] = { PropertyDescriptors["EVENT_BLUR"] = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: function () { get: function() {
return EVENT_BLUR; return EVENT_BLUR;
}, },
set: setEventBlur, set: setEventBlur,

Loading…
Cancel
Save