code-push login
code-push logout
code-push whoami
import {Injectable} from '@angular/core'; | |
import {Cache} from '../utils/storage.provider'; // Decorator to access local storage | |
let OneSignal; | |
const url = ''; | |
@Injectable() | |
export class OneSignalService { | |
@Cache({pool: 'OneSignal'}) oneSignalInit; // to check if OneSignal is already initialized. |
axios({ | |
url: 'http://localhost:5000/static/example.pdf', | |
method: 'GET', | |
responseType: 'blob', // important | |
}).then((response) => { | |
const url = window.URL.createObjectURL(new Blob([response.data])); | |
const link = document.createElement('a'); | |
link.href = url; | |
link.setAttribute('download', 'file.pdf'); | |
document.body.appendChild(link); |
To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.
Create a folder, run npm init -f
on it and paste both server.js
and client.js
there (see files below). Needless to say, you must have Node.js installed on your system.
Install the required libraries:
#!/bin/bash | |
# NOTE: The commands here only applicable for Ubuntu 16.04 Xenial, do not use it for other distros | |
# Update server to latest packages | |
sudo apt update && sudo apt upgrade -y | |
# Install nginx and git | |
sudo apt install -y nginx git |
// Feeds model after cache | |
import DB from '../db'; | |
import CacheService from '../cache.service'; | |
const ttl = 60 * 60 * 1; // cache for 1 Hour | |
const cache = new CacheService(ttl); // Create a new cache service instance | |
const FeedModel = { |
// Feeds model after cache | |
import DB from '../db'; | |
import CacheService from '../cache.service'; | |
const ttl = 60 * 60 * 1; // cache for 1 Hour | |
const cache = new CacheService(ttl); // Create a new cache service instance | |
const FeedModel = { | |
// ... |
// Initializing cache service in feeds model | |
import DB from '../db'; | |
import CacheService from '../cache.service'; | |
const ttl = 60 * 60 * 1; // cache for 1 Hour | |
const cache = new CacheService(ttl); // Create a new cache service instance | |
const FeedModel = { | |
... |
import NodeCache from 'node-cache'; | |
class Cache { | |
constructor(ttlSeconds) { | |
this.cache = new NodeCache({ stdTTL: ttlSeconds, checkperiod: ttlSeconds * 0.2, useClones: false }); | |
} | |
get(key, storeFunction) { | |
const value = this.cache.get(key); |
# location of keystore | |
storeFile=/path/to/app.keystore | |
# Key alias | |
keyAlias=alias_name | |
# Store password | |
storePassword=Password1 | |
# Key password |