Skip to content

Commit 918ea7e

Browse files
authored
Merge pull request #366 from mdentremont/master
Expose rrule exports to window so they can be used in the browser debugger
2 parents 4ef9268 + 4b95f00 commit 918ea7e

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

demo/demo.ts

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
import * as $ from 'jquery'
2-
import { RRule, Options, Weekday } from '../src/index'
32

4-
const getDay = (i: number) =>
5-
[RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR, RRule.SA, RRule.SU][i]
6-
7-
const makeArray = (s: string | string[]) => (Array.isArray(s) ? s : [s])
3+
import { RRule, Weekday, Options } from '../src/index'
4+
5+
// Make library accessible to browser debuggers so users can try things out themselves
6+
// tslint:disable-next-line:no-duplicate-imports
7+
import * as rruleExports from '../src/index'
8+
$.extend(window, rruleExports)
9+
10+
const getDay = (i: number) => [
11+
RRule.MO,
12+
RRule.TU,
13+
RRule.WE,
14+
RRule.TH,
15+
RRule.FR,
16+
RRule.SA,
17+
RRule.SU
18+
][i]
19+
20+
const makeArray = (s: string | string[]) =>
21+
Array.isArray(s) ? s : [s]
822

923
const getFormValues = function ($form: JQuery<HTMLElement>) {
1024
const paramObj: { [K in keyof Partial<Options>]: string | string[] } = {}

src/index.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,15 @@
1616

1717
import RRule from './rrule'
1818
import RRuleSet from './rruleset'
19-
import { rrulestr } from './rrulestr'
19+
20+
export { rrulestr } from './rrulestr'
2021
export { Frequency, ByWeekday, Options } from './types'
2122
export { Weekday, WeekdayStr } from './weekday'
2223
export { RRuleStrOptions } from './rrulestr'
2324

24-
// =============================================================================
25-
// Export
26-
// =============================================================================
27-
2825
export {
2926
RRule,
30-
RRuleSet,
31-
rrulestr
27+
RRuleSet
3228
}
3329

3430
export default RRule

0 commit comments

Comments
 (0)