Convenient extension methods for building Bespoke.js plugins. This plugin is targeted towards plugin developers, not everyday bespoke users looking to make a nice presentation.
Download the production version or the development version, or use a package manager.
First, include both bespoke.js
and bespoke-convenient.js
in your page.
Then, simply include the plugin when instantiating your presentation - and make sure to insert convenient: true
before any other plugin that might use convenient.
bespoke.horizontal.from('article', {
convenient: true
});
Since this is a plugin written for other bespoke plugin developers, have a look at the source files.
// bespoke.plugins.convenient.builder(pluginName)
// Convenient plugin level functions - create the variable cv in your plugin.
var cv = bespoke.plugins.convenient.builder("myplugin");
// cv.generateObject(message)
// An error object with a prefixed error message.
throw cv.generateErrorObject("Look, sometimes bad things happen, and there is nothing you can do about it, so why worry? -- Simba, The Lion King");
// cv.fire(deck, eventName, innerEvent, slide, customData)
// Fire an event on the deck, with plugin name etcetera filled in.
// innerEvent: either a DOM/browser event or a bespoke event
// slide: either the index of the affected slide, or the slide object itself
var success = cv.fire(deck, "myevent", e, 123, { someExtraPluginData: "data value", somePluginStatus: 999 });
// cv.copyArray(array)
// Mostly useful for function arguments
var args = cv.copyArray(arguments);
// cv.log([object], ...)
// Log a prefixed log message, by default to the developer console
cv.log("Something", "happened", 1974);
// deck.createEventData(eventNamespace, eventName, innerEvent, slide, eventData)
// Creates the event same object used by cv.fire(...).
var eventData = deck.createEventData();
$ bower install bespoke-convenient
$ npm install bespoke-convenient
The bespoke-convenient npm package is designed for use with browserify, e.g.
require('bespoke');
require('bespoke-convenient');
- Move more shared functionality into this plugin.
Mark Dalgleish for bespoke.js and related tools. This plugin was built with generator-bespokeplugin.
AJ Batac, ajbatac on flickr, for his photo E-Mart Convenience Store (CC BY 2.0).
Copyright (c) 2013, Joel Purra All rights reserved.
When using bespoke-convenient, comply to the MIT license. Please see the LICENSE file for details, and the MIT License on Wikipedia.