سؤال

What is the difference between YUI.add and YUI().add ?

هل كانت مفيدة؟

المحلول

In the first case you are registering that a module is available to be loaded into a YUI sandbox, in the second case you are constructing a sandbox and then doing the registering (which would be a very atypical use). The add method is not instance specific so constructing the sandbox first doesn't restrict the module registration for use to only that sandbox. (So there doesn't appear to be a difference specifically for 'add', though it does return 'this' so the return value would be different in the two cases.)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top