Comments (4)
Hi @phpengine,
Once you have an Engine instance, you can define an "auto-coercing" function like so (contrived example):
my_module.php
<?php
var_dump(my_multiply(21, 100));
index.js
var engine = require('./php/my_module.php')();
engine.defineCoercingFunction('my_multiply', function (value1, value2) {
return value1 * value2;
});
engine.execute();
so you could use this for each function you want to define. There isn't currently a way to define a "magic" function that would be called for undefined functions, but it's something I think could come in handy so I'll look into adding that as a feature soon.
Cheers
from uniter.
Perfect - Thanks :)
from uniter.
defineCoercingFunction
seems to be useless now.
from uniter.
@yi-ge apologies for not responding before; I must have missed your message. If it's still relevant could you elaborate a bit on what problem you were having with defineCoercingFunction(...)
please, ie. is there a specific error you saw raised? I appreciate a lot of time has passed since though!
from uniter.
Related Issues (20)
- Uppercase FALSE does not work HOT 1
- ...error: Call to undefined method JSObject::__toString() HOT 2
- Pronunciation HOT 2
- Using uniter name in a domain HOT 2
- Logo? HOT 9
- Beta HOT 2
- HTML Tags for Uniter HOT 3
- Production Settings HOT 10
- Unreachable Code after return statement HOT 6
- Include transport when run on CLI HOT 4
- Uncaught TypeError: propertyData.value is not a function HOT 13
- Documentation : Benchmark? HOT 1
- Documentation on how to use async API HOT 3
- wrong output in foreach loops HOT 2
- Switch Order different HOT 6
- ... operator not supported for variadic functions or argument unpacking HOT 1
- Array HOT 6
- jQuery - var this HOT 5
- Working with stdin HOT 1
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 uniter.