Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

app-loading

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-loading - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

app-loading.min.css

42

app-loading.js

@@ -1,6 +0,6 @@

/***********************************************
*app-loading
*(c) 2015
*github.com/aprilorange/app-loading
***********************************************/
/*
* app-loading
* (c) 2015
* github.com/aprilorange/app-loading
*/

@@ -16,5 +16,5 @@ 'use strict';

var definition = function definition(W, D) {
var appLoading = (function () {
function appLoading() {
_classCallCheck(this, appLoading);
var AppLoading = (function () {
function AppLoading() {
_classCallCheck(this, AppLoading);

@@ -28,6 +28,5 @@ this.opts = {

_createClass(appLoading, [{
_createClass(AppLoading, [{
key: 'start',
value: function start(color) {
console.log('start');
this.showBar(color);

@@ -38,3 +37,2 @@ }

value: function stop() {
console.log('stop');
this.hideBar();

@@ -46,4 +44,8 @@ }

var bar = this.getBar();
if (this.opts.color) bar.style.backgroundColor = this.opts.color;
if (color) bar.style.backgroundColor = color;
if (this.opts.color) {
bar.style.backgroundColor = this.opts.color;
}
if (color) {
bar.style.backgroundColor = color;
}
D.querySelector('body').classList.add(this.opts.className);

@@ -61,3 +63,5 @@ }

var bar = D.querySelector(this.opts.loadingBar);
if (!bar) this.initBar();
if (!bar) {
bar = this.initBar();
}
return bar;

@@ -71,2 +75,3 @@ }

D.body.appendChild(bar);
return bar;
}

@@ -77,15 +82,14 @@ }, {

this.opts.color = color;
this.getBar().style.backgroundColor = color;
}
}]);
return appLoading;
return AppLoading;
})();
return new appLoading();
return new AppLoading();
};(function (context, name, definition) {
if (typeof module !== 'undefined') {
module.exports = definition;
} else if (typeof define === 'function' && define.amd) {
define(definition);
} else {
} else if (typeof context !== 'undefined') {
context[name] = definition;

@@ -92,0 +96,0 @@ }

@@ -1,2 +0,2 @@

"use strict";function _classCallCheck(e,o){if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,o){for(var t=0;t<o.length;t++){var n=o[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(o,t,n){return t&&e(o.prototype,t),n&&e(o,n),o}}();!function(){var e=function(e,o){var t=function(){function e(){_classCallCheck(this,e),this.opts={className:"app-loading",loadingBar:".loading-bar",color:null}}return _createClass(e,[{key:"start",value:function(e){console.log("start"),this.showBar(e)}},{key:"stop",value:function(){console.log("stop"),this.hideBar()}},{key:"showBar",value:function(e){var t=this.getBar();this.opts.color&&(t.style.backgroundColor=this.opts.color),e&&(t.style.backgroundColor=e),o.querySelector("body").classList.add(this.opts.className)}},{key:"hideBar",value:function(){o.querySelector("body").classList.remove(this.opts.className),this.getBar().style.backgroundColor=null}},{key:"getBar",value:function(){var e=o.querySelector(this.opts.loadingBar);return e||this.initBar(),e}},{key:"initBar",value:function(){var e=o.createElement("div");e.className=this.opts.loadingBar.substring(1),o.body.appendChild(e)}},{key:"setColor",value:function(e){this.opts.color=e}}]),e}();return new t};!function(e,o,t){"undefined"!=typeof module?module.exports=t:"function"==typeof define&&define.amd?define(t):e[o]=t}(window,"appLoading",e(window,document))}();
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}();!function(){var e=function(e,t){var o=function(){function e(){_classCallCheck(this,e),this.opts={className:"app-loading",loadingBar:".loading-bar",color:null}}return _createClass(e,[{key:"start",value:function(e){this.showBar(e)}},{key:"stop",value:function(){this.hideBar()}},{key:"showBar",value:function(e){var o=this.getBar();this.opts.color&&(o.style.backgroundColor=this.opts.color),e&&(o.style.backgroundColor=e),t.querySelector("body").classList.add(this.opts.className)}},{key:"hideBar",value:function(){t.querySelector("body").classList.remove(this.opts.className),this.getBar().style.backgroundColor=null}},{key:"getBar",value:function(){var e=t.querySelector(this.opts.loadingBar);return e||(e=this.initBar()),e}},{key:"initBar",value:function(){var e=t.createElement("div");return e.className=this.opts.loadingBar.substring(1),t.body.appendChild(e),e}},{key:"setColor",value:function(e){this.opts.color=e,this.getBar().style.backgroundColor=e}}]),e}();return new o};!function(e,t,o){"undefined"!=typeof module?module.exports=o:"undefined"!=typeof e&&(e[t]=o)}(window,"appLoading",e(window,document))}();
//# sourceMappingURL=app-loading.min.js.map

@@ -0,0 +0,0 @@ {

@@ -9,2 +9,3 @@ 'use strict';

var rename = require('gulp-rename')
var qunit = require('gulp-qunit')

@@ -35,2 +36,9 @@ gulp.task('serve', serve({

gulp.task('test', function() {
gulp.src('./test/index.html')
.pipe(qunit({
timeout: 20
}))
})
gulp.task('watch', function() {

@@ -42,2 +50,2 @@ return gulp.watch('./lib/*.js', ['js'])

gulp.task('default', ['build', 'serve', 'watch'])
gulp.task('default', ['build', 'serve', 'test', 'watch'])

@@ -1,6 +0,6 @@

/***********************************************
*app-loading
*(c) 2015
*github.com/aprilorange/app-loading
***********************************************/
/*
* app-loading
* (c) 2015
* github.com/aprilorange/app-loading
*/

@@ -10,4 +10,4 @@ () => {

let definition = (W, D) => {
class appLoading {
constructor() {
class AppLoading {
constructor () {
this.opts = {

@@ -20,20 +20,22 @@ className: 'app-loading',

start(color) {
console.log('start')
start (color) {
this.showBar(color)
}
stop() {
console.log('stop')
stop () {
this.hideBar()
}
showBar(color) {
showBar (color) {
let bar = this.getBar()
if(this.opts.color) bar.style.backgroundColor = this.opts.color
if(color) bar.style.backgroundColor = color
if (this.opts.color) {
bar.style.backgroundColor = this.opts.color
}
if (color) {
bar.style.backgroundColor = color
}
D.querySelector('body').classList.add(this.opts.className)
}
hideBar() {
hideBar () {
D.querySelector('body').classList.remove(this.opts.className)

@@ -43,16 +45,20 @@ this.getBar().style.backgroundColor = null

getBar() {
getBar () {
let bar = D.querySelector(this.opts.loadingBar)
if(!bar) this.initBar()
if (!bar) {
bar = this.initBar()
}
return bar
}
initBar() {
initBar () {
let bar = D.createElement('div')
bar.className = this.opts.loadingBar.substring(1)
D.body.appendChild(bar)
return bar
}
setColor(color) {
setColor (color) {
this.opts.color = color
this.getBar().style.backgroundColor = color
}

@@ -62,13 +68,9 @@

return new appLoading()
return new AppLoading()
}
;(context, name, definition) => {
if(typeof module !== 'undefined') {
if (typeof module !== 'undefined') {
module.exports = definition
}
else if(typeof define === 'function' && define.amd) {
define(definition)
}
else {
} else if (typeof context !== 'undefined') {
context[name] = definition

@@ -80,2 +82,1 @@ }

}()
{
"name": "app-loading",
"version": "0.0.4",
"version": "0.0.5",
"description": "Focus on Medium-like app loading style",
"main": "app-loading.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "gulp test",
"dev": "gulp",

@@ -19,4 +19,6 @@ "build": "gulp build"

"devDependencies": {
"babel-eslint": "^4.1.0",
"gulp": "^3.8.11",
"gulp-babel": "^5.2.1",
"gulp-qunit": "^1.2.1",
"gulp-rename": "^1.2.2",

@@ -26,3 +28,6 @@ "gulp-serve": "^1.0.0",

"gulp-uglify": "^1.2.0"
},
"standard": {
"parser": "babel-eslint"
}
}
# app-loading
Focus on Medium-like app loading style ;-)
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
## Quick start

@@ -35,39 +36,8 @@

appLoading.start('rgba(76, 207, 177, 0.7)')
```
## ECMAScript 2015
**bower install app-loading-es6**
A.K.A ES6, please refer to https://github.com/aprilorange/app-loading-es6
## LiveScript
A really simple implement in LiveScript, not yet full-featured. [Live edit on JS Bin](http://jsbin.com/wowera/edit?js,output)
```livescript
((W, D) ->
class appLoading
$$ = D.query-selector.bind document
init-bar = ->
bar = D.create-element \div
bar.className = \loading-bar
D.body.appendChild bar
get-bar = ->
init-bar! if not $$ \.loading-bar
$$ \.loading-bar
@start = ->
get-bar!
D.body.classList.add \app-loading
@stop = ->
D.body.classList.remove \app-loading
W.appLoading = appLoading
) window, document
// use on server side
if (typeof window !== 'undefined') {
import appLoading from 'app-loading'
appLoading.start()
}
```

@@ -74,0 +44,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc