Skip to content

Commit 6d6dbb9

Browse files
author
zhenshuai
committed
- upgrade to Notify.js 2.x
- Notify.js requestPermission function has not onPermissionDefaultCallback, so add fork and modify
1 parent d09f8df commit 6d6dbb9

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-wt-genius",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"authors": [
55
"zhenshuai <[email protected]>"
66
],
@@ -15,6 +15,6 @@
1515
"gulpfile.js"
1616
],
1717
"dependencies": {
18-
"notify.js": "1.2.5"
18+
"notify.js": "[email protected]:zhenshuaiwws/notify.js.git"
1919
}
2020
}

src/wt-notify/wt-notify.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,21 @@
5151
notSetPermission : Notify.permissionLevel == 'default',
5252
checkPermission : function (onSuccess, onError, onThen) {
5353
//验证权限,设置开启与禁止
54-
var onSuccess = onSuccess || function () {
55-
};
56-
var onError = onError || function () {
57-
};
58-
var onThen = onThen || function () {
59-
};
6054
if (Notify.needsPermission) {
6155
Notify.requestPermission(function () {
6256
result.permissionLevel = 'granted';
6357
result.needsPermission = false;
64-
onSuccess();
58+
onSuccess && onSuccess();
6559
}, function () {
6660
result.permissionLevel = 'denied';
6761
result.needsPermission = true;
68-
onError();
62+
onError && onError();
63+
}, function () {
64+
result.notSetPermission = true;
6965
});
7066
} else {
7167
result.permissionLevel = 'granted';
72-
onSuccess();
68+
onSuccess && onSuccess();
7369
}
7470
result.notSetPermission = false;
7571
onThen();
@@ -80,7 +76,6 @@
8076
permissionLevel : Notify.permissionLevel
8177
};
8278
return result;
83-
}
84-
];
79+
}];
8580
}]);
8681
})();

0 commit comments

Comments
 (0)