@@ -191,25 +191,25 @@ class TypeWriter {
191191 constructor ( textElement , words , wait = 3000 ) {
192192 this . textElement = textElement ;
193193 this . words = words ;
194- this . text = '' ;
194+ this . text = "" ;
195195 this . wordIndex = 0 ;
196196 this . wait = parseInt ( wait , 10 ) ;
197197 this . isDeleting = false ;
198198 this . type ( ) ;
199199 }
200200
201201 // Type method
202- type ( ) {
202+ type ( ) {
203203 // current index of word
204204 const current = this . wordIndex % this . words . length ;
205205 // Get full text of current word
206206 const fullText = this . words [ current ] ;
207-
207+
208208 // Check if deleting
209- if ( this . isDeleting ) {
209+ if ( this . isDeleting ) {
210210 // Remove char
211211 this . text = fullText . substring ( 0 , this . text . length - 1 ) ;
212- } else {
212+ } else {
213213 // Add char
214214 this . text = fullText . substring ( 0 , this . text . length + 1 ) ;
215215 }
@@ -220,17 +220,17 @@ class TypeWriter {
220220 // Initial type Speed
221221 let typeSpeed = 250 ;
222222
223- if ( this . isDeleting ) {
223+ if ( this . isDeleting ) {
224224 typeSpeed /= 2 ;
225225 }
226226
227227 // If word is complete
228- if ( ! this . isDeleting && this . text === fullText ) {
228+ if ( ! this . isDeleting && this . text === fullText ) {
229229 // Make pause at end
230230 typeSpeed = this . wait ;
231231 // Set delete to true
232232 this . isDeleting = true ;
233- } else if ( this . isDeleting && this . text === '' ) {
233+ } else if ( this . isDeleting && this . text === "" ) {
234234 this . isDeleting = false ;
235235 //
236236 this . wordIndex ++ ;
@@ -241,11 +241,11 @@ class TypeWriter {
241241 }
242242}
243243
244- function init ( ) {
245- const textElement = document . querySelector ( ' .txt-type' ) ;
246- const words = JSON . parse ( textElement . getAttribute ( ' data-words' ) ) ;
247- const wait = textElement . getAttribute ( ' data-wait' ) ;
244+ function init ( ) {
245+ const textElement = document . querySelector ( " .txt-type" ) ;
246+ const words = JSON . parse ( textElement . getAttribute ( " data-words" ) ) ;
247+ const wait = textElement . getAttribute ( " data-wait" ) ;
248248 // init TypeWriter
249249
250250 new TypeWriter ( textElement , words , wait ) ;
251- }
251+ }
0 commit comments