forked from YahooArchive/boomerang
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.js
52 lines (38 loc) · 1.47 KB
/
plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
\file plugin.js
Skeleton template for all boomerang plugins. Use this code as a starting point for your
own plugins.
*/
//////////////////////////////////////////////////////////
// DO NOT INCLUDE THIS FILE IN YOUR HTML DOCUMENT //
// THIS IS A SAMPLE PLUGIN //
//////////////////////////////////////////////////////////
// w is the window object
(function(w) {
var d=w.document;
// First make sure BOOMR is actually defined. It's possible that your plugin is loaded before boomerang, in which case
// you'll need this.
BOOMR = BOOMR || {};
BOOMR.plugins = BOOMR.plugins || {};
// A private object to encapsulate all your implementation details
// This is optional, but the way we recommend you do it.
var impl = {
};
BOOMR.plugins.MyPlugin = {
init: function(config) {
var i, properties = ["prop1", "prop2"]; // list of user configurable properties in O
// This block is only needed if you actually have user configurable properties
BOOMR.utils.pluginConfig(impl, config, "MyPlugin", properties);
// Other initialisation code here
// Subscribe to any BOOMR events here.
// Unless your code will explicitly be called by the developer
// or by another plugin, you must to do this.
return this;
},
// Any other public methods would be defined here
is_complete: function() {
// This method should determine if the plugin has completed doing what it
/// needs to do and return true if so or false otherwise
}
};
}(window));