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 8144661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:26:42+00:00 2026-06-06T13:26:42+00:00

My code: myobj = new Object(); classes.testegy = Class.extend({ init: function (token) { console.log(test

  • 0

My code:

myobj = new Object();
classes.testegy = Class.extend({
    init: function (token) {
        console.log("test egy");
        setInterval(function () {
            console.log('hello');
        }, 300);
    },
    testt: function () {
        console.log("luli");
    }
});
classes.testketto = Class.extend({
    init: function (token) {
        console.log("test ketto");
    }
});
classes.site = Class.extend({
    init: function (token) {
        var myobj = new Object();
        myobj.lel1 = new classes.testegy();
        myobj.lel2 = new classes.testketto();
        console.log(myobj);
        delete myobj.lel1;
        myobj.lel1.testt();
    }
});
var class = new classes.site();

If I delete the myobj.lel1 object, it will be deleted, but the setInterval goes in the testegy class. Why? How can I full delete Object? Thanks

edited:

some example, when not use setInterval, use click, and console log.

classes.testegy = Class.extend({
init: function(token){
    console.log("test egy");
    $(".piii").live("click", function() {
        console.log("hello");
    });

},
foo: function() {
    console.log("pina");
}
});

classes.testketto = Class.extend({
init: function(token){
    console.log("test ketto");
}   
});

classes.site = Class.extend({
init: function(token){
    var myobj = new Object();

    myobj.lel1 = new classes.testegy();
    myobj.lel2 = new classes.testketto();

    console.log(myobj);

    delete myobj.lel1;
    myobj.lel1 = new classes.testegy();
    delete myobj.lel1;
    myobj.lel1 = new classes.testegy();
    delete myobj.lel1;
    myobj.lel1 = new classes.testegy();

}   
});

return: 1 click event -> 4x click = 4x console log 🙁 it was created 4 shadow object.

  • 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-06T13:26:43+00:00Added an answer on June 6, 2026 at 1:26 pm

    You need to define cleaning function. First, hold the reference to setInterval:

    init: function(token){
        console.log("test egy");
        this.interval = setInterval(function() { console.log('hello'); }, 300);
    }
    

    then define cleaning function (in prototype):

    clean: function() {
        clearInterval(this.interval);
    }
    

    and finally call myobj.lel1.clean() before deleting.

    EDIT

    The problem with the edited code is different. Look at this:

    init: function(token){
        console.log("test egy");
        $(".piii").live("click", function() {
            console.log("hello");
        });
    }
    

    Whenever you initialize new object, this function adds new handler to click event on .piii. What you have to do is to use this code:

    $(".piii").live("click", function() {
        console.log("hello");
    });
    

    outside an object definition. Or you can use $(".piii").unbind('click').click(/* handler */) inside init.

    BTW. .live method is outdated. Use .on now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the following code static class ... { static object myobj
Say I have the following java code: Object myObj = new ArrayList(); List myList
I have this code: class MyObj { int Id; string Name; string Location; }
I have code like this var MyObj = { f1 : function(o){ o.onmousedown =
let's say I have a JavaScript-Class like this: Foo.prototype = { init: function() {
I have a line of code like this: var myObj:[SomeClass] = new [SomeClass](); I
I have this piece of code: var myObj = function () { this.complex =
Consider a simple POJO Java Object: class MyObj { String a, b; Integer c;
What I want to do in my code: myobj = <SomeBuiltinClass>() myobj.randomattr = 1
Code to create new form instance of a closed form using form name I

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.