Extending one JavaScript Object Function from Another

I need to add some functionality to a core JavaScript object function, without touching the original file.

How can I extend the following object function from my object below while keeping the namespace intact?

Read More

core object

    (function() {
        var DOM = tinymce.DOM;

        tinymce.create('tinymce.plugins.WordPress', {

            // i need to extend this function
            _hideButtons : function() {

                // stuff here

            };

        }); 

        tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);

    })();

my object

I tried this, but it doesn’t work:

    (function() {

        tinymce.create('tinymce.plugins.Mine', {

            init : function(ed, url) {  

                ed.plugins.wordpress._hideButtons.prototype = function() {

                    // new function stuff

                }
            },  

        }); 

        tinymce.PluginManager.add('mine', tinymce.plugins.Mine);

    })();

Am I on the right track?

Related posts

Leave a Reply

1 comment

  1. extending was, in fact, not what i needed.

    by just removing .prototype above, allowed me to completely over write the function in question. this is exactly what i wanted to do.

    check it…

    (function() {
    
        tinymce.create('tinymce.plugins.Mine', {
    
            init : function(ed, url) {  
    
                ed.plugins.wordpress._hideButtons = function() {
    
                    // new function stuff
    
                }
            },  
    
        }); 
    
        tinymce.PluginManager.add('mine', tinymce.plugins.Mine);
    
    })();