cordova-plugin-insets
This plugin provides access to Android's native unsafe area insets. Normally these insets are accessed through the CSS env variables, unsafe-area-inset-* (where * is top, right, bottom, or left).
These env variables are recognized by Android's webviews but are not properly implemented. They always resolve to 0.
This plugin provides a work around to obtain these values in javascript. You will have to implement your own javascript code to actually start using these values in your CSS.
Supported Platforms
Android.
If your app suppots multiple platforms, the API calls to this plugin should be platform guarded.
if (cordova.platform === 'android') {
let insets = await window.totalpave.Inset.create();
}
Documentation
See Docs
Licenses
This plugin is licensed under Apache 2.0. See LICENSE for more information.
0.3.0 (TBD)
Breaking Changes:
Depluralize symbols
Several symbols were written in plural form which goes against common naming
conventions. In effort to make the API a bit cleaner, this was corrected.
|Old Name|New Name|
|---|---|
|Insets
|Inset
|
|IInsets
|IInset
|
window.totalpave.Insets
has been renamed to window.totalpave.Inset
The typescript global typedefs have been updated accordingly.
IInsetAPI
This type interface was removed, the Inset
class can be referenced instead.
Inset API is no longer static
The static addListener
, removeListener
, and getInsets
APIs have been
removed and replaced with non-static versions. Two new static methods are introduced:
It is now the application's responsibility to create their own Inset
instance via
Inset.create
, passing
in their own configuration object. An instance of Inset
will be returned that
can be used like before.
Once the inset instance is no longer needed it will be desirable to free resources
by calling inset.free()
which will free up retained references allowing the
objects to be garbage collected.
Most use cases only calls for a single instance to be created for the application,
but it is valid to create several Inset
instances with different configuration
parameters.
A non-static version of getInsets
as noted above was introduced replacing the
static method. However getInsets
is also deprecated in effort to de-pluralize
the API for better naming conventions. It will be removed in a future release.
Any usages of getInsets
should use getInset
instead.