Skip to content

Commit 60ee1bf

Browse files
committed
Incremental update to development branch with compiled Scripting
1 parent 61cd803 commit 60ee1bf

18 files changed

+5307
-111
lines changed

build/CommentCoreLibrary.js

+24-1
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ var CommentManager = (function() {
764764

765765
function CommentManager(stageObject){
766766
var __timer = 0;
767+
this._listeners = {};
767768
this.stage = stageObject;
768769
this.options = {
769770
opacity:1,
@@ -833,17 +834,20 @@ var CommentManager = (function() {
833834
return 0;
834835
}
835836
});
837+
this.dispatchEvent("load");
836838
};
837839

838840
CommentManager.prototype.clear = function(){
839841
while(this.runline.length > 0){
840842
this.runline[0].finish();
841843
}
844+
this.dispatchEvent("clear");
842845
};
843846

844847
CommentManager.prototype.setBounds = function(){
845848
this.width = this.stage.offsetWidth;
846849
this.height= this.stage.offsetHeight;
850+
this.dispatchEvent("resize");
847851
for(var comAlloc in this.csa){
848852
this.csa[comAlloc].setBounds(this.width,this.height);
849853
}
@@ -924,10 +928,12 @@ var CommentManager = (function() {
924928
}break;
925929
}
926930
cmt.y = cmt.y;
931+
this.dispatchEvent("enterComment", cmt);
927932
this.runline.push(cmt);
928933
};
929934

930935
CommentManager.prototype.finish = function(cmt){
936+
this.dispatchEvent("exitComment", cmt);
931937
this.stage.removeChild(cmt.dom);
932938
var index = this.runline.indexOf(cmt);
933939
if(index >= 0){
@@ -943,7 +949,24 @@ var CommentManager = (function() {
943949
case 7:break;
944950
}
945951
};
946-
952+
CommentManager.prototype.addEventListener = function(event, listener){
953+
if(typeof this._listeners[event] !== "undefined"){
954+
this._listeners[event].push(listener);
955+
}else{
956+
this._listeners[event] = [listener];
957+
}
958+
};
959+
CommentManager.prototype.dispatchEvent = function(event, data){
960+
if(typeof this._listeners[event] !== "undefined"){
961+
for(var i = 0; i < this._listeners[event].length; i++){
962+
try{
963+
this._listeners[event][i](data);
964+
}catch(e){
965+
console.err(e.stack);
966+
}
967+
}
968+
}
969+
};
947970
/** Static Functions **/
948971
CommentManager.prototype.onTimerEvent = function(timePassed,cmObj){
949972
for(var i= 0;i < cmObj.runline.length; i++){

build/CommentCoreLibrary.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)