浏览代码

more robust error handling

master
mort 8 年前
父节点
当前提交
fdfe627445
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 7
    2
      client.js
  2. 1
    1
      package.json

+ 7
- 2
client.js 查看文件

@@ -20,6 +20,10 @@
xhr.addEventListener("error", function(err) {
cb(err);
});
xhr.addEventListener("abort", function(err) {
console.log("Aborted.");
cb(err);
});

xhr.open("POST", url);
xhr.send();
@@ -59,9 +63,10 @@
}

function await() {
console.log("await...");
post("/webevents/await/"+key, function(err, res) {
console.log("Await done,", err ? "with errors" : "no errors");
if (err) {
console.log("Await done, with errors");
}

// Retry on error
if (err === "ENOTREGISTERED") {

+ 1
- 1
package.json 查看文件

@@ -1,6 +1,6 @@
{
"name": "webevents",
"version": "1.1.1",
"version": "1.1.2",
"description": "A simple library for sending events from the server to the client.",
"main": "index.js",
"scripts": {

正在加载...
取消
保存