-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(temporal-set): Code did not match spec
- Loading branch information
Showing
5 changed files
with
101 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 20 additions & 8 deletions
28
languages/javascript/templates/declarations/temporal-set.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
interface ${method.item.type}Process { | ||
stop(): void | ||
} | ||
|
||
/** | ||
* ${method.summary} | ||
* Live list: ${method.summary} | ||
* | ||
${method.params.annotations} * @param {Function} add A method for receiving ${method.item.type} objects as they become available${if.deprecated} | ||
* @deprecated ${method.deprecation} | ||
${method.params.annotations} * @param {Function} add A method for receiving ${method.item.type} objects as they become available | ||
* @param {Function} remove A method for receiving ${method.item.type} objects as they become unavailable | ||
${if.deprecated} * @deprecated ${method.deprecation} | ||
${end.if.deprecated} */ | ||
function ${method.name}(${method.signature.params}${if.context}, ${end.if.context} add: (${method.item}: ${method.item.type}) => void): { stop: () => void } | ||
function ${method.name}(${method.signature.params}${if.context}, ${end.if.context} add: (${method.item}: ${method.item.type}) => void, remove: (${method.item}: ${method.item.type}) => void): ${method.item.type}Process | ||
|
||
/** | ||
* ${method.summary} | ||
* First match: ${method.summary} | ||
* | ||
${method.params.annotations} * @param {Function} add A method for receiving ${method.item.type} objects as they become available | ||
* @param {Function} remove A method for receiving ${method.item.type} objects as they become unavailable | ||
${method.params.annotations} * @param {Function} timeout How long, in ms, to wait for a match | ||
${if.deprecated} * @deprecated ${method.deprecation} | ||
${end.if.deprecated} */ | ||
function ${method.name}(${method.signature.params}${if.context}, ${end.if.context} timeout: number): Promise<${method.item.type}> | ||
|
||
/** | ||
* Known values w/out updates: ${method.summary} | ||
* | ||
${method.params.annotations} | ||
${if.deprecated} * @deprecated ${method.deprecation} | ||
${end.if.deprecated} */ | ||
function ${method.name}(${method.signature.params}${if.context}, ${end.if.context} add: (${method.item}: ${method.item.type}) => void, remove: (${method.item}: ${method.item.type}) => void): { stop: () => void } | ||
function ${method.name}(${method.signature.params}): Promise<${method.item.type}[]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
function ${method.name}(...args) { | ||
let add, remove | ||
let add, remove, timeout | ||
if (typeof args[args.length-1] === 'function' && typeof args[args.length-2] === 'function') { | ||
remove = args.pop() | ||
add = args.pop() | ||
} | ||
else if (typeof args[args.length-1] === 'function') { | ||
add = args.pop() | ||
} | ||
else if (typeof args[args.length-1] === 'number') { | ||
timeout = args.pop() | ||
} | ||
|
||
const transforms = ${method.transforms} | ||
|
||
return TemporalSet.start('${info.title}', '${method.name}', '${method.temporalset.add}', '${method.temporalset.remove}', arguments, add, remove, transforms) | ||
return TemporalSet.start('${info.title}', '${method.name}', '${method.temporalset.add}', '${method.temporalset.remove}', args, add, remove, timeout, transforms) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters