jquery / jquery/api.jquerymobile.com

Library: Document that, when using requirejs, a page should only be instantiated after the whole library is loaded, otherwise it may fail to instantiate some widgets

Open
#339 0 comments 0 reactions 1 assignee View on GitHub

@gabrielschulhof is already working on this.

Since Oct 14, 2014.

Dominant language
HTML
Stars
55
Forks
57
PR merge metrics
No merged PRs in 30d

Description

We need to provide an example of a scenario where somebody uses the library using requirejs, and maybe skips init altogether. For example,

require([
    "jqm/widgets/popup",
    "jqm/widgets/listview",
    "jqm/widgets/page" ], function() {

    $( function() {
        $( "#start-page" ).page();
    });
};

Will not work if requirejs loads page after it has loaded popup and listview. We need to document that, in 1.4.x, one needs to require page before requiring any of the widgets:

require([
    "jqm/widgets/page" ], function() {

    require([
        "jqm/widgets/popup",
        "jqm/widgets/listview" ] ,function() {

        $( function() {
            $( "#start-page" ).page();
        });
    });
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.