Dart und JavaScript
- 11. Fallstricke.
'' == '0' // false
0 == '' // true
0 == '0' // true
false == 'false' // false
false == '0' // true
false == undefined // false
false == null // false
null == undefined // true
' trn ' == 0 // true
- 14. Dart
VM
Dart
Source
JavaScript
dart2js
Engine
Überall.
- 21. JS -> Dart
Roadcrew.js
github.com/grobmeier/Roadcrew.js
- 22. Use Case
<div class="page" id="tablePage">
<h1>Table Page</h1>
<a href="#otherPage">Other</a>
</div>
<div class="page" id="otherPage">
<h1>Other Page</h1>
<a href="#tablePage">Table</a>
</div>
- 23. .js
function Roadcrew() {
// Constructor
}
Roadcrew.prototype = {
// Prototyp
};
Roadcrew.prototype.act = function () {
// Function
};
Roadcrew.another = function () {
// Static Function
};
- 24. class RoadcrewController {
var pages;
RoadcrewController() {
// Constructor
}
void act(e) {
// Method
}
void static another() {
// Static method
}
}
- 30. .js
var myobj = (function() {
var name = „CG“;
return {
getName = function() {
return name;
}
}
}());
- 33. class Roadcrew {
String _name = „CG“;
String _getTest() => name;
List<DivElement> pages;
}
- 35. class RcEx {
String msg = "An error...";
int c;
RcEx(this.msg, [this.c = 1] );
}
try {
interceptors[pageId].act(d);
} on RcEx catch(e) {
}
- 41. import 'dart:isolate';
echo() {
port.receive((msg, reply) {
reply.send('I received: $msg');
});
}
main() {
var sendPort = spawnFunction(echo);
sendPort.call('Hello').then((reply) {
print(reply);
});
}
- 45. <head>
<link rel="components”
href="click.html">
</head>
<body>
<x-click-counter></x-click-counter>
<script type="application/dart">
main() {}
</script>
- 49. Image Credits
Omikuji: Flickr (jessleecuizon)
Dollars: Flickr (401(K) 2012)
Pub: Flickr (ell brown)
Dog: Flickr (joshme17)
Package: Flickr (lemonhalf)
Threads: Flickr (The Big Quack)
Server: Flickr (getButterfly)
School Bus: Flickr (loop_oh)
Batteries: Flickr (scalespeeder)
Discussing Monks: Flickr (wonderlane)