Code Archive Skip to content Google About Google Privacy Terms
Overload.js is a tiny but handy library for MooTools, my attempt at shaping Javascript towards being a more OOP-esque language. It lets you overload methods of a class to do different things based on their actual parameters. Although it is not production code yet, it works pretty much as expected. Call it 0.1, and maybe spice it with a touch of “beta” too ;) A class with an overloaded method, setC
In a side project that I’ve been working on I built a quick-and-dirty function for doing simple method overloading. For those of you who aren’t familiar with, it’s just a way of mapping a single function call to multiple functions based upon the arguments they accept. Here’s the function in question: // addMethod - By John Resig (MIT Licensed) function addMethod(object, name, fn){ var old = object
Modello is a lightweight framework that enables you to write JavaScript class like other class-based object-oriented programming language. It introduces class, class-based inheritance, multi-inheritance, private members, RTTI and more into JavaScript. Modello can help you write more readable, reusable and maintainable JavaScript code. Usage Create a class
去る8月30日(土曜日)、ライトウェイトプログラミング言語(Lightweight programming Language)の総合カンファレンス「LL Future」が、なかのZERO(中野区もみじ山文化センター)大ホールで開催された。当日は前線の影響で時おり豪雨に見舞われる中、さまざまな言語のユーザーや開発者など千人近くが集まった。
※追記:あまりにも記事タイトルが適当すぎて我ながら日本語でおkと思ったのでタイトルを変えました。 http://labs.cybozu.co.jp/blog/kazuho/archives/2006/12/oo-settimeout.php http://blog.livedoor.jp/dankogai/archives/50714622.html このネタはmalaさんが1年半前に通過した地点なのである程度常識の部類かと思ってました。 でもdankogaiがわざわざやるってことは知らない人も多そうだし、malaさんが同じネタをまたやるようにも思えないので、ついでにLDRに現在使われてるFunction.prototype.laterとかを紹介してみる。 Function.prototype.later = function(ms){ var self = this; return fu
最近、プロトタイプ的継承の話しが盛り上がっています。 http://blog.livedoor.jp/dankogai/archives/50662064.html http://labs.cybozu.co.jp/blog/kazuho/archives/2006/10/javascript_string.php http://blog.livedoor.jp/dankogai/archives/50662606.html 最終形がやたら複雑になっています でも、実際はあそこまで複雑に書かなくても、できると思います ^^; そう思う理由 P 関数は object 関数の中でローカルのものである。コンストラクタとして使える必要はない。なので、 Atomic な場合でも P は function(){} でいい。 method 関数では P.prototype のプロパティに関数が代入されて
NB. I’ve amended the code samples below to reflect recent changes in this class. I’m an OO programmer at heart and JavaScript supports prototype based inheritance. Unfortunatley this leads to verbose class definitions: function Animal(name) {}; Animal.prototype.eat = function() {}; Animal.prototype.say = function(message) {}; I want a nice base class for JavaScript OO: I want to easily create clas
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser on
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く