Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

defining a module with module id "length" does not work #2

Open
alexlawrence opened this issue Jun 11, 2012 · 0 comments
Open

defining a module with module id "length" does not work #2

alexlawrence opened this issue Jun 11, 2012 · 0 comments

Comments

@alexlawrence
Copy link
Owner

I assume this is because all defined modules are saved to the define function itself. It looks like a function has a property length which cannot be overridden:

var f = function() {};
f.length = {};
console.log(f.length); // will be zero

Therefore this will not work:

define('length', function() { return {}; });
require(['length'], function(length) {}); // length will be zero
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant