Skip to content
Browse files

exposed view class so it can be used with the module

  • Loading branch information...
1 parent dafb7ed commit 936f6db28b58059f6fd0bf7eb4dc7d312c3bc9b9 @malgorithms committed Dec 20, 2012
Showing with 20 additions and 17 deletions.
  1. +1 −0 index.coffee
  2. +2 −0 index.js
  3. +2 −2 lib/command_line.js
  4. +6 −6 lib/view.js
  5. +1 −1 package.json
  6. +2 −2 src/command_line.coffee
  7. +6 −6 src/view.coffee
View
1 index.coffee
@@ -3,6 +3,7 @@
{view} = require('./lib/view')
exports.engine = engine
+exports.view = view
e = new engine { verbose: false, prettyPrintErrors: true }
exports.expressEngine = e
View
2 index.js
@@ -8,6 +8,8 @@
exports.engine = engine;
+ exports.view = view;
+
e = new engine({
verbose: false,
prettyPrintErrors: true
View
4 lib/command_line.js
@@ -47,9 +47,9 @@
minimize: (program.minimize != null) && program.minimize
});
if (program.coffee) {
- output = v._toCoffee();
+ output = v.toCoffee();
} else {
- output = v._toJavaScript();
+ output = v.toJavaScript();
}
if (v.error) {
process.stderr.write(v.error.getPrettyPrintText());
View
12 lib/view.js
@@ -108,9 +108,9 @@
this._toTokenObj();
v = this;
return setTimeout(function() {
- v._toCoffee();
+ v.toCoffee();
return setTimeout(function() {
- v._toJavaScript();
+ v.toJavaScript();
return setTimeout(function() {
v._toScriptObj();
v._log("Done async prep of " + (v.fileName != null ? v.fileName : 'unknown') + ". Calling back.");
@@ -216,7 +216,7 @@
view.prototype._toScriptObj = function() {
var d, txt;
if (!(this.scriptObj != null)) {
- txt = this._toJavaScript();
+ txt = this.toJavaScript();
if (!this.error) {
d = Date.now();
this.scriptObj = vm.createScript(txt);
@@ -226,10 +226,10 @@
return this.scriptObj;
};
- view.prototype._toJavaScript = function() {
+ view.prototype.toJavaScript = function() {
var c, d, d2;
if (!(this.javaScript != null)) {
- c = this._toCoffee();
+ c = this.toCoffee();
if (!this.error) {
d = Date.now();
try {
@@ -249,7 +249,7 @@
return this.javaScript;
};
- view.prototype._toCoffee = function() {
+ view.prototype.toCoffee = function() {
var d, res, tobj;
if (!(this.coffeeScript != null)) {
tobj = this._toTokenObj();
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "toffee",
"description": "A NodeJs, Express 3.x, Express 2.x, and browser-side templating language based on CoffeeScript with slicker tokens and syntax. Built with love at OkCupid.",
- "version": "0.0.56",
+ "version": "0.0.57",
"directories": {
"lib": "./lib"
},
View
4 src/command_line.coffee
@@ -65,9 +65,9 @@ compile = (start_path, full_path) ->
browserMode: true
minimize: program.minimize? and program.minimize
if program.coffee
- output = v._toCoffee()
+ output = v.toCoffee()
else
- output = v._toJavaScript()
+ output = v.toJavaScript()
if v.error
process.stderr.write v.error.getPrettyPrintText()
process.exit 1
View
12 src/view.coffee
@@ -180,9 +180,9 @@ class view
@_toTokenObj()
v = @
setTimeout ->
- v._toCoffee()
+ v.toCoffee()
setTimeout ->
- v._toJavaScript()
+ v.toJavaScript()
setTimeout ->
v._toScriptObj()
v._log "Done async prep of #{if v.fileName? then v.fileName else 'unknown'}. Calling back."
@@ -257,16 +257,16 @@ class view
_toScriptObj: ->
if not @scriptObj?
- txt = @_toJavaScript()
+ txt = @toJavaScript()
if not @error
d = Date.now()
@scriptObj = vm.createScript txt
@_log "#{@fileName} compiled to scriptObj in #{Date.now()-d}ms"
@scriptObj
- _toJavaScript: ->
+ toJavaScript: ->
if not @javaScript?
- c = @_toCoffee()
+ c = @toCoffee()
if not @error
d = Date.now()
try
@@ -279,7 +279,7 @@ class view
@_log "#{@fileName} compiled to JavaScript in #{Date.now()-d}ms"
@javaScript
- _toCoffee: ->
+ toCoffee: ->
if not @coffeeScript?
tobj = @_toTokenObj()
if not @error

0 comments on commit 936f6db

Please sign in to comment.
Something went wrong with that request. Please try again.