~zubairassad89/sahana-eden/vms_gsoc

« back to all changes in this revision

Viewing changes to static/mfbase/ext/air/src/NativeObservable.js

  • Committer: Fran Boon
  • Date: 2008-12-09 22:35:23 UTC
  • Revision ID: flavour@partyvibe.com-20081209223523-fcs5k95jjk0uqo0z
Initial import of work done so far

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Ext JS Library 0.20
 
3
 * Copyright(c) 2006-2008, Ext JS, LLC.
 
4
 * licensing@extjs.com
 
5
 * 
 
6
 * http://extjs.com/license
 
7
 */
 
8
 
 
9
/**
 
10
 * @class Ext.air.NativeObservable
 
11
 * @extends Ext.util.Observable
 
12
 * 
 
13
 * Adds ability for Ext Observable functionality to proxy events for native (AIR) object wrappers
 
14
 * 
 
15
 * @constructor
 
16
 */
 
17
 
 
18
Ext.air.NativeObservable = Ext.extend(Ext.util.Observable, {
 
19
        addListener : function(name){
 
20
                this.proxiedEvents = this.proxiedEvents || {};
 
21
                if(!this.proxiedEvents[name]){
 
22
                        var instance = this;
 
23
                        var f = function(){
 
24
                                var args = Array.prototype.slice.call(arguments, 0);
 
25
                                args.unshift(name);
 
26
                                instance.fireEvent.apply(instance, args);
 
27
                        };
 
28
                        this.proxiedEvents[name] = f;
 
29
                        this.getNative().addEventListener(name, f);
 
30
                }
 
31
                Ext.air.NativeObservable.superclass.addListener.apply(this, arguments);
 
32
        }
 
33
});
 
34
 
 
35
Ext.air.NativeObservable.prototype.on = Ext.air.NativeObservable.prototype.addListener;
 
 
b'\\ No newline at end of file'