Created
May 23, 2012 23:01
-
-
Save oppara/2778384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function assert(condition, opt_message) { | |
if (!condition) { | |
if (window.console) { | |
// メッセージの表示 | |
console.log('Assertion Failure'); | |
if (opt_message) console.log('Message: ' + opt_message); | |
// スタックトレースの表示 | |
if (console.trace) console.trace(); | |
if (Error().stack) console.log(Error().stack); | |
} | |
// デバッガーを起動し、ブレークする | |
debugger; | |
} | |
} | |
var DEBUG = true; // 開発時は true 、リリース時は false にする | |
Component.prototype.handleMouseOver = function(evt) { | |
// 開発時だけアサーションする | |
DEBUG && assert(this.element_.className === 'out'); | |
this.element_.className = 'over'; | |
} | |
Component.prototype.enterDragOver = function() { | |
// 状態名の確認 | |
DEBUG && assert(this.status_ === 'dragging'); | |
// 状態名を設定 | |
this.status_ = 'dragover'; | |
// 状態 dragover が満たすべき様々な条件を設定 | |
this.element_.style.background = 'red'; | |
this.element_.style.border= 'blue 1px solid'; | |
this.element_.style.boxSizing = 'border-box'; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment