Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/couto/blueprint
Sugar syntax for Prototypal Inheritance
https://github.com/couto/blueprint
Last synced: about 8 hours ago
JSON representation
Sugar syntax for Prototypal Inheritance
- Host: GitHub
- URL: https://github.com/couto/blueprint
- Owner: Couto
- License: wtfpl
- Created: 2012-01-18T00:10:18.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-06-18T22:08:13.000Z (over 11 years ago)
- Last Synced: 2024-10-16T01:32:01.281Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 142 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.mdown
- License: LICENSE
Awesome Lists containing this project
README
Blueprint - Sugar syntax for Prototypal Inheritance
===================================================Why another?
------------I wanted a small utility (858B bytes minified/413 bytes gzipped) that could easily be used in a cross-browser fashion and still be AMD and Node.js compatible.
yeahh… that's the only reason.
Beware
------
* It's a sugar for Prototypal Inheritance, not a Class system…TODO
----
* A decent page for tests.
* Finish testing.
* Polyfill for the Object.getPrototypeOf and Object.isPrototypeOf methods---
Installation
============as a Node.js Package
--------------------$ npm install Blueprint-Sugar
Require package
---------------var Blueprint = require('Blueprint-Sugar');
---
Example of Use
==============Create an Object
----------------var Example = Blueprint.create({
init : function(){},
method1 : function(){},
method2 : fucntion(){}
});Instanciate the object
----------------------var example = Example.create();
Instanciate and extend an object
--------------------------------var example = Example.create({
anotherMethod : function () {}
});Add methods/properties to instance
----------------------------------// I find myself adding properties/methods to instances a lot,
// this is just a helper. Could ease some work while working
// with mixins…example.implement({
moreMethods : function () {},
moreProperties : 2
});----
Feel free to pull requests, open issues and so on… right now i'm quite open to ideas, improvements and suggestions.