{"action":"created","issue":{"url":"https://api.github.com/repos/andrewplummer/Sugar/issues/536","repository_url":"https://api.github.com/repos/andrewplummer/Sugar","labels_url":"https://api.github.com/repos/andrewplummer/Sugar/issues/536/labels{/name}","comments_url":"https://api.github.com/repos/andrewplummer/Sugar/issues/536/comments","events_url":"https://api.github.com/repos/andrewplummer/Sugar/issues/536/events","html_url":"https://github.com/andrewplummer/Sugar/issues/536","id":130378177,"number":536,"title":"Can't use versions after 1.4.1 with Qt QML","user":{"login":"bgr","id":425768,"avatar_url":"https://avatars.githubusercontent.com/u/425768?v=3","gravatar_id":"","url":"https://api.github.com/users/bgr","html_url":"https://github.com/bgr","followers_url":"https://api.github.com/users/bgr/followers","following_url":"https://api.github.com/users/bgr/following{/other_user}","gists_url":"https://api.github.com/users/bgr/gists{/gist_id}","starred_url":"https://api.github.com/users/bgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgr/subscriptions","organizations_url":"https://api.github.com/users/bgr/orgs","repos_url":"https://api.github.com/users/bgr/repos","events_url":"https://api.github.com/users/bgr/events{/privacy}","received_events_url":"https://api.github.com/users/bgr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-02-01T14:38:48Z","updated_at":"2016-02-02T18:27:19Z","closed_at":null,"body":"I've been using Sugar with Qt's [QML](https://en.wikipedia.org/wiki/QML) for a long time, and it's been very useful. However, I've noticed that upgrading to a newer version won't be possible out-of-the-box, due to the following change:\r\n\r\n    // The global context\r\n    var globalContext = typeof global !== 'undefined' ? global : window;\r\n\r\nwhich raises `ReferenceError: window is not defined`, since there is no `window` in QML's JavaScript. I can fix it manually but I just wanted to raise awareness for another platform where Sugar's been used extensively, so that it can be taken into consideration for future changes."},"comment":{"url":"https://api.github.com/repos/andrewplummer/Sugar/issues/comments/178740166","html_url":"https://github.com/andrewplummer/Sugar/issues/536#issuecomment-178740166","issue_url":"https://api.github.com/repos/andrewplummer/Sugar/issues/536","id":178740166,"user":{"login":"andrewplummer","id":74646,"avatar_url":"https://avatars.githubusercontent.com/u/74646?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewplummer","html_url":"https://github.com/andrewplummer","followers_url":"https://api.github.com/users/andrewplummer/followers","following_url":"https://api.github.com/users/andrewplummer/following{/other_user}","gists_url":"https://api.github.com/users/andrewplummer/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewplummer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewplummer/subscriptions","organizations_url":"https://api.github.com/users/andrewplummer/orgs","repos_url":"https://api.github.com/users/andrewplummer/repos","events_url":"https://api.github.com/users/andrewplummer/events{/privacy}","received_events_url":"https://api.github.com/users/andrewplummer/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T18:27:19Z","updated_at":"2016-02-02T18:27:19Z","body":"So, if we assume that the global reference doesn't exist (which it doesn't seem to), and also given your last 2 points, I think the best solution is to update the code to use built-ins by name `Date` etc, when a reference to the global scope isn't available, then have a `qml` gulp task that essentially creates a non-minified build with a single `var Sugar = ...` token output that can then be accessed as `Sugar.Sugar.` What do you think?"}}