Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pebble.js + Rocky.js = Develop in Browser #178

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

jscottnz
Copy link

@jscottnz jscottnz commented Nov 5, 2016

This is a POC that enables development of pebble.js apps in a web browser - super fast development turnaround. (And maybe rocky.js compatibility with pebble allows it!)

It is intended to have minimal to no special code ( there is a little at the moment - see markDirty )

This is simply a gulp project that browserifies the source code so that its compatible with the web browser.

It then replaces simply-pebble.js with simply-rocky.js

The implementation uses rocky.js to render to the html canvas.
The pebble.js stage is replaced with an array of render functions.

Please note that only a small set of components are implemented to the bare minimum

  • window
  • click
  • rect
  • text - incuding fonts
  • texttime

Jeremy Scott added 2 commits November 5, 2016 10:41
- uses rockyjs so this should be compatible with rocky when implemented
- adds a gulp build task with browserify (for require)
@@ -0,0 +1,1462 @@
var Color = require('../../src/js/lib/color');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy and paste from simply-rocky.js

It is intended to be culled down as more components are implemented

state.timeOffset = new Date().getTimezoneOffset() * -60;

var clickStartTime, clickEndTime, longPress;
ButtonTypes.forEach(function(button) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wont work for rocky.js on the device, will leave it here until we know the device api

if (this.emit(type, subtype, e) === false) {
return false;
}
return !!this.emit(type, subtype, e);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change allows the browser to know if a handler acted on the event - in the case of the back button we want to know if there was no handler so we can take action

@@ -116,6 +116,7 @@ Window.prototype._show = function(pushing) {

Window.prototype.show = function() {
WindowStack.push(this);
simply.impl.markDirty();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with pebble.js we are transmitting the window components to the watch then calling the render, however when we don't need to transmit we need to know when the screen is being shown so we only call render once(ish)

I hope there is a better way to do this with out modifying this file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant