@ulu/frontend
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -47,2 +47,3 @@ /** | ||
this.breakpoints = {}; | ||
this.onChangeCallbacks = []; | ||
this.order.forEach(n => this.breakpoints[n] = new Breakpoint(n, this)); | ||
@@ -54,2 +55,18 @@ log(this, this); | ||
/** | ||
* Add a callback for everytime a breakpoint changes | ||
* - Not recommended, possibly use to watch for changes, etc | ||
* - For more control use intance.at(name) with breakpoint methods | ||
* @param {Function} callback Function to call, passed one argument current instance which can be used to get information about breakpoints | ||
*/ | ||
onChange(callback) { | ||
this.onChangeCallbacks.push(callback); | ||
} | ||
/** | ||
* Remove change callback | ||
* @param {Function} callback Function to remove | ||
*/ | ||
removeOnChange(callback) { | ||
removeArrayElement(this.onChangeCallbacks, callback); | ||
} | ||
/** | ||
* Get breakpoint from a psuedo element | ||
@@ -122,2 +139,4 @@ */ | ||
} | ||
this.onChangeCallbacks.forEach(cb => cb(this)); | ||
} | ||
@@ -124,0 +143,0 @@ /** |
{ | ||
"name": "@ulu/frontend", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Theming library", | ||
@@ -5,0 +5,0 @@ "browser": "js/index.js", |
@@ -37,3 +37,16 @@ /** | ||
breakpoints: {}; | ||
onChangeCallbacks: any[]; | ||
/** | ||
* Add a callback for everytime a breakpoint changes | ||
* - Not recommended, possibly use to watch for changes, etc | ||
* - For more control use intance.at(name) with breakpoint methods | ||
* @param {Function} callback Function to call, passed one argument current instance which can be used to get information about breakpoints | ||
*/ | ||
onChange(callback: Function): void; | ||
/** | ||
* Remove change callback | ||
* @param {Function} callback Function to remove | ||
*/ | ||
removeOnChange(callback: Function): void; | ||
/** | ||
* Get breakpoint from a psuedo element | ||
@@ -40,0 +53,0 @@ */ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
298800
3850