constructor.runtime.js

来自「javascript扩展库」· JavaScript 代码 · 共 39 行

JS
39
字号
function foo() {	trace(1);	this.x = bar->();	trace(2);	this.toString = function() {		return "foo instance";	}}function bar(frame) {	if (frame.isResuming())		return frame.commence();	setTimeout(function() { frame.resume("retval") }, 1);	return frame.suspend();}function baz() {	// make sure to execute each type of constructor -- with(out) args,	// with(out) yielding -- to cover all the codepaths.	trace(3);	var y = new foo->();	trace(4);	new foo();	trace(5);	var z = new foo->(1);	trace(6);	new foo(1);	trace(7);	new foo;	trace(8);	trace(y.toString());	trace(z.toString());	trace(y.x);}baz();runTimeouts();assertTrail(3,1,2,4,1,5,1,2,2,6,1,7,1,8,"foo instance", "foo instance", "retval",2,2);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?