Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Unable to define api #2

Description

@o-leary

If you have any knowledge of a working example of how to use this, please let me know!
This project looks awesome and is exactly what I've been looking for, but I can't seem to figure out when I should be able to access the api.

Resources:
Before submitting an issue, please consult our docs.

Stencil version: (run npm list @stencil/core from a terminal/cmd prompt and paste output below):
NA

 insert the output from npm list @stencil/core here

NA

I'm submitting a ... (check one with "x")
[ X] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Current behavior:

Unable to define api object in scripts. I can only use the api in the console after everything has run. window.onload doesn't work, nor does including scripts in order at the end of the body tag.

Additionally after loading a page in chrome, via the console the api object appears to be at window.WordPress.api, and can be used as:

var api = window.WordPress.api;

however the instructions:

var api = document.querySelector('wordpress-api').api(); //fail as api is not a function
var api = window.WordPress; //contains an api object (api.api.posts...).

Expected behavior:

<wordpress-api> <!-- with or without base url specified -->
</wordpress-api>
<script>
var api = window.WordPress.api;

console.log(JSON.stringify(api));
</script>

  • not to be undefined.

Steps to reproduce:

Related code:

insert any relevant code here

Other information:

If you have any knowledge of a working example of how to use this, please let me know!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions