optional warnings displaying

This commit is contained in:
Лаврёнов Антон 2014-05-20 17:57:39 +08:00
parent 7e3803bdd1
commit f573b3a76b
5 changed files with 24 additions and 5 deletions

View File

@ -82,6 +82,15 @@ var Kinetic = {};
* node.rotation(Math.PI / 2); // PI/2 radian * node.rotation(Math.PI / 2); // PI/2 radian
*/ */
angleDeg: true, angleDeg: true,
/**
* Show different warnings about errors or wrong API usage
* @property
* @default true
* @memberof Kinetic
* @example
* Kinetic.showWarnings = false;
*/
showWarnings : true,
@ -1244,7 +1253,7 @@ var Kinetic = {};
* IE9 on Windows7 64bit will throw a JS error * IE9 on Windows7 64bit will throw a JS error
* if we don't use window.console in the conditional * if we don't use window.console in the conditional
*/ */
if(Kinetic.root.console && console.warn) { if(Kinetic.root.console && console.warn && Kinetic.showWarnings) {
console.warn(KINETIC_WARNING + str); console.warn(KINETIC_WARNING + str);
} }
}, },

6
kinetic.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -82,6 +82,15 @@ var Kinetic = {};
* node.rotation(Math.PI / 2); // PI/2 radian * node.rotation(Math.PI / 2); // PI/2 radian
*/ */
angleDeg: true, angleDeg: true,
/**
* Show different warnings about errors or wrong API usage
* @property
* @default true
* @memberof Kinetic
* @example
* Kinetic.showWarnings = false;
*/
showWarnings : true,

View File

@ -624,7 +624,7 @@
* IE9 on Windows7 64bit will throw a JS error * IE9 on Windows7 64bit will throw a JS error
* if we don't use window.console in the conditional * if we don't use window.console in the conditional
*/ */
if(Kinetic.root.console && console.warn) { if(Kinetic.root.console && console.warn && Kinetic.showWarnings) {
console.warn(KINETIC_WARNING + str); console.warn(KINETIC_WARNING + str);
} }
}, },

View File

@ -58,6 +58,7 @@ function init() {
Kinetic.enableTrace = true; Kinetic.enableTrace = true;
Kinetic.showWarnings = false;
function addStats() { function addStats() {
stats = new Stats(); stats = new Stats();