/ fuse

Adding Vibrations to Fuse Applications

Adding feedback when a user clicks a button or even upon a particular event is easy with Fuse. We can add the Vibration package to our Fuse project and use it accordingly. Let’s take a look!

Create a new Fuse application

To create a new application with Fuse, run fuse create app vibration.

Add the Vibration package

We can then add the Fuse.Vibration package to our Vibration.unoproj like so:

     "Packages": [
        "Includes": [

It is important that you add this, else you’ll not be able to access the FuseJS/Vibration package within your JavaScript.

Using Vibration

In our application, I’ve simply got a button that’s aligned to the center of the screen. When a user clicks on the button, the phone will vibrate for X amount of time.

Here’s the template:

<Panel Alignment="Center">
   <Button Text="Vibrate" Clicked="{vibrate}"/>

When the button is Clicked, the vibrate function is called. We can add custom JavaScript like this:

var vibration = require("FuseJS/Vibration")

function vibrate() {

module.exports = {
    vibrate: vibrate

As you can see, we’re first importing the Vibration module from FuseJS/Vibration, and then we’re making a function named vibrate.

This function calls vibration.vibrate(time: number) which can then be used to vibrate the phone for a particular number of seconds.

After which, we’re exporting this function to be used inside of our button’s Clicked event.

Tada! You should now be able to use Vibration inside of your Fuse projects. Here's a video if you prefer that:

Paul Halliday

Progress Telerik Developer Expert. Course author with students in 110+ countries. BSc (Hons) Computer Science @ UoS. Google accredited Mobile Site professional.

Read More