var applicationEventListener = new ListenerManager(native, APPLICATION_EVENT_LISTENER);
ApplicationManager.prototype.addAppInfoEventListener = function() {
- console.warn('DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be removed from next release. '
+ privUtils_.warn('DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be removed from next release. '
+ 'Use tizen.package.setPackageInfoEventListener() instead.');
var args = AV.validateMethod(arguments, [
};
ApplicationManager.prototype.removeAppInfoEventListener = function() {
- console.warn('DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be removed from next release. '
+ privUtils_.warn('DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be removed from next release. '
+ 'Use tizen.package.unsetPackageInfoEventListener() instead.');
var args = AV.validateMethod(arguments, [
BluetoothAdapter.prototype.setPowered = function() {
privUtils_.log('Entered BluetoothAdapter.setPowered()');
- console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. '
+ privUtils_.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. '
+ 'Let the user turn on/off Bluetooth through the Settings application instead.');
var args = AV.validateMethod(arguments, [
DISPLAY: 'DISPLAY'
};
+var privUtils_ = xwalk.utils;
+
var CalendarAlarm = function(time, method, description) {
validator_.isConstructorCall(this, CalendarAlarm);
try {
_method = converter_.toEnum(method, Object.keys(AlarmMethod), false);
} catch (e) {
- console.warn('Failed to convert method: "' + method + '" to enum AlarmMethod.');
+ privUtils_.warn('Failed to convert method: "' + method + '" to enum AlarmMethod.');
_method = method;
}
*/
var T_ = xwalk.utils.type;
+var privUtils_ = xwalk.utils;
var CONTENT_MANAGER_LISTENER_ID = 'ContentManagerChangeCallback';
};
ContentManager.prototype.setChangeListener = function(changeCallback) {
- console.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed '
+ privUtils_.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed '
+ 'from next release. Use addChangeListener() instead.');
var args = validator_.validateArgs(arguments, [{
};
ContentManager.prototype.unsetChangeListener = function() {
- console.warn('DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed '
+ privUtils_.warn('DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed '
+ 'from next release. Use removeChangeListener() instead.');
var data = {};
case HumanActivityType.SLEEP_MONITOR:
return new HumanActivitySleepMonitorData(data);
default:
- console.error('Uknown human activity type: ' + type);
+ utils_.error('Uknown human activity type: ' + type);
}
}
func = HumanActivityRecorderPressureData;
break;
default:
- console.error('Uknown human activity recorder type: ' + type);
+ utils_.error('Uknown human activity recorder type: ' + type);
return;
}
}
NFCAdapter.prototype.setPowered = function() {
- console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. Let the user turn NFC on/off '
+ privUtils_.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. Let the user turn NFC on/off '
+ 'through the Settings application instead.');
var args = validator_.validateArgs(arguments, [
var validator_ = xwalk.utils.validator;
var types_ = validator_.Types;
var native_ = new xwalk.utils.NativeManager(extension);
+var privUtils_ = xwalk.utils;
function ListenerManager(native, listenerName) {
this.listener;
]);
if (args['state'] && args.state === PowerScreenState['SCREEN_BRIGHT']) {
- console.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.');
+ privUtils_.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.');
}
var nativeParam = {
* Turns on the screen.
*/
PowerManager.prototype.turnScreenOn = function() {
- console.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.');
+ privUtils_.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.');
var nativeParam = {
};
* Turns off the screen.
*/
PowerManager.prototype.turnScreenOff = function() {
- console.warn('DEPRECATION WARNING: turnScreenOff() is deprecated and will be removed from next release. Use release() instead.');
+ privUtils_.warn('DEPRECATION WARNING: turnScreenOff() is deprecated and will be removed from next release. Use release() instead.');
var nativeParam = {
};
var native = new xwalk.utils.NativeManager(extension);
var validator = xwalk.utils.validator;
var validatorType = xwalk.utils.type;
-
+var privUtils_ = xwalk.utils;
/**
* @const
}
PushManager.prototype.registerService = function() {
- console.warn('DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. Use register() instead.');
+ privUtils_.warn('DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. Use register() instead.');
var data = validator.validateArgs(arguments, [
{
name: 'appControl',
};
PushManager.prototype.unregisterService = function() {
- console.warn('DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next release. Use unregister() instead.');
+ privUtils_.warn('DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next release. Use unregister() instead.');
var data = validator.validateArgs(arguments, [
{
name: 'successCallback',
};
PushManager.prototype.connectService = function(notificationCallback) {
- console.warn('DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. Use connect() instead.');
+ privUtils_.warn('DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. Use connect() instead.');
var data = validator.validateArgs(arguments, [
{
name: 'notificationCallback',
};
PushManager.prototype.disconnectService = function() {
- console.warn('DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next release. Use disconnect() instead.');
+ privUtils_.warn('DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next release. Use disconnect() instead.');
var ret = native.callSync('Push_disconnectService', {});
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
};
SystemInfo.prototype.getCapabilities = function() {
- console.warn('DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. Use getCapability() instead.');
+ privUtils_.warn('DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. Use getCapability() instead.');
var result = native_.callSync('SystemInfo_getCapabilities', {});
if (native_.isFailure(result)) {
tizen.TZDate.prototype.getTimezoneAbbreviation = function() {
utils_.log('Entered TZDate.getTimezoneAbbreviation');
- console.warn('DEPRECATION WARNING: getTimezoneAbbreviation() is deprecated and will be removed from next release.');
+ utils_.warn('DEPRECATION WARNING: getTimezoneAbbreviation() is deprecated and will be removed from next release.');
var result = native_.callSync('TZDate_getTimezoneAbbreviation',
{timezone: String(this._timezoneName),
//Object xwalk.JSON - guaranteed to not being modified by the application programmer
var JSON_ = {stringify: JSON.stringify, parse: JSON.parse};
-Object.freeze(JSON_)
+Object.freeze(JSON_);
exports.JSON = JSON_;
var _enableJsLogs = false;
});
}
-Utils.prototype.log = function() {
- if (_enableJsLogs) {
- console.log.apply(console, arguments);
- }
-}
+Utils.prototype.error = console.error.bind(console);
+Utils.prototype.warn = console.warn.bind(console);
+Utils.prototype.log = _enableJsLogs ? console.log.bind(console) : function(){};
Utils.prototype.repackFilter = function(filter) {
if (filter instanceof tizen.AttributeFilter) {
// TODO: Remove mockup if WRT implements sendRuntimeMessage
// This is temporary mockup!
extension.sendRuntimeMessage = extension.sendRuntimeMessage || function() {
- console.error('Runtime did not implement extension.sendRuntimeMessage!');
+ _console.error('Runtime did not implement extension.sendRuntimeMessage!');
throw new WebAPIException(WebAPIException.UNKNOWN_ERR,
'Runtime did not implement extension.sendRuntimeMessage!');
};
extension.sendRuntimeAsyncMessage = extension.sendRuntimeAsyncMessage || function() {
- console.error('Runtime did not implement extension.sendRuntimeAsyncMessage!');
+ _console.error('Runtime did not implement extension.sendRuntimeAsyncMessage!');
throw new WebAPIException(WebAPIException.UNKNOWN_ERR,
'Runtime did not implement extension.sendRuntimeAsyncMessage!');
};
extension.sendRuntimeSyncMessage = extension.sendRuntimeSyncMessage || function() {
- console.error('Runtime did not implement extension.sendRuntimeSyncMessage!');
+ _console.error('Runtime did not implement extension.sendRuntimeSyncMessage!');
throw new WebAPIException(WebAPIException.UNKNOWN_ERR,
'Runtime did not implement extension.sendRuntimeSyncMessage!');
};
delete msg[this.CALLBACK_ID_KEY];
if (!_type.isFunction(this.callbacks_[id])) {
- console.error('Wrong callback identifier. Ignoring message.');
+ _console.error('Wrong callback identifier. Ignoring message.');
return;
}
try {
f(msg);
} catch (e) {
- console.error('########## exception');
- console.error(e);
+ _console.error('########## exception');
+ _console.error(e);
}
}, 0);
delete this.callbacks_[id];
delete msg[this.LISTENER_ID_KEY];
if (!_type.isFunction(this.listeners_[id])) {
- console.error('Wrong listener identifier. Ignoring message.');
+ _console.error('Wrong listener identifier. Ignoring message.');
return;
}
try {
f(msg);
} catch (e) {
- console.error('########## exception');
- console.error(e);
+ _console.error('########## exception');
+ _console.error(e);
}
}, 0);
return;
}
- console.error('Missing callback or listener identifier. Ignoring message.');
+ _console.error('Missing callback or listener identifier. Ignoring message.');
}.bind(this));
};
* age: 28
* }
* });
- * console.log(result);
+ * _console.log(result);
*
* To send async method and handle response:
* bridge.async({
CallbackManager.prototype = {
add: function (/*callbacks, cid?*/) {
- if (debug) console.log('bridge.CallbackManager.add');
+ if (debug) _console.log('bridge.CallbackManager.add');
var args = Array.prototype.slice.call(arguments);
var c = args.shift();
var cid = args.pop();
return cid;
},
remove: function (cid) {
- if (debug) console.log('bridge.CallbackManager.remove, cid: ' + cid);
+ if (debug) _console.log('bridge.CallbackManager.remove, cid: ' + cid);
if (_collection[cid]) delete _collection[cid];
},
call: function (cid, key, args, keep) {
- if (debug) console.log('bridge.CallbackManager.call, cid: '+ cid + ', key: ' + key);
+ if (debug) _console.log('bridge.CallbackManager.call, cid: '+ cid + ', key: ' + key);
var callbacks = _collection[cid];
keep = !!keep;
if (callbacks) {
ListenerManager.prototype = {
add: function (l) {
- if (debug) console.log('bridge.ListenerManager.add');
+ if (debug) _console.log('bridge.ListenerManager.add');
var id = _next();
_listeners[id] = l;
return id;
},
resolve: function (id, action, data, keep) {
- if (debug) console.log('bridge.ListenerManager.resolve, id: ' + id + ', action: ' + action);
+ if (debug) _console.log('bridge.ListenerManager.resolve, id: ' + id + ', action: ' + action);
keep = !!keep;
var l = _listeners[id];
if (l) {
return l;
},
remove: function (id) {
- if (debug) console.log('bridge.ListenerManager.remove, id: ' + id);
+ if (debug) _console.log('bridge.ListenerManager.remove, id: ' + id);
var l = _listeners[id];
if (l) {
var cm = Callbacks.getInstance();
})();
var Listener = function () {
- if (debug) console.log('bridge: Listener constructor');
+ if (debug) _console.log('bridge: Listener constructor');
this.cid = null;
};
Listener.prototype = {
then: function (c) {
- if (debug) console.log('bridge.Listener.then');
+ if (debug) _console.log('bridge.Listener.then');
var cm = Callbacks.getInstance();
this.cid = cm.add(c, this.cid);
return this;
cmd: data.cmd,
args: data
});
- if (debug) console.log('bridge.sync, json: ' + json);
+ if (debug) _console.log('bridge.sync, json: ' + json);
var result = extension.internal.sendSyncMessage(json);
var obj = JSON_.parse(result);
if (obj.error)
cmd: data.cmd,
args: data
});
- if (debug) console.log('bridge.async, json: ' + json);
+ if (debug) _console.log('bridge.async, json: ' + json);
setTimeout(function () {
extension.postMessage(json);
});
*}
*/
- if (debug) console.log('bridge.setMessageListener, json: ' + json);
+ if (debug) _console.log('bridge.setMessageListener, json: ' + json);
var data = JSON_.parse(json);
if (data.cid && data.action) {
setTimeout(function() {