GithubHelp home page GithubHelp logo

Superglobals about uniter HOT 10 CLOSED

asmblah avatar asmblah commented on June 18, 2024
Superglobals

from uniter.

Comments (10)

IngwiePhoenix avatar IngwiePhoenix commented on June 18, 2024

I just realized my test didnt mention cookies - but, you get what i meant. :)

from uniter.

asmblah avatar asmblah commented on June 18, 2024

@IngwiePhoenix I've just published PHPCore v3.13.0 with support for super globals 😄
They can be set with the method <Engine>.setSuperGlobal('<name>', '<native JS value>');.
I have a patch to add support for 'accessor' superglobals in dev at the moment, which would be needed for your should automatically match $argc to $argv scenario, but it's not quite ready yet.

Note that the name is without the leading dollar-sign character.

from uniter.

asmblah avatar asmblah commented on June 18, 2024

Here's an example from the tests: https://github.com/uniter/phpcore/blob/master/test/integration/superGlobalTest.js#L34

from uniter.

IngwiePhoenix avatar IngwiePhoenix commented on June 18, 2024

Nice! Looks good to me. :)

from uniter.

asmblah avatar asmblah commented on June 18, 2024

@IngwiePhoenix I've just published PHPCore v3.14.0, now with support for accessor superglobals with getters and setters using <engine>.setSuperGlobalAccessor('<name>', <getter>, <setter>);. Here's an example from the tests: https://github.com/uniter/phpcore/blob/master/test/integration/superGlobalTest.js#L68

from uniter.

asmblah avatar asmblah commented on June 18, 2024

Based on this, I'm considering deprecating the current <Engine>.expose(...) API and adding a new set of methods for each operation instead: <Engine>.setVariable(...), <Engine>.getVariable(...), <Engine>.defineClass(...), <Engine>.defineFunction(...) etc.

(Non-superglobal) variables could then have accessors too, eg.: <Engine>.setVariableAccessor(...)

from uniter.

IngwiePhoenix avatar IngwiePhoenix commented on June 18, 2024

You could keep .expose() for BC untill the next major bump and have it decide an action according to to the type of input. Just an idea :)

from uniter.

asmblah avatar asmblah commented on June 18, 2024

Yep, that's the plan, sorry, that's what I meant by 'deprecate' rather than remove. 😄
I think .expose(...) definitely should be removed eventually though, to make it more obvious what's going on.

from uniter.

asmblah avatar asmblah commented on June 18, 2024

Hi @IngwiePhoenix,

Now that superglobals have been added as a feature, and ArrayAccess support has been added, is there anything else you need to resolve this issue?

from uniter.

IngwiePhoenix avatar IngwiePhoenix commented on June 18, 2024

I doubt there is anything left from here on out. :)

As such, Ill also close the issue.

Thanks a lot for the implementations!

from uniter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.