@@ -6,7 +6,6 @@ const OP_CODE_WRITING = 'WRITING';
6
6
7
7
export async function type (
8
8
node : HTMLElementTagNameMap [ Wrapper ] ,
9
- splitter : StringSplitter ,
10
9
speed : number ,
11
10
deletionSpeed : number ,
12
11
omitDeletionAnimation : boolean ,
@@ -15,14 +14,14 @@ export async function type(
15
14
for ( const arg of args ) {
16
15
switch ( typeof arg ) {
17
16
case 'string' :
18
- await edit ( node , splitter , arg , speed , deletionSpeed , omitDeletionAnimation ) ;
17
+ await edit ( node , arg , speed , deletionSpeed , omitDeletionAnimation ) ;
19
18
break ;
20
19
case 'number' :
21
20
await wait ( arg ) ;
22
21
break ;
23
22
case 'function' :
24
23
// when typeloop is passed from the TypeAnimation component, this causes an infinite, recursive call-loop here
25
- await arg ( node , splitter , speed , deletionSpeed , omitDeletionAnimation , ...args ) ;
24
+ await arg ( node , speed , deletionSpeed , omitDeletionAnimation , ...args ) ;
26
25
break ;
27
26
default :
28
27
await arg ;
@@ -32,7 +31,6 @@ export async function type(
32
31
33
32
async function edit (
34
33
node : HTMLElementTagNameMap [ Wrapper ] ,
35
- splitter : StringSplitter ,
36
34
text : string ,
37
35
speed : number ,
38
36
deletionSpeed : number ,
@@ -43,7 +41,7 @@ async function edit(
43
41
const overlap = getOverlap ( nodeContent , text ) ;
44
42
await perform (
45
43
node ,
46
- [ ...deleter ( nodeContent , splitter , overlap ) , ...writer ( text , splitter , overlap ) ] ,
44
+ [ ...deleter ( nodeContent , overlap ) , ...writer ( text , overlap ) ] ,
47
45
speed ,
48
46
deletionSpeed ,
49
47
omitDeletionAnimation
@@ -101,7 +99,7 @@ function* editor(edits: ReadonlyArray<string>) {
101
99
}
102
100
103
101
function * writer ( text : string , splitter : StringSplitter , startIndex = 0 ) {
104
- const splitText = splitter ( text ) ;
102
+ const splitText = [ ... text ] ;
105
103
const endIndex = splitText . length ;
106
104
107
105
while ( startIndex < endIndex ) {
@@ -110,7 +108,7 @@ function* writer(text: string, splitter: StringSplitter, startIndex = 0) {
110
108
}
111
109
112
110
function * deleter ( text : string , splitter : StringSplitter , startIndex = 0 ) {
113
- const splitText = splitter ( text ) ;
111
+ const splitText = [ ... text ] ;
114
112
let endIndex = splitText . length ;
115
113
116
114
while ( endIndex > startIndex ) {
0 commit comments