UNPKG

2.31 kBJavaScriptView Raw
1void (function(){var _ion_runtime_ObjectExpression_ = function(module,exports,require){'use strict';
2var ion = require('../'), DynamicExpression = require('./DynamicExpression');
3var ObjectExpression = ion.defineClass({
4 name: 'ObjectExpression',
5 properties: {
6 setLeftValue: function (value) {
7 this.value = value;
8 },
9 activate: function () {
10 ObjectExpression.super.prototype.activate.apply(this, arguments);
11 this.typeExpression = this.typeExpression != null ? this.typeExpression : this.context.createRuntime(this.objectType != null ? this.objectType : null);
12 this.typeExpression.watch(this.typeWatcher = this.typeWatcher != null ? this.typeWatcher : ion.bind(function (type) {
13 var value;
14 if (!ion.is(this.value, type)) {
15 this.statements != null ? this.statements.deactivate() : void 0;
16 this.statements = null;
17 value = type != null ? type : {};
18 } else {
19 value = this.value;
20 }
21 if (value != null && !(this.statements != null)) {
22 var newContext = this.context.newContext(value);
23 this.statements = newContext.createRuntime({
24 type: 'BlockStatement',
25 body: this.properties
26 });
27 this.statements.activate();
28 }
29 this.setValue(value);
30 }, this));
31 },
32 deactivate: function () {
33 ObjectExpression.super.prototype.deactivate.apply(this, arguments);
34 this.typeExpression.unwatch(this.typeWatcher);
35 }
36 }
37 }, DynamicExpression);
38module.exports = exports = ObjectExpression;
39 }
40 if (typeof require === 'function') {
41 if (require.register)
42 require.register('ion/runtime/ObjectExpression',_ion_runtime_ObjectExpression_);
43 else
44 _ion_runtime_ObjectExpression_.call(this, module, exports, require);
45 }
46 else {
47 _ion_runtime_ObjectExpression_.call(this);
48 }
49}).call(this)
50//# sourceMappingURL=./ObjectExpression.map
\No newline at end of file