-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from wintercms/wip/snowboard
[1.1.8] Implement an opt-in improved JS framework (Snowboard). Documented by wintercms/docs#45
- Loading branch information
Showing
39 changed files
with
4,416 additions
and
26 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
**/node_modules/** | ||
build/*.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"browser": true | ||
}, | ||
"globals": { | ||
"Snowboard": "writable" | ||
}, | ||
"extends": "airbnb-base", | ||
"rules": { | ||
"class-methods-use-this": ["off"], | ||
"indent": ["error", 4, { | ||
"SwitchCase": 1 | ||
}], | ||
"max-len": ["off"], | ||
"new-cap": ["error", { "properties": false }], | ||
"no-alert": ["off"], | ||
"no-param-reassign": ["error", { | ||
"props": false | ||
}] | ||
} | ||
} |
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,3 @@ | ||
# Ignore packages | ||
node_modules | ||
package-lock.json |
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,48 @@ | ||
/** | ||
* Plugin base abstract. | ||
* | ||
* This class provides the base functionality for all plugins. | ||
* | ||
* @copyright 2021 Winter. | ||
* @author Ben Thomson <[email protected]> | ||
*/ | ||
export default class PluginBase { | ||
/** | ||
* Constructor. | ||
* | ||
* The constructor is provided the Snowboard framework instance. | ||
* | ||
* @param {Snowboard} snowboard | ||
*/ | ||
constructor(snowboard) { | ||
this.snowboard = snowboard; | ||
} | ||
|
||
/** | ||
* Defines the required plugins for this specific module to work. | ||
* | ||
* @returns {string[]} An array of plugins required for this module to work, as strings. | ||
*/ | ||
dependencies() { | ||
return []; | ||
} | ||
|
||
/** | ||
* Defines the listener methods for global events. | ||
* | ||
* @returns {Object} | ||
*/ | ||
listens() { | ||
return {}; | ||
} | ||
|
||
/** | ||
* Destructor. | ||
* | ||
* Fired when this plugin is removed. | ||
*/ | ||
destructor() { | ||
this.detach(); | ||
delete this.snowboard; | ||
} | ||
} |
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,15 @@ | ||
import PluginBase from './PluginBase'; | ||
|
||
/** | ||
* Singleton plugin abstract. | ||
* | ||
* This is a special definition class that the Snowboard framework will use to interpret the current plugin as a | ||
* "singleton". This will ensure that only one instance of the plugin class is used across the board. | ||
* | ||
* Singletons are initialised on the "domReady" event by default. | ||
* | ||
* @copyright 2021 Winter. | ||
* @author Ben Thomson <[email protected]> | ||
*/ | ||
export default class Singleton extends PluginBase { | ||
} |
Oops, something went wrong.