JavaScript Plugin File Pattern

3. April 2008 – 03:37
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
52
53
54
// vim: sw=4:ts=4:nu:nospell:fdc=4
/**
 * A Plugin
 *
 * @author    Ing. Jozef Sakáloš
 * @copyright (c) 2008, by Ing. Jozef Sakáloš
 * @date      3. April 2008
 * @version   $Id$
 *
 * @license plugin.js is licensed under the terms of the Open Source
 * LGPL 3.0 license. Commercial use is permitted to the extent that the 
 * code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * License details: http://www.gnu.org/licenses/lgpl.html
 */
 
/*global Ext */
 
/**
 * @class APlugin
 * @extends Ext.util.Observable
 *
 * Creates new APlugin object
 * @constructor
 * @param {Object} config The config object
 */
APlugin = function(config) {
    Ext.apply(this, config);
 
    // call parent
    APlugin.superclass.constructor.call(this);
 
}; // eo constructor
 
Ext.extend(APlugin, Ext.util.Observable, {
 
    // defaults - can be configured from outside
 
    init:function(parent) {
        this.parent = parent;
 
        // rest of plugin init code
 
    } // eo function init
 
    // other plugin functions
 
}); // eo extend
 
// register xtype
Ext.reg('apluginxtype', APlugin); 
 
// eof

StumbleUpon Toolbar
  1. 2 Responses to “JavaScript Plugin File Pattern”

  2. Using this pattern (plugin has no functionality, it is only declared…), I get “too much recursion” in FireBug, ext-all-debug.js, at line 10555.

    Special mention: this is the trunk version of Ext (3.0 alpha).

    By Lucian on May 22, 2008

  3. This pattern has not been tested with Ext 3.0. Remember, 3.0 is alpha so the problem can be there as well. All my running and fully functional Ext 2.x plugins follow this pattern.

    The best would be if you posted a showcase.

    By Saki on May 22, 2008

Post a Comment

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a