(JS) update: Avoid the warning message "[Violation] setTimeout took xxx ms"
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.1.2-beta-20171115-1504" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.1.2-beta-20171115-1911" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -792,6 +792,9 @@ var _lastGetMapExecuted = 0;
var _isResizeMapExecuting = false;
var _stopRequested = false;
+var resolvedPromise = typeof Promise == 'undefined' ? null : Promise.resolve();
+var nextTick = resolvedPromise ? function(fn) { resolvedPromise.then(fn); } : function(fn) { setTimeout(fn); };
+
function execCmd(success, error, pluginName, methodName, args, execOptions) {
execOptions = execOptions || {};
if (this._isRemoved && !execOptions.remove || !this._isReady) {
@@ -811,9 +814,9 @@ function execCmd(success, error, pluginName, methodName, args, execOptions) {
for (var i = 0; i < arguments.length; i++) {
results.push(arguments[i]);
}
- setTimeout(function() {
+ setTimeout(nextTick(function() {
success.apply(self,results);
- }, 0);
+ }), 0);
}
var delay = 0;
@@ -827,7 +830,7 @@ function execCmd(success, error, pluginName, methodName, args, execOptions) {
}
setTimeout(function() {
_executingCnt--;
- _exec();
+ nextTick(_exec);
}, delay);
}, function() {
//console.log("error: " + methodName);
@@ -839,16 +842,16 @@ function execCmd(success, error, pluginName, methodName, args, execOptions) {
for (var i = 0; i < arguments.length; i++) {
results.push(arguments[i]);
}
- setTimeout(function() {
+ setTimeout(nextTick(function() {
error.apply(self,results);
- }, 0);
+ }), 0);
}
if (methodName === _isWaitMethod) {
_isWaitMethod = null;
}
_executingCnt--;
- _exec();
+ nextTick(_exec);
}, pluginName, methodName, args]
});
@@ -856,7 +859,7 @@ function execCmd(success, error, pluginName, methodName, args, execOptions) {
if (_isExecuting || _executingCnt >= MAX_EXECUTE_CNT ) {
return;
}
- _exec();
+ nextTick(_exec);
}
function _exec() {
//console.log("commandQueue.length: " + commandQueue.length);

(JS) update: Avoid the warning message "[Violation] setTimeout took xxx ms"