我有一个ExtJS单例类.
作为测试,我在app.js的launch()函数中调用它的方法.
但是没有定义单例静态方法.
我想当我需要课时单身人士变得活跃了吗?
Ext.Loader.setConfig({
enabled : true,
paths: {
'AM': 'app'
}
});
Ext.application({
name: 'AM',
autoCreateViewport: true,
requires: [
'AM.localization.ResourceManager'
],
controllers: [
'Users'
],
launch: function() {
alert(ResourceManager.initBundleLoader());
}
});
Ext.define('AM.localization.ResourceManager', {
alternateClassName: 'ResourceManager',
singleton: true,
init: function() {
this.initBundleLoader();
},
statics: {
test: 'here',
initBundleLoader: function() {
debugger;
Ext.applyIf(Ext.Loader, {
resourceBundles: new Object()
});
},
registerBundle: function(bundleName, locale) {
debugger;
if(!Ext.Loader.hasOwnProperty('resourceBundles')) {
this.initBundleLoader();
}
if(!Ext.Loader.resourceBundles.hasOwnProperty(bundleName)) {
if(Ext.ClassManager.isCreated('AM.locale.' + locale + '.resources.' + bundleName)) {
this.resourceBundles.bundleName = …Run Code Online (Sandbox Code Playgroud) 当我打开Chrome开发者工具时,打开此网页并拍摄快照,大小为2.1MB.
当我点击其中一个按钮时,所有这些按钮和它们的div都被删除了.如果我再拍一张快照,则大小为1.6MB.
因此,当使用Chrome开发人员工具并拍摄快照时,网页总会消耗一些内存,在拍摄快照和查找内存泄漏时需要考虑这些内存吗?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript">
var onLoadFunc = function() {
for(var x=0;x<30000;x++) {
var button = document.createElement("input");
button.type = "button";
button.value = "Destroy Content";
button.onclick = destroyFunc;
document.getElementById('mainDiv').appendChild(button);
}
};
var destroyFunc = function() {
var el = document.getElementById( 'mainDiv' );
el.parentNode.removeChild(el);
};
</script>
</head>
<body onLoad="onLoadFunc()">
<div id="mainDiv"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我们正在进行更改以使用Sencha Cmd,但它使用Ant.我们将Maven用于其他事情,因此我们可以对配置文件或其他内容进行更改,因此Sencha Cmd使用Maven而不是Ant,或者我们必须安装Ant才能使用Sencha Cmd.
提前致谢.
我正在尝试创建一个框架UI,根据配置创建容器内容,我得到一个错误"TypeError:item.onAdded不是一个函数".
这在我的小型测试应用程序中不会发生,但它确实发生在我们的实际应用程序中.无法弄清楚为什么.
这是一些部分代码.
Ext.define('atlas.screen.Viewport', {
extend: 'Ext.container.Viewport',
alias: 'widget.atlas.Viewport',
autoScroll: true,
layout: 'fit',
requires: [
'base.framework.MainAppView',
'base.framework.MainAppNavigation'
],
items: [{
// MainAppView requires providing config with items to populate the north,
// west, and center regions.
xtype: 'mainAppView',
westItems: [{
xtype: 'mainAppNavigation'
}]
}]
});
Ext.define('base.framework.MainAppView', {
extend: 'Ext.container.Container',
alias: 'widget.mainAppView',
requires: ['base.util.CommonBaseUtil'],
autoScroll: true,
layout: 'border',
westItems: null,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [{
xtype: 'container',
itemId: 'appWestContainer',
region: 'west',
width: 85,
items: me.westItems, …Run Code Online (Sandbox Code Playgroud) 在Windows 7上,当我运行这个Python 2.7代码时,"NOT file"打印,但文件在那里,它不是只读的,该文件夹不是只读的,它的父项都不是只读的.
if os.path.exists('D:\testfiles\mysub\GraphiteController.js'):
print "IS file"
else:
print "NOT file"
sys.exit(1)
Run Code Online (Sandbox Code Playgroud)
如果我将文件移动到d:\myother directory,则打印"IS文件".如果我将文件移动到d:\testfiles directory,则打印"NOT file".
我在另一台Windows机器上试过这个,同样的问题.很奇怪.
extjs ×3
ant ×1
extjs4.2 ×1
javascript ×1
maven ×1
memory-leaks ×1
python ×1
python-2.7 ×1
sencha-cmd ×1
singleton ×1
snapshot ×1