SlideShare uma empresa Scribd logo
1 de 52
Baixar para ler offline
SPINE JS
var Messenger = function(message){
  defaultGreeting = "hello ";
  this.message = message;
}

Messenger.prototype.sayHi = function(){
  alert(defaultGreeting + this.message);
}

var hiDosug = new Messenger("DOSUG");
hiDosug.sayHi();
tr    var Messenger = function(message){
                                              ("id",
            listParent.children("ul").at
"list" + uniqueListId);                          defaultGreeting = "hello ";

              self.listName = "list" +
                                    listParent = $  this.message = message;
uniqueLi stId;         ('#categoryList').pare
                                                nt();
                                                  }
                                                 " +
              li stParent.attr("id", "wrapper            var
                                    listParent.children("u ViewBuilder = functi
                                                             l").attr("id",       on(type){
uniqueListId);         "list" + uniqueListId); Messenger.prototype.sayHi = functionunction(){
                                                           defaultSomething = "grid"
              se lf.wrapperName = self pper" +
                                     "wra                                             ;
                                         .listName alert(defaultGreeting + this.message);
                                                    = "list" +
uniqueLi stId;         uniqueListId;                       this.type = type;
                   this.message = message;
                                               , } ue);
                                                  tr
               self.updateView(inlistPa tion
                                    Transi
                                           rent.attr("id",this.buildView();
                                                             "wrapper" +
                }     uniqueListId);      listParent = $
                                                  var hiDosug = new Messenger("DOSUG");
           })               ('#categoryList').parent(); }
                Messenger.prototype.sayHi = function(){
                                   self.wrapperName = "wra
                                                  hiDosug.sayHi(); +
                                                              pper"
       );             uniqueListId;       listParent.children("ul").attr("id",
                                                        Messen
                   alert(defaultGreeting + this.message); ger.prototype.buildView = function(
                            "list" + uniqueListId);
 }switch(this.viewType){           self.updateView(inTran target.loa
                                                          $( tion, true 'templates
                }                                           si          d();        /category.html'
                                          self.listName = "list" +
      case "grid":          uniqueListId;
                               })
                var hiDosug = new Messenger("DOSUG");             function() {
        templatePath = "templates/ listParent.attr("id", "wrapper" +
                            );
  categoryGridElement.html";
                hiDosug.sayHi();                                     listParent = $
                            uniqueListId);             ('#categoryList').parent
                     }                                                           ();
        break;                            self.wrapperName = "wrapper" +
                                                                     listParent.children("ul"
                            uniqueListId;              "list" + uniqueListId);                ).att
      default:
                                          self.updateView(inTransition, true);
        templatePath = "templates/                                  self.listName = "list" +
                                                       uniqueListId;
  categoryListElement.html";          })

    }                                                            listParent.attr("id", "w
                                                                                          rapper
What’s Needed


Framework for consistency

Core UI and Data Modeling

Easy to get up to speed

Minimal dependencies
What’s Out There
SPINE JS HISTORY
MAY 2011
OCTOBER 2011
CURRENT V1.0.4 5
JAVASCRIPT OR
COFFESCRIPT
CoffeeScript


You’re not forced into using it

SpineJS is written in CoffeeScript

It’s not just a cool new trend...
CoffeeScript Benefits


Helps avoid erroneously global vars and pollution

Leads to more readable code

Provides appearance of classical inheritance
WHAT’S IN IT FOR ME?
Benefits


Lightweight Framework

Single Library Dependency

Straightforward Use
More reasons...


Flexible UI rendering with no pre-determined templating

Built in LocalStorage and RESTful support

Write once with near-ready-to-deploy mobile code
Minimal Dependencies
Compatibility


No Plans for Archaic Browser Support

HTML5-Centric with LocalStorage

json2.js Dependency for IE7 Support
ON THE HORIZON
Spine Mobile


Strengthens reason to build around core framework

Extend core components to be mobile ready

Requires minimal additional implementation
Spine Mobile


No Re-Writing, Extend Existing Controllers

Transition Effects

Tap & Orientation Events
IMPLEMENTATION
& CODE EXAMPLES
SPINE CLASS
Module (a.k.a. Spine Class)


Spine’s extension of core CoffeeScript class

Provides class and instance property support

All Spine internals inherit from Spine.Module
Spine Module
   (a.k.a. Extended CoffeeScript Class)


class MyClass extends Spine.Module
  @extend MyOtherClass
  @include myInstanceProperty
MODEL
Model


Inherits from Spine.Module

Establishes Controller and UI Agnostic Data Model

One and Only component for storing and retrieving data
(local or remote)
class UsrGrp extends Spine.model
   @configure "UsrGrp",
   ↳"groupName", "description"


   @extend Spine.Model.Ajax
   @extend Spine.Model.Local
class UsrGrp extends Spine.model
   @configure "UsrGrp",
   ↳"groupName", "description"


   @extend Spine.Model.Ajax
   @extend Spine.Model.Local


   validate: ->
      unless @groupName.length > 0
      "Group Name field missing"
@extend Spine.Model.Ajax
@extend Spine.Model.Local


validate: ->
   unless @groupName.length > 0
   "Group Name field missing"
CONTROLLER
Controller


Brings it all together

Glues the HTML, DOM manipulation and Model together

Handles all event and UI interaction binding

Extends Spine.Events, allows custom event triggering
class UsrGrpsApp extends
   ↳Spine.Controller
   constructor: ->
      super
      UsrGrp.bind("create",
      ↳@addOne)


   #Bind event handling
UsrGrp.bind("create",
   ↳@addOne)


#Bind event handling
#to DOM elements
events:
   "submit form": "create"
   "click .deleteAll": "delete"


#DOM Element references
elements:
events:
   "submit form": "create"
   "click .deleteAll": "delete"


#DOM Element references
elements:
  "form input": "input"
  ".list": "list"


#New up a model & render
create: (event) ->
"form input": "input"
  ".list": "list"


#New up a model & render
create: (event) ->
   #Prevent form submit
   #page load from propagating
   event.preventDefault()


   #New up a model instance
#Prevent form submit
#page load from propagating
event.preventDefault()


#New up a model instance
user = new UserGrp(
↳groupName: @input.val())


#Persist or catch
#validation error
unless user.save()
user = new UserGrp(
  ↳groupName: @input.val())


   #Persist or catch
   #validation error
   unless user.save()
      #Very basic notification
      alert user.validate()


#Add new element to DOM
#Add new element to DOM
#Triggered on create() of Model
addOne: (userGroup) =>
   group = new UsrGrps(
  ↳item: userGroup)
   @list.append(
  ↳$("#listTemplate")
  ↳.tmpl(userGroup))
GETTING IT STARTED
$ = jQuery
$ ->
  new UsrGrpsApp(el: $("#groups"))
CONTROLLER MANAGER
Controller Manager


Simple state machine for Controller Instances

One additional script to include in HTML

Manipulates DOM with class flag
<script src="lib/spine/manager.js"
↳type="text/javascript"></script>
class UsrGrpsApp extends
↳Spine.Controller
class OtherController extends
↳Spine.Controller


ugApp = new UsrGrpsApp
other = new OtherController
class UsrGrpsApp extends
↳Spine.Controller
class OtherController extends
↳Spine.Controller


ugApp = new UsrGrpsApp
other = new OtherController


new Spine.Manager(ugApp, other)
class OtherController extends
↳Spine.Controller


ugApp = new UsrGrpsApp
other = new OtherController


new Spine.Manager(ugApp, other)
ugApp.active()
Ques
    tions
         ?
Contact Me

Jordan McCullough
Twitter: @ambientphoto
Email: jordanm@ambientideas.com
Web: ambientideas.com
Links & Resources

SpineJS: http://www.SpineJS.com

jQuery: http://www.jQuery.com

Zepto: http://www.ZeptoJS.com

CoffeeScript: http://jashkenas.github.com/coffee-script/

Little Book of CoffeeScript:
http://arcturo.github.com/library/coffeescript/
Links & Resources


JavaScriptMVC: http://javascriptmvc.com

Backbone JS: http://documentcloud.github.com/backbone/

SproutCore: http://www.sproutcore.com

Knockout: http://knockoutjs.com
Photo Credit



Ambient Ideas Photography
http://www.AmbientIdeasPhotography.com

Mais conteúdo relacionado

Mais procurados

From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
Modern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapModern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapHoward Lewis Ship
 
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL SpartakiadeJohannes Hoppe
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperJonathan Wage
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...Rafael Dohms
 
Dig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup CairoDig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup CairoMohamed Mosaad
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMJonathan Wage
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureGarann Means
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMJonathan Wage
 
droidQuery: The Android port of jQuery
droidQuery: The Android port of jQuerydroidQuery: The Android port of jQuery
droidQuery: The Android port of jQueryPhDBrown
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascriptShah Jalal
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009hugowetterberg
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryRebecca Murphey
 
RxSwift 시작하기
RxSwift 시작하기RxSwift 시작하기
RxSwift 시작하기Suyeol Jeon
 

Mais procurados (20)

From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
Advanced MongoDB #1
Advanced MongoDB #1Advanced MongoDB #1
Advanced MongoDB #1
 
Modern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapModern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter Bootstrap
 
BVJS
BVJSBVJS
BVJS
 
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
 
Dig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup CairoDig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup Cairo
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODM
 
droidQuery: The Android port of jQuery
droidQuery: The Android port of jQuerydroidQuery: The Android port of jQuery
droidQuery: The Android port of jQuery
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
 
Ch8(oop)
Ch8(oop)Ch8(oop)
Ch8(oop)
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQuery
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
RxSwift 시작하기
RxSwift 시작하기RxSwift 시작하기
RxSwift 시작하기
 
Spock and Geb
Spock and GebSpock and Geb
Spock and Geb
 

Semelhante a Spine JS

Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsJarod Ferguson
 
Building DSLs With Eclipse
Building DSLs With EclipseBuilding DSLs With Eclipse
Building DSLs With EclipsePeter Friese
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformanceJonas De Smet
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An AnalysisJustin Finkelstein
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using RoomNelson Glauber Leal
 
Scala in practice
Scala in practiceScala in practice
Scala in practicepatforna
 
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...Databricks
 
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...Matthew Tovbin
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersAmanda Gilmore
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 
Jazoon 2010 - Building DSLs with Eclipse
Jazoon 2010 - Building DSLs with EclipseJazoon 2010 - Building DSLs with Eclipse
Jazoon 2010 - Building DSLs with EclipsePeter Friese
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your CodeDrupalDay
 
jQuery - Introdução
jQuery - IntroduçãojQuery - Introdução
jQuery - IntroduçãoGustavo Dutra
 
JQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraJQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraTchelinux
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of LithiumNate Abele
 
Knockoutjs UG meeting presentation
Knockoutjs UG meeting presentationKnockoutjs UG meeting presentation
Knockoutjs UG meeting presentationValdis Iljuconoks
 

Semelhante a Spine JS (20)

Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
Building DSLs With Eclipse
Building DSLs With EclipseBuilding DSLs With Eclipse
Building DSLs With Eclipse
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and Performance
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An Analysis
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...
The Rule of 10,000 Spark Jobs: Learning From Exceptions and Serializing Your ...
 
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...
The Rule of 10,000 Spark Jobs - Learning from Exceptions and Serializing Your...
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
Jazoon 2010 - Building DSLs with Eclipse
Jazoon 2010 - Building DSLs with EclipseJazoon 2010 - Building DSLs with Eclipse
Jazoon 2010 - Building DSLs with Eclipse
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
jQuery - Introdução
jQuery - IntroduçãojQuery - Introdução
jQuery - Introdução
 
JQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraJQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo Dutra
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
Knockoutjs UG meeting presentation
Knockoutjs UG meeting presentationKnockoutjs UG meeting presentation
Knockoutjs UG meeting presentation
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Último (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Spine JS

  • 2. var Messenger = function(message){ defaultGreeting = "hello "; this.message = message; } Messenger.prototype.sayHi = function(){ alert(defaultGreeting + this.message); } var hiDosug = new Messenger("DOSUG"); hiDosug.sayHi();
  • 3. tr var Messenger = function(message){ ("id", listParent.children("ul").at "list" + uniqueListId); defaultGreeting = "hello "; self.listName = "list" + listParent = $ this.message = message; uniqueLi stId; ('#categoryList').pare nt(); } " + li stParent.attr("id", "wrapper var listParent.children("u ViewBuilder = functi l").attr("id", on(type){ uniqueListId); "list" + uniqueListId); Messenger.prototype.sayHi = functionunction(){ defaultSomething = "grid" se lf.wrapperName = self pper" + "wra ; .listName alert(defaultGreeting + this.message); = "list" + uniqueLi stId; uniqueListId; this.type = type; this.message = message; , } ue); tr self.updateView(inlistPa tion Transi rent.attr("id",this.buildView(); "wrapper" + } uniqueListId); listParent = $ var hiDosug = new Messenger("DOSUG"); }) ('#categoryList').parent(); } Messenger.prototype.sayHi = function(){ self.wrapperName = "wra hiDosug.sayHi(); + pper" ); uniqueListId; listParent.children("ul").attr("id", Messen alert(defaultGreeting + this.message); ger.prototype.buildView = function( "list" + uniqueListId); }switch(this.viewType){ self.updateView(inTran target.loa $( tion, true 'templates } si d(); /category.html' self.listName = "list" + case "grid": uniqueListId; }) var hiDosug = new Messenger("DOSUG"); function() { templatePath = "templates/ listParent.attr("id", "wrapper" + ); categoryGridElement.html"; hiDosug.sayHi(); listParent = $ uniqueListId); ('#categoryList').parent } (); break; self.wrapperName = "wrapper" + listParent.children("ul" uniqueListId; "list" + uniqueListId); ).att default: self.updateView(inTransition, true); templatePath = "templates/ self.listName = "list" + uniqueListId; categoryListElement.html"; }) } listParent.attr("id", "w rapper
  • 4. What’s Needed Framework for consistency Core UI and Data Modeling Easy to get up to speed Minimal dependencies
  • 11. CoffeeScript You’re not forced into using it SpineJS is written in CoffeeScript It’s not just a cool new trend...
  • 12. CoffeeScript Benefits Helps avoid erroneously global vars and pollution Leads to more readable code Provides appearance of classical inheritance
  • 13. WHAT’S IN IT FOR ME?
  • 14. Benefits Lightweight Framework Single Library Dependency Straightforward Use
  • 15. More reasons... Flexible UI rendering with no pre-determined templating Built in LocalStorage and RESTful support Write once with near-ready-to-deploy mobile code
  • 17. Compatibility No Plans for Archaic Browser Support HTML5-Centric with LocalStorage json2.js Dependency for IE7 Support
  • 19. Spine Mobile Strengthens reason to build around core framework Extend core components to be mobile ready Requires minimal additional implementation
  • 20. Spine Mobile No Re-Writing, Extend Existing Controllers Transition Effects Tap & Orientation Events
  • 23. Module (a.k.a. Spine Class) Spine’s extension of core CoffeeScript class Provides class and instance property support All Spine internals inherit from Spine.Module
  • 24. Spine Module (a.k.a. Extended CoffeeScript Class) class MyClass extends Spine.Module @extend MyOtherClass @include myInstanceProperty
  • 25. MODEL
  • 26. Model Inherits from Spine.Module Establishes Controller and UI Agnostic Data Model One and Only component for storing and retrieving data (local or remote)
  • 27. class UsrGrp extends Spine.model @configure "UsrGrp", ↳"groupName", "description" @extend Spine.Model.Ajax @extend Spine.Model.Local
  • 28. class UsrGrp extends Spine.model @configure "UsrGrp", ↳"groupName", "description" @extend Spine.Model.Ajax @extend Spine.Model.Local validate: -> unless @groupName.length > 0 "Group Name field missing"
  • 29. @extend Spine.Model.Ajax @extend Spine.Model.Local validate: -> unless @groupName.length > 0 "Group Name field missing"
  • 31. Controller Brings it all together Glues the HTML, DOM manipulation and Model together Handles all event and UI interaction binding Extends Spine.Events, allows custom event triggering
  • 32. class UsrGrpsApp extends ↳Spine.Controller constructor: -> super UsrGrp.bind("create", ↳@addOne) #Bind event handling
  • 33. UsrGrp.bind("create", ↳@addOne) #Bind event handling #to DOM elements events: "submit form": "create" "click .deleteAll": "delete" #DOM Element references elements:
  • 34. events: "submit form": "create" "click .deleteAll": "delete" #DOM Element references elements: "form input": "input" ".list": "list" #New up a model & render create: (event) ->
  • 35. "form input": "input" ".list": "list" #New up a model & render create: (event) -> #Prevent form submit #page load from propagating event.preventDefault() #New up a model instance
  • 36. #Prevent form submit #page load from propagating event.preventDefault() #New up a model instance user = new UserGrp( ↳groupName: @input.val()) #Persist or catch #validation error unless user.save()
  • 37. user = new UserGrp( ↳groupName: @input.val()) #Persist or catch #validation error unless user.save() #Very basic notification alert user.validate() #Add new element to DOM
  • 38. #Add new element to DOM #Triggered on create() of Model addOne: (userGroup) => group = new UsrGrps( ↳item: userGroup) @list.append( ↳$("#listTemplate") ↳.tmpl(userGroup))
  • 40. $ = jQuery $ -> new UsrGrpsApp(el: $("#groups"))
  • 42. Controller Manager Simple state machine for Controller Instances One additional script to include in HTML Manipulates DOM with class flag
  • 44. class UsrGrpsApp extends ↳Spine.Controller class OtherController extends ↳Spine.Controller ugApp = new UsrGrpsApp other = new OtherController
  • 45. class UsrGrpsApp extends ↳Spine.Controller class OtherController extends ↳Spine.Controller ugApp = new UsrGrpsApp other = new OtherController new Spine.Manager(ugApp, other)
  • 46. class OtherController extends ↳Spine.Controller ugApp = new UsrGrpsApp other = new OtherController new Spine.Manager(ugApp, other)
  • 48. Ques tions ?
  • 49. Contact Me Jordan McCullough Twitter: @ambientphoto Email: jordanm@ambientideas.com Web: ambientideas.com
  • 50. Links & Resources SpineJS: http://www.SpineJS.com jQuery: http://www.jQuery.com Zepto: http://www.ZeptoJS.com CoffeeScript: http://jashkenas.github.com/coffee-script/ Little Book of CoffeeScript: http://arcturo.github.com/library/coffeescript/
  • 51. Links & Resources JavaScriptMVC: http://javascriptmvc.com Backbone JS: http://documentcloud.github.com/backbone/ SproutCore: http://www.sproutcore.com Knockout: http://knockoutjs.com
  • 52. Photo Credit Ambient Ideas Photography http://www.AmbientIdeasPhotography.com