jsfiddle-api
v0.0.1
Published
JSFiddle API for NodeJS
Downloads
12
Readme
JSFiddle Api
Node library for accessing JSFiddle resources.
Example and test
// require jsfiddle api
var JSFiddleApi = require ("jsfiddle-api");
// get this fiddle
JSFiddleApi.getFiddle ("iu8B29/1", function (err, fiddleObj) {
// handle error
if (err) { return console.log (err); }
// output the response
console.log (fiddleObj)
});
Run this example using
$ npm test
> [email protected] test /home/.../jsfiddle-api
> node test/1.js
{ html: '<div class="hi">Hi</div>',
js: '$(".hi").fadeOut();',
css: '.hi {\n color: red;\n}' }
Methods
getFiddle (@options, @callback)
@options
is a string containing the fiddle id and the version (e.g."iu8B29/1"
)@callback
is a function that will be called after fetching the fiddle information- First parameter will be the error (
null
if the call was made successfully) - Second parameter will be an object containing three fields:
html
: the HTML code provided in the JSFiddlejs
: the JavaScript codecss
: and the CSS code
- First parameter will be the error (
Changelog
v0.1.0
- Initial release
License
See LICENSE file.