README.md in coffee-processing-0.0.4 vs README.md in coffee-processing-0.0.5
- old
+ new
@@ -51,9 +51,32 @@
<script type='text/javascript'>
var processing = new Processing(document.getElementById("sketch"), this.sketch)
</script>
```
+Preloading (Experimental)
+-------------------------
+
+Asynchronous nature of Javascript requires preloading of images and fonts.
+Processing.js allows you to preload assets with [@pjs directives](http://processingjs.org/reference/pjs%20directive/).
+However they are only applied during the compilation of Processing syntax,
+and there's currenty no direct way to preload in Javascript-only Processing.js code.
+
+If you define `preload` object in your coffee-processing code as the following example,
+coffee-processing will delay the execution until those assets are ready.
+(Although the way it does so seems quite hacky.)
+
+```coffee
+preload =
+ images: ['/images/image1.png', '/images/image2.png']
+ fonts: ['/fonts/font.ttf']
+
+setup = ->
+ font = createFont '/fonts/font.ttf', 0
+ img1 = loadImage '/images/image1.png'
+ img2 = loadImage '/images/image2.png'
+```
+
coffee-processing script
------------------------
```
usage: coffee-processing [--template] <js object name> <sketch file>