Upgrading to 2.0
The most major change in v2.0 is the new Sugar
global
object as the main method of interaction with Sugar, and native extension
becoming opt-in. If you simply want to continue using Sugar as before, the
first step is to call the extend
method, which will extend
methods onto their native counterparts:
For more about this method, and also the two new ways of interacting with Sugar, see the Getting Started guide.
Helpers
For more help upgrading, Sugar also provides some resources to make the transition easier. The most useful is the upgrade script. This simple script monitors your calls to Sugar methods and warns about incompatibilities in the console as the methods are called. You can either add the script before upgrading to get an idea about breaking changes, or upgrade first and fix errors as you go. To be optimally useful, the script should be loaded immediately after Sugar, however it is also offered here as a bookmarklet to let you quickly inject it into production sites.
Download | Sugar Upgrade (bookmarklet)
Also available is the cautionlog, which is a vetted changelog detailing changes in order of severity. The upgrade helper can be thought of as an interactive version of this log.