开发者

Rename "Event" object in jQuery FullCalendar plug-in

GREAT PLUGIN!!! BUT... choice of word "Event" to mean a "calendar entry" was particularly unfortunate

This is a wonderfully well-written plug in, and I've really impressed people here at work with what this thing can do. The documentation is astonishingly thorough and clear.

Congratulations to Adam!

HOWEVER, this plug-in refers to entries in the calendar as "Events" -- this has caused a lot of confusion in my development team's conversations, because when we use the word "Event" we think of things like onmouseover, click, etc. We would really prefer a term like 开发者_运维问答CalendarEvent or CalendarEntry.

I am not all that experienced with jQuery yet, so am wondering if there is a simple way to alias one of those terms to this plug-in's Event/Events object? (I know we could recode the plug-in directly, but our code will then break when we download an update.)

Thanks!


Why don't you write a Facade class called CalendarEvent that will just call the appropriate function from the Event class?


i understand. in the original docs, they were called "calEvents" but i changed it back to "events" for brevity.

the current docs are what coined the term, but you can always use different names for function arguments. however, you'll obviously still need to use the same option names, so a solution would be to create a wrapper sort of like this...

$.fn.jeffsFullCalendar = function(options) {
    options = options || {};
    options.events = options.calEvents;
    options.eventSource = options.calEventSources;
    this.fullCalendar(options);
};

will let you rename the 'events' and 'eventSources' options. basically a wrapper around the plugin

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜