示例#1
0
      delay(function() {
        pb.skip(_entries[3]);
        pb.play();

        delay(function() {
          pb.skip(last(_entries));
        }, ONE_SECOND);
      }, ONE_SECOND);
示例#2
0
module.exports = function delay(func, wait, ticks) {

    // Asserting
    assertArgument(isFunction(func), 1, 'Function');
    assertArgument(isVoid(wait) || isIndex(wait), 2, 'number');

    // Delaying
    if (wait > 0 && !ticks) { return _delay(func, wait); }

    // Returning
    return _defer(() => wait > 1 ? delay(func, wait - 1, ticks) : func());
};
示例#3
0
const rotateEvent = throttle(() => {
    let show = true;
    currentEvent += 1;
    currentEvent %= eventList.length;
    if (eventList[currentEvent].date) {
        const eventDate = moment(new Date(eventList[currentEvent].date));
        const timeUntil = eventDate.diff();
        if (timeUntil < 0) {
            show = false;
            rotateEvent();
        }
        else {
            ractive.set(`eventList[${currentEvent}].fromNow`, eventDate.fromNow());
        }
    }
    if (show) {
        ractive.set('currentEvent', currentEvent);
    }
    delay(hideEvents, EVENT_INTERVAL - EVENT_HIDE_DELAY);
}, EVENT_INTERVAL);
    function track(data) {
      const props = ['s_265_account', 'prop54', 'pfxID', 'channel', 'linkInternalFilters', 'mmxgo', 'pageName', 'prop1', 'prop3', 'prop2', 'eVar11', 'eVar17', 'authOverride', 'prop6custom', 'prop9', 'prop16', 'prop17', 'prop18', 'prop19', 'prop20', 'prop22', 'prop58', 'prop6custom', 'prop62'];

      // Wait until the omniture library is loaded into browser
      if (isUndefined(window.bN) || isUndefined(window.s_265) || isUndefined(window.s_265.t)) {
        return delay(track, 100, data);
      }

      // Delete any props set from previous ping
      each(props, (prop) => {
        if (!isUndefined(window.s_265[prop])) {
          delete window.s_265[prop];
        }
      });

      // Set some defaults
      extend(window.s_265, {
        prop54: 'vault',
        pfxID: 'smp',
        channel: 'us.smpvault',
        linkInternalFilters: `javascript:,stylemepretty.com`,
        mmxgo: true,
        s_265_account: 'aolsmp,aolsvc'
      });
      extend(window.s_265, data);
      if (!window.s_265.prop62){
        extend(window.s_265, { prop62: 'video_novideo' });
      }

      if (isObject(window.s_265) && isFunction(window.s_265.t)) {
        window.s_265.t();
      }

      if (isFunction(window.bN)) {
        window.bN.view();
      }

      resolve(pick(window.s_265, props.concat(keys(data))));
    }
示例#5
0
  it('plays the last skipped to video when skip occurred while paused', function(done) {

    var comingNextSpy,
      pb = playbackWithDefaults(function(defaultConfig) {
        comingNextSpy = defaultConfig.comingNext;

        return {
          stateChanged: function(prevState, state) {
            if (state === playback.States.stopped) {
              runChecks();
              done();
            }
          }
        };
      });

    pb.play();
    pb.skip(_entries[0]);

    delay(function() {
      pb.pause();

      delay(function() {
        pb.skip(_entries[3]);
        pb.play();

        delay(function() {
          pb.skip(last(_entries));
        }, ONE_SECOND);
      }, ONE_SECOND);
    }, ONE_SECOND);

    function runChecks() {
      expect(comingNextSpy.calls.mostRecent().args[0].id).toEqual(last(_entries).id);
    }


  }, ONE_HOUR);
示例#6
0
 this.addEventListener(input, 'blur', (event) => {
   // Delay to allow click on suggestion list
   _delay(function() {
     suggestionContainer.style.display = 'none';
   }, 100);
 });