requirejs-define

What is 'define' used for in JavaScript (aside from the obvious)?

只愿长相守 提交于 2019-12-17 10:07:55
问题 I have searched high and low for documentation on this, but I just cannot find anything anywhere. I am using Aloha and want to use their sidebar prototype to create a new side bar of my own attached to other plugin functionality. Their sidebar.js starts off with this, but I can't for the life of me find any documentation that explains what it means. define( [ 'aloha/core', 'aloha/jquery', 'aloha/selection' ], function (Aloha, jQuery, Selection, Plugin) { It then goes on in that wrapper to

RequireJS: Different count of dependencies and params at callback function

谁说胖子不能爱 提交于 2019-12-02 09:11:22
问题 I have legacy code and a module definition like this: define(["a", "b", "c", "d"], function(a, b, c) { ... }); You can see that there are more dependencies than actual params that we are using at module. Does it make any sense? I think module "d" is redundant. 回答1: This only means that module "d" (or, to be more precise, the result of calling "d"'s factory function) won't be passed as a parameter (e.g. d ) to the function, so it won't be available inside it. It's possible that module "d"

RequireJS: Different count of dependencies and params at callback function

落花浮王杯 提交于 2019-12-02 04:33:26
I have legacy code and a module definition like this: define(["a", "b", "c", "d"], function(a, b, c) { ... }); You can see that there are more dependencies than actual params that we are using at module. Does it make any sense? I think module "d" is redundant. This only means that module "d" (or, to be more precise, the result of calling "d"'s factory function) won't be passed as a parameter (e.g. d ) to the function, so it won't be available inside it. It's possible that module "d" executes some code with side-effects so removing it could potentially change how you application behaves (i.e.

What is 'define' used for in JavaScript (aside from the obvious)?

和自甴很熟 提交于 2019-11-27 10:07:31
I have searched high and low for documentation on this, but I just cannot find anything anywhere. I am using Aloha and want to use their sidebar prototype to create a new side bar of my own attached to other plugin functionality. Their sidebar.js starts off with this, but I can't for the life of me find any documentation that explains what it means. define( [ 'aloha/core', 'aloha/jquery', 'aloha/selection' ], function (Aloha, jQuery, Selection, Plugin) { It then goes on in that wrapper to define a bunch of functions, so vars and some proptotypes - which I can just about get my head around...