The Detailed Description Of MochiKit JS Library And Its Function

Developed by Bob Ippolito, the JavaScript Library of MochiKit has cross platform operating system with both MIT License and Academic Free License. With the stable release of the 1.4.2 version, MochiKit is a lightweight library that has taken inspiration from Python’s networking framework named Twisted. By using deferred execution concept for allowing asynchronous behavior, MochiKit is significantly useful for development of the interactive pages on any website while maintaining the dialog with web server, also referred to as AJAX Applications sometimes.

After loading, it is efficient in manipulating data sets of JSON encode as well as the MochiKit.DOM for creating dynamic web page components easily. The web application stack of TurboGears Python gains functionality from client side by MochiKit. nIppolito’s familiarity with Python community has also made him incorporate a number of idioms which the Python programmers would find to be familiar –hence, it is widely used in the web applications based on Python.

As the “feature complete” tool, there is no active development going on because the developers are confident that it consists of all the best features from the modern advanced frameworks and hence, no major change is required in near future.

Demos Of MochiKit

With focus on coding and documentation, the following demos of MochiKit will help out any beginner as well as experienced coder.

  • JavaScript Interactive Interpreter shows off the functionality of MochiKit.DOM for manipulating the display while also waiting for the MochiKit.Async Deferreds through blockOn (aDeferred)
  • With MochiKit.Signal, Key Events demonstrate key handling procedure
  • Draggable also makes use of the MochiKit.Signal for creating easy drag handler based on CSS.
  • The Logging Pane is also a no-frills section which demonstrates pop-up (debuggingBookmarklet) and inline modes (Inline LoggingPane) of the log levels of MochiKit.LoggingPane and MochiKit.Logging. The Logging actions are logDebug, log, logWarning, logError and logFatal
  • MochiRegExp or Regular Expression explorer is created with the MochiKit.Async and MochiKit.DOM. It matches regular expression “live” by manipulating the display and facilitating live updating.
  • View-source uses MochiKit.Async, MochiKit.DOM and dp.SyntaxHighlighter to help in syntax highlighting for the source codes and sources for other examples. From the location.hash, the file source path is read and after loading doSimpleXMLHttpRequest it is inserted into DOM along with replaceChildNodes
  • AJAX Tables demonstrate comprehensive MochiKit application built on sortable tables. It can use MochiKit.Async for loading JSON and XML documents or MochiKit.DOM for displaying the fetched data.
  • The easy usage of MochiKit.DOM is demonstrated by Sortable Tables which take old plain HTML tables while making it sortable. It can convert the dates of Date Objects while sorting them properly. While other JavaScript libraries offer simple sortable tables, MochiKit’s libraries will let you sort from scratch!
  • Color Wheel in fully CSS3 model shows off color support with MochiKit.Color. You will be able to notice significant Alpha Blending on browsers like safari which support CSS3 RGBA () colors. As for other modern browsers, Color Wheel emulates alpha blending with background colors. Some of the colors thus offered are Antique White, Midnight Blue, Dark Green, Forest Green, Sandy Brown, Misty Rose etc.
  • The MochiKit.Visual effects with MochiKit.Visual offer combination effects like Visual.fade, Visual.puff, Visual.appear, Visual.slideUp, Visual.slideDown, Visual.blindUp, Visual.blindDown, Visual.dropOut, Visual.squish, Visual.shake, Visual.grow etc. Big slide, Onload, Scroll, Shrink, Grow, Queue are some of the other effects.
  • If you want HTML elements to look fancy with rounded edges, the Rounded Corners with MochiKit.Visual will help you in creating examples without any difficulty and without making it look weird.

Documentation Index Of MochiKit

As mentioned before in respect with the demos, here is the distribution of documentation of MochiKit –

  • Async –For managing asynchronous tasks
    AlreadyCalledError, Deferred, DeferredLock, callLater, fail, loadScript etc
  • Base –For functional programming along with comparisons
    For e.g. NotFound, average, compare, concat, extend, camelize, bool, counter etc
  • DOM –for seamless DOM Manipulation
    For e.g. NBSP, emiyHTML, escapeHTML, createDOMFunc etc
  • DragAndDrop –to help in dragging and dropping elements
    For e.g. Draggable, Droppable
  • Color –For creating color abstraction through CSS3 support
    For e.g. Color.fromHSL, Color.namedColors, Color.fromText etc
  • DateTime –for detecting date and time
    For e.g. isoDate, isoTimestamp, toISODate, toAmericanDate etc
  • Format –for string formatting
    For e.g.twoDigitFloat, rstrip, roundToFixed, formatLocale etc
  • Iter –offering itertools to JavaScript
    For e.g. ifilterfalse, izip, next, reduce, groupby, every, cycle, StopIteration etc
  • Logging –Notifying about alert()
    For e.g. Logger.prototype.addListener, alertListener, logFatal, logLevelAtLeast etc
  • LoggingPane –Making logging pane interactive
    For e.g. LoggingPane.prototype.closePane, createLoggingpane etc
  • Selector –for selecting elements with CSS selector syntax
    For e.g. findDocElements, Selector, Selector.findElements etc
  • Signal –for event handling in universal way
    For e.g. event, srs, stop, key, relatedTarget, disconnectAllTo etc
  • Style –For seamless CSS manipulation
    For e.g. Coordinates, Dimensions, makePositioned, setElementPosition, setOpacity etc
  • Sortable –To sort and create tables
    For e.g. SortableObserver, Sortable.create, Sortable.destroy etc
  • Text –For helper functions and string formatting
    For e.g. FormatPatternError, truncate, startsWith, padRightt, padLeft, formatValue etc
  • Visual –for interactive visual effects
    For e.g. roundClass, slideUp, pulsate, Opacity, Move, Scale, Highlight, Transitions, Sequence etc

So, now if you are interested in getting MochiKit JS Library, you have two options namely development and release where the development version offers most features and demos. It is better to use development version while you are developing the applications. After you are ready for deploying, you can switch over the Release version which makes the JavaScript environment favorable to reproduce.

The Release version was launched in 2008 as 1.4.2 version in which there has been upgrade in MochiKit.Style and MochiKit.DOM. In future release versions, the old APIs get removed for backward compatibility. To get the developed version, you can customize in git repository i.e. the git hub.

Although being quite a newcomer in the JavaScript world, MochiKit has been developed to be mature for incorporating in various public projects. The top corporate giants and retail websites have used it, take for example AFLAX, Snipshot, PlotKit, TurboGears, and In this advancing world of JavaScript Libraries, MochiKit is the leading framework which you should definitely use for your websites or web apps.