react-countdown-clock
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,187 +0,2 @@ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("react")); | ||
else if(typeof define === 'function' && define.amd) | ||
define(["react"], factory); | ||
else if(typeof exports === 'object') | ||
exports["ReactCountdownClock"] = factory(require("react")); | ||
else | ||
root["ReactCountdownClock"] = factory(root["React"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = "/build/"; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var React; | ||
React = __webpack_require__(1); | ||
module.exports = React.createClass({ | ||
_seconds: 0, | ||
_radius: null, | ||
_fraction: null, | ||
_content: null, | ||
_canvas: null, | ||
propTypes: { | ||
seconds: React.PropTypes.number, | ||
size: React.PropTypes.number, | ||
color: React.PropTypes.string, | ||
alpha: React.PropTypes.number, | ||
onComplete: React.PropTypes.func | ||
}, | ||
getDefaultProps: function() { | ||
return { | ||
size: 300, | ||
color: '#000', | ||
alpha: 1 | ||
}; | ||
}, | ||
componentWillReceiveProps: function(props) { | ||
this._seconds = props.seconds; | ||
return this._setupTimer(); | ||
}, | ||
componentDidMount: function() { | ||
this._seconds = this.props.seconds; | ||
return this._setupTimer(); | ||
}, | ||
_setupTimer: function() { | ||
this._setScale(); | ||
this._setupCanvas(); | ||
this._drawTimer(); | ||
return this._startTimer(); | ||
}, | ||
_updateCanvas: function() { | ||
this._clearTimer(); | ||
return this._drawTimer(); | ||
}, | ||
_setScale: function() { | ||
this._radius = this.props.size / 2; | ||
this._fraction = 2 / this._seconds; | ||
return this._tickPeriod = this._seconds * 1.8; | ||
}, | ||
_setupCanvas: function() { | ||
this._canvas = this.getDOMNode(); | ||
this._context = this._canvas.getContext('2d'); | ||
this._context.textAlign = 'center'; | ||
this._context.textBaseline = 'middle'; | ||
return this._context.font = "bold " + (this._radius / 2) + "px Arial"; | ||
}, | ||
_startTimer: function() { | ||
return setTimeout(((function(_this) { | ||
return function() { | ||
return _this._tick(); | ||
}; | ||
})(this)), 200); | ||
}, | ||
_tick: function() { | ||
var start; | ||
start = Date.now(); | ||
return setTimeout(((function(_this) { | ||
return function() { | ||
var duration; | ||
duration = (Date.now() - start) / 1000; | ||
_this._seconds -= duration; | ||
if (_this._seconds <= 0) { | ||
_this._seconds = 0; | ||
_this._handleComplete(); | ||
return _this._clearTimer(); | ||
} else { | ||
_this._updateCanvas(); | ||
return _this._tick(); | ||
} | ||
}; | ||
})(this)), this._tickPeriod); | ||
}, | ||
_handleComplete: function() { | ||
if (this.props.onComplete) { | ||
return this.props.onComplete(); | ||
} | ||
}, | ||
_clearTimer: function() { | ||
this._context.clearRect(0, 0, this._canvas.width, this._canvas.height); | ||
return this._drawBackground(); | ||
}, | ||
_drawBackground: function() { | ||
this._context.beginPath(); | ||
this._context.globalAlpha = this.props.alpha / 3; | ||
this._context.arc(this._radius, this._radius, this._radius, 0, Math.PI * 2, false); | ||
this._context.arc(this._radius, this._radius, this._radius / 1.8, Math.PI * 2, 0, true); | ||
return this._context.fill(); | ||
}, | ||
_drawTimer: function() { | ||
var decimals, percent, ref; | ||
percent = this._fraction * this._seconds + 1.5; | ||
decimals = (ref = this._seconds <= 9.9) != null ? ref : { | ||
1: 0 | ||
}; | ||
this._context.globalAlpha = this.props.alpha; | ||
this._context.fillStyle = this.props.color; | ||
this._context.fillText(this._seconds.toFixed(decimals), this._radius, this._radius); | ||
this._context.beginPath(); | ||
this._context.arc(this._radius, this._radius, this._radius, Math.PI * 1.5, Math.PI * percent, false); | ||
this._context.arc(this._radius, this._radius, this._radius / 1.8, Math.PI * percent, Math.PI * 1.5, true); | ||
return this._context.fill(); | ||
}, | ||
render: function() { | ||
return React.createElement("canvas", { | ||
"className": "react-countdown-clock", | ||
"width": this.props.size, | ||
"height": this.props.size | ||
}); | ||
} | ||
}); | ||
/***/ }, | ||
/* 1 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_1__; | ||
/***/ } | ||
/******/ ]) | ||
}); | ||
; | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactCountdownClock=e(require("react")):t.ReactCountdownClock=e(t.React)}(this,function(t){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var s={};return e.m=t,e.c=s,e.p="/build/",e(0)}([function(t,e,s){var i;i=s(1),t.exports=i.createClass({_seconds:0,_radius:null,_fraction:null,_content:null,_canvas:null,_timeoutIds:[],displayName:"ReactCountdownClock",propTypes:{seconds:i.PropTypes.number,size:i.PropTypes.number,color:i.PropTypes.string,alpha:i.PropTypes.number,onComplete:i.PropTypes.func},getDefaultProps:function(){return{size:300,color:"#000",alpha:1}},componentWillReceiveProps:function(t){return this._seconds=t.seconds,this._setupTimer()},componentDidMount:function(){return this._seconds=this.props.seconds,this._setupTimer()},componentWillUnmount:function(){return this._cancelTimer()},_setupTimer:function(){return this._setScale(),this._setupCanvas(),this._drawTimer(),this._startTimer()},_updateCanvas:function(){return this._clearTimer(),this._drawTimer()},_setScale:function(){return this._radius=this.props.size/2,this._fraction=2/this._seconds,this._tickPeriod=1.8*this._seconds},_setupCanvas:function(){return this._canvas=ReactDOM.findDOMNode(this),this._context=this._canvas.getContext("2d"),this._context.textAlign="center",this._context.textBaseline="middle",this._context.font="bold "+this._radius/2+"px Arial"},_startTimer:function(){return this._timeoutIds.push(setTimeout(function(t){return function(){return t._tick()}}(this),200))},_cancelTimer:function(){var t,e,s,i,n;for(s=this._timeoutIds,i=[],t=0,e=s.length;e>t;t++)n=s[t],i.push(clearTimeout(n));return i},_tick:function(){var t;return t=Date.now(),this._timeoutIds.push(setTimeout(function(e){return function(){var s;return s=(Date.now()-t)/1e3,e._seconds-=s,e._seconds<=0?(e._seconds=0,e._handleComplete(),e._clearTimer()):(e._updateCanvas(),e._tick())}}(this),this._tickPeriod))},_handleComplete:function(){return this.props.onComplete?this.props.onComplete():void 0},_clearTimer:function(){return this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._drawBackground()},_drawBackground:function(){return this._context.beginPath(),this._context.globalAlpha=this.props.alpha/3,this._context.arc(this._radius,this._radius,this._radius,0,2*Math.PI,!1),this._context.arc(this._radius,this._radius,this._radius/1.8,2*Math.PI,0,!0),this._context.fill()},_drawTimer:function(){var t,e,s;return e=this._fraction*this._seconds+1.5,t=null!=(s=this._seconds<=9.9)?s:{1:0},this._context.globalAlpha=this.props.alpha,this._context.fillStyle=this.props.color,this._context.fillText(this._seconds.toFixed(t),this._radius,this._radius),this._context.beginPath(),this._context.arc(this._radius,this._radius,this._radius,1.5*Math.PI,Math.PI*e,!1),this._context.arc(this._radius,this._radius,this._radius/1.8,Math.PI*e,1.5*Math.PI,!0),this._context.fill()},render:function(){return i.createElement("canvas",{className:"react-countdown-clock",width:this.props.size,height:this.props.size})}})},function(e,s){e.exports=t}])}); | ||
//# sourceMappingURL=react-countdown-clock.js.map |
{ | ||
"name": "react-countdown-clock", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "HTML5 canvas countdown clock React component", | ||
@@ -24,3 +24,3 @@ "main": "build/react-countdown-clock.js", | ||
"devDependencies": { | ||
"cjsx-loader": "^1.1.0", | ||
"cjsx-loader": "^2.1.0", | ||
"coffee-loader": "^0.7.2", | ||
@@ -31,4 +31,4 @@ "coffee-script": "^1.8.0", | ||
"dependencies": { | ||
"react": "^0.13.3" | ||
"react": "^0.14.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
106746
10
1745
1
+ Addedasap@2.0.6(transitive)
+ Addedcore-js@1.2.7(transitive)
+ Addedfbjs@0.6.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedreact@0.14.10(transitive)
+ Addedua-parser-js@0.7.39(transitive)
+ Addedwhatwg-fetch@0.9.0(transitive)
- Removedreact@0.13.3(transitive)
Updatedreact@^0.14.3