Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

模块规范中 define() 的 factory 可以是 string 吗? #48

Open
conwnet opened this issue Oct 11, 2017 · 0 comments
Open

模块规范中 define() 的 factory 可以是 string 吗? #48

conwnet opened this issue Oct 11, 2017 · 0 comments

Comments

@conwnet
Copy link

conwnet commented Oct 11, 2017

factory可以是任何类型,一般来说常见的就是三种类型function, string, object。当factory不是function时,将直接做为模块对象。

The third argument, factory, is a function that should be executed to instantiate the module or an object. (-- amdjs/amdjs-api)

您好,我测试 RequireJS 中,如果 factory 直接是一个 String 的话,是无法得到理想的效果的。
看了 esl 和 RequireJS 的源码,如果 define 第一个参数是 string 的话,就会被当做 string 了。
请问 define() 的 factory 可以是 string 吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant