cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-9365) Add support for 'vibrateWithPattern' to Windows Phone 8.1 / Windows 10
Date Thu, 03 Sep 2015 17:10:45 GMT

    [ https://issues.apache.org/jira/browse/CB-9365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14729403#comment-14729403
] 

ASF GitHub Bot commented on CB-9365:
------------------------------------

Github user robpaveza commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-vibration/pull/38#discussion_r38669919
  
    --- Diff: src/windows/VibrationProxy.js ---
    @@ -60,12 +61,43 @@ if (VibrationDevice) {
                     fail(e);
                 }
             }, 
    -        vibrateWithPattern: function(success, fail, args) {
    -            // TODO: Implement with setTimeout.
    -            fail('"vibrateWithPattern" is unsupported by this platform.');
    +        vibrateWithPattern: function (success, fail, args) {
    +            // Cancel current vibrations first
    +            module.exports.cancelVibration(function () {
    +                // Removes the first zero
    +                if (args[0] && args[0][0] === 0) {
    +                    args[0].shift(0);
    +                }
    +
    +                patternChainPromise = args[0].reduce(function (previousValue, currentValue,
index) {
    +                    if (index % 2 === 0) {
    +                        return previousValue.then(function () {
    +                            return new WinJS.Promise(function (complete, error) {
    +                                module.exports.vibrate(function () {}, function(err)
{
    +                                    console.error(err);
    +                                    error(err);
    +                                }, [currentValue]);
    +
    +                                setTimeout(function () {
    +                                    complete();
    +                                }, parseInt(currentValue, 10));
    +                            });
    +                        });
    +                    } else {
    +                        return previousValue.then(function () {
    +                            return new WinJS.Promise(function (complete) {
    +                                setTimeout(function () {
    +                                    complete();
    +                                }, parseInt(currentValue, 10));
    +                            });
    +                        });
    +                    }
    +                }, WinJS.Promise.as());
    +            }, fail);
             },
             cancelVibration: function(success, fail, args) {
                 try {
    +                patternChainPromise && patternChainPromise.cancel();
    --- End diff --
    
    If you're currently vibrating, will the vibration itself also be cancelled?  


> Add support for 'vibrateWithPattern' to Windows Phone 8.1 / Windows 10
> ----------------------------------------------------------------------
>
>                 Key: CB-9365
>                 URL: https://issues.apache.org/jira/browse/CB-9365
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Vibration
>            Reporter: Rob Paveza
>            Assignee: Sergey Shakhnazarov
>            Priority: Minor
>
> 'vibrateWithPattern' is supported by C# component in wp8, but needs to be migrated to
Windows Phone 8.1.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message