Skip to content

Commit 8fc8867

Browse files
committed
Modified readme
1 parent f6a8a88 commit 8fc8867

File tree

4 files changed

+13
-30
lines changed

4 files changed

+13
-30
lines changed

README.txt renamed to README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# typescript-dci
2+
3+
Brings support for DCI programming to TypeScript. For more information on DCI, see http://fulloo.info.
4+
5+
Documentation is forthcoming. In the meantime, check out the samples/dci folder.
6+
7+
18
# TypeScript
29

310
Scalable JavaScript development with types, classes and modules.

samples/dci/test.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
1-
//import dci = require('dci');
2-
//console.log(dci);
3-
/*
4-
var DCI = {
5-
Context: function Context(callback) {
6-
return function(...args : any[]) {
7-
var context = new callback();
8-
context.bindRoles.apply(callback, arguments);
9-
return context;
10-
}
11-
}
12-
};
13-
*/
141
function TransferMoney(sourceAcct, destinationAcct) {
152
var __context = this;
163
//Role binding
174
__context.SourceAccount = sourceAcct;
185
__context.DestinationAccount = destinationAcct;
196
//Execute the use case
20-
__context.__$SourceAccount.call(__context.SourceAccount);
7+
__context.__$SourceAccount.transferOut.call(__context.SourceAccount);
218
this.__$SourceAccount = { transferOut: function () {
229
//TODO test calling role methods this way:
2310
//this['withdraw']();
24-
DCI.callMethodOnSelf(__context, this, 'SourceAccount', 'withdraw');
25-
__context.__$DestinationAccount.call(__context.DestinationAccount);
11+
__dci_internal__.callMethodOnSelf(__context, this, 'SourceAccount', 'withdraw');
12+
__context.__$DestinationAccount.deposit.call(__context.DestinationAccount);
2613
}
2714
,withdraw: function () {
2815
console.log('withdraw');

samples/dci/test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
//import dci = require('dci');
2-
//console.log(dci);
3-
4-
/*
5-
var DCI = {
6-
Context: function Context(callback) {
7-
return function(...args : any[]) {
8-
var context = new callback();
9-
context.bindRoles.apply(callback, arguments);
10-
return context;
11-
}
12-
}
13-
};
14-
*/
151

162
function TransferMoney(sourceAcct, destinationAcct) {
173
//Role binding

src/compiler/emitter.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,9 @@ module TypeScript {
770770
//this.writeLineToOutput("__context.__rolePlayers = {};");
771771
this.indenter.decreaseIndent();
772772
}
773+
774+
//DCI TODO
775+
//Roles should be output here, at the top of the function, not wherever they happen to have been declared in the source
773776

774777
if (funcDecl.isConstructor) {
775778
this.recordSourceMappingNameStart("constructor");

0 commit comments

Comments
 (0)