Commits

Anonymous committed 245dc8a

added init and test

Comments (0)

Files changed (4)

 
 bin
 parts
+hgtools*
 .installed.cfg
 *.egg-info
 *.pyc

js/foutbgone/__init__.py

 
 foutbgone = Resource(library, 'foutbgone.js')
 
-# Define the resources in the library like this.
-# For options and examples, see the fanstatic documentation.
-# resource1 = Resource(library, 'style.css')
+def render_init(url):
+    return '''<script type="text/javascript">fbg.hideFOUT('asap');</script>'''
+    
+foutbgone_init = Resource(library, 'foutbgone_init.js', renderer=render_init, 
+    depends=[foutbgone])    

js/foutbgone/resources/foutbgone_init.js

+fbg.hideFOUT('asap');

js/foutbgone/test_fout-b-gone.txt

   >>> from js.foutbgone import foutbgone
   >>> foutbgone.need()
 
+There is also an init available which renders the initialization into the HTML::
+
+  >>> from js.foutbgone import foutbgone_init
+  >>> from fanstatic import NeededResources
+  >>> needed = NeededResources()
+  >>> needed.need(foutbgone_init)
+  >>> print needed.render()
+  <script type="text/javascript" src="/fanstatic/fout-b-gone/foutbgone.js"></script>
+  <script type="text/javascript">fbg.hideFOUT('asap');</script>