Deep Dive on How ArcGIS API for JavaScript Widgets Were Built

Similar documents
Building Your own Widget with ArcGIS API for JavaScript

Frontend UI Training. Whats App :

Full Stack boot camp

Front End Nanodegree Syllabus

55249: Developing with the SharePoint Framework Duration: 05 days

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Developing Add-Ins for ArcGIS Pro (.NET) Toronto Esri Canada UC Presented by: Gandhar Wazalwar & Kern Ranjitsingh October 11, 2018

Front End Nanodegree Syllabus

Advanced React JS + Redux Development

Cisco Spark Widgets Technical drill down

"Charting the Course... MOC A: Developing with the SharePoint Framework. Course Summary

Modern and Responsive Mobile-enabled Web Applications

Advance Mobile& Web Application development using Angular and Native Script

P a g e 1. Danish Technological Institute. Scripting and Web Languages Online Course k Scripting and Web Languages

Nick Senger & Jesse van den Kieboom

Integrating New Visualizations with Pentaho Using the Viz API

Introduction to Sencha Ext JS

Developing Cross-Platform Native Apps with AppStudio for ArcGIS. Jo Fraley Erwin Soekianto

Web AppBuilder Presented by

Lab 6: Testing. Software Studio DataLab, CS, NTHU

ArcGIS Runtime SDK for.net: Building Xamarin Apps. Rich Zwaap Thad Tilton

"Charting the Course... Comprehensive Angular. Course Summary

Web AppBuilder for ArcGIS Dive Into Mobile Development. Yiwei Ma & Kevin Gao

Arjen de Blok. Senior Technical Consultant bij ICT Groep ( sinds 1995 Programmeren sinds 1990 Technologiën. Links

Modular JavaScript. JC Franco. Blake Stearman

Welcome. Quick Introductions

Course 1: Microsoft Professional Orientation: Front-End Web Developer

Presented by. Dheepa Iyer Managing Consultant. Commissioned for. Reston SharePoint User Group. SharePoint Framework. May 2017

Theme System. Wisej Themes 1 OVERVIEW

Stencil: The Time for Vanilla Web Components has Arrived

Web Development for Dinosaurs An Introduction to Modern Web Development

Angular 2 and TypeScript Web Application Development

Front End. Presentation Layer. UI (User Interface) User <==> Data access layer

Spark SDK Video - Overview and Coding Demo

ArcGIS Runtime SDK for Qt: Building Apps. Koushik Hajra and Lucas Danzinger

Front-End Web Developer Nanodegree Syllabus

20480C: Programming in HTML5 with JavaScript and CSS3. Course Code: 20480C; Duration: 5 days; Instructor-led. JavaScript code.

widgetjs Documentation

React + React Native. Based on material by Danilo Filgueira

Getting started with Tabris.js Tutorial Ebook

Collaborate. w/ ArcGIS Runtime SDK for Android

AngularJS Fundamentals

08/10/2018. Istanbul Now Platform User Interface

Full Stack Developer with Java

FRONT END WEB. {< Course Details >}

An Introduction to TypeScript. Personal Info

Full Stack Web Developer

High Performance Single Page Application with Vue.js

Real-Time GIS Leveraging Stream Services

ArcGIS API for JavaScript: Getting Started Andy René

Comprehensive AngularJS Programming (5 Days)

Webform: THERE IS THIS FOR THAT

International Research Journal of Engineering and Technology (IRJET) e-issn: Volume: 05 Issue: 06 June p-issn:

Etanova Enterprise Solutions

Advanced Development with the ArcGIS API for JavaScript. Jeremy Bartley, Kelly Hutchins, Derek Swingley

PHP WITH ANGULAR CURRICULUM. What you will Be Able to Achieve During This Course

CREATE SASSY WEB PARTS. Developer Guide to SASS usage in SPFx

A Closer Look at XPages in IBM Lotus Domino Designer 8.5 Ray Chan Advisory I/T Specialist Lotus, IBM Software Group

eclipse rich ajax platform (rap)

Angular 2 Programming

Webform: THERE IS THIS FOR THAT

SIX REASONS. You Should Use ArcGIS API 4.0 for JavaScript. By Julie Powell, Esri Product Management

ArcGIS Viewer for Silverlight Advanced Topics

WebStorm, intelligent IDE for JavaScript development

Finally JavaScript Is Easy, with Oracle JET! Geertjan Wielenga Product Manager Oracle Developer Tools

FRONT END DEVELOPER CAREER BLUEPRINT

Adapt Learning: Adapt Framework Concept and Vision

04 Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio. Ben Riga

Liferay Digital Experience Platform. New Features Summary

Essentials of Developing Windows Store Apps Using HTML5 and JavaScript

Web UI. Survey of Front End Technologies. Web Challenges and Constraints. Desktop and mobile devices. Highly variable runtime environment

Interactive XML Visualization - using XSLT 2.0 on the Browser. Phil Fearon - Saxonica

CHOOSING THE RIGHT HTML5 FRAMEWORK To Build Your Mobile Web Application

Vue.js Developer friendly, Fast and Versatile

django-baton Documentation

Templates and Databinding. SWE 432, Fall 2017 Design and Implementation of Software for the Web

PHP + ANGULAR4 CURRICULUM 6 WEEKS

ArcGIS Runtime SDK for.net Building Apps. Antti Kajanus David Cardella

POWER BI BOOTCAMP. COURSE INCLUDES: 4-days of instructor led discussion, Hands-on Office labs and ebook.

Full Stack Web Developer

Designing RIA Accessibility: A Yahoo UI (YUI) Menu Case Study

WebApp development. Outline. Web app structure. HTML basics. 1. Fundamentals of a web app / website. Tiberiu Vilcu

Learn Web Development CodersTrust Polska course outline. Hello CodersTrust! Unit 1. HTML Structuring the Web Prerequisites Learning pathway.

ArcGIS Runtime SDK for Android: Building Apps. Shelly Gill

JavaScript and MVC Frameworks FRONT-END ENGINEERING

ArcGIS Pro SDK for.net: Add-in Fundamentals and Development Patterns. Wolf Kaiser, Uma Harano

THE GREAT CONSOLIDATION: ENTERTAINMENT WEEKLY MIGRATION CASE STUDY JON PECK, MATT GRILL, PRESTON SO

City of Mobile GIS Web Mapping Applications: New Technology, New Expectations

ArcGIS GeoEvent Server: Making 3D Scenes Come Alive with Real-Time Data

ANGULAR 2.X,4.X + TYPESRCIPT by Sindhu

Jquery Manually Set Checkbox Checked Or Not

Configuring and Customizing the ArcGIS Viewer for Silverlight. Katy Dalton

Basics of Web Technologies

Building Mashups Using the ArcGIS APIs for FLEX and JavaScript. Shannon Brown Lee Bock

The course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material.

Course 1: Microsoft Professional Orientation: Front-End Web Developer

ArcGIS Pro SDK for.net Beginning Pro Customization. Charles Macleod

Building Custom UIs for APS 2.0 Applications. Timur Nizametdinov, APS Dynamic UI Lead Developer

Introduction to Web AppBuilder for ArcGIS: JavaScript Apps Made Easy

Dreamweaver CS4. Introduction. References :

Transcription:

Deep Dive on How ArcGIS API for JavaScript Widgets Were Built Matt Driscoll @driskull JC Franco @arfncode

Agenda Prerequisites How we got here Our development lifecycle Widget development tips Tools we use Resources Q & A

Prereqs: Accessor Accessor SDK esri/core/accessor Building Classes Using Accessor and the ArcGIS API for JavaScript

Prereqs: TypeScript Leverage ES6 (syntactic sugar) Interfaces Typing const and let vs var () => {} vs bind or this-binding utility TypeScript Setup Using TypeScript with ArcGIS API for Javascript

How we got here 3.x Dojo Dijit Dijit Themes Logic tied to UI 4.x Abstracted & framework independent ViewModels

Why? Framework independent Easily customizable themes Responsive design Redesigned Widget API Consistent with core API

Our development lifecycle How do we go about developing widgets?

Development lifecycle API design Kickoff UI/UX design Develop ViewModel Develop View Write tests Pull request API merge!!!

Development lifecycle: API Design Widget developer writes objective for widget Sample Widget dev defines API in markdown View & ViewModel Properties Methods Events Sample code snippets Demos Q & A API reviewed and tweaked JS doc written and approved

Development lifecycle: ViewModel Friendly, consistent naming Public methods Return types Arguments Public properties Make sure no view/ui logic

Development lifecycle: View Research DOM structure needed for widget Layout containers needed Using proper semantic tags for nodes CSS lookup object used in render() Accessible, Aria roles present if necessary Properties, events, methods aliased as necessary Make sure no API logic

Development lifecycle: Styles Classes needed BEM naming of classes 4x Widgets can use flexbox for layout

Development lifecycle: UI/UX Design Meeting with our creative lab Discuss needs, API Collaborate on design and tweak markup as necessary Receive mockup/wireframes/assets/sass Implement design

Development lifecycle: Tests Make sure we have tests that hit all the API Unit, integration, functional, screenshot tests Methods are tested with all options and return types Assert properties behave as expected when modified Screenshot tests Test early

Development lifecycle: Pull Request All the code changes done in a git branch PR is opened with all changes and tests included PR is reviewed and tested API build is successful Merge!

Development tips

Development tips: API Design How things can be done differently in 4 compared to 3 Leverage Collection Accessor View properties instead of events Read-only properties Promises for async operations Support modules Offloading logic where appropriate. More modular.

Development tips: render() Hiding nodes render() { const childnode = this.childvisible? } return ( <div>{childnode}</div> );

Development tips: render() Reusing classes const CSS = { root: "example", part: "example part", disabled: "example--disabled" };

Development tips: render() Toggling classes render() { const dynamicclasses = { [CSS.disabled]: this.isdisabled }; } return ( <div classes={dynamicclasses}>...< );

Development tips: render() class cannot change between renders render() { const rootclass = somecondition? CS } // throws error - cannot change clas return ( <div class={rootclass}>...</div> );

Development tips: render() Use join to apply multiple classes render() { return ( <div class={join(css.root, CSS.but ); }

Development tips: render() Toggle styles (similar to classes) render() { const dynamicstyles = { "x": getx(), "y": gety() }; } return ( <div styles={dynamicstyles}>...</d );

Development tips: render() Attributes are not removed between render calls render() { const tabindex = this.focusable? 0 } // `tabindex` attribute will get ren return ( <div tabindex={tabindex}>...</div> );

Development tips: render() String templates! render() { return ( <div class={css.root}>`hello, ${th ); }

Development tips: render() Distinguishable children render() { } // children are NOT dynamically adde return ( <div> <div>foo</div> <div>bar</div> </div> );

Development tips: render() Distinguishable children render() { const foo = this.showfoo? <div key=" const bar = this.showbar? <div key=" } // children are dynamically added/re return ( <div> {foo} {bar} </div> ); Note: key can be a string, number or object

Development tips: render() Storing data on attributes render() { return ( <div onclick={this._handleclick} data-lucky-numbers={luckynumb ); } private _handleclick(event: MouseEvent const node = event.currenttarget as const luckynums = node.getattribute( console.log(`today's lucky numbers a }

Development tips: render() Binding render() { return ( <div class={css.base}> <div onclick={this._logthis}>thi } <div bind={this} onclick={this._logthis}>thi </div> );

Development tips: render() DOM events render() { return ( <div class={css.base}> <img onclick={this._handleclicke </div> ); } private _handleclickevent(event: Mouse // do something with event }

Development tips: render() Real nodes Markup in render() is virtual Need to store reference to actual node with aftercreate or afterupdate private _realnode: Element = null; render() { return ( <div aftercreate={this._storethisn ) } private _storethisnode(node: Element): this._realnode = node; }

Development tips: render() accessiblehandler render() { return ( <div onclick={this._dosomething} onkeydown={this._dosomething} ); } @accessiblehandler() private _dosomething(): void { //... }

Development tips: render() Close childless node tags for conciseness render() { return ( <div> <div class={css.childless} /> </div> ); }

Development tips: render() Keep render manageable by extracting pieces as it grows render() { return <div>{this._rendercontent()}< } private _rendercontent(): any { return ( <div> <h1>{this.title}</h1> {this._renderitems()} </div> ); }

Development tips: ViewModels Rethinking APIs More collections More Accessors View properties instead of events Read-only properties Support modules Offloading logic where appropriate. More modular Autocasting

Development tips: Styling CSS to Sass Variables Theming Mixins SDK Guide: Styles Sass BEM Icon font / SVG

Widget Theming: Sass CSS preprocessor Variables @mixin (group statements) @include - (use mixins) @import - (split up files) @extend - (inheritance) More power!

Sass Install Installing grunt sass $ npm install --save-dev grunt-sass

Widget BEM BEM: Block Element Modifier Methodology to create reusable components Uses delimiters to separate block, element, modifiers Provides semantics (albeit verbose) Keeps specificity low Scopes styles to blocks /* block */.example-widget {} /* block element */.example-widget input {}.example-widget submit {} /* block--modifier */.example-widget--loading {} /* block element--modifier */.example-widget submit--disabled {}

Development tips: Styling within View CSS lookup object const CSS = { base: "my-widget", title: "my-widget title" }; Lookup referenced in JSX <div class={css.base}/> <h1 class={css.title}>hello world</h </div>

Our Tools IDEs Tasks Testing Other

Tools: IDEs Multiple flavors Visual Studio Code WebStorm and more... Plugins

Tools: Tasks Node/npm Installing Grunt Compile TS/Sass

Testing Intern Jasmine QUnit Karma (test runner)

Other tools Besides an IDE and browser dev tools... SourceTree Terminal GitHub Enterprise Slack :D A handful of browsers Coffee

Additional Resources 4x widget snippets JavaScript Sessions at DevSummit Documentation 4.3

Find this on GitHub GitHub Code

Please Take Our Survey! 1. Download the Esri Events app and go to DevSummit 2. Select the session you attended 3. Scroll down to the "Feedback" section 4. Complete Answers, add a Comment, and Select "Submit"

Questions?