Zap Plugins

Back to Support

Plugins are client-side JS that enhance zap by offering stand-alone tools as well as small libraries to connect to other frameworks like jQuery. They can be loaded with the Zap JavaScript client by setting the client script tag url with a "plugins" parameter containing a list of plugins to load, in the order specified (left to right). Some of the plugins are commons files and not specific to Zap. We include them to allow a single-url script load (since you're grabbing Zap anyway), and to allow these handy script to easily be included on https or http sites without re-configuring.


you can view a list of available plugins using the js api list method.

Filter

  • aes encryption for strong pre-wire-broadcast data security.
    provides:
    Zap.aes={
      dec:  function(str, secret )
      enc:  function(str, secret )
    }

    AES is a powerful cipher algorithm designed to prevent man-in-the-middle attacks. it's good for when you deploy to http, but still want some of the benefits of https. The plugin lets you encode and decode a string using the same "secret password" on each end of the conversation.

  • coffeescript the client-side coffeescript interpreter
    provides: window.CoffeeScript :: VERSION, compile, eval, helpers, load, nodes, require, run, tokens

    coffeescript provides a a less-verbose syntax and handy programming features to javascript. The plugin is good for executing coffeescript on the client, as is common in single-page applications. See the coffeescript homepage for more info.

  • deflate description
    provides: window.deflate : function(strTextToCompress)

    deflate packs strings into less-repetitive versions that can end up weighting 1/10th as much as the original. This can save data footprints, bandwidth, or extend client-side size limitations. Use the inflate plugin to reverse the operation.

  • inflate reverses a DEFLATE routine to restore data to usable form. aka unzip.
    provides: window.inflate : function(strDeflatedText)

    inflate() unpacked deflate()'d strings into the original string. Used in combination with deflate to compress data before sending it over zap, it can reduce an app's zap usage up to 75%. Note however that you won't be able to use all of SELECT features to inspect data that's be compressed.

  • jquery a powerful declarative markup engine for web applications. (NOT a copy of jQuery)
    provides: many html smart attributes for live binding to data, configuring zap, templated content from data, and getting feedback from channel events. There are too many to document here, but the goal of the plug-in is to allow simple interactive applications to be built without writing a single line of Javascript. See the jQuery plugin demo page for examples, or checkout the declarative chat demonstration for a quick idea of what it can accomplish.
  • lodash underscore's little brother
    provides: window._ :: after, all, any, assign, at, bind, bindAll, bindKey, chain, clone, cloneDeep, collect, compact, compose, constant, contains, countBy, create, createCallback, curry, debounce, defaults, defer, delay, detect, difference, drop, each, eachRight, escape, every, extend, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, findWhere, first, flatten, foldl, foldr, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, has, head, identity, include, indexBy, indexOf, initial, inject, intersection, invert, invoke, isArguments, isArray, isBoolean, isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, isObject, isPlainObject, isRegExp, isString, isUndefined, keys, last, lastIndexOf, map, mapValues, max, memoize, merge, methods, min, mixin, noConflict, noop, now, object, omit, once, pairs, parseInt, partial, partialRight, pick, pluck, property, pull, random, range, reduce, reduceRight, reject, remove, rest, result, runInContext, sample, select, shuffle, size, some, sortBy, sortedIndex, support, tail, take, tap, template, templateSettings, throttle, times, toArray, transform, unescape, union, uniq, unique, uniqueId, unzip, values, where, without, wrap, xor, zip, zipObject

    lodash provides the same methods as underscore and more, in a smaller and faster package to boot! this plugin is simply a highly-compressed version of the regular distribution lodash javascript file. See the lodash webpage for more info.

  • markdown a simple way to markup plain-text with fancy formatting
    provides: window.markdown {object} : Markdown, parse, toHTML, toHTMLTree, renderJsonML

    This plugin allows simple text to be turned into rich HTML. Markdown supports headers, lists (bulleted and numbered), links, images, tables and more. It's safer than allowing user-provided HTML, looks good without being turned into HTML, and is simpler and more convenient to create and edit than html. See the markdown online format guide for details.

  • mustache build markup by expanding tags in a template using values provided in an object
    provides: window.Mustache Context, Renderer, Scanner, clearCache, compile, compilePartial, escapeHtml, escapeRe, isArray, isWhitespace, name, parse, quote, render, tags, to_html, version

    mustache lets you build rich html with embeded data on the client. This is great for single-page-apps to re-generate views based on live updated data. See the mustache github homepage for syntax examples and configuration options

  • notify desktop notifications for web apps
    provides: Zap.notify: function( StrTitle, strDetail, numMsTimeout, iconURL)

    notify shows notifications on the user's desktop, even if the application's tab is not visible. This can help to grab attention as soon as a zap event happens, or to announce advisory status updates such as song title changes. Use this simple method in lieu of complex modal dialogs, pop-ups and title changes.

  • observe2 object observers automatically keeps an object's values in-sync on many devices
    provides: zapInstance.observe(object, strNameFlag)

    observe2 allows a simple data model syncing capability with no custom wiring. In your app, it's passed a regular JavaScript object, and this object will be then be synced for anyone using the app. As an object gets new properties, deletes properties, or modifies values, this observer spots the alteration and sends a small change diff over the web. when other clients get an incoming diff, they patch the observed object with the new values or removals. Think of a subscribed object as a world-wide global variable.

  • sha1 a fast Secure Hash Algorithm implementation from the CryptoJS library.
    provides:
    Zap.sha1=function(s){
         return CryptoJS.SHA1(s);
    };

    sha1 turns a string of data into a 40-byte checksum/fingerprint of the data. A small change in the input will result in a large change on the output. It's good for validating data and obscuring mutually known-data for comparisons. Readup on SHA1 at wikipedia for more information.

  • sha2 a fast Secure Hash Algorithm implementation from the CryptoJS library.
    provides:
    Zap.sha2=function(s){
         return CryptoJS.SHA2(s);
    };

    sha1 turns a string of data into a 64-byte checksum/fingerprint of the data. A small change in the input will result in a large change on the output. It's good for validating data and obscuring mutually known-data for comparisons. Readup on SHA2 at wikipedia for more information.

  • storage an extensive and fast client-side storage interface for long-term data
    provides: Zap.storage : SQLREPS, _export, _import, _query, defSQL, dm, dt, guid, list, load, name, path, query, remove, save, size, tags, type, upgrade

    The storage plugin provides indexed key-value storage to client-side javascript applications. It can store large amounts of data by seamlessly underpinning itself on WebSQL, IndexedDB, or even localStrorage. It has true indexing, and provides a powerful asynchronous search engine. See the storage plugin section of this documentation for more info, and visit zapjs.com/demos/storage/ for dozens of live examples.

  • Underscore the data utility belt for JavaScript
    provides: window._ : VERSION, after, all, any, bind, bindAll, chain, clone, collect, compact, compose, contains, countBy, debounce, defaults, defer, delay, detect, difference, drop, each, escape, every, extend, filter, find, findWhere, first, flatten, foldl, foldr, forEach, functions, groupBy, has, head, identity, include, indexBy, indexOf, initial, inject, intersection, invert, invoke, isArguments, isArray, isBoolean, isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, isObject, isRegExp, isString, isUndefined, keys, last, lastIndexOf, map, max, memoize, methods, min, mixin, noConflict, object, omit, once, pairs, partial, pick, pluck, random, range, reduce, reduceRight, reject, rest, result, sample, select, shuffle, size, some, sortBy, sortedIndex, tail, take, tap, template, templateSettings, throttle, times, toArray, unescape, union, uniq, unique, uniqueId, values, where, without, wrap, zip

    underscore provides many handy data manipulation utility methods in a cross-browser-compatible library. It's especially suited for working on sets or arrays of data. See the underscore homepage for more information.

  • zepto an unmodified copy of the common Zepto jQuery-replacement library
    provides: window.$

    zepto can be used in place of jQuery in many projects. It is compatible with the zap jQuery plugin, enabling all the that smart-html to jump to life with a few kilobytes of code. Use it just like jQuery. See the Zepto project homepage for more information.