PageSourceSearch

https://codelamp.co.uk/js/steps.js?build=BUILDTOKEN

js codelamp.co.uk collected 2026-10-04 13:34:40 UTC 1,404 bytes, 77 lines download raw bytes

1var steps = {
2
3  list: [],
4  working: [],
5
6  create: function(){
7    return this.prep.apply(Object.create(this), arguments);
8  },
9
10  prep: function(){
11    this.next = this.next.bind(this);
12    return this;
13  },
14  
15  context: function(obj){
16    if ( arguments.length ) {
17      this._context = obj;
18      return this;
19    }
20    else {
21      return this._context || this;
22    }
23  },
24  
25  addDelay: function(delay){
26    this.addWithDelay(delay, function(){});
27    return this;
28  },
29
30  addWithDelay: function(delay, method){
31    if ( !method ) return this;
32    this.list.push({
33      type: 'delay',
34      delay: delay,
35      method: method
36    });
37    return this;
38  },
39
40  addWithDefer: function(method){
41    if ( !method ) return this;
42    this.list.push({
43      type: 'defer',
44      method: method
45    });
46    return this;
47  },
48  
49  start: function(){
50    this.working = this.list.slice(0);
51    this.next();
52    return this;
53  },
54  
55  next: function(){
56    if ( !this.working.length ) return this;
57    var itm = this.working.shift();
58    this.nexts[itm.type] && this.nexts[itm.type].call(this, itm);
59    return this;
60  },
61
62  nexts: {
63    
64    delay: function(step){
65      step.method.call(this.context());
66      setTimeout(this.next, step.delay);
67    },
68    
69    defer: function(step){
70      var d = jQuery.Deferred();
71      step.method.call(this.context(), d);
72      d.then(this.next);
73    }
74    
75  }
76  
77};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.