-
Notifications
You must be signed in to change notification settings - Fork 2
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 #26 from mcfly-io/feat-fuse
- Loading branch information
Showing
50 changed files
with
1,556 additions
and
238 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,10 +47,6 @@ shippable/ | |
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Cordova | ||
platforms/ | ||
plugins/ | ||
|
||
# Visual Studio Code | ||
.vscode/ | ||
|
||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
loglevel=silent | ||
loglevel=error |
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
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
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
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,39 @@ | ||
using Uno; | ||
using Uno.Collections; | ||
using Fuse; | ||
using Fuse.Scripting; | ||
using Fuse.Reactive; | ||
|
||
//namespace Fuse.Angular { | ||
|
||
public class Angular: Fuse.Controls.Panel { | ||
|
||
static bool isInitialized = false; | ||
|
||
public Angular() { | ||
if (!isInitialized) { | ||
isInitialized = true; | ||
var common = new JavaScript() { | ||
File = new global::Uno.UX.BundleFileSource(import global::Uno.BundleFile("../dist/<%=targetname%>/dev/common.js")) | ||
}; | ||
global::Uno.UX.Resource.SetGlobalKey(common, "common"); | ||
var vendor = new JavaScript() { | ||
File = new global::Uno.UX.BundleFileSource(import global::Uno.BundleFile("../dist/<%=targetname%>/dev/vendor.js")) | ||
}; | ||
global::Uno.UX.Resource.SetGlobalKey(vendor, "vendor"); | ||
var bundle = new JavaScript() { | ||
File = new global::Uno.UX.BundleFileSource(import global::Uno.BundleFile("../dist/<%=targetname%>/dev/bundle.js")) | ||
}; | ||
global::Uno.UX.Resource.SetGlobalKey(bundle, "bundle"); | ||
var AngularRenderer = new JavaScript() { | ||
File = new global::Uno.UX.BundleFileSource(import global::Uno.BundleFile("AngularRenderer.js")) | ||
}; | ||
global::Uno.UX.Resource.SetGlobalKey(AngularRenderer, "AngularRenderer"); | ||
} | ||
var AngularBootstrap = new JavaScript() { | ||
File = new global::Uno.UX.BundleFileSource(import global::Uno.BundleFile("AngularBootstrap.js")) | ||
}; | ||
Behaviors.Add(AngularBootstrap); | ||
} | ||
} | ||
//} |
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,93 @@ | ||
'use strict'; | ||
var Observable = require('FuseJS/Observable'); | ||
window.isFuse = true; | ||
window.fusejs = window.fusejs || { | ||
isFuse: true, | ||
renderer: null, | ||
requireCacheAfterVendor: {}, | ||
timers: [], | ||
context: Observable() // { | ||
//id: 'root', | ||
//depth: 0, | ||
//children: Observable() | ||
//} | ||
}; | ||
|
||
function debounce(fn, delay) { | ||
return function() { | ||
var self = this; | ||
var args = arguments; | ||
if (window.fusejs.timers.length > 0) { | ||
for (var i = 0; i < window.fusejs.timers.length; i++) { | ||
clearTimeout(window.fusejs.timers[i]); | ||
} | ||
window.fusejs.timers = []; | ||
} | ||
var timer = setTimeout(function() { | ||
fn.apply(self, args); | ||
}, delay); | ||
window.fusejs.timers.push(timer); | ||
}; | ||
} | ||
|
||
function loadRenderer() { | ||
if (!window.fusejs.angularRenderer) { | ||
// window.context = { | ||
// id: 'root', | ||
// depth: 0, | ||
// children: Observable() | ||
// }; | ||
var AngularRendererClass = require('AngularRenderer'); | ||
window.fusejs.angularRenderer = new AngularRendererClass(window.fusejs.context); | ||
require('common'); | ||
require('vendor'); | ||
window.fusejs.requireCacheAfterVendor = {}; | ||
|
||
for (var moduleId in window.requireCache) { | ||
if (window.requireCache[moduleId]) { | ||
window.fusejs.requireCacheAfterVendor[moduleId] = true; | ||
} | ||
} | ||
} | ||
} | ||
|
||
function reloadBundle() { | ||
/// BUNDLE: REFRESH ON EVERY CHANGE | ||
if (window.clearWebpackCache) { | ||
window.clearWebpackCache(window.fusejs.requireCacheAfterVendor); | ||
} | ||
require('bundle'); | ||
} | ||
|
||
function bootstrapAngular() { | ||
/// DISPOSE PREVIOUS APPLICATION : ON EVERY CHANGE | ||
if (window.fusejs.angularRenderer) { | ||
window.fusejs.angularRenderer.reset(); | ||
//window.fusejs.context.children.clear(); | ||
window.fusejs.context.clear(); | ||
if (window.fusejs.applicationRef) { | ||
try { | ||
window.fusejs.applicationRef.dispose(); | ||
} catch (err) { | ||
} | ||
} | ||
} | ||
/// BOOTSTRAP APPLICATION : ON EVERY CHANGE | ||
return window.fusejs.bootstraper.bootstrap(window.fusejs.rootComponent); | ||
} | ||
|
||
function reloadAngular() { | ||
window.isLoading = true; | ||
loadRenderer(); | ||
reloadBundle(); | ||
bootstrapAngular().then(function(applicationRef) { | ||
window.fusejs.applicationRef = applicationRef; | ||
window.fusejs.angularRenderer.print(); | ||
}); | ||
} | ||
try { | ||
debounce(reloadAngular, 1000)(); | ||
} catch (err) { | ||
|
||
} | ||
module.exports = window.fusejs.context; |
Oops, something went wrong.