future of scripting

42
Umbraco, Angular and Typescript Making typescript a part of the way you work

Upload: perploug

Post on 17-Jul-2015

266 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Future of scripting

Umbraco, Angular and Typescript

Making typescript a part of the way you work

Page 2: Future of scripting

HELLO

Page 3: Future of scripting

PER

Page 4: Future of scripting

Agenda

Page 5: Future of scripting

Umbraco + angular Tooling Benefits

Perspective

Page 6: Future of scripting

MEMEMEMEMEMEMEMEMEMEMEME

Page 7: Future of scripting

Umbraco

Page 8: Future of scripting

package.manifest

{ /views/license.html /scripts/controller.js /styles/style.css}

Server

Browser

{ /views/license. /scripts/contro /styles/style. }

Page 9: Future of scripting

Hello world demo

Page 10: Future of scripting

tooling

Page 11: Future of scripting

automation testing

optimization

Page 12: Future of scripting

JS Tooling Ecosystem• Code Editor (Atom,Sublime,Brackets Visual Studio)

• Build system (MsBuild, Grunt, Gulp, Jake, Broccoli)

• Dependencies (Nuget, Bower, npm, tsd)

• Compiler (tsc)

• Scaffolding (yeoman)

• Unit testing (karma, TsUnit, jasmine)

Page 13: Future of scripting

> npm install typescript -g> tsc file.ts

Page 14: Future of scripting
Page 15: Future of scripting

My Yeoman workflow

Page 16: Future of scripting

GruntAtom Karma

Grunt-ts Grunt-tsd

Atom-Typescript

Page 17: Future of scripting

My Yeoman with Typescript workflow

Page 18: Future of scripting

JSvsTS

Page 19: Future of scripting

syntax

Page 20: Future of scripting

angular.module(‘umbraco').controller('DriversLicenseEditorController', ['$scope',

function($scope) {

//your code

}

]);

Page 21: Future of scripting

module License.Controllers {

export class LcsController {static $inject = [‘$scope'];

constructor(private $scope) {//your code

}

angular.module(‘umbraco').controller(‘LicenseController',LcsController);

}

Page 22: Future of scripting

angular.module(‘umbraco').directive('someDirective', [‘$timeout',

function($timeout) {

return { link: link, templateUrl: ‘view.html', restrict: 'EA' };

function link(scope, element, attrs) { /* your code */ }}]);

Page 23: Future of scripting

class MyDirective { public link: (scope: ng.IScope,

element: ng.IAugmentedJQuery, attrs: ng.IAttributes) => void;

public templateUrl = ‘view.html';

constructor(/*list of dependencies*/) { this.link = (scope: ng.IScope,

element: ng.IAugmentedJQuery, attrs: ng.IAttributes) =>

{ /*handle all your linking requirements here*/ };

} public static Factory() { var directive = (/*list of dependencies*/) => { return new MyDirective(/*list of dependencies*/); };

directive['$inject'] = ['/*list of dependencies*/']; return directive; }}angular.module(“umbraco”, MyDirective.Factory() );

Page 24: Future of scripting

module Project.Directives { export interface IMyScope: ng.IScope { name: string; }

export function MyDirective(): ng.IDirective { return { template: '<div>{{name}}</div>', scope : {}, link : (scope: IMyScope) => { scope.name = 'Aaron'; } }; }

angular.module(“umbraco”, MyDirective );}

Page 25: Future of scripting
Page 26: Future of scripting

structure

Page 27: Future of scripting
Page 28: Future of scripting

scope, model interfaces any => concrete

Page 29: Future of scripting
Page 30: Future of scripting

definitions

Page 31: Future of scripting
Page 32: Future of scripting

> npm install tsd -g> tsd install jquery> tsd install angularjs

Page 33: Future of scripting

Angular.d.ts

Page 34: Future of scripting

discovery

Page 35: Future of scripting

service discovery

Page 36: Future of scripting

tooling

Page 37: Future of scripting

You all get your own workflow!

Page 38: Future of scripting

• Code Editor (Atom,Sublime,Brackets Visual Studio)

• Build system (MsBuild, Grunt, Gulp, Jake, Broccoli)

• Dependencies (Nuget, Bower, npm, tsd)

• Compiler (tsc)

• Scaffolding (yeoman)

• Unit testing (karma, TsUnit, jasmine)

Page 39: Future of scripting

perspective

Page 40: Future of scripting

Future of JS now Angular 2

In developement Not M$ only

Page 41: Future of scripting

Thanks!Per Ploug

@pploug - [email protected]

github.com/perploug

Page 42: Future of scripting