Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #1625: js/object/api.html JSAPI -> Fifty #1641

Merged
merged 1 commit into from
Sep 1, 2024
Merged
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
1 change: 0 additions & 1 deletion contributor/browser-jsapi-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
suite.part(id, part);
};

add("js/object/", getSlimePart("js/object/api.html"));
add("js/document/", getSlimePart("js/document/api.html"));
// TODO: does js/promise have any real tests?
add("js/promise/", getSlimePart("js/promise/api.html"));
Expand Down
4 changes: 0 additions & 4 deletions contributor/jrunscript.jsh.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@
// TODO loader/jrunscript/test/data/2/ has some tests but they require some classes in classpath
}));

suite.add("js/object/other", new jsh.unit.html.Part({
pathname: SRC.getRelativePath("js/object/api.html")
}));

suite.add("js/document", new jsh.unit.html.Part({
pathname: SRC.getRelativePath("js/document/api.html")
}));
Expand Down
142 changes: 0 additions & 142 deletions js/object/api.html

This file was deleted.

27 changes: 26 additions & 1 deletion js/object/module.fifty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
*/
namespace slime.$api.old {
export interface Context {
/**
* Whether to modify the global scope by supplying implementations of missing methods. If `true`, this module,
* in addition to providing the exports below, supplies implementations of the following JavaScript constructs if they are
* not supplied by the environment. These constructs do not currently have any automated tests implemented and thus should
* be treated as suspect.
*
* <div> <ul> <li>Object <ul> <li>ECMA 262v5: Object.keys</li> </ul> </li> <li>Array <ul> <li>JS 1.6: Array.prototype.indexOf</li> <li>JS 1.6: Array.prototype.filter</li> <li>JS 1.6: Array.prototype.forEach</li> <li>JS 1.6: Array.prototype.map</li> </ul> </li> </ul> </div>
*/
globals: boolean
}

Expand Down Expand Up @@ -693,8 +701,25 @@ namespace slime.$api.old {

export interface Exports {
Error: any
Task: any
}

export interface Tell<O,T> {
(this: O, e: Error, t: T): void
(this: O, result: { threw: Error } | { returned: T }): void
}

export interface Exports {
Task: {
tell: <O,T>(p: {
target?: O
tell: Tell<O,T>
threw?: Error
returned?: T
}) => void
}
}

export interface Exports {
/**
* @deprecated
*/
Expand Down
39 changes: 20 additions & 19 deletions js/object/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,27 +672,28 @@

$exports.Error = $loader.file("Error.js").Error;

$exports.Task = {};
$exports.Task.tell = function(p) {
if (typeof(p.tell) != "function") {
throw new TypeError();
}
var tell;
if (typeof(p.target) == "object" && p.target) {
tell = p.tell.bind(p.target);
} else {
tell = p.tell;
}
if (p.tell.length == 1) {
if (p.threw) {
tell({ threw: p.threw });
$exports.Task = {
tell: function(p) {
if (typeof(p.tell) != "function") {
throw new TypeError();
}
var tell;
if (typeof(p.target) == "object" && p.target) {
tell = p.tell.bind(p.target);
} else {
tell({ returned: p.returned });
tell = p.tell;
}
if (p.tell.length == 1) {
if (p.threw) {
tell({ threw: p.threw });
} else {
tell({ returned: p.returned });
}
} else if (p.tell.length == 2) {
tell(p.threw,p.returned);
} else {
throw new TypeError("Tell length: " + p.tell.length + " tell=" + p.tell.toString());
}
} else if (p.tell.length == 2) {
tell(p.threw,p.returned);
} else {
throw new TypeError("Tell length: " + p.tell.length + " tell=" + p.tell.toString());
}
};

Expand Down
Loading