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

BlackBerry: All modules should support event listeners.

    Details

      Description

      Developers should be able to add and fire events on module objects (ex: API, App).

      Acceptance Test

      function listener() {
      	Ti.API.info('Event from ' + this.module);
      }
       
      function testEvent(module, name) {
          module.addEventListener('foo', listener.bind({module:name}));
          module.fireEvent('foo');
      }
       
      testEvent(Ti, 'Ti');
      testEvent(Ti.API, 'API');
      testEvent(Ti.App, 'App');
      testEvent(Ti.Codec, 'Codec');
      testEvent(Ti.Database, 'Database');
      testEvent(Ti.Network, 'Network');
      testEvent(Ti.Platform, 'Platform');
      testEvent(Ti.UI, 'UI');
       
      var win = Ti.UI.createWindow();
       
      var button = Ti.UI.createButton({
      	title: 'Click, me!',
      	width: 300, height: 300
      });
      win.add(button);
       
      button.addEventListener('click', function() {
      	Ti.API.info('click!');
      });
       
      button.addEventListener('foo', function() {
      	Ti.API.info('foo!');
      });
      button.fireEvent('foo');
       
      win.open();
      

      1. Run the test case.
      2. You should see events fire and log the module from which they
      came from in the logs.
      3. You should also see a 'foo' event logged which was fired from the button.
      4. Try clicking the button and you will see "click!" printed to confirm native events still work.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joshroesslein Josh Roesslein
                Reporter:
                joshroesslein Josh Roesslein
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-15493
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code