Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/flash/display/ShaderData.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package flash.display {


import flash.utils.ByteArray;


/**
* @externs
*/
final public dynamic class ShaderData {


public function ShaderData (byteArray:ByteArray) {}


}


}
53 changes: 53 additions & 0 deletions lib/flash/net/URLVariables.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package flash.net {


/**
* @externs
* The URLVariables class allows you to transfer variables between an
* application and a server. Use URLVariables objects with methods of the
* URLLoader class, with the `data` property of the URLRequest
* class, and with flash.net package functions.
*/
public dynamic class URLVariables {


/**
* Creates a new URLVariables object. You pass URLVariables objects to the
* `data` property of URLRequest objects.
*
* If you call the URLVariables constructor with a string, the
* `decode()` method is automatically called to convert the string
* to properties of the URLVariables object.
*
* @param source A URL-encoded string containing name/value pairs.
*/
public function URLVariables (source:String = null) {}


/**
* Converts the variable string to properties of the specified URLVariables
* object.
*
* This method is used internally by the URLVariables events. Most users
* do not need to call this method directly.
*
* @param source A URL-encoded query string containing name/value pairs.
* @throws Error The source parameter must be a URL-encoded query string
* containing name/value pairs.
*/
public function decode (source:String):void {}


/**
* Returns a string containing all enumerable variables, in the MIME content
* encoding _application/x-www-form-urlencoded_.
*
* @return A URL-encoded string containing name/value pairs.
*/
public function toString ():String { return null; }


}


}
10 changes: 10 additions & 0 deletions lib/flash/net/navigateToURL.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.net {


/**
* @externs
*/
public function navigateToURL (request:URLRequest, window:String = null):void {}


}
10 changes: 10 additions & 0 deletions lib/flash/net/sendToURL.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.net {


/**
* @externs
*/
public function sendToURL (request:URLRequest):void {}


}
34 changes: 34 additions & 0 deletions lib/flash/utils/Dictionary.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package flash.utils {


/**
* @externs
*/
public dynamic class Dictionary {


public function Dictionary (weakKeys:Boolean = false) {}
// public function exists (key:*):Boolean { return false; }
// public function get (key:K):V { return null; }
// public function remove (key:*):Boolean { return false; }
// public function set (key:K, value:V):V { return null; }


// public inline function iterator ():Iterator<K> {

// return this.keys ();

// }


// public inline function each ():Iterator<V> {

// return this.iterator ();

// }


}


}
10 changes: 10 additions & 0 deletions lib/flash/utils/clearTimeout.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.utils {


/**
* @externs
*/
public function clearTimeout (id:uint):void {}


}
10 changes: 10 additions & 0 deletions lib/flash/utils/getDefinitionByName.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.utils {


/**
* @externs
*/
public function getDefinitionByName (name:String):* { return null; }


}
10 changes: 10 additions & 0 deletions lib/flash/utils/getQualifiedClassName.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.utils {


/**
* @externs
*/
public function getQualifiedClassName (value:*):String { return null; }


}
10 changes: 10 additions & 0 deletions lib/flash/utils/getQualifiedSuperclassName.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.utils {


/**
* @externs
*/
public function getQualifiedSuperclassName (value:*):String { return null; }


}
10 changes: 10 additions & 0 deletions lib/flash/utils/getTimer.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.utils {


/**
* @externs
*/
public function getTimer ():Number { return 0; }


}
10 changes: 10 additions & 0 deletions lib/flash/utils/setTimeout.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package flash.utils {


/**
* @externs
*/
public function setTimeout (closure:Function, delay:Number, ...arguments):uint { return 0; }


}
8 changes: 7 additions & 1 deletion lib/openfl/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
const openfl = {

desktop: require("./desktop"),

Expand Down Expand Up @@ -323,3 +323,9 @@ module.exports = {
Vector: require("./Vector").default,

}

module.exports = openfl;
if(typeof window !== "undefined")
{
window.flash = openfl;
}
48 changes: 46 additions & 2 deletions scripts/AS3ExternsGenerator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ class AS3ExternsGenerator {
return true;
}
if (options != null) {
if (options.includedSymbols != null) {
for (includedSymbol in options.includedSymbols) {
if (qname == includedSymbol) {
return false;
}
}
}
if (options.includedPackages != null) {
final qnameLastDotIndex = qname.lastIndexOf(".");
final qnamePack = qnameLastDotIndex != -1 ? qname.substr(0, qnameLastDotIndex).split(".") : [];
Expand Down Expand Up @@ -965,10 +972,39 @@ class AS3ExternsGenerator {
return true;
}
var qname = baseTypeToQname(baseType, []);
if (qname.indexOf(".") == -1) {
if (qname.indexOf(".") == -1 && ALWAYS_ALLOWED_REFERENCE_TYPES.indexOf(baseType.name) != -1) {
return true;
}
if (isInPackage(currentPackage, baseType.pack, true)) {
var baseTypePack = baseType.pack;
var i = 0;
if (options != null && options.renameSymbols != null) {
var renameSymbols = options.renameSymbols;
while (i < renameSymbols.length) {
var originalName = renameSymbols[i];
i++;
var newName = renameSymbols[i];
i++;
if (baseTypePack.indexOf(originalName) != -1) {
baseTypePack[baseTypePack.indexOf(originalName)] = newName;
break;
}
}
}
if (options != null && options.renamePackages != null) {
i = 0;
var renamePackages = options.renamePackages;
while (i < renamePackages.length) {
var originalName = renamePackages[i];
i++;
var newName = renamePackages[i];
i++;
if (baseTypePack.indexOf(originalName) != -1) {
baseTypePack[baseTypePack.indexOf(originalName)] = newName;
break;
}
}
}
if (isInPackage(currentPackage, baseTypePack, true)) {
return true;
}
return false;
Expand Down Expand Up @@ -1273,6 +1309,14 @@ typedef AS3GeneratorOptions = {
**/
?includedPackages:Array<String>,

/**
Externs will be generated for symbols specified.

Types from other packages may still be referenced by fields or method
signatures. Use `allowedPackageReferences` to restrict those too.
**/
?includedSymbols:Array<String>,

/**
When `includedPackages` is not empty, `allowedPackageReferences` may
be used to allow types from other packages to be used for field types,
Expand Down
15 changes: 15 additions & 0 deletions scripts/TSExternsGenerator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ class TSExternsGenerator {
return true;
}
if (options != null) {
if (options.includedSymbols != null) {
for (includedSymbol in options.includedSymbols) {
if (qname == includedSymbol) {
return false;
}
}
}
if (options.includedPackages != null) {
final qnameLastDotIndex = qname.lastIndexOf(".");
final qnamePack = qnameLastDotIndex != -1 ? qname.substr(0, qnameLastDotIndex).split(".") : [];
Expand Down Expand Up @@ -1576,6 +1583,14 @@ typedef TSGeneratorOptions = {
**/
?includedPackages:Array<String>,

/**
Externs will be generated for symbols specified.

Types from other packages may still be referenced by fields or method
signatures. Use `allowedPackageReferences` to restrict those too.
**/
?includedSymbols:Array<String>,

/**
When `includedPackages` is not empty, `allowedPackageReferences` may
be used to allow types from other packages to be used for field types,
Expand Down
3 changes: 2 additions & 1 deletion scripts/build.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@
-D webgl1
--macro AS3ExternsGenerator.generate({outputPath: "../lib", includedPackages: ["openfl"], allowedPackageReferences: [], renameSymbols: ["openfl.VectorData", "openfl.Vector", "openfl.utils.ByteArrayData", "openfl.utils.ByteArray", "lime.app.Future", "openfl.utils.Future"]})
--macro TSExternsGenerator.generate({outputPath: "../lib", includedPackages: ["openfl"], allowedPackageReferences: [], renameSymbols: ["openfl.VectorData", "openfl.Vector", "openfl.utils.ByteArrayData", "openfl.utils.ByteArray", "lime.app.Future", "openfl.utils.Future"]})
--no-inline
--macro AS3ExternsGenerator.generate({outputPath: "../lib", includedPackages: ["flash"], allowedPackageReferences: [], renameSymbols: ["flash.VectorData", "flash.Vector", "flash.utils.ByteArrayData", "flash.utils.ByteArray", "lime.app.Future", "flash.utils.Future"], renamePackages: ["openfl", "flash"]})
--no-inline