Giter Club home page Giter Club logo

bevry-archive / csextends Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 3.0 42 KB

Use the Coffee-Script extends keyword outside of Coffee-Script. Useful for easily extending existing existing classes, e.g. `require('csextends')(klass, extensions)`, and for providing your module consumers with an easy way to extend your classes, i.e. `Backbone.Model.extend(extensions)`.

Home Page: http://jsfiddle.net/balupton/k9buB/

License: Other

CoffeeScript 100.00%
classes client-side inheritance nodejs

csextends's People

Contributors

balupton avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

csextends's Issues

Calling parent constructor with instructions from ReadMe throws error

Using this.__super__.constructor.apply(this, arguments) to call the parent constructor within the child constructor will throw an error telling you that this.super is not defined.

To call the parent constructor correctly, do this:

var MyJavaScriptClass = SomeCoffeeScriptClass.extend({
    constructor: function(){
        MyJavaScriptClass.__super__.constructor.apply(this, arguments);
    }
});

Make coffee-script a devDependency

Could you please make coffee-script a devDependency rather than a regular dependency? I only today discovered that coffee-script was being pulled into my project when my builds started failing due to this issue. I personally have no need of coffee-script and would prefer that it isn't pulled in. Unfortunately, the csextends module is itself a transitive dependency five layers deep in my dependency tree, so I have no option to remove it from my code base.

how to call super method?

I am trying to figure out how to call a method on the base class from the derived class. I have tried the code below but it cannot find A.shutdown although it is implemented. Please help.

var extend = require('csextends');

var B = extend(A, {
  shutdown: function () {
    A.shutdown.call(this);
  }
});

var instance = new B();
instance.shutdown();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.