Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8626291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:59:25+00:00 2026-06-12T07:59:25+00:00

My class structure is something like this: var jpTWUI = function(id, connection){ this.id =

  • 0

My class structure is something like this:

var jpTWUI = function(id, connection){
    this.id = id;
    this.muteButton = "#mute";
    this.hangupButton = "#hang";
    this.transferButton = "#trans";
    this.parentElement = jQuery('#timerCon');
    this.connection = connection;

    this.interval = "";

    this.createElements();
    this.addEvents(); 
};

jpTWUI.prototype = { 
    createElements: function(){ ... }, 
    addEvents: function(){...}, 
    startTimer: function(){...}
}

Now I have created an object and called the class something like this

var callHandler = new jpTWUI('timerCon', connection);
callHandler.startTimer();

But the problem is that the method startTimer has the setInterval function which display the duration in minutes and seconds.

I want to implement one more method like stopTimer which stop that startTimer‘s interval, I know I have to user window.clearInterval. but when I implemented the function stopTimer in the same class then I don’t know how do I access that method with the class like:

var callHandler = new jpTWUI('timerCon', device);
callHandler.stopTimer();

Hope you guys understand what I want to achieve, this is first time I have used the class in javascript..

Please guide me is this approach is correct??
or how do i make it correct..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:59:27+00:00Added an answer on June 12, 2026 at 7:59 am

    Modified code. save return value of setInterval in setIntervalConst and use it clearInterval.
    You should use same instance of jpTWUI while calling startTimer and stopTimer.

    var callHandler = new jpTWUI('timerCon', connection);
    callHandler.startTimer();
    
    ///var callHandler = new jpTWUI('timerCon', device); // remove this line if you want access same instance of jpTWUI.
    callHandler.stopTimer();
    

    .

    jpTWUI.prototype = { 
        createElements: function(){ ... }, 
        addEvents: function(){...}, 
        setIntervalConst: 0,
        startTimer: function(){ this.setIntervalConst = setInterval(....) ....},
        stoptTimer: function(){ clearInterval(this.setIntervalConst ); ....}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Eclipse project. It originally had a structure something like this: MyProj
With predetermined class structure like this: @XmlRootElement class Root { Foo property; transient Wrapper
I have a table structure something like this table Collection Id Name table Product
I have a class structure like class A: def method1(self): return 1 class B:
I have a class structure like abstract class Animal { public Animal(){ //init stuff..
I have a class structure like: abstract class A { String a; } class
I have got the following class structure, and have plenty of classes like C
I have a DOM structure which looks something like below - <div id='MyDiv'> <span>Hello
I have 3 expand divs with the same strcuture. Something like: <div class=expand> <h3
I have the following class structure: class Organization { string Name; List<User> users; List<Organization>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.