mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-27 05:24:44 +00:00
Make require() compliant with CommonJS Modules/1.1
This commit is contained in:
19
editions/testcommonjs/tiddlers/method/program.js
Normal file
19
editions/testcommonjs/tiddlers/method/program.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/*\
|
||||
title: method/program.js
|
||||
type: application/javascript
|
||||
module-type: library
|
||||
|
||||
Method test
|
||||
|
||||
\*/
|
||||
|
||||
|
||||
var test = require('test');
|
||||
var a = require('./a');
|
||||
var foo = a.foo;
|
||||
test.assert(a.foo() == a, 'calling a module member');
|
||||
test.assert(foo() == (function (){return this})(), 'members not implicitly bound');
|
||||
a.set(10);
|
||||
test.assert(a.get() == 10, 'get and set')
|
||||
test.print('DONE', 'info');
|
||||
|
||||
Reference in New Issue
Block a user