SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

PyJS intro