You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 31, 2017. It is now read-only.
Is there any way to use this syntax and correctly parse the docs? Currently it fails to load this file as dependency of other AMD module.
Or could you give me a hint, what would be the best way to implement custom 'callHandler'? The doc says it's possible, but there are not instructions how should a callHandler be implmented.
The text was updated successfully, but these errors were encountered:
If anyone interested, I have succeed in creating custom callHandler for UMD:
define([
"dojo/_base/lang",
"dojo/AdapterRegistry",
"jsdocparser/lib/env",
"jsdocparser/lib/callHandler/amd",
"jsdocparser/lib/console"
], function(lang, AdapterRegistry, env, amd, console) {
var handlers = new AdapterRegistry();
//we can reuse same processing as amd, just detection is different
//js-doc-parser was modified to expose '_handleDefine' function
handlers.register("define", isUmd, amd._handleDefine);
function isUmd(callInfo) {
// we consider callInfo to be UMD definition if identifier has 2 items,
// first one is objet, and second one is Identifier with name 'define'
// Sample of UMD module
// ({
// define : typeof define != "undefined" ? define : function(deps, factory) {
// module.exports = factory();
// }
// }).define([], function() {
var identifier = callInfo.identifier;
if (identifier.length == 2 //
&& identifier[0].type == "object" //
&& identifier[1].type == "Identifier" //
&& identifier[1].name == "define") {
console.log("Detected module as UMD", callInfo.callee.file && callInfo.callee.file.moduleId);
return true;
}
return false;
}
return handlers;
});
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have a module that I use in both Node and Dojo, so I have some kind of UMD mechanism:
Is there any way to use this syntax and correctly parse the docs? Currently it fails to load this file as dependency of other AMD module.
Or could you give me a hint, what would be the best way to implement custom 'callHandler'? The doc says it's possible, but there are not instructions how should a callHandler be implmented.
The text was updated successfully, but these errors were encountered: