プロトタイプベース・オブジェクト指向 at TECH
[2ch|▼Menu]
475:デフォルトの名無しさん
04/02/19 10:52
ついでにURLリンク(homepage.mac.com)
の Chain of Responsibility を JS で。

var app = new Object;
app.preview = function(){alert("preview in app");}
function make_app(){}
make_app.prototype = app;

var dialog = new make_app;
dialog.print = function(){alert("print in dialog");}
function make_dialog(){}
make_dialog.prototype = dialog;

var button = new make_dialog;
button.help = function(){alert("help in button");}

button.help();
button.print();
button.preview()

すっきり書けてるほうとは思うけど、どうも…


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

5405日前に更新/368 KB
担当:undef