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 { RESPONSE, REQUEST } from '@nguniversal/express-engine/tokens'; | |
import { renderModuleFactory } from '@angular/platform-server'; | |
// These are important and needed before anything else | |
import 'zone.js/dist/zone-node'; | |
import 'reflect-metadata'; | |
import { enableProdMode, ValueProvider, FactoryProvider } from '@angular/core'; | |
// Import module map for lazy loading | |
import {provideModuleMap} from '@nguniversal/module-map-ngfactory-loader'; | |
import { registerLocaleData } from '@angular/common'; |
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
// add this code to your server.ts | |
// implementation credits: https://gist.github.com/paulirish/1579671 | |
global['requestAnimationFrame'] = function(callback, element) { | |
let lastTime = 0; | |
const currTime = new Date().getTime(); | |
const timeToCall = Math.max(0, 16 - (currTime - lastTime)); | |
const id = setTimeout(function() { callback(currTime + timeToCall); }, | |
timeToCall); | |
lastTime = currTime + timeToCall; |