Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typewriting

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typewriting - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

2

dist/typewriting.min.js

@@ -7,2 +7,2 @@ "use strict";function _classCallCheck(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(n,e,i){return e&&t(n.prototype,e),i&&t(n,i),n}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};/*!

*/
!function(t,n){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.TypeWriting=n()}(void 0,function(){var t=1,n=!1,e={UNREADY:"UNREADY",READY:"READY",TYPEING:"TYPEING"},i={targetElement:null,inputString:"",typingInterval:150,blinkInterval:"0.7s",cursorColor:"black",pluginCallback:function(){},task:e.UNREADY},r=function r(){if(t<=i.inputString.length){var a=o(t);t+=1,"<"===a.slice(-1)?n=!0:">"===a.slice(-1)&&(n=!1),i.targetElement.innerHTML=a,n?r():setTimeout(function(){r()},i.typingInterval)}else i.task=e.READY,t=1,i.pluginCallback.call()},o=function(t){return i.inputString.slice(0,t)},a=function(){i.pluginCallback=function(){}},l=function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t},c=function(){function t(n,o){if(_classCallCheck(this,t),!n||"object"!==("undefined"==typeof n?"undefined":_typeof(n)))throw new Error("`options` is invalid");if(!n.inputString)throw new Error("Missing argument: inputString");if("string"!=typeof n.inputString)throw new Error("`inputString` is not a string");i=l(i,n),o?"function"==typeof o?i.pluginCallback=o:(console.error(o+" is not a function"),a()):a();var c=document.createElement("div");c.style.display="inline-block",c.innerHTML="I",i.targetElement.appendChild(c);var u=c.offsetHeight,f=c.offsetWidth;i.targetElement.removeChild(c);var s="@-webkit-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@-moz-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}.typingCursor::after{content:'';width:"+f+"px;height:"+u+"px;margin-left:5px;display:inline-block;vertical-align:bottom;background-color:"+i.cursorColor+";-webkit-animation:blink "+i.blinkInterval+" infinite;-moz-animation:blink "+i.blinkInterval+" infinite;animation:blink "+i.blinkInterval+" infinite}",p=document.createElement("style");p.type="text/css",p.styleSheet?p.styleSheet.cssText=s:p.appendChild(document.createTextNode(s)),document.head.appendChild(p),i.targetElement.className+=" typingCursor",i.task=e.TYPING,r()}return _createClass(t,[{key:"rewrite",value:function(t,n){var o=this;if(i.task===e.TYPING)return console.warn("Last task is not finished yet"),void setTimeout(function(){o.rewrite(t,n)},i.typingInterval);if(!t)throw new Error("Missing argument: inputString");if("string"!=typeof t)throw new Error("`inputString` is not a string");i.inputString=t,n?"function"==typeof n?i.pluginCallback=n:(console.error(n+" is not a function"),a()):a(),i.task=e.TYPING,r()}}]),t}();return c});
!function(t,n){"function"==typeof define&&define.amd?define(n):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?module.exports=n(require,exports,module):t?t.TypeWriting=n():window.TypeWriting=n()}(void 0,function(t,n,e){var i=1,r=!1,o={UNREADY:"UNREADY",READY:"READY",TYPEING:"TYPEING"},a={targetElement:null,inputString:"",typingInterval:150,blinkInterval:"0.7s",cursorColor:"black",pluginCallback:function(){},task:o.UNREADY},l=function t(){if(i<=a.inputString.length){var n=c(i);i+=1,"<"===n.slice(-1)?r=!0:">"===n.slice(-1)&&(r=!1),a.targetElement.innerHTML=n,r?t():setTimeout(function(){t()},a.typingInterval)}else a.task=o.READY,i=1,a.pluginCallback.call()},c=function(t){return a.inputString.slice(0,t)},u=function(){a.pluginCallback=function(){}},s=function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t},f=function(){function t(n,e){if(_classCallCheck(this,t),!n||"object"!==("undefined"==typeof n?"undefined":_typeof(n)))throw new Error("`options` is invalid");if(!n.inputString)throw new Error("Missing argument: inputString");if("string"!=typeof n.inputString)throw new Error("`inputString` is not a string");a=s(a,n),e?"function"==typeof e?a.pluginCallback=e:(console.error(e+" is not a function"),u()):u();var i=document.createElement("div");i.style.display="inline-block",i.innerHTML="I",a.targetElement.appendChild(i);var r=i.offsetHeight,c=i.offsetWidth;a.targetElement.removeChild(i);var f="@-webkit-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@-moz-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}.typingCursor::after{content:'';width:"+c+"px;height:"+r+"px;margin-left:5px;display:inline-block;vertical-align:bottom;background-color:"+a.cursorColor+";-webkit-animation:blink "+a.blinkInterval+" infinite;-moz-animation:blink "+a.blinkInterval+" infinite;animation:blink "+a.blinkInterval+" infinite}",p=document.createElement("style");p.type="text/css",p.styleSheet?p.styleSheet.cssText=f:p.appendChild(document.createTextNode(f)),document.head.appendChild(p),a.targetElement.className+=" typingCursor",a.task=o.TYPING,l()}return _createClass(t,[{key:"rewrite",value:function(t,n){var e=this;if(a.task===o.TYPING)return console.warn("Last task is not finished yet"),void setTimeout(function(){e.rewrite(t,n)},a.typingInterval);if(!t)throw new Error("Missing argument: inputString");if("string"!=typeof t)throw new Error("`inputString` is not a string");a.inputString=t,n?"function"==typeof n?a.pluginCallback=n:(console.error(n+" is not a function"),u()):u(),a.task=o.TYPING,l()}}]),t}();return f});
{
"name": "typewriting",
"version": "1.2.5",
"version": "1.2.6",
"description": "TypeWriting.js is a javascript library to make a typewriter effect.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -9,8 +9,16 @@ /*!

(function(root, factory) {
if( typeof define === 'function' && define.amd ) {
define(factory);
}
else if(typeof exports === 'object') {
module.exports = factory(require, exports, module);
}
else if( root ) {
root.TypeWriting = factory();
}
else {
window.TypeWriting = factory();
}
}(this, (require, exports, module) => {
'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
root.TypeWriting = factory()
}(this, () => {
'use strict';

@@ -17,0 +25,0 @@ /**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc