Skip to content

Instantly share code, notes, and snippets.

@theredpea
Created February 23, 2018 01:23
Show Gist options
  • Select an option

  • Save theredpea/eeab0d419fc0382c8720bd2daf510f16 to your computer and use it in GitHub Desktop.

Select an option

Save theredpea/eeab0d419fc0382c8720bd2daf510f16 to your computer and use it in GitHub Desktop.
//app.getObject
q.prototype.getObject = function(b, c, e) {
var f, h, i = this.model;
return c || (c = b,
b = void 0),
f = new a,
i.waitForOpen.promise.then(function() {
if ("CurrentSelections" === c) {
if (b) {
var a = e || {};
a.currentSelections = !0,
h = m.showVisualization(b, null, a, i)
}
d.get(i).then(function(a) {
a.close = h ? h.$destroy.bind(h) : function() {}
,
f.resolve(a)
})
} else
i.enigmaModel.getObject(c).then(function(a) {
b && (h = m.showVisualization(b, a, e),
a.close = function() {
this.session.emit("handle-closed", this.handle)
}
,
a.Closed.bind(function() {
h.$destroy(),
m.clearElement(b)
})),
r(a, f)
}, function(a) {
a.error && a.error.code === v.LOCERR_GENERIC_NOT_FOUND && (a = {
message: g.get("Object not found"),
code: a.error.code
}),
s && (s(a),
a.isHandled = !0),
f.reject(a)
})
}, function() {
f.reject()
}),
f.promise
}
//app.visualization.get
[["objects.utils/type-loader", "apis/qtable", "apis/qutil"], function(a, b, c) {
"use strict";
function d(a) {
this.qapp = a
}
function e(a, c) {
Object.defineProperties(this, {
id: {
value: c.id
},
qapp: {
value: a
},
model: {
value: c
}
}),
c.layout.qHyperCube && Object.defineProperties(this, {
table: {
value: new b(this.qapp,c),
configurable: !0
}
})
}
return d.prototype.get = function(a) {
var b = this;
return b.qapp.getObject(a).then(function(a) {
return new e(b.qapp,a)
})
}
,
d.prototype.create = function(b, d, f) {
var g = this;
return a.load().then(function() {
return c.createDefinition(b, d, f).then(function(a) {
return g.qapp.createGenericObject(a).then(function(a) {
return new e(g.qapp,a)
})
})
})
}
,
e.prototype.setOptions = function(a) {
var b = [];
return c.addPatches("/", a, b),
this.model.applyPatches(b, !0)
}
,
e.prototype.show = function(a, b) {
var d = c.showVisualization(a, this.model.enigmaModel, b);
return this._scopes = this._scopes || [],
this._scopes.push(d),
this._elements = this._elements || [],
this._elements.push(a),
d
}
,
e.prototype.close = function() {
return this._scopes && (this._scopes.forEach(function(a) {
a.$destroy()
}),
delete this._scopes),
this._elements && (this._elements.forEach(function(a) {
c.clearElement(a)
}),
delete this._elements),
this.table && (this.table.destroy(),
delete this.table),
this.model.session.emit("handle-closed", this.model.handle),
c.Promise.resolve()
}
,
e.prototype.resize = function() {
c.resize(this.id)
}
,
d
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment