Skip to content

Commit 2d41c74

Browse files
committed
Initial commit (library and example code)
1 parent 9c40651 commit 2d41c74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+13184
-2
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
9+
10+
# dependencies
11+
/node_modules
12+
13+
# profiling files
14+
chrome-profiler-events*.json
15+
speed-measure-plugin*.json
16+
17+
# IDEs and editors
18+
/.idea
19+
.project
20+
.classpath
21+
.c9/
22+
*.launch
23+
.settings/
24+
*.sublime-workspace
25+
26+
# IDE - VSCode
27+
.vscode/*
28+
!.vscode/settings.json
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
31+
!.vscode/extensions.json
32+
.history/*
33+
34+
# misc
35+
/.sass-cache
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
npm-debug.log
40+
yarn-error.log
41+
testem.log
42+
/typings
43+
44+
# System Files
45+
.DS_Store
46+
Thumbs.db

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# ng-lazy-script
2-
Load external javascript libraries/files on the fly and execute code as soon as its loaded
1+
# NgLazyScript
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.6.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

angular.json

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"ng-lazy-script": {
7+
"projectType": "library",
8+
"root": "projects/ng-lazy-script",
9+
"sourceRoot": "projects/ng-lazy-script/src",
10+
"prefix": "lib",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-ng-packagr:build",
14+
"options": {
15+
"tsConfig": "projects/ng-lazy-script/tsconfig.lib.json",
16+
"project": "projects/ng-lazy-script/ng-package.json"
17+
}
18+
},
19+
"test": {
20+
"builder": "@angular-devkit/build-angular:karma",
21+
"options": {
22+
"main": "projects/ng-lazy-script/src/test.ts",
23+
"tsConfig": "projects/ng-lazy-script/tsconfig.spec.json",
24+
"karmaConfig": "projects/ng-lazy-script/karma.conf.js"
25+
}
26+
},
27+
"lint": {
28+
"builder": "@angular-devkit/build-angular:tslint",
29+
"options": {
30+
"tsConfig": [
31+
"projects/ng-lazy-script/tsconfig.lib.json",
32+
"projects/ng-lazy-script/tsconfig.spec.json"
33+
],
34+
"exclude": [
35+
"**/node_modules/**"
36+
]
37+
}
38+
}
39+
}
40+
},
41+
"ng-lazy-script-example": {
42+
"projectType": "application",
43+
"schematics": {
44+
"@schematics/angular:component": {
45+
"style": "scss"
46+
}
47+
},
48+
"root": "projects/ng-lazy-script-example",
49+
"sourceRoot": "projects/ng-lazy-script-example/src",
50+
"prefix": "app",
51+
"architect": {
52+
"build": {
53+
"builder": "@angular-devkit/build-angular:browser",
54+
"options": {
55+
"outputPath": "dist/ng-lazy-script-example",
56+
"index": "projects/ng-lazy-script-example/src/index.html",
57+
"main": "projects/ng-lazy-script-example/src/main.ts",
58+
"polyfills": "projects/ng-lazy-script-example/src/polyfills.ts",
59+
"tsConfig": "projects/ng-lazy-script-example/tsconfig.app.json",
60+
"aot": false,
61+
"assets": [
62+
"projects/ng-lazy-script-example/src/favicon.ico",
63+
"projects/ng-lazy-script-example/src/assets"
64+
],
65+
"styles": [
66+
"projects/ng-lazy-script-example/src/styles.scss"
67+
],
68+
"scripts": []
69+
},
70+
"configurations": {
71+
"production": {
72+
"fileReplacements": [
73+
{
74+
"replace": "projects/ng-lazy-script-example/src/environments/environment.ts",
75+
"with": "projects/ng-lazy-script-example/src/environments/environment.prod.ts"
76+
}
77+
],
78+
"optimization": true,
79+
"outputHashing": "all",
80+
"sourceMap": false,
81+
"extractCss": true,
82+
"namedChunks": false,
83+
"aot": true,
84+
"extractLicenses": true,
85+
"vendorChunk": false,
86+
"buildOptimizer": true,
87+
"budgets": [
88+
{
89+
"type": "initial",
90+
"maximumWarning": "2mb",
91+
"maximumError": "5mb"
92+
},
93+
{
94+
"type": "anyComponentStyle",
95+
"maximumWarning": "6kb",
96+
"maximumError": "10kb"
97+
}
98+
]
99+
}
100+
}
101+
},
102+
"serve": {
103+
"builder": "@angular-devkit/build-angular:dev-server",
104+
"options": {
105+
"browserTarget": "ng-lazy-script-example:build"
106+
},
107+
"configurations": {
108+
"production": {
109+
"browserTarget": "ng-lazy-script-example:build:production"
110+
}
111+
}
112+
},
113+
"extract-i18n": {
114+
"builder": "@angular-devkit/build-angular:extract-i18n",
115+
"options": {
116+
"browserTarget": "ng-lazy-script-example:build"
117+
}
118+
},
119+
"test": {
120+
"builder": "@angular-devkit/build-angular:karma",
121+
"options": {
122+
"main": "projects/ng-lazy-script-example/src/test.ts",
123+
"polyfills": "projects/ng-lazy-script-example/src/polyfills.ts",
124+
"tsConfig": "projects/ng-lazy-script-example/tsconfig.spec.json",
125+
"karmaConfig": "projects/ng-lazy-script-example/karma.conf.js",
126+
"assets": [
127+
"projects/ng-lazy-script-example/src/favicon.ico",
128+
"projects/ng-lazy-script-example/src/assets"
129+
],
130+
"styles": [
131+
"projects/ng-lazy-script-example/src/styles.scss"
132+
],
133+
"scripts": []
134+
}
135+
},
136+
"lint": {
137+
"builder": "@angular-devkit/build-angular:tslint",
138+
"options": {
139+
"tsConfig": [
140+
"projects/ng-lazy-script-example/tsconfig.app.json",
141+
"projects/ng-lazy-script-example/tsconfig.spec.json",
142+
"projects/ng-lazy-script-example/e2e/tsconfig.json"
143+
],
144+
"exclude": [
145+
"**/node_modules/**"
146+
]
147+
}
148+
},
149+
"e2e": {
150+
"builder": "@angular-devkit/build-angular:protractor",
151+
"options": {
152+
"protractorConfig": "projects/ng-lazy-script-example/e2e/protractor.conf.js",
153+
"devServerTarget": "ng-lazy-script-example:serve"
154+
},
155+
"configurations": {
156+
"production": {
157+
"devServerTarget": "ng-lazy-script-example:serve:production"
158+
}
159+
}
160+
}
161+
}
162+
}},
163+
"defaultProject": "ng-lazy-script"
164+
}

external-scripts/example-script.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function ColorUtil(elementId) {
2+
this.elementID = elementId;
3+
}
4+
5+
ColorUtil.prototype.changeBackgroundColor = function(colorCode) {
6+
document.getElementById(this.elementID).style.backgroundColor = colorCode;
7+
};

0 commit comments

Comments
 (0)