Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69024

Function from js-file becomes global for all files.

    XMLWordPrintable

Details

    • Linux/Other display system

    Description

      Let's say there are 2 js files:

      Bar.js:

      function say() {
          console.log("BAR")
      }
      

      Foo.js: 

      function say() {
          console.log("FOO")
      }
      this.say = say;
      

      and the main.qml:

      ...
      import "Foo.js" as Foo
      import "Bar.js" as Bar
      
      ...
      
      Component.onCompleted: {
          Foo.say();
          Bar.say(); // !
          say();     // !!!
      }

       

      The output is wrong:

      qml: FOO
      qml: FOO
      qml: FOO
      

       

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              roumed Roman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes