Commit 96885dd 1 parent 902cef1 commit 96885dd Copy full SHA for 96885dd
File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,9 @@ var Runtime = function (world) {
85
85
self . disableStackEvents = false ;
86
86
87
87
self . load ( [ [ 'HALT' ] ] ) ;
88
+ self . events = new EventTarget ( ) ;
88
89
} ;
89
90
90
- Runtime . prototype = new EventTarget ( ) ;
91
-
92
91
Runtime . HALT = 0 ;
93
92
Runtime . LINE = 1 ;
94
93
Runtime . LEFT = 2 ;
@@ -118,6 +117,22 @@ Runtime.CALL = 25;
118
117
Runtime . RET = 26 ;
119
118
Runtime . PARAM = 27 ;
120
119
120
+ Runtime . prototype . addEventListener = function ( type , listener ) {
121
+ this . events . addEventListener ( type , listener ) ;
122
+ } ;
123
+
124
+ Runtime . prototype . removeEventListener = function ( type , listener ) {
125
+ this . events . removeEventListener ( type , listener ) ;
126
+ } ;
127
+
128
+ Runtime . prototype . dispatchEvent = function ( evt ) {
129
+ this . events . dispatchEvent ( evt ) ;
130
+ } ;
131
+
132
+ Runtime . prototype . fireEvent = function ( type , properties ) {
133
+ this . events . fireEvent ( type , properties ) ;
134
+ } ;
135
+
121
136
Runtime . prototype . load = function ( opcodes ) {
122
137
var self = this ;
123
138
var opcode_mapping = [
You can’t perform that action at this time.
0 commit comments