Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Created March 28, 2014 11:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badsyntax/9830697 to your computer and use it in GitHub Desktop.
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.
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