SlideShare uma empresa Scribd logo
1 de 10
请放心地将你的相片地址发给他人
 Backbone 页面路由技术分析与实例




         分享人:杨凯   QQ:786506
现状
单张图片没有指定的url
1
2
改变现状
运用锚文片段(hash #pic)
给图片提供固定链接
(function() {

  var Model = Backbone.Model = function(attributes, options) {…};
  _.extend(Model.prototype, Events, {…});

  var Collection = Backbone.Collection = function(models, options) {…};
  _.extend(Collection.prototype, Events, {…});

  var Router = Backbone.Router = function(options) {…}    //路由配置器构造函数
  _.extend(Router.prototype, Events, {…});

  var History = Backbone.History = function() {…}; // 路由器构造函数
  _.extend(History.prototype, Events, {…});

  var View = Backbone.View = function(options) {…};
  _.extend(View.prototype, Events, {…});

  Backbone.sync = function(method, model, options) {…};

  var extend = function (protoProps, classProps) {…};
  Model.extend = Collection.extend = Router.extend = View.extend = extend;

}).call(this);
_.extend = function(obj) {
   each(slice.call(arguments,1), function(source) {
     for (var prop in source) {
       obj[prop] = source[prop];
     }                                                Router.prototype
   });
   return obj;
                                                      Router.prototype.initialize = function() {};
 };                                underscore.js
                                                      Router.prototype.route = function(route, name,
                                                      callback) {…};
                                                      Router.prototype.navigate = function(fragment,
                                                      options) {…};
                                                      Router.prototype._bindRoutes = function(){…};
                                                      Router.prototype._routeToRegExp =
  var Events = Backbone.Events = {                    function(route){…};
      on: function(events, callback, context) {…},
      off: function(events, callback, context) {…},   Router.prototype._extractParameters =
      trigger: function(events) {…}                   function(route, fragment) {…};
  };                                                  Router.prototype.on = function(events, callback,
  Events.bind   = Events.on;                          context) {…};
  Events.unbind = Events.off;                         Router.prototype.off = function(events, callback,
                                                      context) {…};
                                                      Router.prototype.trigger = function(events,
                                                      callback, context) {…};


                                                      History.prototype
                                                      …
_.extend(Router.prototype, Events, {
  initialize: function(){},
  route: function(route, name, callback) {…},
  navigate: function(fragment, options) {…},
                                                      接下来对Router/History源码进行分析 (‧‧)nnn
  _bindRoutes: function() {…},
  _routeToRegExp: function(route) {…},
  _extractParameters: function(route, fragment) {…}
});
谢谢大家
欢迎拍砖

Mais conteúdo relacionado

Mais procurados

Javascript & Ajax Basics
Javascript & Ajax BasicsJavascript & Ajax Basics
Javascript & Ajax BasicsRichard Paul
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」Tsuyoshi Yamamoto
 
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace PatternDiego Fleury
 
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! GrailsプラグインTsuyoshi Yamamoto
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 

Mais procurados (8)

Javascript & Ajax Basics
Javascript & Ajax BasicsJavascript & Ajax Basics
Javascript & Ajax Basics
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
 
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace Pattern
 
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
 
this
thisthis
this
 
Js hacks
Js hacksJs hacks
Js hacks
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 

Destaque

4 navigation and search
4 navigation and search4 navigation and search
4 navigation and searchMichael Dain
 
Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)
Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)
Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)kararos
 
Driving an experience based culture
Driving an experience based culture Driving an experience based culture
Driving an experience based culture Michael Dain
 
Baidu新人串讲
Baidu新人串讲Baidu新人串讲
Baidu新人串讲yidiyu
 
1 welcome and icons
1 welcome and icons1 welcome and icons
1 welcome and iconsMichael Dain
 
10 usability and screencasts
10 usability and screencasts10 usability and screencasts
10 usability and screencastsMichael Dain
 
Purina user testing
Purina user testingPurina user testing
Purina user testingMichael Dain
 
RelFinder使用与分析
RelFinder使用与分析RelFinder使用与分析
RelFinder使用与分析yidiyu
 
Suction Unit Catalogue
Suction Unit CatalogueSuction Unit Catalogue
Suction Unit Cataloguemedicaidsanand
 
9 animation and transitions
9 animation and transitions9 animation and transitions
9 animation and transitionsMichael Dain
 
I'm watir
I'm watirI'm watir
I'm watiryidiyu
 

Destaque (17)

4 navigation and search
4 navigation and search4 navigation and search
4 navigation and search
 
Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)
Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)
Happy New Year 2010 From Suwanna Kongsuriyanawin (Oo)
 
Driving an experience based culture
Driving an experience based culture Driving an experience based culture
Driving an experience based culture
 
6 prototype
6 prototype6 prototype
6 prototype
 
Pedigree Harzy2
Pedigree Harzy2Pedigree Harzy2
Pedigree Harzy2
 
Baidu新人串讲
Baidu新人串讲Baidu新人串讲
Baidu新人串讲
 
1 welcome and icons
1 welcome and icons1 welcome and icons
1 welcome and icons
 
10 usability and screencasts
10 usability and screencasts10 usability and screencasts
10 usability and screencasts
 
Trabajo D..[1]
Trabajo D..[1]Trabajo D..[1]
Trabajo D..[1]
 
Purina user testing
Purina user testingPurina user testing
Purina user testing
 
8 user testing
8 user testing8 user testing
8 user testing
 
RelFinder使用与分析
RelFinder使用与分析RelFinder使用与分析
RelFinder使用与分析
 
Suction Unit Catalogue
Suction Unit CatalogueSuction Unit Catalogue
Suction Unit Catalogue
 
9 animation and transitions
9 animation and transitions9 animation and transitions
9 animation and transitions
 
Poemas Ermen[1]
Poemas Ermen[1]Poemas Ermen[1]
Poemas Ermen[1]
 
7 data entry
7 data entry7 data entry
7 data entry
 
I'm watir
I'm watirI'm watir
I'm watir
 

Semelhante a Backbone页面路由技术分析与实例

Node Powered Mobile
Node Powered MobileNode Powered Mobile
Node Powered MobileTim Caswell
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Training: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and FacesTraining: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and FacesArtur Ventura
 
Real Time Web with Node
Real Time Web with NodeReal Time Web with Node
Real Time Web with NodeTim Caswell
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScriptkvangork
 
Reitit - Clojure/North 2019
Reitit - Clojure/North 2019Reitit - Clojure/North 2019
Reitit - Clojure/North 2019Metosin Oy
 
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Jiayun Zhou
 
Building Smart Async Functions For Mobile
Building Smart Async Functions For MobileBuilding Smart Async Functions For Mobile
Building Smart Async Functions For MobileGlan Thomas
 
AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaStephen Vance
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Engineering JavaScript
Engineering JavaScriptEngineering JavaScript
Engineering JavaScriptJim Purbrick
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013Laurent_VB
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascriptMiao Siyu
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneRafael Felix da Silva
 
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobileFirefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobileRobert Nyman
 

Semelhante a Backbone页面路由技术分析与实例 (20)

Node Powered Mobile
Node Powered MobileNode Powered Mobile
Node Powered Mobile
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Training: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and FacesTraining: Day Four - Struts, Tiles, Renders and Faces
Training: Day Four - Struts, Tiles, Renders and Faces
 
Real Time Web with Node
Real Time Web with NodeReal Time Web with Node
Real Time Web with Node
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
Meteor iron:router
Meteor iron:routerMeteor iron:router
Meteor iron:router
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
Reitit - Clojure/North 2019
Reitit - Clojure/North 2019Reitit - Clojure/North 2019
Reitit - Clojure/North 2019
 
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015
 
Building Smart Async Functions For Mobile
Building Smart Async Functions For MobileBuilding Smart Async Functions For Mobile
Building Smart Async Functions For Mobile
 
AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprima
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Engineering JavaScript
Engineering JavaScriptEngineering JavaScript
Engineering JavaScript
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascript
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com Backbone
 
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobileFirefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Backbone页面路由技术分析与实例

  • 3. 1 2
  • 4.
  • 5.
  • 7.
  • 8. (function() { var Model = Backbone.Model = function(attributes, options) {…}; _.extend(Model.prototype, Events, {…}); var Collection = Backbone.Collection = function(models, options) {…}; _.extend(Collection.prototype, Events, {…}); var Router = Backbone.Router = function(options) {…} //路由配置器构造函数 _.extend(Router.prototype, Events, {…}); var History = Backbone.History = function() {…}; // 路由器构造函数 _.extend(History.prototype, Events, {…}); var View = Backbone.View = function(options) {…}; _.extend(View.prototype, Events, {…}); Backbone.sync = function(method, model, options) {…}; var extend = function (protoProps, classProps) {…}; Model.extend = Collection.extend = Router.extend = View.extend = extend; }).call(this);
  • 9. _.extend = function(obj) { each(slice.call(arguments,1), function(source) { for (var prop in source) { obj[prop] = source[prop]; } Router.prototype }); return obj; Router.prototype.initialize = function() {}; }; underscore.js Router.prototype.route = function(route, name, callback) {…}; Router.prototype.navigate = function(fragment, options) {…}; Router.prototype._bindRoutes = function(){…}; Router.prototype._routeToRegExp = var Events = Backbone.Events = { function(route){…}; on: function(events, callback, context) {…}, off: function(events, callback, context) {…}, Router.prototype._extractParameters = trigger: function(events) {…} function(route, fragment) {…}; }; Router.prototype.on = function(events, callback, Events.bind = Events.on; context) {…}; Events.unbind = Events.off; Router.prototype.off = function(events, callback, context) {…}; Router.prototype.trigger = function(events, callback, context) {…}; History.prototype … _.extend(Router.prototype, Events, { initialize: function(){}, route: function(route, name, callback) {…}, navigate: function(fragment, options) {…}, 接下来对Router/History源码进行分析 (‧‧)nnn _bindRoutes: function() {…}, _routeToRegExp: function(route) {…}, _extractParameters: function(route, fragment) {…} });