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
« Japanize - Opera9に対応しました | メイン | Firefox Developers Conference での質疑応答メモ » 2006年12月14日 setTimeout をオブジェクト指向にしてみる setTimeout と setInterval が window オブジェクトのプロパティなのは、それがブラウザの機能であって言語処理系自体の機能でないことを考えれば当然だと思います。しかし、それがゆえかに、this が引き継げなかったり、IE では引数が渡せなかったりといった不便があります。どうせだったら、こうなっていたらよかったのにね、ということで、Function.prototype をイジってみました。すでにありそうなネタですが (苦笑) Function.prototype.applyTimeout = function (ms, self, args)
最近、プロトタイプ的継承の話しが盛り上がっています。 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
Get a new domain registered at NameSilo.com. Find out who owns any domain name with the WHOIS tool. This webpage was generated by the domain owner using Sedo Domain Parking. Disclaimer: Sedo maintains no relationship with third party advertisers. Reference to any specific service or trade mark is not controlled by Sedo nor does it constitute or imply its association, endorsement or recommendation.
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く