I have a problem with scopes (global variables/namespaces) that i just can't fix. The thing is that I have some legacy code on a project in which i added new functionalities using Require.js. This legacy code is loaded using standard <script>
tags, but the new code is loaded with Require. The problem occurs when I add the Ractive.js in Require as AMD. Because legacy code loads Prototype.js, it has some clashes with Ractive.js.
The main problem is when observing the array for changes. Specifically, when i observe the array with pattern observer.
ractive.observe('dataArray.*', function(newValue, oldValue, keypath) {
alert(' status changed from ' + oldValue + ' to ' + newValue);
}, {debug: true, init: false});
If i don't add observer to array, everything works, but if I add it, i get an error undefined is not a function
in prototype.js (this doesn't happen when I remove prototype.js from globals).
Another this is that it actually works when i don't use the pattern observer.
So, my question is, is there a way to configure Require.js to use only the scripts that are loaded as AMD-s? Or, in other words, restrict the scope of AMD scripts to only each other so it ignores global scripts?
Thanks in advance.