1.0.0 • Published 5 years ago

controlledtimer v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

controlledTimer

controlledTimer is a forward / reverse time management application. You can set the start and end times and you can access different functions in both cases.

Values you can enter: day: hour: minute: second

Properties

  • Pure javascript
  • Ecmascript 6
  • Editable properties

Test Address

projects.erselgulyaz.com/controlledtimer/

Usage

Install with terminal

npm install controlledtimer

Import your js file

import controlledTimer from './controlledTimer'

Init

import controlledTimer from './controlledTimer'

Using to Parameters

const timerEl = new controlledTimer({  
	container: '#controlledtimer-container',  
	selector: '#controlledtimer-selector',  
	start: '00:58',  
	end: '00:00',  
	direction: 'down', /* up, down */  
	startCallback: () => {    
		console.log("start");  
	},  
	endCallback: () => {    
		console.log("end");  
	}
});

const killButton = document.querySelector("#controlledtimer-kill");
const restartButton = document.querySelector("#controlledtimer-restart");
const playPauseButton = document.querySelector("#controlledtimer-playpause");

killButton.addEventListener("click", () => { 
	timerEl.kill();
});
restartButton.addEventListener("click", () => {  
	timerEl.restart();
});

playPauseButton.addEventListener("click", () => {  
	timerEl.playPause();
});

Parameters