content: import React from 'react';
  import {NativeEventEmitter} from 'react-native';
  
  export default class ChartManager{
      constructor(){
          //class fields
          this.charts = []
          this.navigation = null
          this.filter = null
          this.update = 1
          
          //bind methods
          this.checkCharts = this.checkCharts.bind(this);
          this.buildChartsList = this.buildChartsList.bind(this);
          this.updateCharts = this.updateCharts.bind(this);
          this.sortCharts = this.sortCharts.bind(this);
          
          //listen to chart update emitter
          this.updateEmitter = new NativeEventEmitter();
          this.updateSubscription = this.updateEmitter.addListener('update-charts', this.checkCharts);
          this.updateSubscription = this.updateEmitter.addListener('sort-charts', this.sortCharts);
      }
  
      checkCharts(navigator, filter, affectedInputs, reload, callback){
          if(navigator != null){
              this.navigation = navigator;
          }
          if(filter != null){
              this.filter = filter;
          }
          if(this.charts.length == 0 || reload === true){
              //load charts from database first 
              this.charts = [];
              this.buildChartsList(() => {
                  if(typeof callback == 'function'){
                      callback();
                  }
              });
          }else{
              this.updateCharts(affectedInputs, callback);
          }
      }
  
      buildChartsList(callback){
          if(typeof callback == 'function'){
              callback();
          }
      }
      
      updateCharts(affectedInputs, callback){
          if(typeof callback == 'function'){
              callback();
          }
      }
  
      sortCharts(ids, callback){
          if(typeof callback == 'function'){
              callback();
          }
      }
  
      removeChart(id){
          let index = this.charts.map(a => a.id).indexOf(id);
          if(index >= 0){
              this.charts = this.charts.splice(index, 1);
          }
      }
  
      render(){return null}
  }