Unpoly will occasionally rename or remove an existing function, event or HTML attribute.
To re-enable old APIs, load the file unpoly-migrate.js
that ships with
Unpoly 2 or higher:
Development | Production | |
---|---|---|
unpoly-migrate.js
|
unpoly-migrate.min.js
|
4.3 KB gzipped |
By loading unpoly-migrate.js
, calls to most old APIs will be forwarded to the
new version. A deprecation notice will be logged to your browser console.
This way you can upgrade Unpoly, revive your application with a few changes,
then replace deprecated API calls under green tests.
unpoly-migrate.js
unpoly-migrate.js
must be loaded after Unpoly, but before your own code. For example:
<script src="unpoly.js">
<script src="unpoly-migrate.js">
<script src="app.js">
unpoly-migrate.js
does
If a function was removed without replacement, unpoly-migrate.js
will provide a polyfill.
E.g. Unpoly no longer supports up.util.times()
, but the function is
re-added by unpoly-migrate.js
.
Calls to deprecated functions will be forwarded if there is an equivalent function in the current version.
E.g. up.modal.close()
will call up.layer.dismiss()
.
Usage of deprecated options will be rewritten if there is an equivalent option in the current version.
E.g. { reveal: false }
will be renamed to { scroll: false }
.
Usage of deprecated pcakages will be rewritten if there is an equivalent packages in the current version.
E.g. up.proxy.config
will return up.network.config
.
Occasionally a package will be removed
E.g. <a up-close>
will translate to <a up-dismiss>
E.g.
up.on('up:proxy:load')
will bind to up:request:load
.
Note that event aliases are only used when registering listeners with up.on()
,
but not with the native Element#addEventListener()
.