The files in this directory provide a backward compatibility layer that restores parts of the yFiles for HTML API of previous releases.
The compatibility layer consists of JavaScript files that can be loaded as any other yFiles for HTML library module file.
Upon loading, the scripts install one or more callback functions in the yfiles
namespace which, when
called, enable parts of the compatibility layer. Since most of the compatibility layer modifies the prototypes of
the yFiles classes, these functions need to be called after all affected yFiles library classes are loaded, for
example in the callback of the require function of the AMD Loader.
Both the script(s) and the installed function(s) can be called safely multiple times from your application code.
It is not necessary to use the compatibility file(s) as a whole. You can (and should) use the file(s) as a reference on how to change your client code to become compatible with current yFiles for HTML releases.
The compatibility layer of version 1.2 for version 1.1 consists of a single module file
migration/compatibility.js
and a callback function yfiles.enable_1_1_compatibility
.
You can use it as follows:
Example: enable backward compatibility
require([ ...yfiles library modules..., ...application scripts..., '.../migration/compatibility.js' ], function () { yfiles.enable_1_1_compatibility(); ...other startup code...; });
Please note that in case you use require
again to load any yFiles modules, you also have to call
yfiles.enable_1_1_compatibility
again to ensure compatibility for the lazily loaded modules.
Compatibility.js provides a convenience function yfiles.enable_1_1_compatibility_wrap_require
that
takes care of this automatically. It enables compatibility and wraps require
, so
yfiles.enable_1_1_compatibility
is called
implicitly for every further require
call. This function can be used instead of
yfiles.enable_1_1_compatibility
, if yFiles modules are loaded lazily.
Example: enable backward compatibility and wrap require
require([ ...yfiles library modules..., ...application scripts..., '.../migration/compatibility.js' ], function () { yfiles.enable_1_1_compatibility_wrap_require(); ...other startup code...; });
The compatibility layer for this version consists of the single module file
migration/compatibility-1.0.js
and the callback function is
yfiles.enable_1_0_compatibility
.
If you happen to be using the demo framework (yfiles.demo.js), e.g. as part of a POC or a modified demo, note
that this file also has to be replaced: please replace the old file yfiles.demo.js
with the file
demos/demo-framework/demo-framework.js
and rename that file to yfiles.demo.js
.
Copyright yWorks GmbH, 2014. All rights reserved.