Example #1
0
function setSelectedSite() {
	var selectedSite = sites.getSelectedSite();

	if ( ! selectedSite ) {
		_selectedSiteID = null;
		return;
	}

	if ( _selectedSiteID === selectedSite.ID ) {
		return;
	}

	if ( _synchronizer && _poller ) {
		PollerPool.remove( _poller );
		_synchronizer.off( 'change', emitChange );
	}

	_selectedSiteID = selectedSite.ID;

	_synchronizer = cartSynchronizer( selectedSite.ID, wpcom );
	_synchronizer.on( 'change', emitChange );

	_poller = PollerPool.add( CartStore, _synchronizer._poll.bind( _synchronizer ) );
}
Example #2
0
	destroy() {
		PollerPool.remove( this.poller );
	}