New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

controlledtimer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

controlledtimer

controlledTimer is a forward / reverse time management application

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
-80%
Maintainers
1
Weekly downloads
 
Created
Source

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

NameTypeDefaultDescription
container string "#controlledtimer-container"

This is a container field selector. The presence of the section where the study will be performed is controlled by this selector.

selector string "#controlledtimer-selector"

The created template is inserted into this selector.

start string "00:58"

Start Time

end string "00:00"

End Time

direction string "down"

How to count from start time to end time is determined by this feature. Only the "up" and "down" options can be written.

startCallback function function

It is a function that runs once when the time starts. You can run a function in your application.

endCallback function function

It is a function that runs once when the time expires. You can run a function in your application.

Keywords

javascript timer

FAQs

Package last updated on 06 Oct 2019

Related posts