Git Product home page Git Product logo

Comments (2)

alittlekitten avatar alittlekitten commented on June 15, 2024

처음에는 단순히 비슷하게 설정한 시간에서 stopwatch에서 사용했던 로직을 이용해 지나간 시간을 계산한 후에 빼면 되겠다고 생각했지만, pause시의 처리를 고민하게 되어서 잠시 보류함

from ssocotimer.

alittlekitten avatar alittlekitten commented on June 15, 2024

시작할 때 setTime으로 남은 시간을 고정하고, 거기서 stopwatch와 동일한 로직으로 계산한 play후 지나간 시간을 빼는 형식으로 구현
(최대한 정확하게 시간을 재기 위해서 1ms후에 setTimeout처리가 되도록 설정함)

0초로 변하면 딱 끝나게 만들기 위해서 시작할 때 999ms를 더해주는 방식을 사용함
(ms단위까지 보여지게 만들 수 있지만, 보다 정확한 시간관리와 stop으로의 상태변화를 위해 초단위까지만 남겨둠)

image
image
image
image

from ssocotimer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.