Angular Poller 项目教程
1. 项目的目录结构及介绍
angular-poller/
├── Gruntfile.js
├── LICENSE.md
├── README.md
├── angular-poller.js
├── angular-poller.min.js
├── bower.json
├── index.js
├── karma.conf.js
├── package.json
└── test/
├── bowerrc
├── editorconfig
├── gitignore
├── jscsrc
├── jshintrc
├── npmignore
├── travis.yml
└── Gruntfile.js
Gruntfile.js
: Grunt 任务配置文件。LICENSE.md
: 项目许可证文件。README.md
: 项目说明文档。angular-poller.js
: 项目主文件。angular-poller.min.js
: 项目主文件的压缩版本。bower.json
: Bower 包管理配置文件。index.js
: 项目入口文件。karma.conf.js
: Karma 测试配置文件。package.json
: npm 包管理配置文件。test/
: 测试文件目录。
2. 项目的启动文件介绍
项目的启动文件是 index.js
。这个文件是 Angular Poller 项目的入口点,负责初始化和配置 Angular 模块。
// index.js
angular.module('emguo.poller', [])
.provider('poller', require('./angular-poller'));
3. 项目的配置文件介绍
bower.json
bower.json
文件用于 Bower 包管理,定义了项目的名称、版本、依赖等信息。
{
"name": "angular-poller",
"version": "0.4.5",
"description": "Lightweight AngularJS poller service which can be easily injected into controllers.",
"main": "angular-poller.js",
"keywords": [
"angular",
"poller",
"service",
"resource",
"http",
"restangular"
],
"authors": [
"Emma Guo"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "~1.2.0"
}
}
package.json
package.json
文件用于 npm 包管理,定义了项目的名称、版本、依赖等信息。
{
"name": "angular-poller",
"version": "0.4.5",
"description": "Lightweight AngularJS poller service which can be easily injected into controllers.",
"main": "angular-poller.js",
"scripts": {
"test": "karma start karma.conf.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/emmaguo/angular-poller.git"
},
"keywords": [
"angular",
"poller",
"service",
"resource",
"http",
"restangular"
],
"author": "Emma Guo",
"license": "MIT",
"bugs": {
"url": "https://github.com/emmaguo/angular-poller/issues"
},
"homepage": "https://github.com/emmaguo/angular-poller#readme",
"devDependencies": {
"angular": "~1.2.0",
"angular-mocks": "~1.2.0",
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.9.0",
"grunt-karma": "^0.10.1",
"jasmine-core": "^2.2.0",
"karma": "^0.12.31",
"karma-jasmine": "^0.3.