我的MeteorJS应用程序出现此特殊错误。最有趣的是,此错误仅在我的生产服务器上发生。检查localhost时,一切都是正确的,没有任何错误:
这里有错误:
setRecentHandsPagination = (data, sort) =>
RecentHandsPagination.set
filters: setFiltersForRecentHandsPagination(data)
sort: setSortForRecentHandsPagination(sort)
setFiltersForRecentHandsPagination = (data) =>
newFilters = new RecentHandsFilters(data).setFilters()
Session.setPersistent 'recentHandsFilters', newFilters
newFilters
setSortForRecentHandsPagination = (sort) =>
newSort = if sort? then else {createdAt: 1}
Session.setPersistent 'recentHandsSort', newSort
newSort
AutoForm.hooks
handsFilters:
onSubmit: (data) ->
@event.preventDefault()
emptyFilters = []
for filterName in PokerFiltersNames
unless data[filterName]?
emptyFilters.push filterName
$("#handsFilters [data-schema-key='#{filterName}'] input[type='checkbox']")
.prop 'checked', true
$("#handsFilters [data-schema-key='#{filterName}'] option[value='#{Pocademy.AddedDate.THIS_MONTH}']")
.prop 'selected', true
if emptyFilters.length > 0
defaultFilters = RecentHandsFilters.defaultAttrs()
for filterName in emptyFilters
data[filterName] = defaultFilters[filterName]
setRecentHandsPagination(data)
$('#dropdown-recent-hands.open').removeClass('open')
@done()
Template.recentHandsFilters.helpers
handsFiltersDefaultDoc: ->
defaultFilters = RecentHandsFilters.defaultAttrs()
filters =
pokerGames: defaultFilters.pokerGames
pokerTypes: defaultFilters.pokerTypes
pokerVariants: defaultFilters.pokerVariants
pokerTables: defaultFilters.pokerTables
pokerCreatedAt: defaultFilters.pokerCreatedAt
Template.recentHandsFilters.events
'click #showAllHandsBtn': (e) ->
e.stopPropagation()
AutoForm.resetForm 'handsFilters'
setRecentHandsPagination()
$('#dropdown-recent-hands.open').removeClass('open')
'click #addHand': (e) ->
e.stopPropagation()
AutoForm.resetForm 'handsFilters'
'click .cancel-dropdown': (e) ->
e.stopPropagation()
$('#dropdown-recent-hands.open').removeClass('open')
Template.recentHandsFilters.onDestroyed ->
RecentHandsPagination.unsubscribe()
Template.recentHandsFilters.onCreated ->
setRecentHandsPagination()
现在我很难对这个错误出现的原因做出任何假设。说实话过去几个小时我试图解决这个错误而没有任何成功。
可能错误是由下面的代码部分引起的,但我还不知道哪个部分:
function getValue(ctrlId) {
return document.getElementById(ctrlId).value;
}
function isValidNumber ( val ) { return !isNaN(+val); }
function update() {
var newGravity = getValue( 'grav' );
if (isValidNumber ( newGravity ) ) gravity = newGravity ;
//... same for other values.
}