-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add strict null checks to @pixi/ticker #10087
Open
8times12
wants to merge
4
commits into
pixijs:v7.x
Choose a base branch
from
8times12:chore/strict-null-checks/ticker
base: v7.x
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2310af2
Add strict null checks to @pixi/ticker
8times12 516115e
Modified the TickerCallback for easier handling.
8times12 4c84613
Merge branch 'dev' into chore/strict-null-checks/ticker
bigtimebuddy 1341ae4
Merge branch 'dev' into chore/strict-null-checks/ticker
8times12 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,25 +4,25 @@ describe('TickerPlugin', () => | |
{ | ||
interface App | ||
{ | ||
_ticker?: Ticker; | ||
ticker?: Ticker; | ||
_ticker?: Ticker | null; | ||
ticker?: Ticker | null; | ||
render?(): void; | ||
start?(): void; | ||
} | ||
let app: App; | ||
|
||
it('should not start application before calling start method if options.autoStart is false', (done) => | ||
{ | ||
const appp = {} as App; | ||
const appp: App = {}; | ||
|
||
TickerPlugin.init.call(appp, { autoStart: false }); | ||
|
||
expect(appp.ticker).toBeInstanceOf(Ticker); | ||
expect(appp.ticker.started).toBe(false); | ||
expect(appp.ticker?.started).toBe(false); | ||
Comment on lines
20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, maybe I don't get this part, but it feels this 2 lines have conflicting logic, no ? |
||
|
||
appp.start(); | ||
appp.start?.(); | ||
|
||
appp.ticker.addOnce(() => | ||
appp.ticker?.addOnce(() => | ||
{ | ||
TickerPlugin.destroy.call(appp); | ||
done(); | ||
|
@@ -41,7 +41,7 @@ describe('TickerPlugin', () => | |
}; | ||
TickerPlugin.init.call(app); | ||
/* remove default listener to prevent uncaught exception */ | ||
app._ticker.remove(app.render, app); | ||
app._ticker?.remove(app.render as () => void, app); | ||
}); | ||
|
||
afterAll(() => | ||
|
@@ -67,10 +67,10 @@ describe('TickerPlugin', () => | |
|
||
it('should assign ticker if no ticker', () => | ||
{ | ||
const ticker = { add: jest.fn() }; | ||
const ticker = { add: jest.fn() } as unknown as Ticker; | ||
|
||
app._ticker = null; | ||
app.ticker = ticker as unknown as Ticker; | ||
app.ticker = ticker; | ||
|
||
expect(app._ticker).toEqual(ticker); | ||
expect(ticker.add).toHaveBeenCalledOnce(); | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it make sense to check this.head, and only after create a variable ?