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-09 22:48:23 +03:00
|
|
|
Native.create("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) {
|
2014-12-18 05:12:21 +03:00
|
|
|
throw new $.newIllegalArgumentException();
|
2014-11-27 03:04:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
navigator.vibrate(duration);
|
|
|
|
});
|
|
|
|
|
|
|
|
Native.create("com/nokia/mid/ui/DeviceControl.stopVibra.()V", function() {
|
|
|
|
navigator.vibrate(0);
|
|
|
|
});
|