How to use the dojo/topic.subscribe function in dojo

To help you get started, we’ve selected a few dojo 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-cascade / src / app / storymaps / tpl / builder / mediaPicker / MediaPicker.jsx View on Github external
import Deferred from 'dojo/Deferred';

var store = createStore(reducer, window.devToolsExtension ? window.devToolsExtension() : {});
var _resultDeferred;

// The event is fired in GalleryItem.jsx and end the media picking workflow
topic.subscribe('MEDIA-PICKER-SELECTION', function(selection) {
  if (_resultDeferred && selection) {
    _resultDeferred.resolve({
      type: selection.type, // TODO temporary
      [selection.type]: selection
    });
  }
});

topic.subscribe('MEDIA-PICKER-SWAP-MAP-EDITOR', function() {
  _resultDeferred && _resultDeferred.reject('swap-map-editor');
});

class MediaPicker extends React.Component {

  constructor(container) {
    super();
    this.container = container;
    this.render();
  }

  open(params) {
    _resultDeferred = new Deferred();

    this.render(Object.assign(params, {justOpened: true}));
github Esri / storymap-cascade / src / app / storymaps / tpl / view / media / VideoBuilder.jsx View on Github external
postCreate(params = {}) {
    super.postCreate(params);

    this._onToggleMediaConfig = params.onToggleMediaConfig;
    this._foregroundOptions = params.foregroundOptions;
    this._applySectionConfig = params.applySectionConfig;

    this._initConfigPanel();

    this.initBuilderUI();

    // we subscribe to the scan change for this SPECIFIC video only (hence the scan/video/videoID pattern).
    this._scanListener = topic.subscribe('scan/videos/' + this._instanceID, lang.hitch(this, this.checkErrors));
  }
github Esri / storymap-cascade / src / app / storymaps / tpl / view / media / AudioBuilder.jsx View on Github external
postCreate(params) {
    super.postCreate(params);
    this._onToggleMediaConfig = params.onToggleMediaConfig;
    this._initConfigPanel();

    // we subscribe to the scan change for this SPECIFIC image only (hence the scan/image/imageID pattern).
    this._scanListener = topic.subscribe('scan/audio/' + this._instanceID, lang.hitch(this, this.checkErrors));

    this.initBuilderUI();
  }
github Esri / storymap-cascade / src / app / storymaps / tpl / view / media / WebPageBuilder.jsx View on Github external
postCreate(params) {
    super.postCreate(params);

    this._onToggleMediaConfig = params.onToggleMediaConfig;

    this._initConfigPanel();

    this.initBuilderUI();

    this._scanListener = topic.subscribe('scan/webpages/' + this._instanceID, lang.hitch(this, this.checkErrors));
  }
github hpcc-systems / HPCC-Platform / esp / src / src / GraphTreeWidget.ts View on Github external
postCreate(args) {
        this.inherited(arguments);
        this._initGraphControls();
        this._initTimings();
        this._initActivitiesMap();
        this._initDialogs();
        var context = this;
        topic.subscribe(this.id + "OverviewTabContainer-selectChild", function (topic) {
            context.refreshActionState();
        });
    }
github Esri / storymap-cascade / src / app / storymaps / tpl / builder / Controller.jsx View on Github external
import i18n from 'lib-build/i18n!resources/tpl/builder/nls/app';

import NormalizeHelper from 'issue-checker/helpers/NormalizeHelper';
import UndoNotification from './notification/Undo';

import Issues from 'issue-checker/IssueTypes';
import Actions from './Actions';

import UIUtils from 'storymaps/tpl/utils/UI';
import CommonHelper from 'storymaps/tpl/utils/CommonHelper';

topic.subscribe('builder-section-update', function() {
  ControllerBuilder.storyChange();
});

topic.subscribe('builder-media-update', function() {
  ControllerBuilder.storyChange();
});

export default class ControllerBuilder extends ControllerCore {
  static storyChange() {
    app.builder.pendingChanges++;

    topic.publish('builder-story-update');
  }

  static storyUndo() {
    app.builder.pendingChanges--;

    topic.publish('builder-story-update');
  }
github Esri / storymap-cascade / src / app / storymaps / tpl / builder / panel / BuilderPanel.jsx View on Github external
_initEvents() {
    topic.subscribe('tpl-ready', this._onStoryReady.bind(this));
    topic.subscribe('builder-section-update', this._updateOverview.bind(this));
    topic.subscribe('story-navigated-section', this._onSectionNavigate.bind(this));
    topic.subscribe('builder-story-title-update', this._updateStoryTitle.bind(this));
    topic.subscribe('builder-story-update', this._updateSaveButtonStatus.bind(this));
    topic.subscribe('check-app-started', this._onStoryCheckStarted.bind(this));
    topic.subscribe('check-app-complete', this._onStoryCheckComplete.bind(this));

    this._node.find('.btn-settings').click(this._onSettings.bind(this));
    this._node.find('.btn-preview').click(this._onPreview.bind(this));
    this._node.find('.my-stories-link').click(this._onCheck.bind(this));
    this._node.find('.btn-save').click(this._onSave.bind(this));

    let appName = 'Story Map Cascade';
    let betaNoteString = builderI18n.builder.builderPanel.betaNote.replace(/\${APP_NAME}/g, appName);

    this._node.find('.beta-tooltip').tooltip({
      title: betaNoteString,
      placement: 'bottom',
      container: '.section-builder-panel'
github Esri / storymap-cascade / src / app / storymaps / tpl / builder / mediaPicker / connectors / ArcGIS.jsx View on Github external
var promise = new Promise((resolve, reject) => {
      if (!app.portal) {
        reject(new Error('No app.portal on checkSignin'));
        return;
      }
      if (app.portal.user && app.portal.signedIn) {
        resolve();
      }
      else {
        topic.subscribe('portal-signin', function() {
          resolve();
        });
      }
    });
github Esri / storymap-cascade / src / app / storymaps / tpl / builder / panel / BuilderPanel.jsx View on Github external
_initEvents() {
    topic.subscribe('tpl-ready', this._onStoryReady.bind(this));
    topic.subscribe('builder-section-update', this._updateOverview.bind(this));
    topic.subscribe('story-navigated-section', this._onSectionNavigate.bind(this));
    topic.subscribe('builder-story-title-update', this._updateStoryTitle.bind(this));
    topic.subscribe('builder-story-update', this._updateSaveButtonStatus.bind(this));
    topic.subscribe('check-app-started', this._onStoryCheckStarted.bind(this));
    topic.subscribe('check-app-complete', this._onStoryCheckComplete.bind(this));

    this._node.find('.btn-settings').click(this._onSettings.bind(this));
    this._node.find('.btn-preview').click(this._onPreview.bind(this));
    this._node.find('.my-stories-link').click(this._onCheck.bind(this));
    this._node.find('.btn-save').click(this._onSave.bind(this));

    let appName = 'Story Map Cascade';
    let betaNoteString = builderI18n.builder.builderPanel.betaNote.replace(/\${APP_NAME}/g, appName);

    this._node.find('.beta-tooltip').tooltip({
      title: betaNoteString,
      placement: 'bottom',
      container: '.section-builder-panel'
    });

    this._node.find('.check-tooltip').tooltip({
github Esri / storymap-cascade / src / app / storymaps / tpl / builder / panel / BuilderPanel.jsx View on Github external
_initEvents() {
    topic.subscribe('tpl-ready', this._onStoryReady.bind(this));
    topic.subscribe('builder-section-update', this._updateOverview.bind(this));
    topic.subscribe('story-navigated-section', this._onSectionNavigate.bind(this));
    topic.subscribe('builder-story-title-update', this._updateStoryTitle.bind(this));
    topic.subscribe('builder-story-update', this._updateSaveButtonStatus.bind(this));
    topic.subscribe('check-app-started', this._onStoryCheckStarted.bind(this));
    topic.subscribe('check-app-complete', this._onStoryCheckComplete.bind(this));

    this._node.find('.btn-settings').click(this._onSettings.bind(this));
    this._node.find('.btn-preview').click(this._onPreview.bind(this));
    this._node.find('.my-stories-link').click(this._onCheck.bind(this));
    this._node.find('.btn-save').click(this._onSave.bind(this));

    let appName = 'Story Map Cascade';
    let betaNoteString = builderI18n.builder.builderPanel.betaNote.replace(/\${APP_NAME}/g, appName);

    this._node.find('.beta-tooltip').tooltip({

dojo

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

BSD-3-Clause OR AFL-2.1
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis