Results 1 to 5 of 5

Thread: Preprocessors does not works in build version

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2008
    Posts
    11
    Vote Rating
    3
      3  

    Exclamation Preprocessors does not works in build version

    Ext version tested:
    • Ext 4.2.2


    Sencha CMD version tested:
    • Sencha Cmd v4.0.2.67


    Browser versions tested against:
    • ALL


    DOCTYPE tested against:
    • <!DOCTYPE HTML>


    Description:
    • Code of preprocessors stops work after build by CMD (in both modes: production or testing).


    Steps to reproduce the problem:
    • generate worspace: sencha generate workspace preProcessorTest
    • generate application: sencha -sdk /path/to/sdk generate app TestApp1 preProcessorTest/extApp1
    • write code of preprocessor which will fire for property "preprocessorProperty"
    • add property "preprocessorProperty" in TestApp1.view.Main class
    • launch application in browser - code of preprocessor runs
    • build application by command "sencha app build testing"
    • launch application from build folder in browser - code of preprocessor does not runs


    The result that was expected:
    • expected that code of preprocessor must work after build by Sencha CMD


    The result that occurs instead:
    • code of preprocessor does not runs - console.log in preprocessor function never called



    Ready for reproduce code in archive - preProcessorTest.zip (30Mb).
    Code of preprocessor located in TestApp1.component.ClassWithPreprocessor.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    Is the file being included in the build?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2008
    Posts
    11
    Vote Rating
    3
      0  

    Default

    Yep. But seems like in production build only:
    Code:
    (Ext.cmd.derive('TestApp1.component.ClassWithPreprocessor', Ext.Base, {singleton: true, method: function() {
      console.log('ClassWithPreprocessor: method called.');
    }}, 0, 0, 0, 0, 0, 0, [TestApp1.component, 'ClassWithPreprocessor'], function() {
      console.log('ClassWithPreprocessor', 'onCreate');
      Ext.Class.registerPreprocessor('preprocessorProperty', function(cls, data, hooks, fn) {
      console.log('ClassWithPreprocessor', 'preprocessor body');
      Ext.Function.interceptAfter(hooks, 'onCreated', function(classInterface) {
      console.log('ClassWithPreprocessor', 'preprocessor hook', Ext.getClassName(classInterface));
      if (!classInterface.prototype.hasOwnProperty('initComponent')) 
      {
        classInterface.addMembers({initComponent: function() {
      this.callParent(arguments);
    }});
      }
      Ext.Function.interceptBefore(classInterface.prototype, 'initComponent', function() {
      this.style = this.style || {};
      this.style.fontSize = 5;
    });
    });
      if (fn) 
      {
        fn.call(this, cls, data, hooks);
      }
    }, 0);
    }));

  4. #4
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Location
    Kansas
    Posts
    1,724
    Vote Rating
    248
      0  

    Default

    The processors property is marked as private and Cmd's optimizer takes advantage of that to streamline the class processor steps knowing that all required classes have been ordered ahead of the classes that need them. This of course presumes that we also know of all processors.

    See http://docs.sencha.com/extjs/4.1.1/#...-preprocessors

    Be aware that use of private API's is not supported nor are they guaranteed to remain as they are currently defined - they can change even in minor/patch releases.

    In Ext JS 5 we are making onClassExtended and onClassMixedIn public so that you can extend class semantics in safe ways. See http://docs.sencha.com/extjs/4.1.1/#...nClassExtended for an example. We have some other enhancements in this area for v5 but these two methods have existed since 4.0 and just not been declared as public. These are being made public because folks have asked for a supported way to extend class declarations (that will also work with Cmd optimizations).

    All disclaimers and warnings aside ... this Cmd feature can be disabled by adding this property to your build.properties file in .sencha/app/build.properties:

    Code:
    build.optimize=
    In Cmd v5 this particular optimization can be disabled while leaving others enabled like so:

    Code:
    build.optimize.defines=0
    Don Griffin
    Director of Engineering - Frameworks (Ext JS / Sencha Touch)

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2008
    Posts
    11
    Vote Rating
    3
      0  

    Default

    Thank you, dongryphon, for your reply. I turned off optimization and all is works.

Tags for this Thread

Posting Permissions

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