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

Add `once`, `on` and `off` to Titanium proxies

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: Release 3.4.1
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:

      master

      Description

      When digging through some source code I discovered Android has a hidden once() method to add an event listener that only fires once and removeAllListeners() to remove all listeners to a certain event:

      Why aren't these methods documented and why not bring these to all platforms?

      Both have very good use cases to me in almost every app.

      I'd even suggest the following:

      view.once('click', doClick); // fires once
      view.on('click', doClick); // alias for addEventListener()
      view.off('click', doClick); // alias for removeEventListener()
      view.off('click'); // removes all listeners for the click-event
      view.off(); // removes all listeners for any event
      

      The last one would make cleaning up and preventing memory leaks a lot easier as well.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              fokkezb Fokke Zandbergen
            • Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration