File: plugin-set-options-v3.js

package info (click to toggle)
less.js 3.13.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,012 kB
  • sloc: javascript: 23,278; makefile: 12; perl: 11; sh: 6
file content (31 lines) | stat: -rw-r--r-- 644 bytes parent folder | download | duplicates (3)
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
var optionsStack = [
    'option1',
    undefined,
    'option2',
    undefined,
    'option3'
];

var options, error;

registerPlugin({
    install: function(less, pluginManager, functions) {
        if (options) {
            error = 'setOptions() called before install';
        }
    },
    use: function() {
        var pos = optionsStack.indexOf(options);

        if (pos === -1) {
            error = 'setOptions() not setting option "' + opt + '" correctly';
        }
        if (error) {
            throw new Error(error);
        }
    },
    setOptions: function(opts) {
        options = opts;
    },
    minVersion: [3,0,0]
});