(options: TourOptions = {})
| 117 | steps: Array<Step>; |
| 118 | |
| 119 | constructor(options: TourOptions = {}) { |
| 120 | super(); |
| 121 | |
| 122 | autoBind(this); |
| 123 | |
| 124 | const defaultTourOptions = { |
| 125 | exitOnEsc: true, |
| 126 | keyboardNavigation: true |
| 127 | }; |
| 128 | |
| 129 | this.options = Object.assign({}, defaultTourOptions, options); |
| 130 | this.classPrefix = normalizePrefix(this.options.classPrefix); |
| 131 | this.steps = []; |
| 132 | this.addSteps(this.options.steps); |
| 133 | |
| 134 | // Pass these events onto the global Shepherd object |
| 135 | const events = [ |
| 136 | 'active', |
| 137 | 'cancel', |
| 138 | 'complete', |
| 139 | 'inactive', |
| 140 | 'show', |
| 141 | 'start' |
| 142 | ]; |
| 143 | events.map((event) => { |
| 144 | ((e) => { |
| 145 | this.on(e, (opts?: { [key: string]: unknown }) => { |
| 146 | opts = opts || {}; |
| 147 | opts['tour'] = this; |
| 148 | Shepherd.trigger(e, opts); |
| 149 | }); |
| 150 | })(event); |
| 151 | }); |
| 152 | |
| 153 | this._setTourID(options.id); |
| 154 | |
| 155 | return this; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Adds a new step to the tour |
nothing calls this directly
no test coverage detected