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
import { Observable } from 'rxjs'; | |
const hasApi = 'geolocation' in navigator; | |
export const Geolocation = { | |
getCurrentPosition( | |
options: PositionOptions = {} | |
): Promise<GeolocationPosition> { | |
return new Promise((resolve, reject) => { | |
if (!hasApi) { |
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
<!DOCTYPE html> | |
<html lang="fr"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Bootstrap initiation</title> | |
<!-- Add here the link to Bootstrap --> |
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
/** | |
* Extends this class to make any class a temporary-cache-like class. | |
* | |
* Especially useful for Angular services, so that you can store any value in it from _e.g._ a component, | |
* and retrieve this stored value from another component. | |
* | |
* This is a generic class to which you can specify the type of data that this cache should accept. | |
*/ | |
export class CacheService<T> { |
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
import { Injectable } from '@angular/core'; | |
import { Connection, Session } from 'autobahn-browser'; | |
import { Observable, Observer, ReplaySubject } from 'rxjs'; | |
import { switchMap } from 'rxjs/operators'; | |
const wampUrl = '<YOUR_WAMP_SERVER_URL>'; | |
const wampRealm = '<YOUR_REALM_NAME>'; | |
@Injectable({ providedIn: 'root' }) | |
export class WampService { |
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
import { Injectable } from '@angular/core'; | |
import { Observable, Observer, ReplaySubject } from 'rxjs'; | |
import { map, switchMap } from 'rxjs/operators'; | |
const WS_SERVER_URL = '<YOUR_WEBSOCKET_URL>'; | |
@Injectable({ providedIn: 'root' }) | |
export class WebsocketService { | |
private ws$ = new ReplaySubject<WebSocket>(1); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" | |
content="IE=edge" /> | |
<meta name="viewport" | |
content="width=device-width, initial-scale=1" /> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
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
<!DOCTYPE html> | |
<html lang="fr"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Bootstrap initiation</title> | |
<!-- Add here the link to Bootstrap --> |
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
<!DOCTYPE html> | |
<html lang="fr"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Bootstrap initiation</title> | |
<!-- Add here the link to Bootstrap --> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Bootstrap initiation</title> | |
<!-- Add here the link to Bootstrap --> |
NewerOlder