Clarify, JSLintify examples in comments

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2646 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-01-31 04:54:49 +00:00
parent 326a517074
commit 5f01a845e6
1 changed files with 8 additions and 8 deletions

View File

@ -4,23 +4,23 @@ Embedded SVG-edit API
General usage: General usage:
- Have an iframe somewhere pointing to a version of svg-edit > r1000 - Have an iframe somewhere pointing to a version of svg-edit > r1000
- Initialize the magic with: - Initialize the magic with:
var svgCanvas = new EmbeddedSVGEdit(window.frames['svgedit']); var svgCanvas = new EmbeddedSVGEdit(window.frames.svgedit);
- Pass functions in this format: - Pass functions in this format:
svgCanvas.setSvgString("string") svgCanvas.setSvgString("string")
- Or if a callback is needed: - Or if a callback is needed:
svgCanvas.setSvgString("string")(function(data, error){ svgCanvas.setSvgString("string")(function(data, error){
if(error){ if (error){
//there was an error // There was an error
}else{ } else{
//handle data // Handle data
} }
}) })
Everything is done with the same API as the real svg-edit, Everything is done with the same API as the real svg-edit,
and all documentation is unchanged. and all documentation is unchanged.
This file depends on the postMessage API which can only However, this file depends on the postMessage API which
support JSON-serializable arguments and can only support JSON-serializable arguments and
return values, so, for example, arguments whose value is return values, so, for example, arguments whose value is
"undefined", a function, a non-finite number, or a built-in "undefined", a function, a non-finite number, or a built-in
object like Date(), RegExp(), etc. will most likely not behave object like Date(), RegExp(), etc. will most likely not behave
@ -31,7 +31,7 @@ JavaScript methods on the frame itself.
The only other difference is The only other difference is
when handling returns: the callback notation is used instead. when handling returns: the callback notation is used instead.
var blah = new EmbeddedSVGEdit(window.frames['svgedit']); var blah = new EmbeddedSVGEdit(window.frames.svgedit);
blah.clearSelection("woot","blah",1337,[1,2,3,4,5,"moo"],-42,{a: "tree",b:6, c: 9})(function(){console.log("GET DATA",arguments)}) blah.clearSelection("woot","blah",1337,[1,2,3,4,5,"moo"],-42,{a: "tree",b:6, c: 9})(function(){console.log("GET DATA",arguments)})
*/ */