6161 </ head >
6262 < body >
6363 < div class ='header '>
64- < h1 > Typester test server</ h1 >
64+ < h1 >
65+ Typester test server
66+ < button class ='destroy-btn '> Destroy</ button >
67+ </ h1 >
6568 < div class ='inspector-tools '>
6669 < a class ='inspect-content ' data-target-inspector ='content '> Inspect Content</ a >
6770 < a class ='inspect-canvas ' data-target-inspector ='canvas '> Inspect Canvas</ a >
@@ -114,7 +117,7 @@ <h1>Typester test server</h1>
114117 < script src ="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js "> </ script >
115118 < script >
116119 const contentEditable = document . getElementById ( 'content-editable' ) ;
117- new Typester ( {
120+ const typesterInstance = new Typester ( {
118121 el : contentEditable ,
119122 configs : {
120123 // toolbar: {
@@ -130,6 +133,7 @@ <h1>Typester test server</h1>
130133 }
131134 }
132135 } ) ;
136+ console . log ( typesterInstance ) ;
133137 </ script >
134138
135139 < script >
@@ -138,6 +142,7 @@ <h1>Typester test server</h1>
138142
139143 const contentInspector = document . getElementById ( 'content-inspector' ) ;
140144 const inspectorTools = document . querySelectorAll ( '.inspector-tools a' ) ;
145+ const destroyBtn = document . querySelector ( '.destroy-btn' ) ;
141146
142147 inspectorTools . forEach ( function ( inspectorTool , index ) {
143148 if ( index === 0 ) {
@@ -230,7 +235,10 @@ <h1>Typester test server</h1>
230235 editorObserver . observe ( contentEditable , observerConfig ) ;
231236 canvasObserver . observe ( document . querySelector ( '.typester-canvas' ) , observerConfig ) ;
232237 updateInspector ( ) ;
233- // requestAnimationFrame(updateInspector);
238+
239+ destroyBtn . addEventListener ( 'click' , function ( ) {
240+ typesterInstance . destroy ( ) ;
241+ } ) ;
234242 } ) ( ) ;
235243 </ script >
236244 </ body >
0 commit comments