Comparing version 2.3.1 to 2.3.2
{ | ||
"name": "flot", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"main": "dist/es5/jquery.flot.js", | ||
@@ -22,8 +22,9 @@ "scripts": { | ||
"devDependencies": { | ||
"babel-cli": "^6.14.0", | ||
"babel-plugin-external-helpers-2": "^6.3.13", | ||
"babel-preset-es2015": "^6.14.0", | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.4.0", | ||
"@babel/plugin-external-helpers": "^7.2.0", | ||
"@babel/preset-env": "^7.2.3", | ||
"concat": "^1.0.3", | ||
"gulp": "^4.0.0", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-concat": "^2.6.1", | ||
@@ -30,0 +31,0 @@ "gulp-sourcemaps": "^2.4.0", |
@@ -28,61 +28,46 @@ /* Pretty handling of time axes. | ||
// A mix-in to provide microsecond support to Date like classes. | ||
var MicroSecondSupportMixIn = (function(){ | ||
// Method to provide microsecond support to Date like classes. | ||
var CreateMicroSecondDate = function(dateType, microEpoch) { | ||
var newDate = new dateType(microEpoch); | ||
var MixIn = function(Base) { | ||
return class extends Base { | ||
var oldSetTime = newDate.setTime.bind(newDate); | ||
newDate.update = function(microEpoch) { | ||
oldSetTime(microEpoch); | ||
constructor(microEpoch) { | ||
super(microEpoch); | ||
this.microseconds = null; | ||
this.microEpoch = null; | ||
this.update(microEpoch); | ||
} | ||
// Round epoch to 3 decimal accuracy | ||
microEpoch = Math.round(microEpoch*1000)/1000; | ||
this.microEpoch = microEpoch; | ||
update(microEpoch) { | ||
super.setTime(microEpoch); | ||
// Microseconds are stored as integers | ||
var seconds = microEpoch/1000; | ||
this.microseconds = 1000000 * (seconds - Math.floor(seconds)); | ||
}; | ||
// Round epoch to 3 decimal accuracy | ||
microEpoch = Math.round(microEpoch*1000)/1000; | ||
this.microEpoch = microEpoch; | ||
newDate.getTime = function () { | ||
return this.microEpoch; | ||
}; | ||
// Microseconds are stored as integers | ||
var seconds = microEpoch/1000; | ||
this.microseconds = 1000000 * (seconds - Math.floor(seconds)); | ||
} | ||
newDate.setTime = function (microEpoch) { | ||
this.update(microEpoch); | ||
}; | ||
getTime() { | ||
return this.microEpoch; | ||
} | ||
newDate.getMicroseconds = function() { | ||
return this.microseconds; | ||
}; | ||
setTime(microEpoch) { | ||
this.update(microEpoch); | ||
} | ||
getMicroseconds() { | ||
return this.microseconds; | ||
}; | ||
setMicroseconds(microseconds) { | ||
// Replace the microsecond part (6 last digits) in microEpoch | ||
var epochWithoutMicroseconds = 1000*Math.floor(this.microEpoch/1000); | ||
var newEpoch = epochWithoutMicroseconds + microseconds/1000; | ||
this.update(newEpoch); | ||
}; | ||
setUTCMicroseconds(microseconds) { this.setMicroseconds(microseconds); } | ||
getUTCMicroseconds() { return this.getMicroseconds(); } | ||
}; | ||
newDate.setMicroseconds = function(microseconds) { | ||
// Replace the microsecond part (6 last digits) in microEpoch | ||
var epochWithoutMicroseconds = 1000*Math.floor(this.microEpoch/1000); | ||
var newEpoch = epochWithoutMicroseconds + microseconds/1000; | ||
this.update(newEpoch); | ||
}; | ||
return MixIn; | ||
})(); | ||
newDate.setUTCMicroseconds = function(microseconds) { this.setMicroseconds(microseconds); } | ||
// Extend Date and timezoneJS.Date (if found) with microsecond support. | ||
var MicroDate = class extends MicroSecondSupportMixIn(Date) {}; | ||
var MicroTimezoneJS; | ||
newDate.getUTCMicroseconds = function() { return this.getMicroseconds(); } | ||
if (typeof timezoneJS !== "undefined" && typeof timezoneJS.Date !== "undefined") { | ||
MicroTimezoneJS = class extends MicroSecondSupportMixIn(timezoneJS.Date) {} | ||
newDate.microseconds = null; | ||
newDate.microEpoch = null; | ||
newDate.update(microEpoch); | ||
return newDate; | ||
} | ||
@@ -233,7 +218,7 @@ | ||
if (opts.timezone === "browser") { | ||
return new MicroDate(ts); | ||
return CreateMicroSecondDate(Date, ts); | ||
} else if (!opts.timezone || opts.timezone === "utc") { | ||
return makeUtcWrapper(new MicroDate(ts)); | ||
return makeUtcWrapper(CreateMicroSecondDate(Date, ts)); | ||
} else if (typeof timezoneJS !== "undefined" && typeof timezoneJS.Date !== "undefined") { | ||
var d = new MicroTimezoneJS(ts); | ||
var d = CreateMicroSecondDate(timezoneJS.Date, ts); | ||
// timezone-js is fickle, so be sure to set the time zone before | ||
@@ -245,3 +230,3 @@ // setting the time. | ||
} else { | ||
return makeUtcWrapper(new MicroDate(ts)); | ||
return makeUtcWrapper(CreateMicroSecondDate(Date, ts)); | ||
} | ||
@@ -248,0 +233,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
971921
26
19362