-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom dispatcher to be specified
- Alt constructor takes config object that enables user to override defaults, in this case the dispatcher - If dispatcher has interface with waitFor, dispatchToken, register, and dispatch functions, then it is valid and can be used, otherwise the default FB dispatcher is used as fallback
- Loading branch information
Showing
6 changed files
with
38 additions
and
19 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
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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { assert } from 'chai' | ||
import Alt from '../dist/alt-with-runtime' | ||
|
||
class CustomDispatcher { | ||
waitFor() {} | ||
dispatchToken() {} | ||
register() {} | ||
dispatch() {} | ||
extraMethod() {} | ||
} | ||
|
||
export default { | ||
'custom dispatcher can be specified in alt config'() { | ||
const alt = new Alt({ | ||
dispatcher: new CustomDispatcher() | ||
}) | ||
const dispatcher = alt.dispatcher | ||
|
||
// uses custom dispatcher | ||
assert.equal(typeof dispatcher.extraMethod, 'function') | ||
assert.equal(typeof dispatcher.dispatch, 'function') | ||
} | ||
} |