[wp-trac] [WordPress Trac] #41111: WP-API JS Client: Add a helper to get model or collection by route

WordPress Trac noreply at wordpress.org
Mon Sep 4 16:00:30 UTC 2017


#41111: WP-API JS Client: Add a helper to get model or collection by route
-------------------------------------------------+-------------------------
 Reporter:  adamsilverstein                      |       Owner:
     Type:  enhancement                          |  adamsilverstein
 Priority:  normal                               |      Status:  closed
Component:  REST API                             |   Milestone:  4.9
 Severity:  normal                               |     Version:  4.7
 Keywords:  good-first-bug has-patch has-unit-   |  Resolution:  fixed
  tests commit                                   |     Focuses:  javascript
-------------------------------------------------+-------------------------
Changes (by adamsilverstein):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"41334"]:
 {{{
 #!CommitTicketReference repository="" revision="41334"
 WP-API JS Client: Add helpers to get a model or collection by route.

 Add two new helper functions, `wp.api.getModelByRoute` and
 `wp.api.getCollectionByRoute`. Passed a route, they return the matching
 model or collection, or `undefined` if none is found.

 Also adds tests to verify these functions work as expected.

 Props rcutmore.
 Fixes #41111.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41111#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list