Created
March 28, 2014 11:34
-
-
Save badsyntax/9830697 to your computer and use it in GitHub Desktop.
Atom editor view (space-pen) without using CoffeeScript. NodeJs util.inherits is not compatible with CofeeScripts __extends. This is most frustrating. For now, we have to use the CS version.
This file contains hidden or 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
var View = require('atom').View; | |
/** CofeeScript's version of inheritance */ | |
var __hasProp = {}.hasOwnProperty; | |
var __extends = function(child, parent) { | |
for (var key in parent) { | |
if (__hasProp.call(parent, key)) child[key] = parent[key]; | |
} | |
function ctor() { this.constructor = child; } | |
ctor.prototype = parent.prototype; | |
child.prototype = new ctor(); | |
child.__super__ = parent.prototype; | |
return child; | |
}; | |
var StatusView = module.exports = function() { | |
View.apply(this, arguments); | |
}; | |
__extends(StatusView, View); | |
/** | |
* Sets the view content elements. | |
*/ | |
StatusView.content = function() { | |
return this.span(function() { | |
this.span({ 'class': 'activity' }); | |
this.span({ 'class': 'msg' }) | |
}.bind(this)); | |
}; | |
/** | |
* Sets some references to elements on init. | |
*/ | |
StatusView.prototype.initialize = function() { | |
this.msgElement = this.find('.msg'); | |
this.activityElement = this.find('.activity'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment