nicer let syntax for fb

This commit is contained in:
peter
2019-08-14 01:13:49 +02:00
parent b706e36b49
commit fed2b455ce
4 changed files with 81 additions and 106 deletions
@@ -3,11 +3,7 @@ import { FrontblockApiConf } from 'frontblock';
import { SubscriptionResponse, parseResponse, SuccessResponse } from 'frontblock-generic/Types.js';
import { environment } from "../../environments/environment"
let fb
if(environment.production){
fb = window["fb"]
}else{
fb = {
const fb = environment.production?window["fb"]:{
ApiClient : {
setConfig: async () => {
await new Promise((resolve, reject) => {
@@ -32,8 +28,6 @@ if(environment.production){
},
unsubscribe: (uid) => new SuccessResponse(),
quit: (uid) => new SuccessResponse()
}
}
}
@Component({
@@ -1,23 +1,19 @@
import { Component, OnInit } from '@angular/core';
import { fbind } from 'q';
import { FrontblockApiConf } from 'frontblock';
import { environment } from "../../environments/environment"
let fb
if(environment.production){
fb = window["fb"]
}else{
fb = {
const fb = environment.production ? window["fb"] : {
ApiClient: {
setConfig: async () => {
await new Promise((resolve, reject) => {
setTimeout(() => {
resolve('Promise A win!');
}, 500)
})}
})
}
}
}
@Component({
selector: 'settings',
template: `
@@ -1,14 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { fbind } from 'q';
import { FrontblockApiConf } from 'frontblock';
import { SubscriptionResponse, SuccessResponse, ErrorResponse, parseResponse } from 'frontblock-generic/Types.js';
import { SubscriptionResponse, SuccessResponse, parseResponse } from 'frontblock-generic/Types.js';
import { environment } from "../../environments/environment"
let fb
if(environment.production){
fb = window["fb"]
}else{
fb = {
const fb = environment.production ? window["fb"] : {
ApiClient: {
setConfig: async () => {
await new Promise((resolve, reject) => {
@@ -33,8 +28,6 @@ if(environment.production){
},
unsubscribe: (uid) => new SuccessResponse(),
quit: (uid) => new SuccessResponse()
}
}
}
@@ -36,26 +36,18 @@ SystemJS.config({ meta: { '*': { authorization: true } } });
/** --------- */
import { AfterViewInit, Component, Input, ViewChild } from '@angular/core';
import { AfterViewInit, Component } from '@angular/core';
import { SidebarComponent } from '../sidebar/sidebar.component';
import { Router } from '@angular/router';
import { FrontendPlugin, SidebarEntries, SidebarEntry } from "frontblock-generic/Plugin"
import { SidebarEntryService } from '../sidebar-entry-service.service';
import { environment } from "../../environments/environment"
let fb
if(environment.production){
fb = window["fb"]
}else{
fb = {
const fb = environment.production ? window["fb"] : {
PluginManager: {
getLoadedPluginNames: () => ["ApiClient", "PluginManager"]
}
}
}
@Component({
selector: 'dynamic-loader',