Пример #1
0
 dispatcher.on('keycontrols:keypressed', function(key) {
     switch (key) {
         case 'PAUSE_RESUME':
             dispatcher.trigger('patterngrid:toggleplay');
             break;
         case 'TOGGLE_FILTER':
             dispatcher.trigger('filterfx:changeactive');
             break;
         case 'CLEAR':
             dispatcher.trigger('patterngrid:setpattern', patterns.empty);
             break;
         default:
             break;
     }
 });
Пример #2
0
/**
 * Advances the scheduler to the next step in the pattern,
 * looping back to the start if needed.
 **/
function advanceStep(currentTime) {
    if (currentTime >= PremixGlobals.getTotalTime()) {
        reset();
        play();
    }
    dispatcher.trigger('timeline:stepchanged', currentTime);
}
Пример #3
0
    onMouseMove: function (e) {

        dispatcher.trigger('resizer:mousemove', e);

        if (this.dragging) {

            var $mc = this.$el.find('#main-content');
            var $cc = this.$el.find('#contextual-content');
            var $footer = this.$el.find('footer');
            var $handle = this.$el.find('#contextual-content-handle');

            var dragY = $(document).height() - e.pageY + ($handle.height()/2);

            $mc.css("bottom", dragY);
            $cc.css("height", dragY - $footer.height() );

            if($cc.css("height").replace("px", "") > 400)  {
                $mc.css("bottom", 450);
                $cc.css("height", 400);
            }

            if($cc.css("height").replace("px", "") < 20) {
                $mc.css("bottom", 70);
                $cc.css("height", 20);
            }
        }

    },
Пример #4
0
function moveLocation(e) {
	var location = locations.get(id);
    lat = location.get('latitude');
    long = location.get('longitude');

    var coords = { "latitude": lat, "longitude": long  };
    
  
    dispatcher.trigger('moveto',coords);
    dispatcher.trigger('closelist');
    
    
/*	
    working but leaks memmory like crazy
    Ti.App.fireEvent('moveto',coords );
	Ti.App.fireEvent('closelist'); */
		
}
Пример #5
0
 $.navigationWindow.addEventListener('android:back', function(){
     Ti.API.warn(">> menu.activeItem", menu.activeItem);
     if(menu.getActiveItem() != 'menuItemSurveys') {
         dispatcher.trigger('menu:activate', 'menuItemSurveys');
         navigateTo('surveys');
         return false;
     }
     $.navigationWindow.close();
 });
Пример #6
0
/**
 * Fires events to the dispatcher if the current step in
 * the grid has any notes to be played.
 *
 * @param pt: calculated time offset to delay the audio by
 **/
function playAudioAtTime(trackId, pt, offset) {


    var trackHitData = {
        trackId: trackId,
        playTime: pt,
        offset: offset
    }
    dispatcher.trigger('timeline:audiohit', trackHitData);

}
Пример #7
0
/**
 * Application startup code
 **/
function launchApp() {

    // Bind some connecting events to 'wire up' our modules
    proxyEvents({
        // PatternGrid note trigger -> SampleBank play sound
        'patterngrid:notehit': 'samplebank:playsample',

        // Transport control changes -> PatternGrid state changes
        'transport:requestplay': 'patterngrid:play',
        'transport:requeststop': 'patterngrid:stop',
        'transport:tempochanged': 'patterngrid:settempo',

        // FilterFX node creation -> SampleBank node hookup
        'filterfx:nodeupdated': 'samplebank:setfxnode'
    });

    // Handle keypress events from KeyControls and trigger
    // the appropriate module events
    dispatcher.on('keycontrols:keypressed', function(key) {
        switch (key) {
            case 'PAUSE_RESUME':
                dispatcher.trigger('patterngrid:toggleplay');
                break;
            case 'TOGGLE_FILTER':
                dispatcher.trigger('filterfx:changeactive');
                break;
            case 'CLEAR':
                dispatcher.trigger('patterngrid:setpattern', patterns.empty);
                break;
            default:
                break;
        }
    });

    // Init the rest of our modules, telling them
    // where in the DOM we want them to render.
    // Try commenting these out one-by-one and note
    // that the app will still run.
    Transport.init({
        el: document.getElementById('top')
    });
    PatternGrid.init({
        el: document.getElementById('middle')
    });
    FilterFX.init({
        el: document.getElementById('bottom')
    });
    KeyControls.init();

    // Start with the basic drum pattern on the grid
    dispatcher.trigger('patterngrid:setpattern', patterns.basic);

    console.log('Ready');
}
Пример #8
0
/**
 * Stops playing.
 **/
function stop() {
    isPlaying = false;
    pauseStart = AUDIO.currentTime;

    for (var key in tracks) {
        if (!tracks.hasOwnProperty(key)) continue;
        tracks[key].isPlaying = false;
    }

    dispatcher.trigger('timeline:paused');

}
Пример #9
0
      .then(() => {
        app.user.set({
          authenticated: true,
          username: username,
          token: keystoneClient.token
        });

        if (password === keystoneClient.DEFAULT_PASSWORD) {
          dispatcher.trigger('showDefaultPasswordWarning');
        }

        return app.fuelSettings.fetch({cache: true});
      })
Пример #10
0
 (task) => {
   dispatcher.trigger('networkConfigurationUpdated updateNodeStats ' +
     'updateNotifications labelsConfigurationUpdated');
   if (task.status === 'ready') {
     // Do not send the 'DELETE' request again, just get rid
     // of this node.
     this.props.node.trigger('destroy', this.props.node);
     return;
   }
   if (this.props.cluster) {
     this.props.cluster.get('tasks').add(new models.Task(task), {parse: true});
   }
   this.props.node.set('status', 'removing');
 },
Пример #11
0
function reset() {

    startTime = 0.0;
    pauseStart = 0.0;
    pauseDuration = 0.0;
    _initialized = false;
    isPlaying = false;

    for (var key in tracks) {
        if (!tracks.hasOwnProperty(key)) continue;
        tracks[key].played = false;
    }

    dispatcher.trigger('timeline:stepchanged', 0.0);
}
Пример #12
0
/**
 * @method saveCoordinates
 * Handle save of coordinates
 * @param  {[type]} evt [description]
 * @return {[type]}     [description]
 */
function saveCoordinates (evt) {
    var latitude = $.latitude.value.trim();
    var longitude = $.longitude.value.trim();

    if (latitude.length < 1 || longitude.length < 1) {
        alert('Please provide your coordinates to continue');
        return;
    }

    var coordinates = {
        latitude: latitude,
        longitude: longitude,
        manual: true
    };

    dispatcher.trigger('survey:coordinates', coordinates);
    closeWindow();
}
Пример #13
0
      .then((token) => {
        app.user.set({
          authenticated: true,
          username,
          token
        });

        if (password === DEFAULT_ADMIN_PASSWORD) {
          dispatcher.trigger('showDefaultPasswordWarning');
        }

        return Promise.all([
          app.version.fetch({cache: true}),
          app.fuelSettings.fetch({cache: true}),
          keystoneClient.getTokenInfo(token).then((tokenInfo) => {
            app.user.set({
              id: tokenInfo.token.user.id,
              roles: tokenInfo.token.roles
            });
          })
        ]);
      })
function closeModal(){
	
	if(!picked) {
		picked = new Date();
		var todayString = "Today";
		Ti.App.Properties.setString('tmpPickedDate', todayString);
	} else {
		var pickerdate = picked;
	    var day = (pickerdate.getDate() < 10 ? '0' + pickerdate.getDate() : pickerdate.getDate());
	    var m = pickerdate.getMonth()+1;
	    var month = (m < 10 ? '0' + m : m);
	    var year = pickerdate.getFullYear();
	    var newdate = day + "-" + month + "-" + year;
	    
		Ti.App.Properties.setString('tmpPickedDate', newdate);
		
	}
	
	
	picked = null;
	dispatcher.trigger('createChallengeDateSet');
	
	$.picNav.close();
}
Пример #15
0
 var drawerOpen = function (evt) { dispatcher.trigger('menu:open'); },
Пример #16
0
 request.catch((response) => {
   if (response.status === 404) {
     this.props.cluster.collection.remove(this.props.cluster);
     dispatcher.trigger('updateNodeStats');
   }
 });
Пример #17
0
 request.then(() => {
   if (deploymentTask.match({active: false})) {
     this.props.cluster.fetch();
     dispatcher.trigger('updateNodeStats');
   }
 });
Пример #18
0
 () => dispatcher.trigger('updateNotifications')
Пример #19
0
/**
 * @method closeCoordinates
 * Found GPS coordinates, give preference over GPS than manual
 */
function closeCoordinates () {
    toast.showToastMessage($, 'surveys', L("coordinates.foundGPS"), true);
    dispatcher.trigger('survey:gps');
    closeWindow();
}
Пример #20
0
    onMouseUp: function(e) {

        dispatcher.trigger('resizer:mouseup', e);

        this.dragging = false;
    }
Пример #21
0
 .then(() => {
   if (task.match({active: false})) dispatcher.trigger('deploymentTaskFinished');
   return this.props.cluster.fetchRelated('nodes');
 });
Пример #22
0
   // this is needed to somehow handle the case when
   // verification is in progress and user pressed Deploy
   backboneMixin({
     modelOrCollection(props) {
       return props.cluster.get('tasks');
     },
     renderOn: 'update change:status'
   })
 ],
 getDefaultProps() {
   return {title: i18n('dialog.display_changes.title')};
 },
 ns: 'dialog.display_changes.',
 deployCluster() {
   this.setState({actionInProgress: true});
   dispatcher.trigger('deploymentTasksUpdated');
   var task = new models.Task();
   task.save({}, {url: _.result(this.props.cluster, 'url') + '/changes', type: 'PUT'})
     .done(() => {
       this.close();
       dispatcher.trigger('deploymentTaskStarted');
     })
     .fail(this.showError);
 },
 renderBody() {
   var cluster = this.props.cluster;
   return (
     <div className='display-changes-dialog'>
       {!cluster.needsRedeployment() && _.contains(['new', 'stopped'], cluster.get('status')) &&
         <div>
           <div className='text-warning'>
Пример #23
0
var args = arguments[0] || {},
    dispatcher = require('dispatcher');

dispatcher.trigger('setMainTitle', {
	title: 'Sponsors'
});

$.init = function() {

};

$.sponsors.addEventListener('open', $.init);

$.cleanup = function() {

    // let Alloy clean up listeners to global collections for data-binding
    // always call it since it'll just be empty if there are none
    $.destroy();

    // remove all event listeners on the controller
    $.off();

    // and custom global dispatchers (all at once, via context)
    dispatcher.off(null, null, $);
};

$.sponsors.addEventListener('close', $.cleanup);
Пример #24
0
 .done(() => {
   dispatcher.trigger(this.state.newPassword === keystoneClient.DEFAULT_PASSWORD ?
     'showDefaultPasswordWarning' : 'hideDefaultPasswordWarning');
   app.user.set({token: keystoneClient.token});
   this.close();
 })
Пример #25
0
 .done(() => {
   dispatcher
     .trigger('updateNodeStats networkConfigurationUpdated labelsConfigurationUpdated');
   this.state.result.resolve();
   this.close();
 })
Пример #26
0
 () => {
   this.close();
   dispatcher.trigger('updateNodeStats updateNotifications');
   app.navigate('#clusters', {trigger: true});
 },
Пример #27
0
 .done(() => {
   this.close();
   dispatcher.trigger('deploymentTaskStarted');
 })
Пример #28
0
 _.defer(() => dispatcher.trigger('vcenter_model_update'));
Пример #29
0
var args = arguments[0] || {},
    dispatcher = require('dispatcher');

dispatcher.trigger('setMainTitle', {
	title: 'Crew'
});

$.init = function() {

};

$.crew.addEventListener('open', $.init);

$.cleanup = function() {

    // let Alloy clean up listeners to global collections for data-binding
    // always call it since it'll just be empty if there are none
    $.destroy();

    // remove all event listeners on the controller
    $.off();

    // and custom global dispatchers (all at once, via context)
    dispatcher.off(null, null, $);
};

$.crew.addEventListener('close', $.cleanup);
Пример #30
0
 drawerClose = function (evt) { dispatcher.trigger('menu:close'); };