Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1237

Alloy: Remove all event listeners added via view in $.destroy()

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: Alloy 1.5.1
    • Fix Version/s: Alloy 1.7.0
    • Component/s: Runtime
    • Labels:
    • Environment:

      Alloy 1.5.1

    • Story Points:
      8
    • Sprint:
      2015 Sprint 11 Tooling

      Description

      Too make it easier for developers to clean up the event listeners they've added via the XML view (onClick and other attributes), could we make it so that if you add an event listener that way, that it would also be removed in the $.destroy() method?

      The developer would still be responsible for calling that method and for removing listeners he added in the controller, but it would align nicely with the current behaviour of the method where it also cleans up a listener added via the view, which is for the <Collection> or <Model> tag.

      For reference:
      https://github.com/appcelerator/alloy/blob/master/test/apps/basics/markup_events/_generated/ios/alloy/controllers/index.js#L44-L49

      Perhaps the __defers object could be used for this in some way?

      We could even go as far as extending the Backbone $.listenTo() method that if its first argument is a proxy, then it would both pass it on to that proxies' addEventListener method and queue it for removal in $.destroy at the same time.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                skypanther Tim Poulsen
                Reporter:
                fokkezb Fokke Zandbergen
              • Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration