pluotsorbet/midp/device_control.js

29 строки
886 B
JavaScript
Исходник Обычный вид История

2014-11-27 03:04:47 +03:00
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
2014-12-19 00:03:59 +03:00
Native["com/nokia/mid/ui/DeviceControl.startVibra.(IJ)V"] = function(freq, longDuration) {
2014-11-27 03:04:47 +03:00
// If method is called during a previously called vibration that has been
// activated from this method, the previous vibration is stopped and the new
// one is activated using the new set of parameters.
navigator.vibrate(0);
// Value 0 can be used for detecting whether or not there is a vibration device.
if (freq === 0) {
return;
}
var duration = longDuration.toNumber();
if (freq < 0 || freq > 100 || duration < 0) {
throw new $.newIllegalArgumentException();
2014-11-27 03:04:47 +03:00
}
navigator.vibrate(duration);
2014-12-19 00:03:59 +03:00
};
2014-11-27 03:04:47 +03:00
2014-12-19 00:03:59 +03:00
Native["com/nokia/mid/ui/DeviceControl.stopVibra.()V"] = function() {
2014-11-27 03:04:47 +03:00
navigator.vibrate(0);
2014-12-19 00:03:59 +03:00
};