Tomasz Ducin
independent consultant, architect, developer, trainer, speaker #architecture #performance #javascript #typescript #react #angular
Tomasz Ducin
23.05.2015 Łódź
senior software consultant @ Cybercom Poland
blah, blah, blah...
przeszłość
teraźniejszość
co z tego wynika
> true + true
2
> "2" - 1
1
> "2" + 1
"21"
> typeof NaN
'number'
> NaN instanceof Number
false
> [] + []
''
> [] + {}
'[object Object]'
> {} + []
0
> {} + {}
NaN
pisząc server-side, wybiera się jedną wersję platformy
zaś pisząc aplikacje pod przeglądarki mamy IE...
i jest łatwiej.
ECMA-262 Ed.1 (1997)
ECMAScript 2 (1998)
ECMAScript 3 (1999)
ECMAScript 5 (2009)
ECMAScript 6 / Harmony (in progress)
- IE9 hurraaaa! <3
ES6 wyczekiwany jak Java 1.8
prototype.js (2005)
jQuery (2006)
node.js (2009)
angularJS (2009)
backbone.js (2010)
underscore.js/lodash (2013)
String.prototype.camelize = function() { return this.substr(0,1).toUpperCase() + this.substr( 1 ); }
String.prototype
String
String, Date, Number, Form, AJAX, Class, ...
$( "button.continue" ).html( "Next Step..." )
var hiddenBox = $( "#banner-message" );
$( "#button-container button" ).on( "click", function( event ) {
hiddenBox.show();
});
_.keys(object)
_.values(object)
_.pick(object, *keys)
_.extend(destination, *sources)
_.has(object, key)
...
_.each(list, iteratee)
_.map(list, iteratee)
_.reduce(list, iteratee)
_.filter(list, predicate)
_.shuffle(list)
_.first(array)
_.indexOf(array, value)
...
_.bind(function, object, *arguments)
_.delay(function, wait, *arguments)
_.memoize(function)
_.once(function)
...
var value = _.chain(array)
.sortBy(comparator)
.map(mapper)
.first()
.value();
<customer-list collapsed="true" />
<div>
<label>Name:</label>
<input type="text" ng-model="yourName">
<h1>Hello {{yourName}}!</h1>
</div>
Node Package Manager
Bower
Grunt
Yeoman
npm install <package>
npm install <package> -g
npm install <package> --save
npm install <package> --save-dev
npm init
npm publish
...
{
"name": "faker",
"description": "Generate massive amounts of fake contextual data",
"version": "2.1.3",
"contributors": [
"Marak Squires <marak.squires@gmail.com>",
"Matthew Bergman <matt@novafabrica.com>",
"Tomasz Ducin <tomasz.ducin@gmail.com>"
],
"repository": {
"type": "git",
"url": "http://github.com/Marak/Faker.js.git"
},
"scripts": {
"test": "node_modules/.bin/mocha test/*.*.js"
},
"devDependencies": {
"browserify": "5.11.1",
"gulp": "3.8.8",
"gulp-mustache": "0.4.0",
...
}
grunt
grunt build
grunt clean
grunt clean:target
grunt clean copy uglify
grunt.registerTask('build', [
'clean', 'copy', 'cssmin', 'uglify'
]);
grunt.registerTask('mock', [
'json_mapreduce', 'browserify'
]);
grunt.registerTask('run', [
'http-server'
]);
grunt.registerTask('default', [
'test', 'build', 'mock',
]);
yo backbone
yo backbone:model
...
yo angular
yo angular:directive
...
var m = require(module);
var m = require(module);
jako platforma server-side pozwala zautomatyzować pracę we frontendzie
http://jaxenter.com/javascript-wins-tiobe-language-year-award-113560.html
i inne (PolyConf, Warsjawa, etc.)
http://githut.info/
http://www.modulecounts.com/
By Tomasz Ducin
How did the Web change over last 10 years? And how does this affect developers? Presentation made during CybercomDEV 2015 conference (2015.cybercomdev.pl)
independent consultant, architect, developer, trainer, speaker #architecture #performance #javascript #typescript #react #angular