diff --git a/README.md b/README.md index 1088e02..72c94b7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ If you use SystemJS to load your files, you might have to update your config wit ```js System.config({ packages: { - "/ng2-scrollspy": {"defaultExtension": "js"} + "ng2-scrollspy": {"defaultExtension": "js"} } }); ``` @@ -35,6 +35,7 @@ It is recommended to instantiate `ScrollSpyService` in the bootstrap of your app If you add it to the "providers" property of a component it will instantiate a new instance of the service that won't be initialized. ```js +import {bootstrap} from '@angular/platform-browser-dynamic'; import {ScrollSpyService} from 'ng2-scrollspy'; bootstrap(AppComponent, [ diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..bab3469 --- /dev/null +++ b/index.ts @@ -0,0 +1,12 @@ +import {ScrollSpyService} from './src/core/service'; +import {ScrollSpyDirective} from './src/core/window.directive'; +import {ScrollSpyElementDirective} from './src/core/element.directive'; + +export * from './src/core/service'; +export * from './src/core/window.directive'; +export * from './src/core/element.directive'; + +export default { + directives: [ScrollSpyDirective, ScrollSpyElementDirective], + providers: [ScrollSpyService] +} diff --git a/package.json b/package.json index f0f647f..ec1744f 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "build": "rm -rf ./dist/ && rm -rf ./typings/ && ./node_modules/.bin/typings install && tsc -d", "semantic-release": "semantic-release pre && npm run build && npm publish && semantic-release post" }, - "main": "./dist/index.js", - "typings": "./dist/index.d.ts", + "main": "./index.js", + "typings": "./index.d.ts", "repository": { "type": "git", "url": "https://github.com/jonnybgod/ng2-scrollspy.git" diff --git a/tsconfig.json b/tsconfig.json index ab78e6a..f7ae31d 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,39 +1,39 @@ { - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": false, - "removeComments": true, - "noLib": false, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "sourceMap": false, - "pretty": true, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noImplicitAny": true, - "noImplicitReturns": false, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "outDir": "./dist" - }, - "files": [ - "typings/browser.d.ts", - "src/index.ts", - "src/core/element.directive.ts", - "src/core/service.spec.ts", - "src/core/service.ts", - "src/core/window.directive.ts", - "src/plugin/affix.directive.ts", - "src/plugin/affix.ts", - "src/plugin/index.directive.ts", - "src/plugin/index.render.directive.ts", - "src/plugin/index.service.spec.ts", - "src/plugin/index.service.ts", - "src/plugin/index.ts", - "src/plugin/infinite.directive.ts", - "src/plugin/infinite.ts", - "src/plugin/parallax.directive.ts", - "src/plugin/parallax.ts" - ] + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "declaration": false, + "removeComments": true, + "noLib": false, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "sourceMap": false, + "pretty": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "noImplicitAny": true, + "noImplicitReturns": false, + "noImplicitUseStrict": false, + "noFallthroughCasesInSwitch": true + }, + "files": [ + "typings/browser.d.ts", + "index.ts", + "src/core/element.directive.ts", + "src/core/service.spec.ts", + "src/core/service.ts", + "src/core/window.directive.ts", + "src/plugin/affix.directive.ts", + "src/plugin/affix.ts", + "src/plugin/index.directive.ts", + "src/plugin/index.render.directive.ts", + "src/plugin/index.service.spec.ts", + "src/plugin/index.service.ts", + "src/plugin/index.ts", + "src/plugin/infinite.directive.ts", + "src/plugin/infinite.ts", + "src/plugin/parallax.directive.ts", + "src/plugin/parallax.ts" + ], + "compileOnSave": false } \ No newline at end of file