列出CalendarApp.Color中的枚举键

时间:2014-08-29 03:11:08

标签: javascript enums google-apps-script google-calendar-api

尝试使用以下代码获取Google Script中Google CalendarApp.Color枚举中的键列表:

var colors = CalendarApp.Color;
for (var x in colors) {
    Logger.log('Color Key: %s, Value: %s', x, colors[x]);
}

但它不起作用,输出:[14-08-29 17:32:38:437 EDT] Color Key: toString, Value: function toString() {/* */}

CalendarApp.Color有什么特别之处吗?

编辑: 也试过了;

var colors = CalendarApp.Color;
var cols;
for (var x in colors) {
    cols += colors[x];
}
Logger.log(cols);

那输出:[14-08-29 10:04:43:582 EDT] undefinedfunction toString(){/ * * /}

然后尝试:

var colors = CalendarApp.Color
Logger.log("Color BLUE is: " + colors.BLUE);
var cols = Object.keys(CalendarApp);
Logger.log(cols);

哪个输出:[14-08-29 17:52:47:366 EDT] Color BLUE is: #2952A3 [14-08-29 17:52:47:367 EDT] [getTimeZone, createEventSeries, isMyPrimaryCalendar, createAllDayEvent, subscribeToCalendar, setColor, getEventSeriesById, setHidden, getTitle, newRecurrence, getAllOwnedCalendars, getOwnedCalendarById, getId, setTimeZone, getColor, getDescription, getDefaultCalendar, getEventsForDay, openByName, createCalendar, getAllCalendars, openByEmailAddress, getCalendarById, getOwnedCalendarsByName, createAllDayEventSeries, isHidden, createEvent, getEvents, isSelected, setDescription, getName, toString, setName, createEventFromDescription, getCalendarsByName, isOwnedByMe, setSelected]

" toString"但这被评论出来(我认为)。不"颜色"在那里...

再次感谢!

0 个答案:

没有答案