Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/pebble-my-data.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbahbka <bahbka@gmail.com>2014-07-13 16:14:37 +0400
committerbahbka <bahbka@gmail.com>2014-07-13 16:14:37 +0400
commitcbcec67da07c688c46399053c7317107e3230b11 (patch)
tree41bb766f09f6e19ca12b31111dd0b357969f01bf
parent89e76572868b95d655ca709e3784af3cf5bbd516 (diff)
Truncate content if too big.
-rw-r--r--src/js/pebble-js-app.src.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/js/pebble-js-app.src.js b/src/js/pebble-js-app.src.js
index 4bbb9d8..30a03f8 100644
--- a/src/js/pebble-js-app.src.js
+++ b/src/js/pebble-js-app.src.js
@@ -15,6 +15,8 @@ var MSG = {
ERROR: 10
};
+var CONTENT_MAX_LENGTH = 900;
+
// default settings
var config = {
"config_location": false,
@@ -47,7 +49,9 @@ function http_request(url) {
//console.log("success: " + JSON.stringify(response));
response["msg_type"] = MSG.JSON_RESPONSE;
- //TODO truncate content bytes= bytes.substring(0, bytes.length-1);
+ if (response["content"] && response["content"].length > CONTENT_MAX_LENGTH) {
+ response["content"] = response["content"].substring(0, CONTENT_MAX_LENGTH);
+ }
Pebble.sendAppMessage(response);
@@ -60,7 +64,7 @@ function http_request(url) {
}
} catch(e) {
- console.log("json parse error");
+ console.log("json parse error " + e);
Pebble.sendAppMessage({ "msg_type": MSG.ERROR });
}