Created
May 27, 2010 17:36
-
-
Save canonic-epicure/416091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class('FileSystem', { | |
trait : JooseX.CPS, | |
continued : { | |
methods : { | |
save : function (data) { | |
var CONT = this.CONT | |
require('fs').saveFile('filename.txt', data, function (err, written) { | |
if (err) { | |
CONT.THROW(err) | |
return | |
} | |
CONT.CONTINUE(written) | |
}) | |
} | |
} | |
} | |
}) | |
var fs = new FileSystem() | |
fs.save('some data').then(function (written) { | |
// do smth | |
}).CATCH(function (exception) { | |
// do smth | |
}).FINALLY(function () { | |
// do smth | |
}).now() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment