const property = new SDK.PluginProperty("integer", "test-property", 0);
this._info.SetProperties([
property
]);
this._info.AddCordovaPluginReference({
id: "cordova-plugin-inappbrowser",
plugin: this,
variables: [
["MY_VAR", property]
]
});
See Cordova plugin variables for more information.
The options object uses the following properties.
- id
- The ID of the Cordova plugin to reference.
- version Optional
- A version spec for the Cordova plugin, e.g.
"1.0.4"
. If this is not specified, the latest version will be used.
- platform Optional
- Specify a specific platform the Cordova plugin applies to. By default this is
"all"
meaning it will be used in both Android and iOS exports. However it can be set to "android"
or "ios"
to only be included when exporting to a specific platform. This is useful to switch between different Cordova plugins on different platforms.
- variables Optional
- Specify variables to be used with the Cordova plugin as an array of
[variableName, pluginProperty]
pairs. The variable name is bound to a SDK.PluginProperty
. When the project is exported a variable is added under the plugin reference in config.xml with the given name and a value taken from the specified property. When variables are specified, the plugin
property must also be set.
- plugin Optional
- Used to specify the plugin when using variables. Normally this should be set to
this
.
Note for security reasons the Scirra mobile app build service does not allow arbitrary Cordova plugins to be used. The build service uses an allowlist of allowed Cordova plugins. If you'd like a Cordova plugin to be added to the allowlist, please file an issue on the Construct 3 issue tracker. Please note we cannot guarantee that Cordova plugins will be allowed, and approval is subject to a security review. Other build services, such as using PhoneGap Build or compiling with the Cordova CLI, do not impose this restriction.
Remote script dependencies
Plugins and behaviors may also specify remote script dependencies. These are loaded from a cross-origin URL, e.g. https://example.com/api.js
.
Use AddRemoteScriptDependency
to add a remote URL to load a script from, e.g.:
this._info.AddRemoteScriptDependency("https://example.com/api.js");
This will produce the following tag on export, loaded before the runtime:
<script src="https://example.com/api.js"></script>
Addon SDK Manual
Construct.net
2017-08-04
2020-06-12
You are here:
Search this manual:
This manual entry was last updated on 12 Jun, 2020 at 15:36