我正在尝试组织我的 js 文件并遵循建议的模块模式。当我在这种模式中使用“use-strict”时,一个函数被声明为未定义,没有“use-strict”方法,该函数就可以正常工作。是否推荐使用严格模式,如果是,为什么使用它时该功能不起作用?
var envy = (function( $ ) {
'use strict';
/**
* Viewport adjusments.
*
* @since 1.0.0
*/
irp_viewportadjst = function() {
$('meta[name="viewport"]').attr('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0');
},
/**
* Fire events on document ready, and bind other events.
*
* @since 1.0.0
*/
ready = function() {
irp_viewportadjst();
};
// Only expose the ready function to the world
return {
ready: ready
};
})( jQuery );
jQuery( envy.ready );