Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-4463

listeners property of proxy objects no longer available in 1.7.X (inconsistant compared with 1.6.2)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Invalid
    • Affects Version/s: Release 1.7.0
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:
      None
    • Environment:

      Titanium 1.6.2 and 1.7.0

      Description

      Accessing a Proxy's listeners property doesn't work as expected in mobilesdk 1.7.0 (as it did in 1.6.2).

      Given the proxy "myView" (any view type):

      • In 1.6.2 - myView.listeners would give you an object with key/value pairs equating to the listener type/array of callback functions bound as Listeners to the view.
      • In 1.7.0 - myView.listeners gives you an object, however the value is now an integer, which seems to be equal to the length of what the callback array would be.

      This code demonstrates the behavior:

      var win = Ti.UI.createWindow({
      	backgroundColor : "blue",
      	exitOnClose:true,
      	layout:'vertical'
      });
       
      var myView=Ti.UI.createView({
      	backgroundColor:'green',
      	height:200,
      	width:200
      });
       
      win.add(myView);
      win.open();
       
      myView.addEventListener('click', function(){
      	Ti.API.info('Click event fired');
      });
       
      Ti.API.info(myView.listeners.click);
      Ti.API.info("myView.listeners.click: " + myView.listeners.click); // comment this for android to avoid exception
      

      The results are as follows:

      Titanium 1.6 on iOS:

      [INFO] myView.listeners: [object Object]
       
      [INFO] myView.listeners.click: function () {
       
      	Ti.API.info('Click event fired');
       
      }
      

      Titanium 1.8, 1.7, 1.7.1 on iOS:

      [INFO] myView.listeners: [object Object]
       
      [INFO] myView.listeners.click: 1
      

      See a full justification for this functionality in this comment.

      Note that this functionality has never been available for Android, as this comment demonstrates.

        Attachments

          Activity

            People

            • Assignee:
              rseagraves Reggie Seagraves
              Reporter:
              rmunson Russell Munson
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code