Skip to content

Commit d09f8df

Browse files
committed
upgrade
1 parent 2712a4b commit d09f8df

File tree

3 files changed

+95
-97
lines changed

3 files changed

+95
-97
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-wt-genius",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"authors": [
55
"zhenshuai <[email protected]>"
66
],

dist/angular-wt-genius.js

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -29,60 +29,59 @@ angular.module('wt.genius', []);
2929
this.config = function (value) {
3030
configOptions = value;
3131
};
32-
this.$get = ['$http', '$document', '$compile', '$rootScope', '$controller', '$templateCache', '$q', '$injector', '$position', '$timeout',
33-
function ($http, $document, $compile, $rootScope, $controller, $templateCache, $q, $injector, $position, $timeout) {
34-
var result;
32+
this.$get = [function () {
33+
var result;
3534

36-
function _notify(p) {
37-
var options = this.options = angular.extend({}, defaults, configOptions, p);
38-
var myNotify = new Notify(options.title, options);
39-
if (Notify.needsPermission) {
40-
Notify.requestPermission(function () {
41-
myNotify.show();
42-
});
43-
} else {
35+
function _notify(p) {
36+
var options = this.options = angular.extend({}, defaults, configOptions, p);
37+
var myNotify = new Notify(options.title, options);
38+
if (Notify.needsPermission) {
39+
Notify.requestPermission(function () {
4440
myNotify.show();
45-
}
41+
});
42+
} else {
43+
myNotify.show();
4644
}
45+
}
4746

48-
result = {
49-
notify : function (p) {
50-
//初始化,默认去验证权限
51-
return new _notify(p);
52-
},
53-
notSetPermission : Notify.permissionLevel == 'default',
54-
checkPermission : function (onSuccess, onError, onThen) {
55-
//验证权限,设置开启与禁止
56-
var onSuccess = onSuccess || function () {
57-
};
58-
var onError = onError || function () {
59-
};
60-
var onThen = onThen || function () {
61-
};
62-
if (Notify.needsPermission) {
63-
Notify.requestPermission(function () {
64-
result.permissionLevel = 'granted';
65-
result.needsPermission = false;
66-
onSuccess();
67-
}, function () {
68-
result.permissionLevel = 'denied';
69-
result.needsPermission = true;
70-
onError();
71-
});
72-
} else {
47+
result = {
48+
notify : function (p) {
49+
//初始化,默认去验证权限
50+
return new _notify(p);
51+
},
52+
notSetPermission : Notify.permissionLevel == 'default',
53+
checkPermission : function (onSuccess, onError, onThen) {
54+
//验证权限,设置开启与禁止
55+
var onSuccess = onSuccess || function () {
56+
};
57+
var onError = onError || function () {
58+
};
59+
var onThen = onThen || function () {
60+
};
61+
if (Notify.needsPermission) {
62+
Notify.requestPermission(function () {
7363
result.permissionLevel = 'granted';
64+
result.needsPermission = false;
7465
onSuccess();
75-
}
76-
result.notSetPermission = false;
77-
onThen();
78-
},
79-
needsPermission : Notify.needsPermission,
80-
requestPermission: Notify.requestPermission,
81-
isSupported : Notify.isSupported,
82-
permissionLevel : Notify.permissionLevel
83-
};
84-
return result;
85-
}
66+
}, function () {
67+
result.permissionLevel = 'denied';
68+
result.needsPermission = true;
69+
onError();
70+
});
71+
} else {
72+
result.permissionLevel = 'granted';
73+
onSuccess();
74+
}
75+
result.notSetPermission = false;
76+
onThen();
77+
},
78+
needsPermission : Notify.needsPermission,
79+
requestPermission: Notify.requestPermission,
80+
isSupported : Notify.isSupported,
81+
permissionLevel : Notify.permissionLevel
82+
};
83+
return result;
84+
}
8685
];
8786
}]);
8887
})();

src/wt-notify/wt-notify.js

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,59 @@
2828
this.config = function (value) {
2929
configOptions = value;
3030
};
31-
this.$get = ['$http', '$document', '$compile', '$rootScope', '$controller', '$templateCache', '$q', '$injector', '$position', '$timeout',
32-
function ($http, $document, $compile, $rootScope, $controller, $templateCache, $q, $injector, $position, $timeout) {
33-
var result;
31+
this.$get = [function () {
32+
var result;
3433

35-
function _notify(p) {
36-
var options = this.options = angular.extend({}, defaults, configOptions, p);
37-
var myNotify = new Notify(options.title, options);
38-
if (Notify.needsPermission) {
39-
Notify.requestPermission(function () {
40-
myNotify.show();
41-
});
42-
} else {
34+
function _notify(p) {
35+
var options = this.options = angular.extend({}, defaults, configOptions, p);
36+
var myNotify = new Notify(options.title, options);
37+
if (Notify.needsPermission) {
38+
Notify.requestPermission(function () {
4339
myNotify.show();
44-
}
40+
});
41+
} else {
42+
myNotify.show();
4543
}
44+
}
4645

47-
result = {
48-
notify : function (p) {
49-
//初始化,默认去验证权限
50-
return new _notify(p);
51-
},
52-
notSetPermission : Notify.permissionLevel == 'default',
53-
checkPermission : function (onSuccess, onError, onThen) {
54-
//验证权限,设置开启与禁止
55-
var onSuccess = onSuccess || function () {
56-
};
57-
var onError = onError || function () {
58-
};
59-
var onThen = onThen || function () {
60-
};
61-
if (Notify.needsPermission) {
62-
Notify.requestPermission(function () {
63-
result.permissionLevel = 'granted';
64-
result.needsPermission = false;
65-
onSuccess();
66-
}, function () {
67-
result.permissionLevel = 'denied';
68-
result.needsPermission = true;
69-
onError();
70-
});
71-
} else {
46+
result = {
47+
notify : function (p) {
48+
//初始化,默认去验证权限
49+
return new _notify(p);
50+
},
51+
notSetPermission : Notify.permissionLevel == 'default',
52+
checkPermission : function (onSuccess, onError, onThen) {
53+
//验证权限,设置开启与禁止
54+
var onSuccess = onSuccess || function () {
55+
};
56+
var onError = onError || function () {
57+
};
58+
var onThen = onThen || function () {
59+
};
60+
if (Notify.needsPermission) {
61+
Notify.requestPermission(function () {
7262
result.permissionLevel = 'granted';
63+
result.needsPermission = false;
7364
onSuccess();
74-
}
75-
result.notSetPermission = false;
76-
onThen();
77-
},
78-
needsPermission : Notify.needsPermission,
79-
requestPermission: Notify.requestPermission,
80-
isSupported : Notify.isSupported,
81-
permissionLevel : Notify.permissionLevel
82-
};
83-
return result;
84-
}
65+
}, function () {
66+
result.permissionLevel = 'denied';
67+
result.needsPermission = true;
68+
onError();
69+
});
70+
} else {
71+
result.permissionLevel = 'granted';
72+
onSuccess();
73+
}
74+
result.notSetPermission = false;
75+
onThen();
76+
},
77+
needsPermission : Notify.needsPermission,
78+
requestPermission: Notify.requestPermission,
79+
isSupported : Notify.isSupported,
80+
permissionLevel : Notify.permissionLevel
81+
};
82+
return result;
83+
}
8584
];
8685
}]);
8786
})();

0 commit comments

Comments
 (0)