Oh, interesting. I'd prefer a separate getter, but I don't feel strongly
about it.


On Tue, Apr 15, 2014 at 9:52 AM, Will Daly <notifications@github.com> wrote:

> In apps/openassessment/xblock/static/js/src/oa_response.js:
>
> > @@ -146,6 +149,39 @@ OpenAssessment.ResponseView.prototype = {
> >      },
> >
> >      /**
> > +    Enable/disable the "navigate away" warning to alert the user of unsaved changes.
> > +
> > +    Args:
> > +        enabled (bool): If specified, set whether the warning is enabled.
> > +
> > +    Returns:
> > +        bool: Whether the warning is enabled.
> > +
> > +    Examples:
> > +        >> view.unsavedWarningEnabled(true); // enable the "unsaved" warning
> > +        >> view.unsavedWarningEnabled();
> > +        >> true
> > +    **/
> > +    unsavedWarningEnabled: function(enabled) {
> > +        if (typeof enabled === 'undefined') {
>
> This function can be used as both a setter (if enabled is provided) or a
> getter (if it isn't). If enabled isn't passed as an argument, it will be
> undefined, so we return a boolean indicating whether we've enabled the
> warning.
>
> The getter is basically only used in tests to encapsulate the tests from
> directly checking window.onbeforeunload.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/edx/edx-ora2/pull/273/files#r11634632>
> .
>