Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. <html>
  2. ....
  3. <script type="text/javascript" src="lib/requirejs/require.js" data-main="src/requireConfigTest"></script>
  4. ....
  5. </html>
  6.  
  7. /*globals require*/
  8. require.config({
  9. shim: {
  10.  
  11. },
  12. paths: {
  13. famous: 'lib/famous',
  14. requirejs: 'lib/requirejs/require',
  15. almond: 'lib/almond/almond',
  16. 'famous-polyfills': 'lib/famous-polyfills/index'
  17. }
  18. });
  19. // this is the injection point where the dynamic code starts
  20. define(function (require,exports,module) {
  21. var Engine = require("famous/core/Engine");
  22. var Surface = require("famous/core/Surface");
  23.  
  24. var mainContext = Engine.createContext();
  25.  
  26. var surface = new Surface({
  27. size: [100, 100],
  28. content: "Hello World",
  29. classes: ["red-bg"],
  30. properties: {
  31. textAlign: "center",
  32. lineHeight: "20px"
  33. }
  34. });
  35. alert('hi');
  36. mainContext.add(surface);
  37.  
  38. });
  39. //this is the end of the dynamic code
  40.  
  41. <html>
  42. ....
  43. <script type="text/javascript" src="lib/requirejs/require.js"</script>
  44. <script type="text/javascript">
  45. /*globals require*/
  46. require.config({
  47. shim: {
  48.  
  49. },
  50. paths: {
  51. famous: 'lib/famous',
  52. requirejs: 'lib/requirejs/require',
  53. almond: 'lib/almond/almond',
  54. 'famous-polyfills': 'lib/famous-polyfills/index'
  55. }
  56. });
  57. // this is the injection point where the dynamic code starts
  58. define(function (require,exports,module) {
  59. var Engine = require("famous/core/Engine");
  60. var Surface = require("famous/core/Surface");
  61.  
  62. var mainContext = Engine.createContext();
  63.  
  64. var surface = new Surface({
  65. size: [100, 100],
  66. content: "Hello World",
  67. classes: ["red-bg"],
  68. properties: {
  69. textAlign: "center",
  70. lineHeight: "20px"
  71. }
  72. });
  73. alert('hi');
  74. mainContext.add(surface);
  75.  
  76. });
  77. //this is the end of the dynamic code
  78. </script>
  79.  
  80. require(["famous/core/Engine", "famous/core/Surface"], function (Engine, Surface) {
  81. var mainContext = Engine.createContext();
  82. // Etc...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement