瀏覽代碼

build-in eventAfterAllRender

Adam Shaw 7 年之前
父節點
當前提交
9238df6c76
共有 1 個文件被更改,包括 1 次插入47 次删除
  1. 1 47
      tests/automated/globals.js

+ 1 - 47
tests/automated/globals.js

@@ -66,17 +66,11 @@ window.initCalendar = function(options, el) {
     $el = $('<div id="calendar">').appendTo('body')
     $el = $('<div id="calendar">').appendTo('body')
   }
   }
 
 
-  var options = getCurrentOptions()
-  var eventAfterAllRenderCallback = options.eventAfterAllRender
-
-  if (eventAfterAllRenderCallback) {
-    delete options.eventAfterAllRender
-  }
-
   if (window.currentCalendar) {
   if (window.currentCalendar) {
     window.currentCalendar.destroy()
     window.currentCalendar.destroy()
   }
   }
 
 
+  var options = getCurrentOptions()
   var newCalendar
   var newCalendar
 
 
   options.SET_DATE_PROFILE = function() {
   options.SET_DATE_PROFILE = function() {
@@ -86,11 +80,6 @@ window.initCalendar = function(options, el) {
   new FullCalendar.Calendar($el[0], options)
   new FullCalendar.Calendar($el[0], options)
 
 
   if (newCalendar === window.currentCalendar) {
   if (newCalendar === window.currentCalendar) {
-
-    if (eventAfterAllRenderCallback) {
-      eventAfterAllRender(newCalendar, eventAfterAllRenderCallback)
-    }
-
     newCalendar.render()
     newCalendar.render()
   } else {
   } else {
     newCalendar.destroy()
     newCalendar.destroy()
@@ -246,38 +235,3 @@ window.spyCall = function(func) {
 window.pushOptions({
 window.pushOptions({
   timezone: 'UTC'
   timezone: 'UTC'
 })
 })
-
-
-// Convoluted triggers that are really useful
-// ---------------------------------------------------------------------------------------------------------------------
-
-window.eventAfterAllRender = function(calendar, callback) {
-
-  function monitor() {
-    var sourceHash = calendar.state.eventSources
-    var pendingSourceCnt = 0
-
-    for (var sourceId in sourceHash) {
-      if (sourceHash[sourceId].isFetching) {
-        pendingSourceCnt++
-      }
-    }
-
-    if (!pendingSourceCnt) {
-      callback()
-    } else {
-      calendar.one('RECEIVE_EVENTS', function() {
-        pendingSourceCnt--
-        if (!pendingSourceCnt) {
-          calendar.one('_rendered', callback)
-        }
-      })
-    }
-  }
-
-  calendar.one('_rendered', monitor) // wait for calendar.render() to be called
-
-  calendar.on('SET_DATE_PROFILE', function() {
-    calendar.one('_rendered', monitor) // wait for the render after a view/date switch
-  })
-}