是我的问题还是Visual Studio 2010的问题
Is it me or Visual Studio 2010?
每当我为网站编写大型JavaScript库时,我都会使用以下模式:
虽然在运行时一切看起来都很好,但在visual studio中总是有一个噩梦。
在匿名函数表达式的最后一行我总是得到错误
最后一个右括号 上的"预期;"
} (window, jQuery));
我已经通过jslint运行代码没有任何问题,但我的智能感知总是中断,我不能格式化代码。我错过什么了吗?
; (function (window, $) {
// Define a local copy of MyLibrary
var MyLibrary = {},
// Shortcuts.
// A central reference to the root messages object
$$messages,
// A central reference to the root messages.messageType object
$$messageType;
MyLibrary = function () {
// The MyLibrary object is actually just the init
// constructor 'enhanced'
return new MyLibrary.fn.init();
};
MyLibrary.fn = MyLibrary.prototype = {
init: function () {
// Initialise the object shortcuts.
$$messages = MyLibrary.fn.messages;
$$messageType = MyLibrary.fn.messages.messageType;
}
};
// Give the init function the MyLibrary prototype for later instantiation
MyLibrary.fn.init.prototype = MyLibrary.fn;
MyLibrary.fn.messages = {
/// <summary>
/// Provides means to provide feedback message to the client.
/// </summary>
messageType: {
information: "information",
error: "error",
success: "success"
}
};
MyLibrary.fn.tester = function () {
alert($$messageType.success);
};
// Expose MyLibrary to the global object
window.MyLibrary = window.$m = MyLibrary();
} (window, jQuery));
jQuery(document).ready(function () {
$m.tester();
});
;
可能导致错误。我不知道为什么它在开头
} (window, jQuery));
})(window, jQuery);
相关文章:
- 在指令控制器中使用$attrs时出现问题
- 将PHP变量传递给jQuery时遇到问题
- Canvas Html5绘图应用程序,移动画布会导致重大问题
- 参数变量出现ngTable指令问题
- 剑道网格jQuery动画()问题
- 我的jQuery插件参数没有正确启动,遇到了问题
- Phonegap-(安卓/iphone)多个图像的图像库出现问题
- TableExport jquery插件:文件名和扩展名问题
- JavaScript Pub/Sub属性访问问题
- JavaScript异步问题
- 如何解决Yii中的页面刷新问题
- Safari(Mac OS)上的jQuery平滑滚动问题
- jqGrid树网格问题
- 使用正则表达式评估电子邮件地址时出现性能问题
- 如何消除代码中的未定义和其他问题
- 让Javascript在SharePoint 2010上运行时遇到问题
- SharePoint 2010中的Javascript window.onload问题
- SharePoint 2010中组织结构图WebPart的VML问题
- 在SharePoint Foundation 2010中嵌入Video.JS控制问题
- 是我的问题还是Visual Studio 2010的问题