Projet

Général

Profil

Paste
Télécharger (785 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / libraries / flexslider-2.5.0 / bower_components / jquery / src / css / addGetHookIf.js @ 0aee3c58

1
define(function() {
2

    
3
function addGetHookIf( conditionFn, hookFn ) {
4
        // Define the hook, we'll check on the first run if it's really needed.
5
        return {
6
                get: function() {
7
                        var condition = conditionFn();
8

    
9
                        if ( condition == null ) {
10
                                // The test was not ready at this point; screw the hook this time
11
                                // but check again when needed next time.
12
                                return;
13
                        }
14

    
15
                        if ( condition ) {
16
                                // Hook not needed (or it's not possible to use it due to missing dependency),
17
                                // remove it.
18
                                // Since there are no other hooks for marginRight, remove the whole object.
19
                                delete this.get;
20
                                return;
21
                        }
22

    
23
                        // Hook needed; redefine it so that the support test is not executed again.
24

    
25
                        return (this.get = hookFn).apply( this, arguments );
26
                }
27
        };
28
}
29

    
30
return addGetHookIf;
31

    
32
});