ActionScript: Multiple public functions in a single .as file?

Since I worked with AS, I developed a set of utility functions. For example:

$ cat utils/curried.as
package utils {
public function curried(f:Function, ...boundArgs):Function {
    function curriedHelper(...dynamicArgs):* {
        return f.apply(null, boundArgs.concat(dynamicArgs));
    }
    return curriedHelper;
}
}

And I found that several times I would like to save several public functions in each file ... But ActionScript limits me to one public definition for each file, if this file defines its "I" as part of the package.

So, without creating a class with static methods, how can I get more than one public function in one file .as?

+3
source share
1 answer

just put, you cannot ... to declare a package level function, you need one file for the declared function ...

: , ... , AS2... , , ... 3-4 , ? -, ( IDE ), -, , , , ... , , ... , ...

Greetz

back2dos

+7

Source: https://habr.com/ru/post/1712584/


All Articles