Skip to content

Commit

Permalink
Rejig send message args
Browse files Browse the repository at this point in the history
  • Loading branch information
leecrossley committed Mar 10, 2015
1 parent adab052 commit 28b95f3
Showing 3 changed files with 9 additions and 15 deletions.
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ Sends a message object to a specific queue (must be called after successful init
Used to send strings or json objects to the Apple Watch extension.

```js
applewatch.sendMessage(successHandler, errorHandler, message, queueName);
applewatch.sendMessage(message, queueName, successHandler, errorHandler);
```

### handleMessage
@@ -55,21 +55,15 @@ Basic example to send a message "test" to the "default" queue and get handled.
This example is iPhone -> iPhone.

```
var onMessageReceived = function (message) {
alert("Message received: " + message);
};
var onInit = function (appGroupId) {
applewatch.init(function (appGroupId) {
alert(appGroupId);
applewatch.handleMessage(onMessageReceived);
setTimeout(function() {
applewatch.sendMessage(null, null, "test");
}, 1000)
};
applewatch.handleMessage(function(message) {
alert("Message received: " + message);
});
applewatch.init(onInit);
applewatch.sendMessage("test");
});
```

## Platforms
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<plugin id="uk.co.ilee.applewatch" version="0.0.3" xmlns="http://apache.org/cordova/ns/plugins/1.0">
<plugin id="uk.co.ilee.applewatch" version="0.1.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>Apple Watch</name>
<author>Lee Crossley (http://ilee.co.uk/)</author>
<description>Cordova / PhoneGap Plugin for the Apple Watch (WatchKit) to allow json object
2 changes: 1 addition & 1 deletion www/applewatch.js
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ AppleWatch.prototype.init = function (onSuccess, onError, appGroupId) {
}]);
};

AppleWatch.prototype.sendMessage = function (onSuccess, onError, message, queueName) {
AppleWatch.prototype.sendMessage = function (message, queueName, onSuccess, onError) {
queueName = queueName || "default";
message = message || "";

0 comments on commit 28b95f3

Please sign in to comment.