SlideShare uma empresa Scribd logo
1 de 36
Baixar para ler offline
PyJs
                           demixcn@gmail.com




Monday, September 19, 11
A CommonJS Based
                           Javascript Framework
                              runs on Browser

                               https://github.com/demix/pyjs




Monday, September 19, 11
CommonJS


Monday, September 19, 11
Math.js




                           increment.js




                           program.js(main)




Monday, September 19, 11
Benifits


Monday, September 19, 11
One code , runs everywhere

                           No need to study and follow an ugly module
                           pattern

                           Automatic namespace




Monday, September 19, 11
Browser

                           Server

                           Desktop

                           Command line tools

                           ...




Monday, September 19, 11
One code , runs everywhere

                           No need to study and follow an ugly module
                           pattern

                           Automatic namespace




Monday, September 19, 11
Traditional Module Pattern




                           CommonJS Module




Monday, September 19, 11
One code , runs everywhere

                           No need to study and follow an ugly module
                           pattern

                           Automatic namespace




Monday, September 19, 11
Monday, September 19, 11
Examples
                           Server side Example:

                             NodeJS

                           Browser side Example:

                             Firefox jetpack
                             project




Monday, September 19, 11
Problem


Monday, September 19, 11
Run directly after ‘require’.
                                 No Callback.




Monday, September 19, 11
Means in Browser, we can only use

                                    “Synchronous”

                              request to get the script file.




Monday, September 19, 11
What’s the fxxk...




Monday, September 19, 11
SeaJS


Monday, September 19, 11
Monday, September 19, 11
How it works


                           User pre-defined template wrapper.



                           Prefetch Js file which has been required.




Monday, September 19, 11
Problems


                           Still ugly template.



                           Still can’t download all files in parallel




Monday, September 19, 11
PyJS


Monday, September 19, 11
Grammar




Monday, September 19, 11
99% same as CommonJS API

                           No ugly user pre-defined template wrapper




Monday, September 19, 11
what about the file
                            loading problem?
                               You haven’t
                              mentioned it ..




Monday, September 19, 11
There is two loading rules in PyJS.

                                One in local debugging,

                              the other in online building.

                            All need Python environment.




Monday, September 19, 11
Local debugging

                           python pyjs.py runserver



                           Fetch the JS file in synchronous XHR request.



                           Server will parse the module file automaticly



Monday, September 19, 11
Server parse




Monday, September 19, 11
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
Then , if we had a combo service like:




Monday, September 19, 11
We can download the
                             file just in one
                                 request!




Monday, September 19, 11
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
That’s all.


Monday, September 19, 11
More..


Monday, September 19, 11
Because we use
                                    python...

                           Local transmission

                           Local plugins

                           Deal with CSS files.

                           ...




Monday, September 19, 11
demix
                           Front-end engineer @ Baidu co.

                           email: demixcn@gmail.com

                           weibo/twitter: @demix

                           Homepage: http://demix.github.com/

                           blog: http://www.cnblogs.com/demix




Monday, September 19, 11
Thank You.


Monday, September 19, 11

Mais conteúdo relacionado

Semelhante a PyJS intro

Vladimir Oane
Vladimir OaneVladimir Oane
Vladimir Oaneevensys
 
Erlang for video delivery
Erlang for video deliveryErlang for video delivery
Erlang for video deliveryHugh Watkins
 
Caching, sharding, distributing - Scaling best practices
Caching, sharding, distributing - Scaling best practicesCaching, sharding, distributing - Scaling best practices
Caching, sharding, distributing - Scaling best practicesLars Jankowfsky
 
Ruby on Windows (RubyConf.tw 2011)
Ruby on Windows (RubyConf.tw 2011)Ruby on Windows (RubyConf.tw 2011)
Ruby on Windows (RubyConf.tw 2011)Ming-hsuan Chang
 
01 Mobile Web Introduction
01 Mobile Web Introduction01 Mobile Web Introduction
01 Mobile Web IntroductionYnon Perek
 
Angrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance ShopAngrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance ShopAOE
 
Symfony2: Get your project started
Symfony2: Get your project startedSymfony2: Get your project started
Symfony2: Get your project startedRyan Weaver
 
Rcos presentation
Rcos presentationRcos presentation
Rcos presentationmskmoorthy
 
A Re-Introduction to Third-Party Scripting
A Re-Introduction to Third-Party ScriptingA Re-Introduction to Third-Party Scripting
A Re-Introduction to Third-Party Scriptingbenvinegar
 
Re-Introduction to Third-party Scripting
Re-Introduction to Third-party ScriptingRe-Introduction to Third-party Scripting
Re-Introduction to Third-party Scriptingbenvinegar
 
Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit Frank Karlitschek
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.jsSergi Mansilla
 
From stock to Cyanogenmod: The Sony Ericsson Case
From stock to Cyanogenmod: The Sony Ericsson CaseFrom stock to Cyanogenmod: The Sony Ericsson Case
From stock to Cyanogenmod: The Sony Ericsson CaseDiogo Ferreira
 
Becoming a Real Programmer
Becoming a Real ProgrammerBecoming a Real Programmer
Becoming a Real ProgrammerJacques Woodcock
 

Semelhante a PyJS intro (19)

Embedjs
EmbedjsEmbedjs
Embedjs
 
Vladimir Oane
Vladimir OaneVladimir Oane
Vladimir Oane
 
Erlang for video delivery
Erlang for video deliveryErlang for video delivery
Erlang for video delivery
 
Introducing Mulberry
Introducing MulberryIntroducing Mulberry
Introducing Mulberry
 
Caching, sharding, distributing - Scaling best practices
Caching, sharding, distributing - Scaling best practicesCaching, sharding, distributing - Scaling best practices
Caching, sharding, distributing - Scaling best practices
 
Ruby on Windows (RubyConf.tw 2011)
Ruby on Windows (RubyConf.tw 2011)Ruby on Windows (RubyConf.tw 2011)
Ruby on Windows (RubyConf.tw 2011)
 
has("builds")
has("builds")has("builds")
has("builds")
 
01 Mobile Web Introduction
01 Mobile Web Introduction01 Mobile Web Introduction
01 Mobile Web Introduction
 
Angrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance ShopAngrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance Shop
 
Symfony2: Get your project started
Symfony2: Get your project startedSymfony2: Get your project started
Symfony2: Get your project started
 
Rcos presentation
Rcos presentationRcos presentation
Rcos presentation
 
Rubypalooza 2009
Rubypalooza 2009Rubypalooza 2009
Rubypalooza 2009
 
A Re-Introduction to Third-Party Scripting
A Re-Introduction to Third-Party ScriptingA Re-Introduction to Third-Party Scripting
A Re-Introduction to Third-Party Scripting
 
Re-Introduction to Third-party Scripting
Re-Introduction to Third-party ScriptingRe-Introduction to Third-party Scripting
Re-Introduction to Third-party Scripting
 
What's in a number?
What's in a number?What's in a number?
What's in a number?
 
Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.js
 
From stock to Cyanogenmod: The Sony Ericsson Case
From stock to Cyanogenmod: The Sony Ericsson CaseFrom stock to Cyanogenmod: The Sony Ericsson Case
From stock to Cyanogenmod: The Sony Ericsson Case
 
Becoming a Real Programmer
Becoming a Real ProgrammerBecoming a Real Programmer
Becoming a Real Programmer
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

PyJS intro