-
-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use alert state as internal API only
- Loading branch information
1 parent
b805718
commit 2978dcc
Showing
9 changed files
with
47 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,16 @@ | ||
import Alert from '../components/Alert'; | ||
|
||
export default class AlertState { | ||
constructor(attrs = {}, alertClass = Alert, alertKey = AlertState.genAlertId()) { | ||
constructor(attrs = {}, alertClass = Alert) { | ||
this.attrs = attrs; | ||
this.alertClass = alertClass; | ||
this.alertKey = alertKey; | ||
} | ||
|
||
getAttrs() { | ||
return this.attrs; | ||
} | ||
|
||
setAttrs(attrs) { | ||
this.attrs = attrs; | ||
} | ||
|
||
getClass() { | ||
return this.alertClass; | ||
} | ||
|
||
setClass(alertClass) { | ||
this.alertClass = alertClass; | ||
} | ||
|
||
getKey() { | ||
return this.key; | ||
} | ||
|
||
static genAlertId() { | ||
return Math.floor(Math.random() * 100000000); // Generate a big random integer to avoid collisions. | ||
} | ||
} |
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