This file contains hidden or 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, Inject } from '@angular/core'; | |
import { ReplaySubject, Observable, forkJoin } from 'rxjs'; | |
import { DOCUMENT } from '@angular/common'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class RemoteLibraryService { | |
// Ref.: https://codeburst.io/lazy-loading-external-javascript-libraries-in-angular-3d86ada54ec7 |
This file contains hidden or 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
// jshint esversion: 6 | |
/** | |
* El comentario jshint es para indicar al parser de javascript del editor que se utilizarán | |
* características de ES6 (EcmaScript 6), como funciones de flecha, const, let, y otros. | |
*/ | |
/** | |
* Requeridos para poder definir la API | |
* - express: permite definir los endpoints de la aplicación | |
* - cors: permite que los endpoints de la API sean accesibles desde servidores externos |
This file contains hidden or 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" /> | |
<title>Ionic App</title> | |
<base href="/" /> | |
<meta | |
name="viewport" |
This file contains hidden or 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
<script> | |
//... | |
function showIosInstall() { | |
let iosPrompt = document.querySelector(".ios-prompt"); | |
iosPrompt.style.display = "block"; | |
iosPrompt.addEventListener("click", () => { | |
iosPrompt.style.display = "none"; | |
}); | |
} |
This file contains hidden or 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
<script> | |
//... | |
// Detects if device is on iOS | |
const isIos = () => { | |
const userAgent = window.navigator.userAgent.toLowerCase(); | |
return /iphone|ipad|ipod/.test( userAgent ); | |
} | |
// Detects if device is in standalone mode | |
const isInStandaloneMode = () => ('standalone' in window.navigator) && (window.navigator.standalone); |
This file contains hidden or 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" /> | |
<title>Ionic App</title> | |
<base href="/" /> | |
<meta | |
name="viewport" |
This file contains hidden or 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
<script type="text/javascript"> | |
// ... | |
// Ref. https://developers.google.com/web/fundamentals/app-install-banners/ | |
function addToHomeScreen() { | |
let a2hsBtn = document.querySelector(".ad2hs-prompt"); // hide our user interface that shows our A2HS button | |
a2hsBtn.style.display = 'none'; // Show the prompt | |
deferredPrompt.prompt(); // Wait for the user to respond to the prompt | |
deferredPrompt.userChoice |
This file contains hidden or 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" /> | |
<title>Ionic App</title> | |
<base href="/" /> | |
<meta | |
name="viewport" |
This file contains hidden or 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
/** | |
* Check out https://googlechromelabs.github.io/sw-toolbox/ for | |
* more info on how to use sw-toolbox to custom configure your service worker. | |
*/ | |
'use strict'; | |
importScripts('./bower_components/sw-toolbox/sw-toolbox.js'); | |
self.toolbox.options.cache = { |
This file contains hidden or 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
{ | |
"name": "Ionic", | |
"short_name": "Ionic", | |
"start_url": "index.html", | |
"display": "standalone", | |
"icons": [{ | |
"src": "assets/imgs/logo-512x512.png", | |
"sizes": "512x512", | |
"type": "image/png" | |
}, |