Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add .editorconfig to control some of IDE settings * Change indent-size to 2 instead of 4
- Loading branch information
Showing
6 changed files
with
117 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ ng2-lint.json | |
|
||
# Other | ||
.travis.yml | ||
.editorconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import { | ||
Injectable, | ||
Optional, | ||
Injectable, | ||
Optional, | ||
} from '@angular/core'; | ||
import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | ||
import { Observable } from 'rxjs/Observable'; | ||
|
||
@Injectable() | ||
export class RecaptchaLoaderService { | ||
/** @internal */ | ||
private _language: string; | ||
/** @internal */ | ||
private static _ready: BehaviorSubject<ReCaptchaV2.ReCaptcha>; | ||
public ready: Observable<ReCaptchaV2.ReCaptcha>; | ||
/** @internal */ | ||
private _language: string; | ||
/** @internal */ | ||
private static _ready: BehaviorSubject<ReCaptchaV2.ReCaptcha>; | ||
public ready: Observable<ReCaptchaV2.ReCaptcha>; | ||
|
||
constructor(@Optional() language?: string) { | ||
this._language = language; | ||
this._init(); | ||
this.ready = RecaptchaLoaderService._ready.asObservable(); | ||
} | ||
constructor( @Optional() language?: string) { | ||
this._language = language; | ||
this._init(); | ||
this.ready = RecaptchaLoaderService._ready.asObservable(); | ||
} | ||
|
||
/** @internal */ | ||
private _init() { | ||
if (RecaptchaLoaderService._ready) { | ||
return; | ||
} | ||
window.ng2recaptchaloaded = () => { | ||
RecaptchaLoaderService._ready.next(grecaptcha); | ||
}; | ||
RecaptchaLoaderService._ready = new BehaviorSubject<ReCaptchaV2.ReCaptcha>(null); | ||
let head = <HTMLHeadElement> document.head; | ||
let script = <HTMLScriptElement>document.createElement('script'); | ||
script.innerHTML = ''; | ||
script.src = 'https://www.google.com/recaptcha/api.js?render=explicit&onload=ng2recaptchaloaded' + (this._language ? '&hl=' + this._language : ''); | ||
script.async = true; | ||
script.defer = true; | ||
head.appendChild(script); | ||
/** @internal */ | ||
private _init() { | ||
if (RecaptchaLoaderService._ready) { | ||
return; | ||
} | ||
window.ng2recaptchaloaded = () => { | ||
RecaptchaLoaderService._ready.next(grecaptcha); | ||
}; | ||
RecaptchaLoaderService._ready = new BehaviorSubject<ReCaptchaV2.ReCaptcha>(null); | ||
let head = <HTMLHeadElement>document.head; | ||
let script = <HTMLScriptElement>document.createElement('script'); | ||
script.innerHTML = ''; | ||
script.src = 'https://www.google.com/recaptcha/api.js?render=explicit&onload=ng2recaptchaloaded' + (this._language ? '&hl=' + this._language : ''); | ||
script.async = true; | ||
script.defer = true; | ||
head.appendChild(script); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
interface Window { | ||
ng2recaptchaloaded: () => void; | ||
ng2recaptchaloaded: () => void; | ||
} |