Caridy Patino![]()
Injection Engine for Plug and Play widget. This class is a phantom class for a Bootstrap Engine (gallery-bootstrap-engine). It will facilitate the execution of the bootstrap engine in an iframe sandbox while provide an easy way to set properties and capture events from the real bootstrap object.
InjectionEngine extends Base, here is the syntax to create a engine obj:
// Call the "use" method, passing in "gallery-injection-engine". This will
// load the injection engine module and all the required dependencies.
YUI().use('gallery-injection-engine', function(Y) {var obj = new Y.InjectionEngine({
css: 'http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css',
js: [
'http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js',
'http://mycompany.com/my/widget/boot.js'
],
container: '#demo',
tete: 1,
lolo: 'a dynamic attribute',
dynamicAttrs: ['tete', 'lolo'],
dynamicEvents: ['foo', 'bar']
});// boot the iframe with the bootstrap engine within it
obj.boot();});
Use "css" and "js" attributes to inject them into an iframe on boot:
Run this test in your browser and report any issue.
Note: Make sure you include OS, Browser Version and the test result from YUI Console in your ticket.
Check the latest changes in this module.
Few facts about this example:
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2011.10.27-17-03'
}).use('gallery-injection-engine', function(Y) {
var obj = new Y.InjectionEngine({
css: 'http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css',
js: [
'(function(){ var foo = 1; })();',
'http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js',
'http://mycompany.com/my/widget/boot.js'
],
container: '#demo',
tete: 1,
lolo: 'a dynamic attribute',
dynamicAttrs: ['tete', 'lolo'],
dynamicEvents: [
'foo',
{
name: 'bar',
rename: 'bar2'
},
{
name: 'bar',
rename: 'bar2'
},
{
name: 'baz',
fn: function (ev, name, o) {
return false; // avoiding firing the original event "baz"
}
}
]
});
// modifying some attributes before the boot
obj.set('tete', 3)
// some listeners before the boot
obj.on('foo', function() {
// fired when "foo" happens within the bootstrap engine in the iframe
});
// boot the iframe with the bootstrap engine within it
obj.boot();
// modifying some attributes after the boot
obj.set('lolo', 'this value will be propagated to the bootstrap engine object');
// some listeners after the boot
obj.on('bar2', function () {
// fired when "bar" happens within the bootstrap engine in the iframe
});
});No forum posts for this module.
© 2006-2011 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info