JSFiddle - React, Tailwind, and code Playground

by fer carranza

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/1.3.1/css/toastr.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/1.3.1/js/toastr.js"></script>
hello

JavaScript

var newJob = function(e) {
	var i = -1;
	var $toastlast;

	var getMessage = function () {
		var msgs = ["There's a new job in the job dispatch queue", "A job pending approval has timed out"];
		i++;
		if (i === msgs.length) {
			i = 0;
		}

		return msgs[i];
	};
	
	var shortCutFunction = "success"; // 'success' or 'error'

	toastr.options = {
		closeButton: true,
		progressBar: true,
		debug: false,
		positionClass: 'toast-top-full-width',
		onclick: null,
		timeOut: "0",
		extendedTimeOut: "0",
		showDuration: "0",
		hideDuration: "0",
		showEasing: "swing",
		hideEasing: "linear",
		showMethod: "fadeIn",
		hideMethod: "fadeOut",
	};


	toastr.options.onclick = function () {
		window.location.href = "/dispatcher";
	};

	var msg = getMessage();

	$("#toastrOptions").text("Command: toastr["
					+ shortCutFunction
					+ "](\""
					+ msg
					+ "\")\n\ntoastr.options = "
					+ JSON.stringify(toastr.options, null, 2)
	);

	var $toast = toastr[shortCutFunction](msg);

};

$(document).ready(function() {
    console.log('ok');
	setInterval(function () {
		newJob();
	}, 5000);

});