web components
play

Web Components Reuse, reduce, recycle Whats Web Components? - PowerPoint PPT Presentation

Web Components Reuse, reduce, recycle Whats Web Components? Component-based software engineering Four features: Custom Elements Shadow DOM HTML Imports HTML Templates Custom Elements <div> soup Art Custom


  1. Web Components Reuse, reduce, recycle

  2. What’s Web Components? Component-based software engineering Four features: Custom Elements ○ Shadow DOM ○ HTML Imports ○ HTML Templates ○

  3. Custom Elements <div> soup Art

  4. Custom Elements Basic Declaration

  5. Custom Elements Lifecycle methods

  6. Custom Elements

  7. Shadow DOM “Hidden in the shadows” HTML, CSS, JS hidden away For example, the <video> tag

  8. HTML Templates & Imports

  9. Tying it all together

  10. Browser Support

  11. Polyfills http://webcomponents.org/

  12. Google Polymer https://www.polymer-project.org/1.0/

  13. Google Polymer

  14. Open Source

  15. Open Source https://customelements.io/

  16. ECMAScript 2015 (ES6) The future!

  17. What is ES6? New Javascript features!

  18. Problems?

  19. Compatibility

  20. Transpiling

  21. TypeScript JavaScript that scales

  22. What’s good about Easy to prototype ● Hybrid imperative/functional ● JavaScript? language First-class functions ● Natural fit for real-time, ● event-driven applications Great open source community ●

  23. What’s bad about JavaScript? (well, one thing that’s bad anyway...)

  24. Enter TypeScript Static typing is actually a super good ● thing Let the compiler do as much of the debugging ○ work for you as possible. You’re probably thinking of types in your ○ head already anyway. TypeScript - a superset of JavaScript with ● a static type system Developed by Microsoft in 2012, now at ○ version 2.1 All your JavaScript code is technically ○ TypeScript code too. Transpiles to JavaScript and does awesome ○ typechecking stuff.

  25. Getting Started 1. npm install -g typescript 2. tsc -w <file.ts> 3. (optional) find a TypeScript plugin for your favorite editor

  26. What is a valid input for sortByName?

  27. The same thing in TypeScript Now do you know what a valid input is?

  28. It also works with ES6 out of the box.

  29. Type Annotations Enums enum Color = {Red, Green, Blue}; ● let c: Color = Color.Green; Basic Types Interfaces let x: number = 6; ● let color: string = “blue”; interface myType = { ● ● width: number ; let list: number [] = [1, 2, 3]; ● color?: string ; Tuples readonly x: number ; } let x: [ string , number ] = ● interface SearchFunc = { ● [“hello”, 10]; (source: string , subString: string ): boolean ; }

  30. Declarations declare class Student { firstName: any ; Let TypeScript generate a ● middleInitial: any ; declaration file with the flag lastName: any ; --declaration fullName: string ; Like a C++ header file! ● constructor(firstName: any , middleInitial: any , lastName: any ); } interface Person { firstName: string ; lastName: string ; } declare function greeter(person: Person ): string ;

  31. Configuration Add a tsconfig.json file to the { top-level directory of your “compilerOptions”: { project. “outFile”: “public/js/script.js”, “watch”: true }, “files”: { Then just run tsc to build. “source_js/*” } }

  32. New in TypeScript 2.0 --strictNullChecks “ I call it my billion-dollar mistake… My ● goal was to ensure that all use of references should be absolutely safe, with checking null and undefined performed automatically by the compiler. But values are completely I couldn’t resist the temptation to put in a disallowed, unless you null reference, simply because it was so specifically define the easy to implement. This has led to type to say it’s okay innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.” Tony Hoare, inventor of ALGOL W

  33. Angular 2.0

  34. So what, it’s just more Angular, right? It’s actually “ drastically different” from Angular 1.x ● Announced in Oct. 2014, released in Sept. 2016 ● Not backwards compatible with Angular 1.x. At all. ● (web devs did not much care for this bit…) ○ Core goals: ● Focus on encapsulated Web Components ○ More elegant API with less feature creep ○ Improve performance across all kinds of devices ○

  35. What’s Different? Improved performance Better dependency injection ● ● Uses TypeScript No more $scope or ● ● New Component system controllers ● Simpler routing ●

  36. Getting Started git clone https://github.com/angular/quickstart.git quickstart cd quickstart npm install npm start

  37. Demo

  38. Mobile App Development with Ionic CS498RK, Fall 2016

  39. Mobile App Development Landscape Using Ionic to build Hybrid Apps

  40. Mobile Landscape Responsive Native Webpages Apps

  41. Mobile Landscape Responsive Native Webpages Apps Complexity of developing for Limited access to device APIs multiple platforms Misses out on benefits of distribution through app stores Performance Penalty

  42. Alternatives Responsive Native Webpages Apps

  43. Xamarin C# based framework for building fully native, cross platform apps Generates multi-platform native code

  44. Ionic Series of performance-focused, beautifully designed HTML, CSS and JavaScript components optimized for building mobile applications Resulting apps are hybrid: neither purely web-based nor truly native Layout rendering is done via Web views Access to native device APIs Distribution similar to native apps possible

  45. Examples of Ionic Apps

  46. Technologies Used

  47. Demo

  48. Routing in Ionic Does not use ngRoute Uses ui-­‑router which is better suited for complex apps https://github.com/angular-ui/ui-router/wiki#state-manager

  49. Router as State Machine State Machine design abstraction on top of traditional router Routes are referred to as states and URLs are properties of states ui-sref directive instead of links in your HTML http://www.funnyant.com/angularjs-ui-router/

  50. Router as State Machine http://www.funnyant.com/angularjs-ui-router/

  51. Persisting Data Local Storage: TODO App Another Todo App angular-­‑local-­‑storage ¡ ¡ Example ngStorage ¡ Consuming APIs Mobile Backend As a Service Firebase

  52. Next Class: Performance/Optimizations, Accessibility, Security

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend