Skip to content

Commit b4312f8

Browse files
committed
Remove cache
As the code currently stands, the cache has no function.
1 parent 1a013b5 commit b4312f8

File tree

1 file changed

+1
-62
lines changed

1 file changed

+1
-62
lines changed

js/src/_base/Three.js

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ var Enums = require('./enums');
1010

1111
var version = require('../../package.json').version;
1212

13-
var ThreeCache = {
14-
byId: {},
15-
byUuid: {},
16-
byName: {}
17-
};
18-
1913

2014
var ThreeModel = widgets.WidgetModel.extend({
2115

@@ -213,35 +207,13 @@ var ThreeModel = widgets.WidgetModel.extend({
213207
obj.ipymodelId = this.model_id; // brand that sucker
214208
obj.ipymodel = this;
215209

216-
var cacheDescriptor = this.getCacheDescriptor();
217-
if (!cacheDescriptor) {
218-
console.error('Model missing ID:', this);
219-
throw new Error('Model missing ID!');
220-
}
221-
222-
this.putThreeObjectIntoCache(cacheDescriptor, obj);
223-
224210
this.obj = obj;
225211
return obj;
226212

227213
},
228214

229215
createThreeObjectAsync: function() {
230216

231-
// try cache first
232-
var cacheDescriptor = this.getCacheDescriptor();
233-
if (cacheDescriptor) {
234-
var obj = this.getThreeObjectFromCache(cacheDescriptor);
235-
if (obj) {
236-
if (obj.ipymodelId != this.model_id) {
237-
throw new Error('model id does not match three object: ' + obj.ipymodelId + ' -- ' + this.model_id);
238-
}
239-
240-
this.obj = obj;
241-
return Promise.resolve(obj);
242-
}
243-
}
244-
245217
var objPromise;
246218

247219
// call constructor method overridden by every class
@@ -262,39 +234,6 @@ var ThreeModel = widgets.WidgetModel.extend({
262234

263235
constructThreeObject: function() {},
264236

265-
//
266-
// Three.js object cache methods
267-
//
268-
269-
getCacheDescriptor: function() {
270-
271-
var id = this.model_id;
272-
if (id != null) {
273-
return { id: id };
274-
}
275-
return;
276-
277-
},
278-
279-
getThreeObjectFromCache: function(cacheDescriptor) {
280-
if (cacheDescriptor.id) {
281-
return ThreeCache.byId[cacheDescriptor.id];
282-
} else if (cacheDescriptor.uuid) {
283-
return ThreeCache.byUuid[cacheDescriptor.uuid];
284-
} else if (cacheDescriptor.name) {
285-
return ThreeCache.byName[cacheDescriptor.name];
286-
}
287-
},
288-
289-
putThreeObjectIntoCache: function(cacheDescriptor, obj) {
290-
if (cacheDescriptor.id) {
291-
ThreeCache.byId[cacheDescriptor.id] = obj;
292-
} else if (cacheDescriptor.uuid) {
293-
ThreeCache.byUuid[cacheDescriptor.uuid] = obj;
294-
} else if (cacheDescriptor.name) {
295-
ThreeCache.byName[cacheDescriptor.name] = obj;
296-
}
297-
},
298237

299238
//
300239
// Remote execution of three.js object methods
@@ -436,7 +375,7 @@ var ThreeModel = widgets.WidgetModel.extend({
436375
// push data from three object to model
437376
syncToModel: function(syncAllProps) {
438377

439-
syncAllProps = syncAllProps == null ? false : syncAllProps;
378+
syncAllProps = syncAllProps === null ? false : syncAllProps;
440379

441380
// Collect all the keys to set in one go
442381
var toSet = {};

0 commit comments

Comments
 (0)