Gathering detailed insights and metrics for typewriter-effect
Gathering detailed insights and metrics for typewriter-effect
Gathering detailed insights and metrics for typewriter-effect
Gathering detailed insights and metrics for typewriter-effect
npm install typewriter-effect
Typescript
Module System
Node Version
NPM Version
85.2
Supply Chain
92.9
Quality
75.4
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
6,705,628
Last Day
4,262
Last Week
49,430
Last Month
283,749
Last Year
3,254,947
2,506 Stars
144 Commits
224 Forks
19 Watching
4 Branches
17 Contributors
Minified
Minified + Gzipped
Latest Version
2.21.0
Package Id
typewriter-effect@2.21.0
Unpacked Size
232.68 kB
Size
60.67 kB
File Count
8
NPM Version
9.6.7
Node Version
18.17.1
Publised On
19 Sept 2023
Cumulative downloads
Total Downloads
Last day
-67.8%
4,262
Compared to previous day
Last week
-30.3%
49,430
Compared to previous week
Last month
-2.2%
283,749
Compared to previous month
Last year
75.4%
3,254,947
Compared to previous year
2
21
NPM Repository JSFiddle Example Emoji Example
You can use the CDN version of this plugin for fast and easy setup.
1<script src="https://unpkg.com/typewriter-effect@latest/dist/core.js"></script>
You can install Typewriterjs with just one command and you're good to go
1 2# with npm 3npm i typewriter-effect 4 5# with yarn 6yarn add typewriter-effect 7
You will need to bundle the javascript before it can be used, this can be done using npm run build:dev
for development or npm run build:prod
for production.
This is the base version of the typewriter effect. It will need a the bundled version of the javascript to work correctly.
See examples in the 'examples' folder.
1import Typewriter from 'typewriter-effect/dist/core'; 2 3new Typewriter('#typewriter', { 4 strings: ['Hello', 'World'], 5 autoStart: true, 6});
Name | Type | Default value | Description |
---|---|---|---|
strings | String or Array | null | Strings to type out when using autoStart option |
cursor | String | Pipe character | String value to use as the cursor. |
delay | 'natural' or Number | 'natural' | The delay between each key when typing. |
deleteSpeed | 'natural' or Number | 'natural' | The delay between deleting each character. |
loop | Boolean | false | Whether to keep looping or not. |
autoStart | Boolean | false | Whether to autostart typing strings or not. You are required to provide strings option. |
pauseFor | Number | 1500 | The pause duration after a string is typed when using autostart mode |
devMode | Boolean | false | Whether or not to display console logs. |
skipAddStyles | Boolean | Skip adding default typewriter css styles. | |
wrapperClassName | String | 'Typewriter__wrapper' | Class name for the wrapper element. |
cursorClassName | String | 'Typewriter__cursor' | Class name for the cursor element. |
stringSplitter | Function | String splitter function, can be used to split emoji's | |
onCreateTextNode | Function | null | Callback function to replace the internal method which creates a text node for the character before adding it to the DOM. If you return null, then it will not add anything to the DOM and so it is up to you to handle it. |
onRemoveNode | Function | null | Callback function when a node is about to be removed. First param will be an object { node: HTMLNode, charater: string } |
All methods can be chained together.
Name | Params | Description |
---|---|---|
start | - | Start the typewriter effect. |
stop | - | Stop the typewriter effect. |
pauseFor | ms Time to pause for in milliseconds | Pause for milliseconds |
typeString | string String to type out, it can contain HTML tags | Type out a string using the typewriter effect. |
pasteString | string String to paste out, it can contain HTML tags | Paste out a string. |
deleteAll | speed Speed to delete all visibles nodes, can be number or 'natural' | Delete everything that is visible inside of the typewriter wrapper element. |
deleteChars | amount Number of characters | Delete and amount of characters, starting at the end of the visible string. |
callFunction | cb Callback, thisArg this Object to bind to the callback function | Call a callback function. The first parameter to the callback elements which contains all DOM nodes used in the typewriter effect. |
changeDeleteSpeed | speed Number or 'natural' | The speed at which to delete the characters, lower number is faster. |
changeDelay | delay Number or 'natural' | Change the delay when typing out each character |
1var app = document.getElementById('app');
2
3var typewriter = new Typewriter(app, {
4 loop: true,
5 delay: 75,
6});
7
8typewriter
9 .pauseFor(2500)
10 .typeString('A simple yet powerful native javascript')
11 .pauseFor(300)
12 .deleteChars(10)
13 .typeString('<strong>JS</strong> plugin for a cool typewriter effect and ')
14 .typeString('<strong>only <span style="color: #27ae60;">5kb</span> Gzipped!</strong>')
15 .pauseFor(1000)
16 .start();
1var app = document.getElementById('app');
2
3var customNodeCreator = function(character) {
4 return document.createTextNode(character);
5}
6
7var typewriter = new Typewriter(app, {
8 loop: true,
9 delay: 75,
10 onCreateTextNode: customNodeCreator,
11});
12
13typewriter
14 .typeString('A simple yet powerful native javascript')
15 .pauseFor(300)
16 .start();
1var input = document.getElementById('input') 2 3var customNodeCreator = function(character) { 4 // Add character to input placeholder 5 input.placeholder = input.placeholder + character; 6 7 // Return null to skip internal adding of dom node 8 return null; 9} 10 11var onRemoveNode = function({ character }) { 12 if(input.placeholder) { 13 // Remove last character from input placeholder 14 input.placeholder = input.placeholder.slice(0, -1) 15 } 16} 17 18var typewriter = new Typewriter(null, { 19 loop: true, 20 delay: 75, 21 onCreateTextNode: customNodeCreator, 22 onRemoveNode: onRemoveNode, 23}); 24 25typewriter 26 .typeString('A simple yet powerful native javascript') 27 .pauseFor(300) 28 .start();
This includes a React component which can be used within your project. You can pass in a onInit function which will be called with the instance of the typewriter so you can use the typewriter core API.
1import Typewriter from 'typewriter-effect'; 2 3<Typewriter 4 onInit={(typewriter) => { 5 typewriter.typeString('Hello World!') 6 .callFunction(() => { 7 console.log('String typed out!'); 8 }) 9 .pauseFor(2500) 10 .deleteAll() 11 .callFunction(() => { 12 console.log('All strings were deleted'); 13 }) 14 .start(); 15 }} 16/>
Alternatively you can also pass in options to use auto play and looping for example:
1import Typewriter from 'typewriter-effect'; 2 3<Typewriter 4 options={{ 5 strings: ['Hello', 'World'], 6 autoStart: true, 7 loop: true, 8 }} 9/>
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
6 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 4/21 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More