【文件属性】:
文件名称:angular-q-timeout:将 .timeout 方法添加到 $q 服务返回的承诺中
文件大小:10KB
文件格式:ZIP
更新时间:2021-06-25 09:07:07
JavaScript
角-q-超时
向 Angular $q 服务返回的承诺添加 .timeout 方法
,
例子
// module('my module', ['ng-q-timeout'])
foo ( )
. timeout ( 100 , function ( defer ) {
defer . reject ( 'foo timed out' ) ;
// probably run $scope.$apply here too
} )
. then ( function ( ) {
// foo has finished ok
} , function ( msg ) {
// foo has failed or timed out.
} ) ;
受到启发,我决定为服务返回的 promises 添加超时方法。
安装
bower install ng-q-timeout
在 a
【文件预览】:
angular-q-timeout-master
----.travis.yml(171B)
----LICENSE-MIT(1KB)
----package.json(2KB)
----test()
--------ng-q-timeout-spec.js(3KB)
----index.html(1KB)
----Gruntfile.js(2KB)
----.gitignore(50B)
----karma.conf.js(2KB)
----README.md(4KB)
----.jshintrc(2KB)
----bower.json(675B)
----ng-q-timeout.js(1011B)