Results 1 to 2 of 2

Thread: Get all function names in controller

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    21
    Answers
    1

    Default Answered: Get all function names in controller

    Hi. I am trying to retrieve all names of functions in some controller. I would like to move bunch of functions which are directly on Application into some controller (CApp) because they are taking too much space and cannot be collapsed in Architect.

    I don't want to correct all calls of functions that were moved from Application into this new Controller or linking functions by hand like:
    Code:
    MyApp.testFunction = MyApp.getController("CApp").testFunction
    Can someone help me?

  2. Code:
    var controller = MyApp.getController("CApp");
    var functions = Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).filter(function(property) {
        return typeof controller[property] == "function";
    }).filter(function(fName) {
        return fName != "self" && fName != "configClass";
    });
    Done

  3. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    21
    Answers
    1

    Default

    Code:
    var controller = MyApp.getController("CApp");
    var functions = Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).filter(function(property) {
        return typeof controller[property] == "function";
    }).filter(function(fName) {
        return fName != "self" && fName != "configClass";
    });
    Done

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •