Homeland CURRENT_USER_ACCESS_TOKEN is not defined issues/218 的修复感觉不对吧?

lihuazhang · October 21, 2013 · Last by huacnlee replied at October 21, 2013 · 4088 hits

https://github.com/ruby-china/ruby-china/issues/218

CURRENT_USER_ACCESS_TOKEN = "xxxxx" // 全局变量,的确在window里。
return unless ('CURRENT_USER_ACCESS_TOKEN' in window)

in 被翻译成了

var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

'CURRENT_USER_ACCESS_TOKEN' in window 永远返回是 false。faye client 就没法初始化了。

求解!

You can use “in” to test for array presence,and "of" to test for JS object-key presence

这里 in 明显用错的

You need to Sign in before reply, if you don't have an account, please Sign up first.