Giter Club home page Giter Club logo

Comments (6)

joekim avatar joekim commented on May 24, 2024 2

@AaronPresley @mathieudutour Hunted down a reference for you all on the syntax conversion.

http://www.mugginsoft.com/kosmictask/help/languages/javascript-cocoa

JSCocoa supports two ways to call methods on Cocoa classes and objects. The first uses JavaScript property syntax. Cocoa method signatures are converted to function names by replacing : (colon) with _ (underscore). The trailing underscore on function names may be omitted.

Cross posted on sketchplugin.com forum.

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024 1

hum probably but I can't find a link.
But it's quite straight forward: [Class methodWithArg1: @'arg1' andArg2:@'arg2 andArg3:@'arg3] -> Class.methodWithArg1_andArg2_andArg3('arg1', 'arg2', 'arg3')

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

you never NEED to use cocoascript. Cocoascript breaks every tooling available in javascript.

In your example, you can use NSXMLNode.attributeWithName_stringValue("attr", "val")

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

sometime there is trailing underscore for some reasons NSXMLNode.attributeWithName_stringValue_("attr", "val")

from skpm.

AaronPresley avatar AaronPresley commented on May 24, 2024

Oh my god I could kiss you. Thanks so much.

Is there anywhere that has this syntax conversion is documented? I'm trying to teach myself to fish here but am finding the documentation hard to locate... I could also just be dense.

from skpm.

AaronPresley avatar AaronPresley commented on May 24, 2024

Ah so it is because I'm dense. Many thanks.

from skpm.

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.