[SOLVED] Can't access function

I have a JavaScript file that I want to use as a shared “utility”. It’s definition is as follows:

import $ from 'jquery';

export class SectionSwitcher {
    currentSection = null;

    constructor(id) {
        swap(id);
    }

    swap(id) {
        this.currentSection.hide("fast");
        this.currentSection = $("#" + id);
        this.currentSection.show("fast");
    }
}

and then I try to call the swap function in an instance of it in some other view model. For example:

this.sectionSwitcher.swap('some_element_id');

I get an error message as follows:

Error: Error invoking ViewModel. Check the inner error for details.
------------------------------------------------
Inner Error:
Message: swap is not defined
Inner Error Stack:
SectionSwitcher@http://localhost:47322/aurelia-app/shared/section-switching.js!transpiled:21:21
ViewModel@http://localhost:47322/aurelia-app/people/index.js!transpiled:31:44
invoke@http://localhost:47322/jspm_packages/npm/aurelia-dependency-injection@1.3.2/aurelia-dependency-injection.js:443:14
invoke@http://localhost:47322/jspm_packages/npm/aurelia-dependency-injection@1.3.2/aurelia-dependency-injection.js:413:155
invoke@http://localhost:47322/jspm_packages/npm/aurelia-dependency-injection@1.3.2/aurelia-dependency-injection.js:684:16
get@http://localhost:47322/jspm_packages/npm/aurelia-dependency-injection@1.3.2/aurelia-dependency-injection.js:130:27
get@http://localhost:47322/jspm_packages/npm/aurelia-dependency-injection@1.3.2/aurelia-dependency-injection.js:623:14
ensureViewModel/<@http://localhost:47322/jspm_packages/npm/aurelia-templating@1.7.0/aurelia-templating.js:4623:58

End Inner Error Stack
------------------------------------------------

How does one make functions publicly available to other models?

Oops… never mind… the problem was in the constructor… when I used this.swap(id), then it’s fine.