Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose rrule exports to window so they can be used in the browser debugger #366

Merged
merged 2 commits into from
Aug 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions demo/demo.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import * as $ from 'jquery'
import { RRule, Options, Weekday } from '../src/index'

const getDay = (i: number) =>
[RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR, RRule.SA, RRule.SU][i]

const makeArray = (s: string | string[]) => (Array.isArray(s) ? s : [s])
import { RRule, Weekday, Options } from '../src/index'

// Make library accessible to browser debuggers so users can try things out themselves
// tslint:disable-next-line:no-duplicate-imports
import * as rruleExports from '../src/index'
$.extend(window, rruleExports)

const getDay = (i: number) => [
RRule.MO,
RRule.TU,
RRule.WE,
RRule.TH,
RRule.FR,
RRule.SA,
RRule.SU
][i]

const makeArray = (s: string | string[]) =>
Array.isArray(s) ? s : [s]

const getFormValues = function ($form: JQuery<HTMLElement>) {
const paramObj: { [K in keyof Partial<Options>]: string | string[] } = {}
Expand Down
10 changes: 3 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@

import RRule from './rrule'
import RRuleSet from './rruleset'
import { rrulestr } from './rrulestr'

export { rrulestr } from './rrulestr'
export { Frequency, ByWeekday, Options } from './types'
export { Weekday, WeekdayStr } from './weekday'
export { RRuleStrOptions } from './rrulestr'

// =============================================================================
// Export
// =============================================================================

export {
RRule,
RRuleSet,
rrulestr
RRuleSet
}

export default RRule