How to use the babel/store/AppStore.subscribe function in babel

To help you get started, we’ve selected a few babel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / storymap-crowdsource / src / app / controllers / user / User.babel.js View on Github external
constructor () {

    // Autobind methods
    this.updateAppState = this.updateAppState.bind(this);
    this.initialLoad = this.initialLoad.bind(this);
    this.checkLoginStatus = this.checkLoginStatus.bind(this);
    this.loginWithOAuth = this.loginWithOAuth.bind(this);
    this.finishOAuthLogin = this.finishOAuthLogin.bind(this);
    this.verifyCredentials = this.verifyCredentials.bind(this);
    window.signInAfterOauth = this.signInAfterOauth = this.signInAfterOauth.bind(this);

    // Subscribe to state changes
    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);

  }
github Esri / storymap-crowdsource / src / app / controllers / layouts / sidePanel / SidePanelController.babel.js View on Github external
this.enable = this.enable.bind(this);
    this.disable = this.disable.bind(this);
    this.checkOverlayComponentVisibility = this.checkOverlayComponentVisibility.bind(this);
    this.updateAppState = this.updateAppState.bind(this);
    this.updateAppView = this.updateAppView.bind(this);
    this.refreshDisplay = this.refreshDisplay.bind(this);
    this.showIntro = this.showIntro.bind(this);
    this.hideIntro = this.hideIntro.bind(this);
    this.showMap = this.showMap.bind(this);
    this.showGallery = this.showGallery.bind(this);

    // Subscribe to state changes
    this.visibleComponents = [];

    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);
  }
github Esri / storymap-crowdsource / src / app / controllers / layouts / stacked / StackedController.babel.js View on Github external
this.enable = this.enable.bind(this);
    this.disable = this.disable.bind(this);
    this.checkOverlayComponentVisibility = this.checkOverlayComponentVisibility.bind(this);
    this.updateAppState = this.updateAppState.bind(this);
    this.updateAppView = this.updateAppView.bind(this);
    this.refreshDisplay = this.refreshDisplay.bind(this);
    this.showIntro = this.showIntro.bind(this);
    this.hideIntro = this.hideIntro.bind(this);
    this.showMap = this.showMap.bind(this);
    this.showGallery = this.showGallery.bind(this);

    // Subscribe to state changes
    this.visibleComponents = [];

    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);
  }
github Esri / storymap-crowdsource / src / app / controllers / builder / appItemAttachments / AppItemAttachments.babel.js View on Github external
constructor() {

    // Autobind methods
    this.updateAppState = this.updateAppState.bind(this);
    this.changeAttachments = this.changeAttachments.bind(this);
    this.uploadAttachment = this.uploadAttachment.bind(this);

    // Subscribe to state changes
    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);

    this.appItemAttatchments = [];
    this.prevIds = [];
  }
github Esri / storymap-crowdsource / src / app / controllers / contribute / ContrbuteController.babel.js View on Github external
constructor() {

    this.savingGraphic = false;

    // Autobind methods
    this.updateAppState = this.updateAppState.bind(this);
    this.checkContributeView = this.checkContributeView.bind(this);
    this.saveGraphic = this.saveGraphic.bind(this);
    this.finishSave = this.finishSave.bind(this);
    this.displayContributionShownAfterReviewMessage = this.displayContributionShownAfterReviewMessage.bind(this);
    this.displayContributeErrorMessage = this.displayContributeErrorMessage.bind(this);
    this.hideUncompleted = this.hideUncompleted.bind(this);

    // Subscribe to state changes
    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);
  }
github Esri / storymap-crowdsource / src / app / controllers / CrowdsourceController.babel.js View on Github external
constructor() {
    // Autobind methods
    this.updateAppState = this.updateAppState.bind(this);
    this.updatePageTitle = this.updatePageTitle.bind(this);
    this.createPortal = this.createPortal.bind(this);
    this.disableGlobalDragAndDrop = this.disableGlobalDragAndDrop.bind(this);

    // Subscribe to state changes
    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);

    const location = new URI(window.location);

    if (location.filename() !== 'index.html') {
      window.history.replaceState({},null,location.filename('index.html').href());
    }

    this.appMode = new AppMode();
    this.appConfig = new AppConfig();

    if (window.location.protocol === 'https:') {
      this.createPortal();
      this.layout = new Layout();
      this.user = new User();
      this.contrbuteController = new ContrbuteController();
    }
github Esri / storymap-crowdsource / src / app / controllers / CrowdsourceBuilderController.babel.js View on Github external
const defaults = {};

    this.settings = $.extend(true,{},defaults,options);

    // Autobind methods
    this.updateAppState = this.updateAppState.bind(this);
    this.createNewStory = this.createNewStory.bind(this);
    this.startSaving = this.startSaving.bind(this);
    this.finishSaving = this.finishSaving.bind(this);
    this.checkAppStateChange = this.checkAppStateChange.bind(this);
    this.checkAppShareChange = this.checkAppShareChange.bind(this);
    this.checkWebmapStateChange = this.checkWebmapStateChange.bind(this);

    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);

    // Load extra builder controllers
    new AppItemAttachments();
    new CrowdsourceReviewController();
    new ComponentsController();

    window.onbeforeunload = () => {
      if (!lang.getObject('appState.mode.fromScratch',false,this) && (this.lastSaveAppData || this.lastSaveWebmapData)
        && (lang.getObject('appState.builder.saving',false,this)
          || this.lastSaveAppData !== JSON.stringify(lang.getObject('appState.items.app',false,this)))) {
        return builderText.banner.hintText.leavingBeforeSave;
      }
    };
  }
github Esri / storymap-crowdsource / src / app / controllers / layouts / Layout.babel.js View on Github external
constructor() {

    // Autobind methods
    this.updateAppState = this.updateAppState.bind(this);

    this.layout = false;
    this.resizedViewer = false;
    this.mapShown = false;
    this.adminShown = false;
    this.layoutControllers = {};

    // Subscribe to state changes
    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);

    this.resizeViewer = function () {
      const height = $('.control-banner').height() || 0;

      $('.viewer').css({
        height: 'calc(100% - ' + height + 'px)'
      });
    };

    $(window).on('resize',this.resizeViewer);
  }
github Esri / storymap-crowdsource / src / app / controllers / builder / review / CrowdsourceReviewController.babel.js View on Github external
constructor() {

    // Autobind methods
    this.updateAppState = this.updateAppState.bind(this);
    this.editReviewedFeatures = this.editReviewedFeatures.bind(this);

    this.approved = JSON.stringify([]);
    this.rejected = JSON.stringify([]);

    // Subscribe to state changes
    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);
  }
github Esri / storymap-crowdsource / src / app / controllers / fromScratch / StoryCreator.babel.js View on Github external
// Autobind methods
    this.updateAppState = this.updateAppState.bind(this);
    this.saveOrgDefaults = this.saveOrgDefaults.bind(this);
    this.saveAppFromWebmapDefaults = this.saveAppFromWebmapDefaults.bind(this);
    this.saveAppFromScratchApp = this.saveAppFromScratchApp.bind(this);
    this.createFeatureService = this.createFeatureService.bind(this);
    this.createWebmap = this.createWebmap.bind(this);
    this.createApp = this.createApp.bind(this);
    this.saveApp = this.saveApp.bind(this);
    this.registerApp = this.registerApp.bind(this);
    this.redirectToEditor = this.redirectToEditor.bind(this);

    // Subscribe to state changes
    this.appState = AppStore.getState();
    this.updateAppState();
    this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);

    if (lang.getObject('appState.config.webmap',false,this)) {
      ArcgisItem.getDataById({
        id: lang.getObject('appState.config.webmap',false,this),
        item: 'webmap'
      });
    }

    this.openFirstDialog('betaMessage');

  }