Skip to content

Commit

Permalink
chore: add playground example
Browse files Browse the repository at this point in the history
  • Loading branch information
hmdhk committed Jun 14, 2017
1 parent 33a12ad commit 34ad4a7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
21 changes: 21 additions & 0 deletions example/playground/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
<title>Play ground</title>
<link rel="stylesheet" href="../css/style.css">
<script src="rootspec.js"></script>
<script src="../../dist/zone.js"></script>
<script src="playground.js"></script>

</head>

<body>

<h1>play ground</h1>


</body>

</html>
8 changes: 8 additions & 0 deletions example/playground/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
;(function () {
console.log(window.Zone && window.Zone.current)
setTimeout(function () {
console.log('settimeout')
}, 1000)

Promise.reject(new Error('reason'))
})()
16 changes: 16 additions & 0 deletions example/playground/rootspec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
;(function () {
window['__rootZoneSpec__'] = {
name: 'customRoot',
onScheduleTask: function (parentZoneDelegate, currentZone, targetZone, task) {
console.log('onScheduleTask', 'targetZone:', targetZone, task.source, ' type:', task.type)
return parentZoneDelegate.scheduleTask(targetZone, task)
},
onInvokeTask: function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
console.log('onInvokeTask', 'targetZone:', targetZone, task.source, ' type:', task.type)
return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs)
},
onCancelTask: function (parentZoneDelegate, currentZone, targetZone, task) {
return parentZoneDelegate.cancelTask(targetZone, task)
}
}
})()

0 comments on commit 34ad4a7

Please sign in to comment.