aaditmshah / augment Goto Github PK
View Code? Open in Web Editor NEWThe world's smallest and fastest classical JavaScript inheritance pattern.
License: MIT License
The world's smallest and fastest classical JavaScript inheritance pattern.
License: MIT License
On your Getting Started wiki page you mention an upcoming article on:
Using augment to create modules and singleton instances.
I couldn't find this anywhere. Do you have an example?
It would be great to be able to override functions.
Now, I know you can do uber.override = ...
but would be nice if this was done automagically.
it looks weird and isn't very transparent when I do
require('augment')
and suddenly Object.augment({...}) is available in that module space (i'm using ringojs). I would rather use it like so:
var {addAugment} = require('augment')
addAugment(Function);
Not a code issue, but I just wonder why augment is GPL3 licensed ? An 8 lines function (as advertised) class library could be seen more as a snippet than a library. But the GPL license prevent one to just copy/paste those 8 lines in a MIT project. Correct me if I'm wrong, but sticking to GPL might reduce the number of people willing to use your lib. (my 2 cents)
Using your sample code in "Getting started" throws an error on lines
alert(circle instanceof Shape);
...
alert(rectangle instanceof Shape);
This works as expected:
alert(circle instanceof Shape.constructor);
Can you add a tag so that the package can be used with Bower?
Having trouble wrapping my head around bind.bind(bind)
and so forth. Would you care to explain the code in README, since it's only 17 lines?
Its certainly faster than some, but calling it the fastest either means you're not trying to be truthful, or you just didn't do your research. Here's a perf test someone that knows how to write them did that includes augment: http://jsperf.com/js-inheritance-method-calls/7
i stumbled over this because I had code not doing Object.keys() or hasOwnProperty and throwing on key augment
. you added it here:
is it necessary?
Hello,
i'm creating performance tests for JavaScript inheritance models.
Despite you wrote 5 wiki pages for your 7 lines of code, and despite I have the source of your model, it's not obvious how to use it.
May I ask you to rewrite the following example using your "prototypal inheritance":
https://github.com/kogarashisan/PerfTests/blob/gh-pages/src/Native/main.js
And also show the proper way to create such classes (with "new" or without)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.