Skip to content

Commit bb7ff88

Browse files
committed
Upgrade Oasis.js ( 0.3.0 )
1 parent b3ebeec commit bb7ff88

23 files changed

+1055
-923
lines changed

Gruntfile.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ module.exports = function(grunt) {
116116
},
117117

118118
watch: {
119-
files: ['lib/**', 'vendor/*', 'test/tests/*', 'node_modules/jsframe/*'],
119+
files: ['lib/**', 'vendor/*', 'test/tests/*', 'test/helpers/*', 'node_modules/jsframe/*'],
120120
tasks: ['build-dev', 'concat:tests']
121121
},
122122

@@ -152,13 +152,16 @@ module.exports = function(grunt) {
152152
},
153153

154154
tests: {
155-
src: ['test/test_helpers.js', 'test/tests/**/*_test.js'],
155+
src: ['test/helpers/*', 'test/tests/**/*_test.js'],
156156
dest: 'tmp/conductor_tests.js'
157157
},
158158

159159
dist: {
160-
src: ['lib/loader.js', 'vendor/uuid.core.js', 'vendor/kamino.js', 'vendor/message_channel.js', 'vendor/rsvp.amd.js', 'vendor/oasis.amd.js', 'lib/exporter.js', 'tmp/browser/<%= pkg.name %>.js'],
161-
dest: 'tmp/dist/<%= pkg.name %>-<%= pkg.version %>.js'
160+
src: ['lib/loader.js', 'vendor/uuid.core.js', 'vendor/kamino.js', 'vendor/message_channel.js', 'vendor/rsvp-2.0.3.amd.js', 'vendor/oasis.amd.js', 'lib/exporter.js', 'tmp/browser/<%= pkg.name %>.js'],
161+
dest: 'tmp/dist/<%= pkg.name %>-<%= pkg.version %>.js',
162+
options: {
163+
footer: "self.Oasis = requireModule('oasis'); self.oasis = new self.Oasis(); self.oasis.autoInitializeSandbox();"
164+
}
162165
}
163166
},
164167

dist/conductor-0.2.0.amd.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ define("conductor",
181181

182182
var Conductor = function(options) {
183183
this.options = options || {};
184+
this.oasis = new Oasis();
184185
this.conductorURL = this.options.conductorURL ||
185-
Oasis.config.oasisURL ||
186+
oasis.configuration.oasisURL ||
186187
'/dist/conductor-0.2.0.js.html';
187188

188189
this.data = {};
@@ -191,16 +192,6 @@ define("conductor",
191192
this.capabilities = Conductor.capabilities.slice();
192193
};
193194

194-
Conductor.configure = function (name, value) {
195-
if (/(conductor|oasis)URL/.test(name)) {
196-
Oasis.config.oasisURL = value;
197-
} else if ('eventCallback' === name) {
198-
Oasis.configure(name, value);
199-
} else {
200-
throw new Error("Unexpected Configuration `" + name + "` = `" + value + "`");
201-
}
202-
};
203-
204195
Conductor.error = function (error) {
205196
return Conductor._error(error);
206197
};
@@ -234,6 +225,14 @@ define("conductor",
234225
}
235226

236227
Conductor.prototype = {
228+
configure: function (name, value) {
229+
if ('eventCallback' === name) {
230+
this.oasis.configure(name, value);
231+
} else {
232+
throw new Error("Unexpected Configuration `" + name + "` = `" + value + "`");
233+
}
234+
},
235+
237236
loadData: function(url, id, data) {
238237
id = coerceId(id);
239238

@@ -290,7 +289,7 @@ define("conductor",
290289
}
291290
}
292291

293-
var sandbox = Conductor.Oasis.createSandbox({
292+
var sandbox = this.oasis.createSandbox({
294293
url: url,
295294
capabilities: capabilities,
296295
oasisURL: this.conductorURL,
@@ -315,9 +314,9 @@ define("conductor",
315314

316315
// TODO: it would be better to access the consumer from
317316
// `conductor.parentCard` after the child card refactoring is in master.
318-
if (Conductor.Oasis.consumers.nestedWiretapping) {
317+
if (this.oasis.consumers.nestedWiretapping) {
319318
card.wiretap(function (service, messageEvent) {
320-
Conductor.Oasis.consumers.nestedWiretapping.send(messageEvent.type, {
319+
this.oasis.consumers.nestedWiretapping.send(messageEvent.type, {
321320
data: messageEvent.data,
322321
service: service+"",
323322
direction: messageEvent.direction,
@@ -452,7 +451,7 @@ define("conductor",
452451
this[prop] = options[prop];
453452
}
454453

455-
this.consumers = o_create(Conductor.Oasis.consumers);
454+
this.consumers = o_create(oasis.consumers);
456455
this.options = options = options || {};
457456

458457
this.deferred = {
@@ -483,7 +482,7 @@ define("conductor",
483482
cardOptions.consumers[prop] = cardOptions.consumers[prop].extend({card: this});
484483
}
485484

486-
Conductor.Oasis.connect(cardOptions);
485+
oasis.connect(cardOptions);
487486
};
488487

489488
Conductor.Card.prototype = {
@@ -492,7 +491,7 @@ define("conductor",
492491
},
493492

494493
updateData: function(name, hash) {
495-
Conductor.Oasis.portFor('data').send('updateData', { bucket: name, object: hash });
494+
oasis.portFor('data').send('updateData', { bucket: name, object: hash });
496495
},
497496

498497
/**

0 commit comments

Comments
 (0)