SlideShare a Scribd company logo
1 of 28
http://canjs.us
@canjsus
Why?
• Prevents Leaks
• Ease of Use
• Fast
What’s Inside
• can.Construct
• can.Observe
• can.Model
• can.Control
• can.view
• can.EJS
• can.route
can.Construct(static, proto)
var Person = can.Construct({
    init : function (name) {
       this.name = name;
    }
});

var curtis = new Person("Curtis");
curtis.name
new can.Observe(data)
var person =
  new can.Observe({ name: 'josh'});

person.bind('name‟, function(ev,newVal,oldVal){
  newVal //-> 'Josh Dean'
  oldVal //-> 'josh'
});

person.attr('name') //-> 'josh'
person.name //-> 'josh'
person.attr('name','Josh Dean‟);
can.Model(ajax,proto)
var Todo = can.Model({
  findAll : '/todo',
  findOne : '/todo/{id}',
  destroy : 'POST /todo/destroy/{id}',
  update : 'POST /todo/{id}',
  create : '/todo'
},{});

Todo.findOne({id: 5}, function( todo ) {
  todo.attr('name')
});
can.Control(proto)
var Tabs = can.Control({
  init: function( el ) {
     // show first tab
  },
  'li click': function( el, ev ) {
     // hide other tabs
     // show selected tab
  }
});

new Tabs('#tabs');
can.route(route, defaults)
var Routing = can.Control({
 ':type/:id route': function( data ) {

  }
})

new Routing( document.body );
can.route.attr( { type : 'todos', id: 5 } )
can.view( idOrURL, data ) -> fragment

<script type='text/ejs' id='messageEJS'>
 <h1><%= message %></h1>
</script>

can.view('messageEJS', {
  message : 'Hello World'
}) //-> frag <h1>Hello World</h1>
EmbeddedJS Templates

Favorite tag is <%= ‟<blink>Blink</blink>‟ %>

-> My favorite tag is <blink>Blink</blink>




Favorite tag is <%== ‟<blink>Blink</blink>‟ %>

-> Favorite tag is Blink
EmbeddedJS Templates
<% if( devs ) { %>
 <% for( var i = 0; i < devs.length; i++ ) { %>
  <li><%= arr[i] %></li>
 <% } %>
<% } else { %>
 <li>No Developers</li>
<% } %>

can.view('devs.ejs',{devs: ['Andy','Fred']})
//-> frag <li>Andy</li><li>Fred</li>
EJS Live Binding
<% if( devs.attr('length') ) { %>
 <% list(devs, function(dev){ %>
  <li><%= dev.attr(„name‟) %></li>
 <% }) %>
<% } else { %>
 <li>No Developers</li>
<% } %>

var devs = new can.Observe.List([
  {name : 'Andy'}, {name : 'Fred'}
])

can.view('devs.ejs',{devs : devs})
//-> frag <li>Andy</li><li>Fred</li>
Why?
• Prevents Leaks
• Speed
• Flexibility + Libraries
• Ease of Use
• Features vs Size
A tooltip.



                                  Undo




$('#undo').bind('mouseenter',function(){
  $('<div>Undo</div>').tooltipFor(this)
})
What’s Wrong?
$.fn.tooltipFor = function(anchor){
 var $el = this
    .appendTo(document.body)
    .offset( $(anchor).offset() )

    $(anchor).bind('mouseleave',function(ev){
       $el.remove()
    })
}
Leaks
Templated Events “{option} eventName”
Templated Events
var Tooltip = can.Control({
  init: function( el, options ) {
    el.appendTo(document.body)
      .offset( $(options.anchor).offset() )
  },
  '{anchor} mouseleave': function( el, ev ) {
    this.element.remove();
  }
});

new Tooltip($('<div>Undo</div>'),{
  anchor : this
});
Non-leaking Global Store

          Critical           Due Today


     File Taxes            Brush Teeth

     Write talk on CanJS   Write talk on CanJS

     Emissions Test        Check into flight
Non-leaking Global Store

             Awesome Developers
Easy To Use
Plugins
• Validations
• Getter / Setter
• Serialize / Deserialize
• Backup / Restore
• Super
• Proxy


$(“#todos”).html( „todos.ejs‟, Todo.findAll() )
can.Control and Backbone.View




                     http://jsperf.com/tabs-timing-test
Live Binding




               http://jsfiddle.net/JMWf4/5/
Live Binding




*can.zepto.js, angular/ember not tested, ask me why   http://jsperf.com/canjs-ejs-live-bind
Features vs Size
 CanJS 8.49kb      - jQuery


 Backbone 8.97kb   -jQuery
                   +Underscore

 Knockout 13kb     none


 Batman 15kb       -pollyfills for ES5


                   none
 Angular 24kb

                   -jQuery
 Ember 39kb        +metamorph.js
Library Support
Questions?


         safer
        faster
       easier
       smaller
     library-er

  http://canjs.us
    @canjsus

More Related Content

What's hot

Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5성일 한
 
Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Jack Franklin
 
hachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JShachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JSKotaro Kawashima
 
Dive into AngularJS Routing
Dive into AngularJS RoutingDive into AngularJS Routing
Dive into AngularJS RoutingEgor Miasnikov
 
Angular JS Routing
Angular JS RoutingAngular JS Routing
Angular JS Routingkennystoltz
 
лукьянченко л.а. пос 10а
лукьянченко л.а. пос 10алукьянченко л.а. пос 10а
лукьянченко л.а. пос 10аl10bov
 
Angular Promises and Advanced Routing
Angular Promises and Advanced RoutingAngular Promises and Advanced Routing
Angular Promises and Advanced RoutingAlexe Bogdan
 
Backbone.js
Backbone.jsBackbone.js
Backbone.jsVO Tho
 
Criando um componente de busca com AngularJS
Criando um componente de busca com AngularJSCriando um componente de busca com AngularJS
Criando um componente de busca com AngularJSDouglas Lira
 
Damage Control
Damage ControlDamage Control
Damage Controlsintaxi
 
Ember: Guts & Goals
Ember: Guts & GoalsEmber: Guts & Goals
Ember: Guts & GoalsBob Lail
 

What's hot (20)

Human Talks Riot.js
Human Talks Riot.jsHuman Talks Riot.js
Human Talks Riot.js
 
NodeJS in Windows Azure
NodeJS in Windows AzureNodeJS in Windows Azure
NodeJS in Windows Azure
 
jQuery in 15 minutes
jQuery in 15 minutesjQuery in 15 minutes
jQuery in 15 minutes
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5
 
Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9
 
OUTDATED (Encore)
OUTDATED (Encore)OUTDATED (Encore)
OUTDATED (Encore)
 
hachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JShachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JS
 
Requirejs
RequirejsRequirejs
Requirejs
 
Expressを使ってみた
Expressを使ってみたExpressを使ってみた
Expressを使ってみた
 
Add loop shortcode
Add loop shortcodeAdd loop shortcode
Add loop shortcode
 
Dive into AngularJS Routing
Dive into AngularJS RoutingDive into AngularJS Routing
Dive into AngularJS Routing
 
Angular JS Routing
Angular JS RoutingAngular JS Routing
Angular JS Routing
 
лукьянченко л.а. пос 10а
лукьянченко л.а. пос 10алукьянченко л.а. пос 10а
лукьянченко л.а. пос 10а
 
Angular Promises and Advanced Routing
Angular Promises and Advanced RoutingAngular Promises and Advanced Routing
Angular Promises and Advanced Routing
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Jquery ui
Jquery uiJquery ui
Jquery ui
 
Criando um componente de busca com AngularJS
Criando um componente de busca com AngularJSCriando um componente de busca com AngularJS
Criando um componente de busca com AngularJS
 
Damage Control
Damage ControlDamage Control
Damage Control
 
Ember: Guts & Goals
Ember: Guts & GoalsEmber: Guts & Goals
Ember: Guts & Goals
 
UI-Router
UI-RouterUI-Router
UI-Router
 

Viewers also liked

Bending the Rules: Community over Code over Policy.
Bending the Rules: Community over Code over Policy.Bending the Rules: Community over Code over Policy.
Bending the Rules: Community over Code over Policy.pescetti
 
Open Development in the Enterprise, October 2013 edition
Open Development in the Enterprise, October 2013 editionOpen Development in the Enterprise, October 2013 edition
Open Development in the Enterprise, October 2013 editionBertrand Delacretaz
 
Open Source enables Open Innovation
Open Source enables Open InnovationOpen Source enables Open Innovation
Open Source enables Open InnovationBertrand Delacretaz
 
Life in Open Source Communities, ApacheCon US 2009
Life in Open Source Communities, ApacheCon US 2009Life in Open Source Communities, ApacheCon US 2009
Life in Open Source Communities, ApacheCon US 2009Bertrand Delacretaz
 
Keynote apache bd-eu-nov-2016
Keynote apache bd-eu-nov-2016Keynote apache bd-eu-nov-2016
Keynote apache bd-eu-nov-2016alanfgates
 
Hortonworks apache training
Hortonworks apache trainingHortonworks apache training
Hortonworks apache trainingalanfgates
 
Open Source at scale: the Apache Software Foundation
Open Source at scale: the Apache Software FoundationOpen Source at scale: the Apache Software Foundation
Open Source at scale: the Apache Software FoundationBertrand Delacretaz
 
Open-Source Collaboration Tools are Good for You - 2009 edition
Open-Source Collaboration Tools are Good for You - 2009 editionOpen-Source Collaboration Tools are Good for You - 2009 edition
Open-Source Collaboration Tools are Good for You - 2009 editionBertrand Delacretaz
 
Why Docker
Why DockerWhy Docker
Why DockerdotCloud
 
Gardler bosc2010 community_developmentattheasf
Gardler bosc2010 community_developmentattheasfGardler bosc2010 community_developmentattheasf
Gardler bosc2010 community_developmentattheasfBOSC 2010
 
Successfully Profiting From Apache Brands
Successfully Profiting From Apache BrandsSuccessfully Profiting From Apache Brands
Successfully Profiting From Apache BrandsShane Curcuru
 
Improving Your Apache Project's Image And Brand
 Improving Your Apache Project's Image And Brand Improving Your Apache Project's Image And Brand
Improving Your Apache Project's Image And BrandShane Curcuru
 
Practical Trademark Law for FOSS Projects
Practical Trademark Law for FOSS ProjectsPractical Trademark Law for FOSS Projects
Practical Trademark Law for FOSS ProjectsShane Curcuru
 

Viewers also liked (16)

Bending the Rules: Community over Code over Policy.
Bending the Rules: Community over Code over Policy.Bending the Rules: Community over Code over Policy.
Bending the Rules: Community over Code over Policy.
 
Open Development in the Enterprise, October 2013 edition
Open Development in the Enterprise, October 2013 editionOpen Development in the Enterprise, October 2013 edition
Open Development in the Enterprise, October 2013 edition
 
Open Source In Education
Open Source In EducationOpen Source In Education
Open Source In Education
 
Dev cloud
Dev cloudDev cloud
Dev cloud
 
Open Source enables Open Innovation
Open Source enables Open InnovationOpen Source enables Open Innovation
Open Source enables Open Innovation
 
Life in Open Source Communities, ApacheCon US 2009
Life in Open Source Communities, ApacheCon US 2009Life in Open Source Communities, ApacheCon US 2009
Life in Open Source Communities, ApacheCon US 2009
 
Keynote apache bd-eu-nov-2016
Keynote apache bd-eu-nov-2016Keynote apache bd-eu-nov-2016
Keynote apache bd-eu-nov-2016
 
Hortonworks apache training
Hortonworks apache trainingHortonworks apache training
Hortonworks apache training
 
Open Source at scale: the Apache Software Foundation
Open Source at scale: the Apache Software FoundationOpen Source at scale: the Apache Software Foundation
Open Source at scale: the Apache Software Foundation
 
Open-Source Collaboration Tools are Good for You - 2009 edition
Open-Source Collaboration Tools are Good for You - 2009 editionOpen-Source Collaboration Tools are Good for You - 2009 edition
Open-Source Collaboration Tools are Good for You - 2009 edition
 
Cloud stack for_beginners
Cloud stack for_beginnersCloud stack for_beginners
Cloud stack for_beginners
 
Why Docker
Why DockerWhy Docker
Why Docker
 
Gardler bosc2010 community_developmentattheasf
Gardler bosc2010 community_developmentattheasfGardler bosc2010 community_developmentattheasf
Gardler bosc2010 community_developmentattheasf
 
Successfully Profiting From Apache Brands
Successfully Profiting From Apache BrandsSuccessfully Profiting From Apache Brands
Successfully Profiting From Apache Brands
 
Improving Your Apache Project's Image And Brand
 Improving Your Apache Project's Image And Brand Improving Your Apache Project's Image And Brand
Improving Your Apache Project's Image And Brand
 
Practical Trademark Law for FOSS Projects
Practical Trademark Law for FOSS ProjectsPractical Trademark Law for FOSS Projects
Practical Trademark Law for FOSS Projects
 

Similar to Canjs

Summit2014 topic 0066 - 10 enhancements that require 10 lines of code
Summit2014 topic 0066 - 10 enhancements that require 10 lines of codeSummit2014 topic 0066 - 10 enhancements that require 10 lines of code
Summit2014 topic 0066 - 10 enhancements that require 10 lines of codeAngel Borroy López
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02careersblog
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesAlfresco Software
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJSZhang Xiaoxue
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionPaul Irish
 
jQuery Anti-Patterns for Performance
jQuery Anti-Patterns for PerformancejQuery Anti-Patterns for Performance
jQuery Anti-Patterns for PerformanceAndrás Kovács
 
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Kris Wallsmith
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patternsStoyan Stefanov
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Kris Wallsmith
 
Practical HTML5: Using It Today
Practical HTML5: Using It TodayPractical HTML5: Using It Today
Practical HTML5: Using It TodayDoris Chen
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node jsfakedarren
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Beyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance JavascriptBeyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance Javascriptaglemann
 

Similar to Canjs (20)

Summit2014 topic 0066 - 10 enhancements that require 10 lines of code
Summit2014 topic 0066 - 10 enhancements that require 10 lines of codeSummit2014 topic 0066 - 10 enhancements that require 10 lines of code
Summit2014 topic 0066 - 10 enhancements that require 10 lines of code
 
Assetic (Zendcon)
Assetic (Zendcon)Assetic (Zendcon)
Assetic (Zendcon)
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Assetic (OSCON)
Assetic (OSCON)Assetic (OSCON)
Assetic (OSCON)
 
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
 
Sequelize
SequelizeSequelize
Sequelize
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJS
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 
jQuery Anti-Patterns for Performance
jQuery Anti-Patterns for PerformancejQuery Anti-Patterns for Performance
jQuery Anti-Patterns for Performance
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3
 
jQuery Basic API
jQuery Basic APIjQuery Basic API
jQuery Basic API
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
 
Practical HTML5: Using It Today
Practical HTML5: Using It TodayPractical HTML5: Using It Today
Practical HTML5: Using It Today
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node js
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Beyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance JavascriptBeyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance Javascript
 

Recently uploaded

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Canjs

  • 2. Why? • Prevents Leaks • Ease of Use • Fast
  • 3. What’s Inside • can.Construct • can.Observe • can.Model • can.Control • can.view • can.EJS • can.route
  • 4. can.Construct(static, proto) var Person = can.Construct({ init : function (name) { this.name = name; } }); var curtis = new Person("Curtis"); curtis.name
  • 5. new can.Observe(data) var person = new can.Observe({ name: 'josh'}); person.bind('name‟, function(ev,newVal,oldVal){ newVal //-> 'Josh Dean' oldVal //-> 'josh' }); person.attr('name') //-> 'josh' person.name //-> 'josh' person.attr('name','Josh Dean‟);
  • 6. can.Model(ajax,proto) var Todo = can.Model({ findAll : '/todo', findOne : '/todo/{id}', destroy : 'POST /todo/destroy/{id}', update : 'POST /todo/{id}', create : '/todo' },{}); Todo.findOne({id: 5}, function( todo ) { todo.attr('name') });
  • 7. can.Control(proto) var Tabs = can.Control({ init: function( el ) { // show first tab }, 'li click': function( el, ev ) { // hide other tabs // show selected tab } }); new Tabs('#tabs');
  • 8. can.route(route, defaults) var Routing = can.Control({ ':type/:id route': function( data ) { } }) new Routing( document.body ); can.route.attr( { type : 'todos', id: 5 } )
  • 9. can.view( idOrURL, data ) -> fragment <script type='text/ejs' id='messageEJS'> <h1><%= message %></h1> </script> can.view('messageEJS', { message : 'Hello World' }) //-> frag <h1>Hello World</h1>
  • 10. EmbeddedJS Templates Favorite tag is <%= ‟<blink>Blink</blink>‟ %> -> My favorite tag is <blink>Blink</blink> Favorite tag is <%== ‟<blink>Blink</blink>‟ %> -> Favorite tag is Blink
  • 11. EmbeddedJS Templates <% if( devs ) { %> <% for( var i = 0; i < devs.length; i++ ) { %> <li><%= arr[i] %></li> <% } %> <% } else { %> <li>No Developers</li> <% } %> can.view('devs.ejs',{devs: ['Andy','Fred']}) //-> frag <li>Andy</li><li>Fred</li>
  • 12. EJS Live Binding <% if( devs.attr('length') ) { %> <% list(devs, function(dev){ %> <li><%= dev.attr(„name‟) %></li> <% }) %> <% } else { %> <li>No Developers</li> <% } %> var devs = new can.Observe.List([ {name : 'Andy'}, {name : 'Fred'} ]) can.view('devs.ejs',{devs : devs}) //-> frag <li>Andy</li><li>Fred</li>
  • 13. Why? • Prevents Leaks • Speed • Flexibility + Libraries • Ease of Use • Features vs Size
  • 14. A tooltip. Undo $('#undo').bind('mouseenter',function(){ $('<div>Undo</div>').tooltipFor(this) })
  • 15. What’s Wrong? $.fn.tooltipFor = function(anchor){ var $el = this .appendTo(document.body) .offset( $(anchor).offset() ) $(anchor).bind('mouseleave',function(ev){ $el.remove() }) }
  • 16. Leaks
  • 18. Templated Events var Tooltip = can.Control({ init: function( el, options ) { el.appendTo(document.body) .offset( $(options.anchor).offset() ) }, '{anchor} mouseleave': function( el, ev ) { this.element.remove(); } }); new Tooltip($('<div>Undo</div>'),{ anchor : this });
  • 19. Non-leaking Global Store Critical Due Today File Taxes Brush Teeth Write talk on CanJS Write talk on CanJS Emissions Test Check into flight
  • 20. Non-leaking Global Store Awesome Developers
  • 22. Plugins • Validations • Getter / Setter • Serialize / Deserialize • Backup / Restore • Super • Proxy $(“#todos”).html( „todos.ejs‟, Todo.findAll() )
  • 23. can.Control and Backbone.View http://jsperf.com/tabs-timing-test
  • 24. Live Binding http://jsfiddle.net/JMWf4/5/
  • 25. Live Binding *can.zepto.js, angular/ember not tested, ask me why http://jsperf.com/canjs-ejs-live-bind
  • 26. Features vs Size CanJS 8.49kb - jQuery Backbone 8.97kb -jQuery +Underscore Knockout 13kb none Batman 15kb -pollyfills for ES5 none Angular 24kb -jQuery Ember 39kb +metamorph.js
  • 28. Questions? safer faster easier smaller library-er http://canjs.us @canjsus

Editor's Notes

  1. Hello, I&apos;m Justin Meyer from BitoviI&apos;m very proud that this is the second time Bitovi (formerly Jupiter) has sponsered JSConfThis year it comes at an important time for us. Not only are we announcing the rebranding at this conference (we are Bitovi now), we are releasing thenext version of JavaScriptMVC&apos;s MVC parts called CanJS.In this talk, I&apos;ll introduce what&apos;s inside CanJS and talk about why, despite a lot of great existing MVC libraries, we think CanJS is the best one the market.
  2. It will fix the memory leaks that you probably don’t even know you have.Fastest control initialization and live template binding. Your app will start fast and run fast.And it’s super easy to pick up, we documented the hello out of it.
  3. positivity
  4. A basic constructor function helper. Useful for providing inheritance. All of JMVC’s constructors inherit from it.
  5. A basic constructor function helper. Useful for providing inheritance
  6. A basic constructor function helper. Useful for providing inheritance hooks up observes to your back end with declarative service bindings
  7. A basic constructor function helper. Useful for providing inheritance
  8. A basic constructor function helper. Useful for providing inheritance - A special observe that is cross bound to the route - pretty urls
  9. ----- Meeting Notes (4/3/12 00:38) -----embedded js
  10. show changing the obseveralph giving the talk
  11. Leaking Event HandlersCleaning Data Stores
  12. Impossible to create memory leaksPeople don&apos;t know what they are doingCan see it in something as simple as a tool tip where you mouseover the elementand it shows the tooltip widget.You might use this tooltip widget like the following: listen on an anchor element, create the content for the tooltip call tooltipFor with the anchor
  13. can.Control fixes this with templated event handlersYou can bind events that will always be unbound auto-magically
  14. ----- Meeting Notes (4/3/12 00:38) -----cleaned up
  15. The next way CanJS helps with memory is through it’s non-leaking global store. Say we have 2 Todo lists, Critical Todos and today’s todos. These lists might get back data for the same instance of a todo. The problem happens when a user changes properties on a todo that exists in both lists. Both lists need to be listening to property changes on the same todo instance.Model needs to see that the data it retrieves belongs to the same instance and return the previously created instance instead of creating a new one.Most MVC libraries either ignore it or solve it with a model store that has all instances, when data is retrieved for an instance, it checks if the instance is already created and uses that instance instead of creating a new one.The problem with this is for long-lived applications, you are constantly collecting unused instances, which fills memory. The developer has to tell the store when to flush instances.CanJS solves this by keeping things in the store only when it knows you are interested in them. How do you express interest? Well by binding to the instance. So, Model keeps instances in the store only while they have event handlers.This, combined with templated event handling, means that simply by replacing the todo list ELEMENTs with a list of “Awesome Developers”&lt;li class=“&lt;%= todo.attr(‘complete’) ? “done” :”” %&gt;” &gt;Very common, but tricky and critical problem for MVC.CanJS has a non-leaking global store, that allows it to solve the 2 ‘instance’ problem without permanently storing all model instances.
  16. All controls are torn down, when all controls are torn down, all event handlers are unbound. When an model instances event handlers are unbound, it’s removed from the store.If you don’t understand this, that’s ok … the big take away is that it’s pretty much impossible to make a leaking CanJS app … You bind and forget ….
  17. Set out to make CanJS the best documented library.Awesome overview page with it’s sweet navigation, underlying docs for every function, method, attribute, and demo applications for each component.Annotated SourceAnd hire us for training, support, or development
  18. deep bindingthe flexibility to switch between libraries without losing all your skills and even some of your (code)
  19. Hello, I&apos;m Justin Meyer from BitoviI&apos;m very proud that this is the second time Bitovi (formerly Jupiter) has sponsered JSConfThis year it comes at an important time for us. Not only are we announcing the rebranding at this conference (we are Bitovi now), we are releasing thenext version of JavaScriptMVC&apos;s MVC parts called CanJS.In this talk, I&apos;ll introduce what&apos;s inside CanJS and talk about why, despite a lot of strong competition, we think CanJS is the best MVC library on the market.