Comments (4)
Thanks for the quick answer! In fact, iooxa exists when I inspect the html document in the console.
But when I try to access iooxa in the linked index.js file, the variable is not recognized and I get a reference error.
Here is my index.html setup
I can't find any explanation for it.
from article.
To get iooxa running, are you using something like:
<script async src="https://unpkg.com/@iooxa/article"></script>
If so, there should be a global variable put onto the page (here), the interface that is provided for that variable is here. Try going to https://iooxa.dev, opening up the console - and there is an iooxa
variable in the global namespace.
You should be able to create new variables using the createVariable
function, and use getVariableByName
or select the DOM and set existing variables.
The command
const v = iooxa.createVariable('scope.name', 3);
creates a new variable that does not have a DOM element, this is equivalent to:
<r-scope name="scope">
<r-var name="name" value="3"></r-var>
</r-scope>
Using the javascript API is lower level, and likely doesn't need to be used if you are scripting with the components, probably the best way is to use the HTML and then if you need access to the variable, use the getVariableByName
function or select it in the DOM.
Once you have the variable, you can update or get the value of it using:
// Select it in the dom
const r = document.getElementById('id').$runtime;
// OR use iooxa to get it by name
const r = iooxa.getVariableByName('scope.name');
// Then you can get access to the variable value (or change the value etc.):
r.get();
Hopefully that helps a bit, happy to clarify or further explain. It might be helpful to explain your use case and I can maybe give some further pointers.
from article.
Ok, I just noticed that the error is caused by the async inside the <script> tag. Without it, it works fine.
from article.
Almost got to commenting on the async
before you. Glad you figured it out!
The other thing that might help is that you can put an arbitrary function in the callbacks of sliders, etc.
<script>
function hello(x, y) {
console.log(`The values of x and y is: ${x}, ${y}`)
}
</script>
<r-var name="x" value="20"></r-var>
<r-var name="y" value="40"></r-var>
<r-button dense :click="hello(x, y)"></r-button>
from article.
Related Issues (18)
- Print Preview HOT 1
- Controlling interactive ink-elements with a function HOT 5
- Redesign for 1.0 HOT 1
- Calling a user defined javascript function? HOT 12
- What's the relationship between this and ink components? HOT 5
- Can not load iooxa.min.js HOT 6
- r-code example/docs should include attributes
- Better resizing of ink-cards HOT 1
- Drawing vectors with arrow-heads. HOT 5
- Table of contents in safari is not looking good. :(
- move math rendering in body to ink-article
- Download as latex has (non-critical) compile errors HOT 1
- Ink cards should resize HOT 3
- Polymer docs inheritance
- Better author byline HOT 1
- Comparing iooxa.dev and Idyll HOT 6
- New Component: Dropdown Selector HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from article.