congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo For Javascript
Base.subscribe
Code IndexAdd Tabnine to your IDE (free)

How to use
subscribe
function
in
Base

Best JavaScript code snippets using pubsub-js.Base.subscribe(Showing top 6 results out of 315)

origin: eMarek/React-examples

React.createClass({
  getInitialState: function() {
    return {
      selection: 'none'
    };
  },
  componentWillMount: function() {
    // when React renders me, I subscribe to the topic 'PRODUCT_CLICKED'
    // and .subscribe returns a unique token necessary to unsubscribe
    this.pubsub_token = PubSub.subscribe('PRODUCT_CLICKED', function(topic, product) {
      // update my selection when there is a message
      this.setState({
        selection: product
      });
    }.bind(this));
  },
  componentWillUnmount: function() {
    // React removed me from the DOM, I have to unsubscribe from the PubSub using my token
    PubSub.unsubscribe(this.pubsub_token);
  },
  render: function() {
    return (
      <div>You have selected the product: {this.state.selection}</div>
    );
  }
})
origin: john-doherty/raspberry-pi-mjpeg-server

var subscriber_token = PubSub.subscribe('MJPEG', function(msg, data) {
origin: eMarek/React-examples

    });
  this.token_GATHERING_SELECT = PubSub.subscribe('GATHERING_SELECT', this.gatheringSelect);
},
componentWillUnmount: function() {
origin: eMarek/React-examples

    });
  this.token_SESSION_CARE = PubSub.subscribe('SESSION_CARE', this.sessionCare);
  this.token_GATHERING_SELECT = PubSub.subscribe('GATHERING_SELECT', this.gatheringSelect);
  this.token_BACKBUTTON_CLICK = PubSub.subscribe('BACKBUTTON_CLICK', this.backButtonClick);
  this.token_POPUP_OPEN = PubSub.subscribe('POPUP_OPEN', this.popupOpen);
  this.token_POPUP_CLOSE = PubSub.subscribe('POPUP_CLOSE', this.popupClose);
},
componentWillUnmount: function() {
origin: eMarek/React-examples

  this.token_POPUP_CLOSE = PubSub.subscribe('POPUP_CLOSE', this.popupClose);
},
componentWillUnmount: function() {
origin: eMarek/React-examples

this.token_GATHERINGS_REFRESH = PubSub.subscribe('GATHERINGS_REFRESH', function(topic) {
  this.refreshGatherings();
}.bind(this));
pubsub-js(npm)Basesubscribe

Most used pubsub-js functions

  • Base.publish
  • Base.subscribe
  • Base.unsubscribe

Popular in JavaScript

  • fs
  • mongodb
    The official MongoDB driver for Node.js
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • winston
    A logger for just about everything.
  • path
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • redis
    Redis client library
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now