Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,52 @@
/* global SourceEvent */
'use strict';
/**
* DOM event source for Stream. One Stream can collect events from multiple
* sources, which pass different native events (not only DOM events)
* to Stream.
**/
(function(exports) {
var DOMEventSource = function(configs) {
this.configs = {
events: configs.events || [],
};
this._collector = window.addEventListener.bind(window);
this._decollector = window.removeEventListener.bind(window);
this._forwardTo; // The forwarding target.
// Some API you just can't bind it with the object,
// but a function.
this.onchange = this.onchange.bind(this);
};
DOMEventSource.prototype.start = function(forwardTo) {
this.configs.events.forEach((ename) => {
this._collector(ename, this.onchange);
});
this._forwardTo = forwardTo;
return this;
};
DOMEventSource.prototype.stop = function() {
this._forwardTo = null;
this.configs.events.forEach((ename) => {
this._decollector(ename, this.onchange);
});
return this;
};
/**
* For forwarding to the target.
*/
DOMEventSource.prototype.onchange = function(domevt) {
if (this._forwardTo) {
var sourceEvent = new SourceEvent(
domevt.type, domevt.detail, domevt);
this._forwardTo(sourceEvent);
}
};
exports.DOMEventSource = DOMEventSource;
})(window);

View file

@ -0,0 +1,71 @@
/* global SourceEvent */
'use strict';
/**
* A source fire events every clock minutes.
**/
(function(exports) {
var MinuteClockSource = function(configs) {
this.configs = {
type: configs.type,
interval: 60000 // one minute.
};
this._tickId = null;
this._forwardTo = null;
// Some API you just can't bind it with the object,
// but a function.
this.onchange = this.onchange.bind(this);
};
MinuteClockSource.prototype.start = function(forwardTo) {
this._forwardTo = forwardTo;
var seconds = (new Date()).getSeconds();
// If it's the #0 second of that minute,
// immediately tick or we would lost this minute.
if (0 === seconds) {
this.onchange();
}
// For the first tick we must set timeout for it.
this._tickId = window.setTimeout(() => {
this.tick();
}, this.calcLeftMilliseconds());
return this;
};
MinuteClockSource.prototype.tick = function() {
this.onchange();
// For the first tick we must set timeout for it.
this._tickId = window.setTimeout(() => {
this.tick();
}, this.calcLeftMilliseconds());
};
MinuteClockSource.prototype.stop = function() {
this._forwardTo = null;
if (this._tickId) {
window.clearTimeout(this._tickId);
}
return this;
};
/**
* For forwarding to the target.
* When the time is up, fire an event by generator.
* So that the onchange method would forward it to the target.
*/
MinuteClockSource.prototype.onchange = function() {
if (this._forwardTo) {
this._forwardTo(new SourceEvent(this.configs.type));
}
};
MinuteClockSource.prototype.calcLeftMilliseconds = function() {
var seconds = (new Date()).getSeconds();
// If it's at the second 0th of the minute, immediate start to tick.
var leftMilliseconds = (60 - seconds) * 1000;
return leftMilliseconds;
};
exports.MinuteClockSource = MinuteClockSource;
})(window);

View file

@ -0,0 +1,52 @@
/* global SourceEvent */
'use strict';
/**
* Event source for Stream. One Stream can collect events from multiple
* sources, which pass different native events (not only DOM events)
* to Stream.
**/
(function(exports) {
var SettingSource = function(configs) {
this.configs = {
settings: configs.settings || []
};
this._collector = navigator.mozSettings.addObserver;
this._decollector = navigator.mozSettings.removeObserver;
this._forwardTo = null;
// Some API you just can't bind it with the object,
// but a function.
this.onchange = this.onchange.bind(this);
};
SettingSource.prototype.start = function(forwardTo) {
this.configs.settings.forEach((key) => {
this._collector(key, this.onchange);
});
this._forwardTo = forwardTo;
return this;
};
SettingSource.prototype.stop = function() {
this._forwardTo = null;
this.configs.settings.forEach((key) => {
this._decollector(key, this.onchange);
});
return this;
};
/**
* For forwarding to the target.
* Would transform the original 'settingName' and 'settingValue' pair as
* 'type' and 'detail', as the event formant.
*/
SettingSource.prototype.onchange = function(change) {
if (this._forwardTo) {
this._forwardTo(
new SourceEvent(change.settingName, change.settingValue));
}
};
exports.SettingSource = SettingSource;
})(window);

View file

@ -0,0 +1,14 @@
'use strict';
/**
* A datum that every source would fire.
**/
(function(exports) {
var SourceEvent = function(type, detail, original) {
this.type = type;
this.detail = detail;
this.original = original; // original event, if any.
};
exports.SourceEvent = SourceEvent;
})(window);