PyJS intro

3,397 views

Published on

PyJS is a CommonJS Based Javascript Framework runs on Browser

Published in: Technology, News & Politics
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
3,397
On SlideShare
0
From Embeds
0
Number of Embeds
307
Actions
Shares
0
Downloads
19
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

PyJS intro

  1. 1. PyJs demixcn@gmail.comMonday, September 19, 11
  2. 2. A CommonJS Based Javascript Framework runs on Browser https://github.com/demix/pyjsMonday, September 19, 11
  3. 3. CommonJSMonday, September 19, 11
  4. 4. Math.js increment.js program.js(main)Monday, September 19, 11
  5. 5. BenifitsMonday, September 19, 11
  6. 6. One code , runs everywhere No need to study and follow an ugly module pattern Automatic namespaceMonday, September 19, 11
  7. 7. Browser Server Desktop Command line tools ...Monday, September 19, 11
  8. 8. One code , runs everywhere No need to study and follow an ugly module pattern Automatic namespaceMonday, September 19, 11
  9. 9. Traditional Module Pattern CommonJS ModuleMonday, September 19, 11
  10. 10. One code , runs everywhere No need to study and follow an ugly module pattern Automatic namespaceMonday, September 19, 11
  11. 11. Monday, September 19, 11
  12. 12. Examples Server side Example: NodeJS Browser side Example: Firefox jetpack projectMonday, September 19, 11
  13. 13. ProblemMonday, September 19, 11
  14. 14. Run directly after ‘require’. No Callback.Monday, September 19, 11
  15. 15. Means in Browser, we can only use “Synchronous” request to get the script file.Monday, September 19, 11
  16. 16. What’s the fxxk...Monday, September 19, 11
  17. 17. SeaJSMonday, September 19, 11
  18. 18. Monday, September 19, 11
  19. 19. How it works User pre-defined template wrapper. Prefetch Js file which has been required.Monday, September 19, 11
  20. 20. Problems Still ugly template. Still can’t download all files in parallelMonday, September 19, 11
  21. 21. PyJSMonday, September 19, 11
  22. 22. GrammarMonday, September 19, 11
  23. 23. 99% same as CommonJS API No ugly user pre-defined template wrapperMonday, September 19, 11
  24. 24. what about the file loading problem? You haven’t mentioned it ..Monday, September 19, 11
  25. 25. There is two loading rules in PyJS. One in local debugging, the other in online building. All need Python environment.Monday, September 19, 11
  26. 26. Local debugging python pyjs.py runserver Fetch the JS file in synchronous XHR request. Server will parse the module file automaticlyMonday, September 19, 11
  27. 27. Server parseMonday, September 19, 11
  28. 28. Online building python pyjs.py Automaticly generate a ‘boot.js’ file, find all the dependences in modules and add the information to the end of boot.js file.Monday, September 19, 11
  29. 29. Then , if we had a combo service like:Monday, September 19, 11
  30. 30. We can download the file just in one request!Monday, September 19, 11
  31. 31. Finally , because of the require function used on page has a callback, it can runs after all the files is received and finish excuting.Monday, September 19, 11
  32. 32. That’s all.Monday, September 19, 11
  33. 33. More..Monday, September 19, 11
  34. 34. Because we use python... Local transmission Local plugins Deal with CSS files. ...Monday, September 19, 11
  35. 35. demix Front-end engineer @ Baidu co. email: demixcn@gmail.com weibo/twitter: @demix Homepage: http://demix.github.com/ blog: http://www.cnblogs.com/demixMonday, September 19, 11
  36. 36. Thank You.Monday, September 19, 11

×